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

#include <WLSEventAction.hh>

Inheritance diagram for WLSEventAction:
G4UserEventAction

Public Member Functions

 WLSEventAction (WLSRunAction *)
 
virtual ~WLSEventAction ()
 
virtual void BeginOfEventAction (const G4Event *)
 
virtual void EndOfEventAction (const G4Event *)
 
G4int GetEventNo ()
 
void SetEventVerbose (G4int)
 
void SetDrawFlag (G4String val)
 
void SetPrintModulo (G4int val)
 
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 44 of file WLSEventAction.hh.

Constructor & Destructor Documentation

WLSEventAction::WLSEventAction ( WLSRunAction runaction)

Definition at line 55 of file WLSEventAction.cc.

56  : fRunAction(runaction), fVerboseLevel(0),
57  fPrintModulo(100), fDrawFlag("all")
58 {
59  fMPPCCollID = 0;
60 
61  fEventMessenger = new WLSEventActionMessenger(this);
62 
63  fForceDrawPhotons = false;
64  fForceNoPhotons = false;
65 
66 }
WLSEventAction::~WLSEventAction ( )
virtual

Definition at line 70 of file WLSEventAction.cc.

71 {
72  delete fEventMessenger;
73 }

Member Function Documentation

void WLSEventAction::BeginOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 77 of file WLSEventAction.cc.

References G4cout, G4endl, and G4Event::GetEventID().

78 {
79  G4int evtNb = evt->GetEventID();
80  if (evtNb%fPrintModulo == 0)
81  G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
82 
83  if(fVerboseLevel>0)
84  G4cout << "<<< Event " << evtNb << " started." << G4endl;
85 }
int G4int
Definition: G4Types.hh:78
G4int GetEventID() const
Definition: G4Event.hh:140
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void WLSEventAction::EndOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 89 of file WLSEventAction.cc.

References WLSTrajectory::DrawTrajectory(), G4TrajectoryContainer::entries(), G4cout, G4endl, WLSTrajectory::GetCharge(), G4SDManager::GetCollectionID(), G4VVisManager::GetConcreteInstance(), G4Event::GetEventID(), G4HCofThisEvent::GetHC(), G4Event::GetHCofThisEvent(), WLSTrajectory::GetParticleName(), WLSRunAction::GetRndmFreq(), G4SDManager::GetSDMpointer(), G4Event::GetTrajectoryContainer(), WLSTrajectory::SetForceDrawTrajectory(), and WLSTrajectory::SetForceNoDrawTrajectory().

90 {
92 
93  // Visualization of Trajectory
94  if(pVVisManager)
95  {
96  G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
97 
98  G4int n_trajectories = 0;
99  if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
100  G4cout << "n_trajectories: " << n_trajectories << G4endl;
101  if (fDrawFlag == "all") G4cout << "draw all trajectories" << G4endl;
102  if (fDrawFlag == "charged") G4cout << "draw only charged" << G4endl;
103 
104  for(G4int i=0; i<n_trajectories; i++)
105  { WLSTrajectory* trj =
106  (WLSTrajectory *)((*(evt->GetTrajectoryContainer()))[i]);
107  if (fDrawFlag == "all") {
108  G4cout << "Now calling DrawTrajectory" << G4endl;
109  G4cout << "Particle Name: " << trj->GetParticleName() << G4endl;
110  trj->DrawTrajectory();
111  }
112  else if ((fDrawFlag == "charged")&&(trj->GetCharge() != 0.))
113  trj->DrawTrajectory();
114  else if (trj->GetParticleName()=="opticalphoton")
115  {
116  G4cout << "We should be drawing an opticalphoton" << G4endl;
117  trj->SetForceDrawTrajectory(fForceDrawPhotons);
118  trj->SetForceNoDrawTrajectory(fForceNoPhotons);
119  trj->DrawTrajectory();
120  }
121  }
122  }
123 
124  if (fVerboseLevel>0)
125  G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
126 
127  // Save the Random Engine Status at the of event
128  if (fRunAction->GetRndmFreq() == 2)
129  {
130  G4Random::saveEngineStatus("endOfEvent.rndm");
131  G4int evtNb = evt->GetEventID();
132  if (evtNb%fPrintModulo == 0)
133  {
134  G4cout << "\n---> End of Event: " << evtNb << G4endl;
135  G4Random::showEngineStatus();
136  }
137  }
138 
139  // Get Hits from the detector if any
141  G4String colName = "PhotonDetHitCollection";
142  fMPPCCollID = SDman->GetCollectionID(colName);
143 
144  G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
145  WLSPhotonDetHitsCollection* mppcHC = 0;
146 
147  // Get the hit collections
148  if (HCE)
149  {
150  if (fMPPCCollID>=0) mppcHC =
151  (WLSPhotonDetHitsCollection*)(HCE->GetHC(fMPPCCollID));
152  }
153 
154  // Get hit information about photons that reached the detector in this event
155  if (mppcHC)
156  {
157 // G4int n_hit = mppcHC->entries();
158  }
159 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
static G4VVisManager * GetConcreteInstance()
virtual G4String GetParticleName() const
int G4int
Definition: G4Types.hh:78
G4TrajectoryContainer * GetTrajectoryContainer() const
Definition: G4Event.hh:178
G4int GetEventID() const
Definition: G4Event.hh:140
G4GLOB_DLL std::ostream G4cout
virtual G4double GetCharge() const
void SetForceNoDrawTrajectory(G4bool b)
G4int GetRndmFreq()
Definition: WLSRunAction.hh:59
void SetForceDrawTrajectory(G4bool b)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:174
virtual void DrawTrajectory() const
G4int WLSEventAction::GetEventNo ( )

Definition at line 163 of file WLSEventAction.cc.

References G4UserEventAction::fpEventManager, G4EventManager::GetConstCurrentEvent(), and G4Event::GetEventID().

164 {
166 }
G4EventManager * fpEventManager
G4int GetEventID() const
Definition: G4Event.hh:140
const G4Event * GetConstCurrentEvent()
void WLSEventAction::SetDrawFlag ( G4String  val)
inline

Definition at line 59 of file WLSEventAction.hh.

Referenced by WLSEventActionMessenger::SetNewValue().

59 { fDrawFlag = val; };
void WLSEventAction::SetEventVerbose ( G4int  level)

Definition at line 170 of file WLSEventAction.cc.

Referenced by WLSEventActionMessenger::SetNewValue().

171 {
172  fVerboseLevel = level;
173 }
void WLSEventAction::SetForceDrawNoPhotons ( G4bool  b)
inline

Definition at line 63 of file WLSEventAction.hh.

References test::b.

63 {fForceNoPhotons=b;}
void WLSEventAction::SetForceDrawPhotons ( G4bool  b)
inline

Definition at line 62 of file WLSEventAction.hh.

References test::b.

62 {fForceDrawPhotons=b;}
void WLSEventAction::SetPrintModulo ( G4int  val)
inline

Definition at line 60 of file WLSEventAction.hh.

Referenced by WLSEventActionMessenger::SetNewValue().

60 { fPrintModulo = val; };

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