Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:42

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 /// \file runAndEvent/RE01/include/RE01Trajectory.hh
0027 /// \brief Definition of the RE01Trajectory class
0028 //
0029 //
0030 //
0031 
0032 #ifndef RE01Trajectory_h
0033 #define RE01Trajectory_h 1
0034 
0035 #include "G4Allocator.hh"
0036 #include "G4ParticleDefinition.hh"
0037 #include "G4Step.hh"
0038 #include "G4ThreeVector.hh"
0039 #include "G4Track.hh"
0040 #include "G4TrajectoryPoint.hh"
0041 #include "G4VTrajectory.hh"
0042 #include "G4ios.hh"
0043 #include "globals.hh"
0044 
0045 #include <stdlib.h>
0046 #include <vector>
0047 
0048 class G4Polyline;
0049 class G4AttDef;
0050 class G4AttValue;
0051 
0052 typedef std::vector<G4VTrajectoryPoint*> RE01TrajectoryPointContainer;
0053 
0054 class RE01Trajectory : public G4VTrajectory
0055 {
0056   public:
0057     RE01Trajectory(const G4Track* aTrack);
0058     virtual ~RE01Trajectory();
0059 
0060     virtual void ShowTrajectory(std::ostream& os = G4cout) const;
0061     virtual void DrawTrajectory() const;
0062     virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
0063     virtual std::vector<G4AttValue>* CreateAttValues() const;
0064     virtual void AppendStep(const G4Step* aStep);
0065     virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
0066 
0067     inline void* operator new(size_t);
0068     inline void operator delete(void*);
0069     inline int operator==(const RE01Trajectory& right) const { return (this == &right); }
0070 
0071     virtual G4int GetTrackID() const { return fTrackID; }
0072     virtual G4int GetParentID() const { return fParentID; }
0073     virtual G4String GetParticleName() const { return fParticleName; }
0074     virtual G4double GetCharge() const { return fPDGCharge; }
0075     virtual G4int GetPDGEncoding() const { return fPDGEncoding; }
0076     virtual G4ThreeVector GetInitialMomentum() const { return fMomentum; }
0077     virtual int GetPointEntries() const { return fPositionRecord->size(); }
0078     virtual G4VTrajectoryPoint* GetPoint(G4int i) const { return (*fPositionRecord)[i]; }
0079 
0080   private:
0081     RE01TrajectoryPointContainer* fPositionRecord;
0082     G4int fTrackID;
0083     G4int fParentID;
0084     G4int fTrackStatus;
0085     G4ParticleDefinition* fParticleDefinition;
0086     G4String fParticleName;
0087     G4double fPDGCharge;
0088     G4int fPDGEncoding;
0089     G4ThreeVector fMomentum;
0090     G4ThreeVector fVertexPosition;
0091     G4double fGlobalTime;
0092 };
0093 
0094 extern G4ThreadLocal G4Allocator<RE01Trajectory>* myTrajectoryAllocator;
0095 
0096 inline void* RE01Trajectory::operator new(size_t)
0097 {
0098   if (!myTrajectoryAllocator) myTrajectoryAllocator = new G4Allocator<RE01Trajectory>;
0099   return (void*)myTrajectoryAllocator->MallocSingle();
0100 }
0101 
0102 inline void RE01Trajectory::operator delete(void* aTrajectory)
0103 {
0104   myTrajectoryAllocator->FreeSingle((RE01Trajectory*)aTrajectory);
0105 }
0106 
0107 #endif