00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "G4Event.hh"
00033 #include "G4VVisManager.hh"
00034
00035
00036 #include "G4VHitsCollection.hh"
00037 #include "G4VDigiCollection.hh"
00038 #include "G4ios.hh"
00039
00040 G4Allocator<G4Event> anEventAllocator;
00041
00042 G4Event::G4Event()
00043 :eventID(0),
00044 thePrimaryVertex(0),numberOfPrimaryVertex(0),
00045 HC(0),DC(0),trajectoryContainer(0),eventAborted(false),userInfo(0),
00046 randomNumberStatus(0),validRandomNumberStatus(false),
00047 randomNumberStatusForProcessing(0),validRandomNumberStatusForProcessing(false),
00048 keepTheEvent(false)
00049 {;}
00050
00051 G4Event::G4Event(G4int evID)
00052 :eventID(evID),
00053 thePrimaryVertex(0),numberOfPrimaryVertex(0),
00054 HC(0),DC(0),trajectoryContainer(0),eventAborted(false),userInfo(0),
00055 randomNumberStatus(0),validRandomNumberStatus(false),
00056 randomNumberStatusForProcessing(0),validRandomNumberStatusForProcessing(false),
00057 keepTheEvent(false)
00058 {;}
00059
00060 G4Event::~G4Event()
00061 {
00062 if(thePrimaryVertex) delete thePrimaryVertex;
00063 if(HC) delete HC;
00064 if(DC) delete DC;
00065 if(trajectoryContainer)
00066 {
00067 trajectoryContainer->clearAndDestroy();
00068 delete trajectoryContainer;
00069 }
00070 if(userInfo) delete userInfo;
00071 if(validRandomNumberStatus) delete randomNumberStatus;
00072 if(validRandomNumberStatusForProcessing) delete randomNumberStatusForProcessing;
00073 }
00074
00075 G4int G4Event::operator==(const G4Event &right) const
00076 {
00077 return ( eventID == right.eventID );
00078 }
00079
00080 G4int G4Event::operator!=(const G4Event &right) const
00081 {
00082 return ( eventID != right.eventID );
00083 }
00084
00085 void G4Event::Print() const
00086 {
00087 G4cout << "G4Event " << eventID << G4endl;
00088 }
00089
00090 void G4Event::Draw() const
00091 {
00092 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
00093 if(!pVVisManager) return;
00094
00095 if(trajectoryContainer)
00096 {
00097 G4int n_traj = trajectoryContainer->entries();
00098 for(G4int i=0;i<n_traj;i++)
00099 { (*trajectoryContainer)[i]->DrawTrajectory(); }
00100 }
00101
00102 if(HC)
00103 {
00104 G4int n_HC = HC->GetCapacity();
00105 for(G4int j=0;j<n_HC;j++)
00106 {
00107 G4VHitsCollection * VHC = HC->GetHC(j);
00108 if(VHC) VHC->DrawAllHits();
00109 }
00110 }
00111
00112 if(DC)
00113 {
00114 G4int n_DC = DC->GetCapacity();
00115 for(G4int j=0;j<n_DC;j++)
00116 {
00117 G4VDigiCollection * VDC = DC->GetDC(j);
00118 if(VDC) VDC->DrawAllDigi();
00119 }
00120 }
00121 }
00122