CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/SimG4CMS/ShowerLibraryProducer/interface/HFShowerG4Hit.h

Go to the documentation of this file.
00001 #ifndef SimG4CMS_ShowerLibraryProducer_HFShowerG4Hit_h
00002 #define SimG4CMS_ShowerLibraryProducer_HFShowerG4Hit_h
00003 
00004 #include "SimDataFormats/CaloHit/interface/HFShowerPhoton.h"
00005 #include "DataFormats/Math/interface/Point3D.h"
00006 
00007 #include "G4VHit.hh"
00008 #include "G4THitsCollection.hh"
00009 #include "G4Allocator.hh"
00010 #include "G4ThreeVector.hh"
00011 #include "G4LogicalVolume.hh"
00012 
00013 #include <boost/cstdint.hpp>
00014 #include <vector>
00015 
00016 class HFShowerG4Hit : public G4VHit {
00017 
00018 public:
00019 
00020   HFShowerG4Hit();
00021   HFShowerG4Hit(G4int hitId, G4int tkID, double edep, double time);
00022   virtual ~HFShowerG4Hit();
00023   HFShowerG4Hit(const HFShowerG4Hit &right);
00024   const HFShowerG4Hit& operator=(const HFShowerG4Hit &right);
00025   G4int operator==(const HFShowerG4Hit &right) const;
00026 
00027   inline void *operator new(size_t);
00028   inline void  operator delete(void *aHit);
00029 
00030 private:
00031 
00032   G4int    theHitId;
00033   G4int    theTrackId;
00034   G4double theEdep;
00035   G4double theTime;
00036   G4ThreeVector localPos;
00037   G4ThreeVector globalPos;
00038   G4ThreeVector momDir;
00039   
00040 public:
00041 
00042   inline void setHitId(G4int hitId)            {theHitId = hitId;}
00043   inline void setTrackId(G4int trackId)        {theTrackId = trackId;}
00044   inline void setEnergy(G4double edep)         {theEdep  = edep;}
00045   inline void updateEnergy(G4double edep)      {theEdep += edep;}
00046   inline void setTime(G4double t)              {theTime  = t;}
00047   inline void setLocalPos(G4ThreeVector xyz)   {localPos  = xyz;}
00048   inline void setGlobalPos(G4ThreeVector xyz)  {globalPos = xyz;}
00049   inline void setPrimMomDir(G4ThreeVector xyz) {momDir    = xyz;}
00050       
00051   inline G4int hitId()                  const {return theHitId;}
00052   inline G4int trackId()                const {return theTrackId;}
00053   inline G4double edep()                const {return theEdep;};
00054   inline G4double time()                const {return theTime;}
00055   inline G4ThreeVector localPosition()  const {return localPos;}
00056   inline G4ThreeVector globalPosition() const {return globalPos;}
00057   inline G4ThreeVector primaryMomDir()  const {return momDir;}
00058 };
00059 
00060 typedef G4THitsCollection<HFShowerG4Hit> HFShowerG4HitsCollection;
00061 
00062 extern G4Allocator<HFShowerG4Hit> HFShowerG4HitAllocator;
00063 
00064 inline void* HFShowerG4Hit::operator new(size_t) {
00065   void* aHit;
00066   aHit = (void*) HFShowerG4HitAllocator.MallocSingle();
00067   return aHit;
00068 }
00069 
00070 inline void HFShowerG4Hit::operator delete(void *aHit) {
00071   HFShowerG4HitAllocator.FreeSingle((HFShowerG4Hit*) aHit);
00072 }
00073 #endif