Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-02 08:28:24

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4ClonedRichTrajectoryPoint
0027 //
0028 // Class description:
0029 //
0030 // This class is identical to G4RichTrajectoryPoint class, but uses the
0031 // singleton G4Allocator so that the master thread can safely
0032 // delete the object instantiated by worker threads in sub-event
0033 // parallel mode.
0034 //
0035 // Makoto Asai (JLab) - Oct.2024
0036 // --------------------------------------------------------------------
0037 #ifndef G4ClonedRichTrajectoryPoint_HH 
0038 #define G4ClonedRichTrajectoryPoint_HH 1
0039 
0040 #include "G4StepStatus.hh"
0041 #include "G4ThreeVector.hh"
0042 #include "G4TouchableHandle.hh"
0043 #include "G4VTrajectoryPoint.hh"
0044 #include "globals.hh"  // Include from 'global'
0045 
0046 #include "trkgdefs.hh"
0047 
0048 #include "trkgdefs.hh"
0049 
0050 #include <vector>
0051 
0052 class G4Track;
0053 class G4Step;
0054 class G4VProcess;
0055 class G4RichTrajectoryPoint;
0056 
0057 class G4ClonedRichTrajectoryPoint : public G4VTrajectoryPoint
0058 {
0059  public:  // without description
0060   // Constructors/Destructor
0061   //
0062   G4ClonedRichTrajectoryPoint() = default;
0063   G4ClonedRichTrajectoryPoint(const G4Track*);  // For first point.
0064   G4ClonedRichTrajectoryPoint(const G4Step*);  // For subsequent points.
0065   G4ClonedRichTrajectoryPoint(const G4RichTrajectoryPoint& right);
0066   ~G4ClonedRichTrajectoryPoint() override;
0067 
0068   // Operators
0069   //
0070   G4ClonedRichTrajectoryPoint& operator=(const G4ClonedRichTrajectoryPoint&) = delete;
0071   inline G4bool operator==(const G4ClonedRichTrajectoryPoint& right) const;
0072   inline void* operator new(size_t);
0073   inline void operator delete(void* aRichTrajectoryPoint);
0074 
0075   // Get/Set functions
0076   //
0077 
0078   inline const G4ThreeVector GetPosition() const override { return fPosition; }
0079 
0080   inline const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const override;
0081   const std::map<G4String, G4AttDef>* GetAttDefs() const override;
0082   std::vector<G4AttValue>* CreateAttValues() const override;
0083 
0084  private:
0085   G4ThreeVector fPosition{0., 0., 0.};
0086 
0087   // Extended member data
0088   //
0089   std::vector<G4ThreeVector>* fpAuxiliaryPointVector = nullptr;
0090   G4double fTotEDep = 0.0;
0091   G4double fRemainingEnergy = 0.0;
0092   const G4VProcess* fpProcess = nullptr;
0093   G4StepStatus fPreStepPointStatus = fUndefined;
0094   G4StepStatus fPostStepPointStatus = fUndefined;
0095   G4double fPreStepPointGlobalTime = 0.0;
0096   G4double fPostStepPointGlobalTime = 0.0;
0097   G4TouchableHandle fpPreStepPointVolume;
0098   G4TouchableHandle fpPostStepPointVolume;
0099   G4double fPreStepPointWeight = 0.0;
0100   G4double fPostStepPointWeight = 0.0;
0101 };
0102 
0103 extern G4TRACKING_DLL G4Allocator<G4ClonedRichTrajectoryPoint>*& aClonedRichTrajectoryPointAllocator();
0104 
0105 inline void* G4ClonedRichTrajectoryPoint::operator new(size_t)
0106 {
0107   if (aClonedRichTrajectoryPointAllocator() == nullptr) {
0108     aClonedRichTrajectoryPointAllocator() = new G4Allocator<G4ClonedRichTrajectoryPoint>;
0109   }
0110   return (void*)aClonedRichTrajectoryPointAllocator()->MallocSingle();
0111 }
0112 
0113 inline void G4ClonedRichTrajectoryPoint::operator delete(void* aRichTrajectoryPoint)
0114 {
0115   aClonedRichTrajectoryPointAllocator()->FreeSingle((G4ClonedRichTrajectoryPoint*)aRichTrajectoryPoint);
0116 }
0117 
0118 inline G4bool G4ClonedRichTrajectoryPoint::operator==(const G4ClonedRichTrajectoryPoint& r) const
0119 {
0120   return (this == &r);
0121 }
0122 
0123 inline const std::vector<G4ThreeVector>* G4ClonedRichTrajectoryPoint::GetAuxiliaryPoints() const
0124 {
0125   return fpAuxiliaryPointVector;
0126 }
0127 
0128 #endif