00001 //---------------------------------------------------------------------------// 00002 //Description: Hit for Monitor 00003 //Author: Wu Chen(wuchen@mail.ihep.ac.cn) 00004 //Created: 17 Oct, 2012 00005 //Comment: 00006 //---------------------------------------------------------------------------// 00007 00008 #ifndef MonitorHit_h 00009 #define MonitorHit_h 1 00010 00011 #include "G4VHit.hh" 00012 #include "G4THitsCollection.hh" 00013 #include "G4Allocator.hh" 00014 #include "G4ThreeVector.hh" 00015 00016 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00017 00018 class MonitorHit : public G4VHit 00019 { 00020 public: 00021 00022 MonitorHit(); 00023 ~MonitorHit(); 00024 MonitorHit(const MonitorHit&); 00025 const MonitorHit& operator=(const MonitorHit&); 00026 int operator==(const MonitorHit&) const; 00027 00028 inline void* operator new(size_t); 00029 inline void operator delete(void*); 00030 00031 void Draw(); 00032 void Print(); 00033 00034 public: 00035 void SetTrackID (G4int track) { trackID = track; }; 00036 void SetVolID (G4int val) { volID = val; }; 00037 void SetEdep (G4double de) { edep = de; }; 00038 void SetPos (G4ThreeVector xyz){ pos = xyz; }; 00039 void SetGlobalT (G4double time) { globalT = time;}; 00040 00041 G4int GetTrackID() { return trackID; }; 00042 G4int GetVolID() { return volID; }; 00043 G4double GetEdep() { return edep; }; 00044 G4ThreeVector GetPos() { return pos; }; 00045 G4double GetGlobalT() { return globalT;}; 00046 00047 private: 00048 G4int trackID; 00049 G4int volID; 00050 G4double edep; 00051 G4ThreeVector pos; 00052 G4double globalT; 00053 }; 00054 00055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00056 00057 typedef G4THitsCollection<MonitorHit> MonitorHitsCollection; 00058 00059 extern G4Allocator<MonitorHit> MonitorHitAllocator; 00060 00061 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00062 00063 inline void* MonitorHit::operator new(size_t) 00064 { 00065 void *aHit; 00066 aHit = (void *) MonitorHitAllocator.MallocSingle(); 00067 return aHit; 00068 } 00069 00070 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00071 00072 inline void MonitorHit::operator delete(void *aHit) 00073 { 00074 MonitorHitAllocator.FreeSingle((MonitorHit*) aHit); 00075 } 00076 00077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00078 00079 #endif 00080 00081