Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:02

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 // G4RichTrajectory
0027 //
0028 // Class description:
0029 //
0030 // This class extends G4Trajectory, which includes the following:
0031 //   1) List of trajectory points which compose the trajectory,
0032 //   2) static information of particle which generated the
0033 //      trajectory,
0034 //   3) trackID and parent particle ID of the trajectory.
0035 // The extended information, only publicly accessible through AttValues,
0036 // includes:
0037 //   4) physical volume and next physical volume;
0038 //   5) creator process;
0039 // ...and much more.
0040 
0041 // Contact:
0042 //   Questions and comments on G4Trajectory should be sent to
0043 //     Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
0044 //     Makoto  Asai   (e-mail: asai@slac.stanford.edu)
0045 //     Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
0046 //   and on the extended code to:
0047 //     John Allison   (e-mail: John.Allison@manchester.ac.uk)
0048 //     Joseph Perl    (e-mail: perl@slac.stanford.edu)
0049 // --------------------------------------------------------------------
0050 #ifndef G4RICHTRAJECTORY_HH
0051 #define G4RICHTRAJECTORY_HH
0052 
0053 #include "G4TouchableHandle.hh"
0054 #include "G4Trajectory.hh"
0055 
0056 #include "trkgdefs.hh"
0057 
0058 class G4RichTrajectory : public G4Trajectory
0059 {
0060   using RichTrajectoryPointsContainer = std::vector<G4VTrajectoryPoint*>;
0061 
0062  public:
0063   // Constructors/destructor
0064   //
0065   G4RichTrajectory() = default;
0066   G4RichTrajectory(const G4Track* aTrack);
0067   ~G4RichTrajectory() override;
0068   G4RichTrajectory(G4RichTrajectory&);
0069   G4RichTrajectory& operator=(const G4RichTrajectory&) = delete;
0070 
0071   // Operators
0072   //
0073   G4bool operator==(const G4RichTrajectory& r) const { return (this == &r); }
0074 
0075   inline void* operator new(size_t);
0076   inline void operator delete(void*);
0077 
0078   // Other (virtual) member functions
0079   //
0080   void ShowTrajectory(std::ostream& os = G4cout) const override;
0081   void DrawTrajectory() const override;
0082   void AppendStep(const G4Step* aStep) override;
0083   void MergeTrajectory(G4VTrajectory* secondTrajectory) override;
0084   inline G4int GetPointEntries() const override;
0085   inline G4VTrajectoryPoint* GetPoint(G4int i) const override;
0086 
0087   // Get methods for HepRep style attributes
0088   //
0089   const std::map<G4String, G4AttDef>* GetAttDefs() const override;
0090   std::vector<G4AttValue>* CreateAttValues() const override;
0091 
0092  private:
0093   // Extended information (only publicly accessible through AttValues)...
0094   //
0095   RichTrajectoryPointsContainer* fpRichPointsContainer = nullptr;
0096   G4TouchableHandle fpInitialVolume;
0097   G4TouchableHandle fpInitialNextVolume;
0098   const G4VProcess* fpCreatorProcess = nullptr;
0099   G4int fCreatorModelID = 0;
0100   G4TouchableHandle fpFinalVolume;
0101   G4TouchableHandle fpFinalNextVolume;
0102   const G4VProcess* fpEndingProcess = nullptr;
0103   G4double fFinalKineticEnergy = 0.0;
0104 };
0105 
0106 extern G4TRACKING_DLL G4Allocator<G4RichTrajectory>*& aRichTrajectoryAllocator();
0107 
0108 inline void* G4RichTrajectory::operator new(size_t)
0109 {
0110   if (aRichTrajectoryAllocator() == nullptr) {
0111     aRichTrajectoryAllocator() = new G4Allocator<G4RichTrajectory>;
0112   }
0113   return (void*)aRichTrajectoryAllocator()->MallocSingle();
0114 }
0115 
0116 inline void G4RichTrajectory::operator delete(void* aRichTrajectory)
0117 {
0118   aRichTrajectoryAllocator()->FreeSingle((G4RichTrajectory*)aRichTrajectory);
0119 }
0120 
0121 inline G4int G4RichTrajectory::GetPointEntries() const
0122 {
0123   return G4int(fpRichPointsContainer->size());
0124 }
0125 
0126 inline G4VTrajectoryPoint* G4RichTrajectory::GetPoint(G4int i) const
0127 {
0128   return (*fpRichPointsContainer)[i];
0129 }
0130 
0131 #endif