00001 #ifndef SimG4CMS_ShowerLibraryProducer_FiberG4Hit_h 00002 #define SimG4CMS_ShowerLibraryProducer_FiberG4Hit_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 "G4LogicalVolume.hh" 00011 00012 #include <boost/cstdint.hpp> 00013 #include <vector> 00014 00015 class FiberG4Hit : public G4VHit { 00016 00017 public: 00018 00019 FiberG4Hit(); 00020 FiberG4Hit(G4LogicalVolume* logVol, G4int tower, G4int depth, G4int tkID); 00021 virtual ~FiberG4Hit(); 00022 FiberG4Hit(const FiberG4Hit &right); 00023 const FiberG4Hit& operator=(const FiberG4Hit &right); 00024 G4int operator==(const FiberG4Hit &right) const; 00025 00026 inline void *operator new(size_t); 00027 inline void operator delete(void *aHit); 00028 00029 private: 00030 00031 G4int theTowerId; 00032 G4int theDepth; 00033 G4int theTrackId; 00034 G4int theNpe; 00035 G4double theTime; 00036 math::XYZPoint theHitPos; 00037 std::vector<HFShowerPhoton> thePhoton; 00038 const G4LogicalVolume* theLogV; 00039 00040 public: 00041 00042 inline void setTowerId(G4int tower) {theTowerId = tower;} 00043 inline void setDepth(G4int depth) {theDepth = depth;} 00044 inline void setNpe(G4int npe) {theNpe = npe;} 00045 inline void setPos(math::XYZPoint xyz) {theHitPos = xyz;} 00046 inline void setTime(G4double t) {theTime = t; } 00047 inline void setPhoton(std::vector<HFShowerPhoton> photon) {thePhoton = photon; } 00048 00049 inline G4int towerId() const {return theTowerId;} 00050 inline G4int depth() const {return theDepth;} 00051 inline G4int trackId() const {return theTrackId;} 00052 inline G4int npe() const {return theNpe;} 00053 math::XYZPoint hitPos() const {return theHitPos;}; 00054 inline G4double time() const {return theTime;} 00055 std::vector<HFShowerPhoton> photon() const {return thePhoton;} 00056 inline void add(G4int npe) {theNpe +=npe;} 00057 }; 00058 00059 typedef G4THitsCollection<FiberG4Hit> FiberG4HitsCollection; 00060 00061 extern G4Allocator<FiberG4Hit> FiberG4HitAllocator; 00062 00063 inline void* FiberG4Hit::operator new(size_t) { 00064 void* aHit; 00065 aHit = (void*) FiberG4HitAllocator.MallocSingle(); 00066 return aHit; 00067 } 00068 00069 inline void FiberG4Hit::operator delete(void *aHit) { 00070 FiberG4HitAllocator.FreeSingle((FiberG4Hit*) aHit); 00071 } 00072 #endif