Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
LXeEventAction Class Reference

#include <LXeEventAction.hh>

Inheritance diagram for LXeEventAction:
G4UserEventAction

Public Member Functions

 LXeEventAction (LXeRecorderBase *)
 
virtual ~LXeEventAction ()
 
virtual void BeginOfEventAction (const G4Event *)
 
virtual void EndOfEventAction (const G4Event *)
 
void SetSaveThreshold (G4int)
 
void SetEventVerbose (G4int v)
 
void SetPMTThreshold (G4int t)
 
void SetForceDrawPhotons (G4bool b)
 
void SetForceDrawNoPhotons (G4bool b)
 
- Public Member Functions inherited from G4UserEventAction
 G4UserEventAction ()
 
virtual ~G4UserEventAction ()
 
void SetEventManager (G4EventManager *value)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserEventAction
G4EventManagerfpEventManager
 

Detailed Description

Definition at line 43 of file LXeEventAction.hh.

Constructor & Destructor Documentation

LXeEventAction::LXeEventAction ( LXeRecorderBase r)

Definition at line 53 of file LXeEventAction.cc.

54  : fRecorder(r),fSaveThreshold(0),fScintCollID(-1),fPMTCollID(-1),fVerbose(0),
55  fPMTThreshold(1),fForcedrawphotons(false),fForcenophotons(false)
56 {
57  fEventMessenger = new LXeEventMessenger(this);
58 }
LXeEventAction::~LXeEventAction ( )
virtual

Definition at line 62 of file LXeEventAction.cc.

62 {}

Member Function Documentation

void LXeEventAction::BeginOfEventAction ( const G4Event anEvent)
virtual

Reimplemented from G4UserEventAction.

Definition at line 66 of file LXeEventAction.cc.

References G4SDManager::GetCollectionID(), G4EventManager::GetEventManager(), G4SDManager::GetSDMpointer(), LXeRecorderBase::RecordBeginOfEvent(), and G4EventManager::SetUserInformation().

66  {
67 
68  //New event, add the user information object
71 
73  if(fScintCollID<0)
74  fScintCollID=SDman->GetCollectionID("scintCollection");
75  if(fPMTCollID<0)
76  fPMTCollID=SDman->GetCollectionID("pmtHitCollection");
77 
78  if(fRecorder)fRecorder->RecordBeginOfEvent(anEvent);
79 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
void SetUserInformation(G4VUserEventInformation *anInfo)
virtual void RecordBeginOfEvent(const G4Event *)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
static G4EventManager * GetEventManager()
void LXeEventAction::EndOfEventAction ( const G4Event anEvent)
virtual

Reimplemented from G4UserEventAction.

Definition at line 83 of file LXeEventAction.cc.

References G4THitsCollection< T >::DrawAllHits(), LXeTrajectory::DrawTrajectory(), G4TrajectoryContainer::entries(), G4THitsCollection< T >::entries(), G4cout, G4endl, LXeUserEventInformation::GetAbsorptionCount(), LXeUserEventInformation::GetBoundaryAbsorptionCount(), G4VVisManager::GetConcreteInstance(), LXeUserEventInformation::GetEDep(), G4HCofThisEvent::GetHC(), G4Event::GetHCofThisEvent(), LXeUserEventInformation::GetHitCount(), G4Trajectory::GetParticleName(), LXeUserEventInformation::GetPhotonCount(), LXeUserEventInformation::GetPhotonCount_Ceren(), LXeUserEventInformation::GetPhotonCount_Scint(), LXeUserEventInformation::GetPMTSAboveThreshold(), G4RunManager::GetRunManager(), G4Event::GetTrajectoryContainer(), G4Event::GetUserInformation(), LXeUserEventInformation::IncEDep(), LXeUserEventInformation::IncHitCount(), LXeUserEventInformation::IncPMTSAboveThreshold(), python.hepunit::keV, python.hepunit::mm, LXeRecorderBase::RecordEndOfEvent(), G4RunManager::rndmSaveThisEvent(), LXeUserEventInformation::SetEWeightPos(), LXeTrajectory::SetForceDrawTrajectory(), LXeTrajectory::SetForceNoDrawTrajectory(), LXeUserEventInformation::SetPosMax(), and LXeUserEventInformation::SetReconPos().

83  {
84 
85  LXeUserEventInformation* eventInformation
87 
88  G4TrajectoryContainer* trajectoryContainer=anEvent->GetTrajectoryContainer();
89 
90  G4int n_trajectories = 0;
91  if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
92 
93  // extract the trajectories and draw them
95  for (G4int i=0; i<n_trajectories; i++){
97  ((*(anEvent->GetTrajectoryContainer()))[i]);
98  if(trj->GetParticleName()=="opticalphoton"){
99  trj->SetForceDrawTrajectory(fForcedrawphotons);
100  trj->SetForceNoDrawTrajectory(fForcenophotons);
101  }
102  trj->DrawTrajectory();
103  }
104  }
105 
106  LXeScintHitsCollection* scintHC = 0;
107  LXePMTHitsCollection* pmtHC = 0;
108  G4HCofThisEvent* hitsCE = anEvent->GetHCofThisEvent();
109 
110  //Get the hit collections
111  if(hitsCE){
112  if(fScintCollID>=0)scintHC = (LXeScintHitsCollection*)(hitsCE->GetHC(fScintCollID));
113  if(fPMTCollID>=0)pmtHC = (LXePMTHitsCollection*)(hitsCE->GetHC(fPMTCollID));
114  }
115 
116  //Hits in scintillator
117  if(scintHC){
118  int n_hit = scintHC->entries();
119  G4ThreeVector eWeightPos(0.);
120  G4double edep;
121  G4double edepMax=0;
122 
123  for(int i=0;i<n_hit;i++){ //gather info on hits in scintillator
124  edep=(*scintHC)[i]->GetEdep();
125  eventInformation->IncEDep(edep); //sum up the edep
126  eWeightPos += (*scintHC)[i]->GetPos()*edep;//calculate energy weighted pos
127  if(edep>edepMax){
128  edepMax=edep;//store max energy deposit
129  G4ThreeVector posMax=(*scintHC)[i]->GetPos();
130  eventInformation->SetPosMax(posMax,edep);
131  }
132  }
133  if(eventInformation->GetEDep()==0.){
134  if(fVerbose>0)G4cout<<"No hits in the scintillator this event."<<G4endl;
135  }
136  else{
137  //Finish calculation of energy weighted position
138  eWeightPos/=eventInformation->GetEDep();
139  eventInformation->SetEWeightPos(eWeightPos);
140  if(fVerbose>0){
141  G4cout << "\tEnergy weighted position of hits in LXe : "
142  << eWeightPos/mm << G4endl;
143  }
144  }
145  if(fVerbose>0){
146  G4cout << "\tTotal energy deposition in scintillator : "
147  << eventInformation->GetEDep() / keV << " (keV)" << G4endl;
148  }
149  }
150 
151  if(pmtHC){
152  G4ThreeVector reconPos(0.,0.,0.);
153  G4int pmts=pmtHC->entries();
154  //Gather info from all PMTs
155  for(G4int i=0;i<pmts;i++){
156  eventInformation->IncHitCount((*pmtHC)[i]->GetPhotonCount());
157  reconPos+=(*pmtHC)[i]->GetPMTPos()*(*pmtHC)[i]->GetPhotonCount();
158  if((*pmtHC)[i]->GetPhotonCount()>=fPMTThreshold){
159  eventInformation->IncPMTSAboveThreshold();
160  }
161  else{//wasnt above the threshold, turn it back off
162  (*pmtHC)[i]->SetDrawit(false);
163  }
164  }
165 
166  if(eventInformation->GetHitCount()>0){//dont bother unless there were hits
167  reconPos/=eventInformation->GetHitCount();
168  if(fVerbose>0){
169  G4cout << "\tReconstructed position of hits in LXe : "
170  << reconPos/mm << G4endl;
171  }
172  eventInformation->SetReconPos(reconPos);
173  }
174  pmtHC->DrawAllHits();
175  }
176 
177  if(fVerbose>0){
178  //End of event output. later to be controlled by a verbose level
179  G4cout << "\tNumber of photons that hit PMTs in this event : "
180  << eventInformation->GetHitCount() << G4endl;
181  G4cout << "\tNumber of PMTs above threshold("<<fPMTThreshold<<") : "
182  << eventInformation->GetPMTSAboveThreshold() << G4endl;
183  G4cout << "\tNumber of photons produced by scintillation in this event : "
184  << eventInformation->GetPhotonCount_Scint() << G4endl;
185  G4cout << "\tNumber of photons produced by cerenkov in this event : "
186  << eventInformation->GetPhotonCount_Ceren() << G4endl;
187  G4cout << "\tNumber of photons absorbed (OpAbsorption) in this event : "
188  << eventInformation->GetAbsorptionCount() << G4endl;
189  G4cout << "\tNumber of photons absorbed at boundaries (OpBoundary) in "
190  << "this event : " << eventInformation->GetBoundaryAbsorptionCount()
191  << G4endl;
192  G4cout << "Unacounted for photons in this event : "
193  << (eventInformation->GetPhotonCount_Scint() +
194  eventInformation->GetPhotonCount_Ceren() -
195  eventInformation->GetAbsorptionCount() -
196  eventInformation->GetHitCount() -
197  eventInformation->GetBoundaryAbsorptionCount())
198  << G4endl;
199  }
200  //If we have set the flag to save 'special' events, save here
201  if(fSaveThreshold&&eventInformation->GetPhotonCount() <= fSaveThreshold)
203 
204  if(fRecorder)fRecorder->RecordEndOfEvent(anEvent);
205 }
G4VUserEventInformation * GetUserInformation() const
Definition: G4Event.hh:188
static G4VVisManager * GetConcreteInstance()
int G4int
Definition: G4Types.hh:78
G4TrajectoryContainer * GetTrajectoryContainer() const
Definition: G4Event.hh:178
G4GLOB_DLL std::ostream G4cout
virtual void rndmSaveThisEvent()
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
void SetReconPos(const G4ThreeVector &p)
virtual void DrawTrajectory() const
#define G4endl
Definition: G4ios.hh:61
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:174
double G4double
Definition: G4Types.hh:76
void SetForceNoDrawTrajectory(G4bool b)
virtual void RecordEndOfEvent(const G4Event *)
G4String GetParticleName() const
Definition: G4Trajectory.hh:99
void SetEWeightPos(const G4ThreeVector &p)
void SetForceDrawTrajectory(G4bool b)
void SetPosMax(const G4ThreeVector &p, G4double edep)
void LXeEventAction::SetEventVerbose ( G4int  v)
inline

Definition at line 57 of file LXeEventAction.hh.

References test::v.

Referenced by LXeEventMessenger::SetNewValue().

57 {fVerbose=v;}
void LXeEventAction::SetForceDrawNoPhotons ( G4bool  b)
inline

Definition at line 62 of file LXeEventAction.hh.

References test::b.

Referenced by LXeEventMessenger::SetNewValue().

62 {fForcenophotons=b;}
void LXeEventAction::SetForceDrawPhotons ( G4bool  b)
inline

Definition at line 61 of file LXeEventAction.hh.

References test::b.

Referenced by LXeEventMessenger::SetNewValue().

61 {fForcedrawphotons=b;}
void LXeEventAction::SetPMTThreshold ( G4int  t)
inline

Definition at line 59 of file LXeEventAction.hh.

Referenced by LXeEventMessenger::SetNewValue().

59 {fPMTThreshold=t;}
void LXeEventAction::SetSaveThreshold ( G4int  save)

Definition at line 209 of file LXeEventAction.cc.

References G4RunManager::GetRunManager(), G4RunManager::SetRandomNumberStore(), and G4RunManager::SetRandomNumberStoreDir().

Referenced by LXeEventMessenger::SetNewValue().

209  {
210 /*Sets the save threshold for the random number seed. If the number of photons
211 generated in an event is lower than this, then save the seed for this event
212 in a file called run###evt###.rndm
213 */
214  fSaveThreshold=save;
217  // G4UImanager::GetUIpointer()->ApplyCommand("/random/setSavingFlag 1");
218 }
void SetRandomNumberStore(G4bool flag)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
void SetRandomNumberStoreDir(const G4String &dir)

The documentation for this class was generated from the following files: