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 #include "MonitorHit.hh" 00009 #include "G4UnitsTable.hh" 00010 #include "G4VVisManager.hh" 00011 #include "G4Circle.hh" 00012 #include "G4Colour.hh" 00013 #include "G4VisAttributes.hh" 00014 00015 G4Allocator<MonitorHit> MonitorHitAllocator; 00016 00017 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00018 00019 MonitorHit::MonitorHit() {} 00020 00021 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00022 00023 MonitorHit::~MonitorHit() {} 00024 00025 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00026 00027 MonitorHit::MonitorHit(const MonitorHit& right) 00028 : G4VHit() 00029 { 00030 trackID = right.trackID; 00031 volID = right.volID; 00032 edep = right.edep; 00033 pos = right.pos; 00034 globalT = right.globalT; 00035 } 00036 00037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00038 00039 const MonitorHit& MonitorHit::operator=(const MonitorHit& right) 00040 { 00041 trackID = right.trackID; 00042 volID = right.volID; 00043 edep = right.edep; 00044 pos = right.pos; 00045 globalT = right.globalT; 00046 return *this; 00047 } 00048 00049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00050 00051 int MonitorHit::operator==(const MonitorHit& right) const 00052 { 00053 return (this==&right) ? 1 : 0; 00054 } 00055 00056 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00057 00058 void MonitorHit::Draw() 00059 { 00060 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); 00061 if(pVVisManager) 00062 { 00063 G4Circle circle(pos); 00064 circle.SetScreenSize(4.); 00065 circle.SetFillStyle(G4Circle::filled); 00066 G4Colour colour(1.,1.,0.); 00067 G4VisAttributes attribs(colour); 00068 circle.SetVisAttributes(attribs); 00069 pVVisManager->Draw(circle); 00070 } 00071 } 00072 00073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00074 00075 void MonitorHit::Print() 00076 { 00077 G4cout << " trackID: " << trackID 00078 << " volID: " << volID 00079 << " energy deposit: " << G4BestUnit(edep,"Energy") 00080 << " position: " << G4BestUnit(pos,"Length") 00081 << " globalT: " << G4BestUnit(globalT,"Time") 00082 <<G4endl; 00083 } 00084 00085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00086