CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/SimG4Core/Notification/interface/TrackInformation.h

Go to the documentation of this file.
00001 #ifndef SimG4Core_TrackInformation_H
00002 #define SimG4Core_TrackInformation_H 
00003 
00004 #include "G4VUserTrackInformation.hh"
00005 
00006 #include "G4Allocator.hh"
00007 
00008 class TrackInformation : public G4VUserTrackInformation {
00009 
00010 public:
00011   virtual ~TrackInformation() {}
00012   inline void * operator new(size_t);
00013   inline void   operator delete(void * TrackInformation);
00014 
00015   bool storeTrack() const       { return storeTrack_; }
00017   void storeTrack(bool v)    
00018   { if (v) storeTrack_ = v; if (v == true) putInHistory(); }
00019 
00020   bool isPrimary() const        { return isPrimary_; }
00021   void isPrimary(bool v)        { isPrimary_ = v; }
00022 
00023   bool hasHits() const  { return hasHits_; }
00024   void hasHits(bool v)  { hasHits_ = v; }
00025 
00026   bool isGeneratedSecondary() const { return isGeneratedSecondary_; }
00027   void isGeneratedSecondary(bool v) { isGeneratedSecondary_ = v; }
00028 
00029   bool isInHistory() const { return isInHistory_; }
00030   void putInHistory()      { isInHistory_= true; }
00031 
00032   bool isAncestor() const { return flagAncestor_; }
00033   void setAncestor()      { flagAncestor_ = true; }
00034 
00035   // Calo section
00036   int getIDonCaloSurface() const           { return idOnCaloSurface_; }
00037   void setIDonCaloSurface(int id, int ical, int last, int pdgID, double p) {
00038     idOnCaloSurface_ = id; idCaloVolume_ = ical; idLastVolume_ = last; 
00039     caloSurfaceParticlePID_ = pdgID; caloSurfaceParticleP_= p;}
00040   int    getIDCaloVolume() const           { return idCaloVolume_; }
00041   int    getIDLastVolume() const           { return idLastVolume_; }
00042   bool   caloIDChecked() const             { return caloIDChecked_; }
00043   void   setCaloIDChecked(bool f)          { caloIDChecked_ = f; }
00044   int    caloSurfaceParticlePID() const    { return caloSurfaceParticlePID_; }
00045   void   setCaloSurfaceParticlePID(int id) { caloSurfaceParticlePID_ = id; }
00046   double caloSurfaceParticleP() const      { return caloSurfaceParticleP_; }
00047   void   setCaloSurfaceParticleP(double p) { caloSurfaceParticleP_ = p; }
00048 
00049   // Generator information
00050   int    genParticlePID() const            { return genParticlePID_; }
00051   void   setGenParticlePID(int id)         { genParticlePID_ = id; }
00052   double genParticleP() const              { return genParticleP_; }
00053   void   setGenParticleP(double p)         { genParticleP_ = p; }
00054 
00055   virtual void Print() const;
00056 private:
00057   bool   storeTrack_;    
00058   bool   isPrimary_;
00059   bool   hasHits_;
00060   bool   isGeneratedSecondary_;
00061   bool   isInHistory_;
00062   bool   flagAncestor_;
00063   int    idOnCaloSurface_;
00064   int    idCaloVolume_;
00065   int    idLastVolume_;
00066   bool   caloIDChecked_;
00067   int    genParticlePID_, caloSurfaceParticlePID_;
00068   double genParticleP_, caloSurfaceParticleP_;
00069 
00070   // Restrict construction to friends
00071   TrackInformation() :G4VUserTrackInformation(),storeTrack_(false),isPrimary_(false),
00072     hasHits_(false),isGeneratedSecondary_(false),isInHistory_(false),
00073     flagAncestor_(false),idOnCaloSurface_(0),idCaloVolume_(-1),
00074     idLastVolume_(-1),caloIDChecked_(false), genParticlePID_(-1),
00075     caloSurfaceParticlePID_(0), genParticleP_(0), caloSurfaceParticleP_(0) {}
00076     friend class NewTrackAction;
00077 };
00078 
00079 extern G4Allocator<TrackInformation> TrackInformationAllocator;
00080 
00081 inline void * TrackInformation::operator new(size_t)
00082 {
00083     void * trkInfo;
00084     trkInfo = (void *) TrackInformationAllocator.MallocSingle();
00085     return trkInfo;
00086 }
00087 
00088 inline void TrackInformation::operator delete(void * trkInfo)
00089 {  TrackInformationAllocator.FreeSingle((TrackInformation*) trkInfo); }
00090 
00091 #endif