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

#include <XrayFluoEventAction.hh>

Inheritance diagram for XrayFluoEventAction:
G4UserEventAction

Public Member Functions

 XrayFluoEventAction (XrayFluoDetectorConstruction *)
 
 XrayFluoEventAction (XrayFluoPlaneDetectorConstruction *)
 
 XrayFluoEventAction (XrayFluoMercuryDetectorConstruction *)
 
virtual ~XrayFluoEventAction ()
 
virtual void BeginOfEventAction (const G4Event *)
 
virtual void EndOfEventAction (const G4Event *)
 
void SetDrawFlag (G4String val)
 
void SetPrintModulo (G4int val)
 
- 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 54 of file XrayFluoEventAction.hh.

Constructor & Destructor Documentation

XrayFluoEventAction::XrayFluoEventAction ( XrayFluoDetectorConstruction det)

Definition at line 62 of file XrayFluoEventAction.cc.

References G4cout, G4endl, XrayFluoDetectorConstruction::GetDetectorType(), and XrayFluoDetectorConstruction::GetPhaseSpaceFlag().

63  :drawFlag("all"),
64  HPGeCollID(0),
65  eventMessenger(0),
66  printModulo(1),
67  detectorType(0)
68 {
69  eventMessenger = new XrayFluoEventActionMessenger(this);
70 
71  if (!(det->GetPhaseSpaceFlag()) ){
72  detectorType = det->GetDetectorType();
73  HPGeCollID=-1;
74  }
75 
76  //runManager = new XrayFluoRunAction();
77  G4cout << "XrayFluoEventAction created" << G4endl;
78 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
XrayFluoEventAction::XrayFluoEventAction ( XrayFluoPlaneDetectorConstruction det)

Definition at line 82 of file XrayFluoEventAction.cc.

References G4cout, G4endl, and XrayFluoPlaneDetectorConstruction::GetDetectorType().

83  :drawFlag("all"),
84  HPGeCollID(-1),
85  eventMessenger(0),
86  printModulo(1),
87  detectorType(0)
88 {
89  eventMessenger = new XrayFluoEventActionMessenger(this);
90  detectorType = det->GetDetectorType();
91 
92  //runManager = new XrayFluoRunAction();
93  G4cout << "XrayFluoEventAction created" << G4endl;
94 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
XrayFluoEventAction::XrayFluoEventAction ( XrayFluoMercuryDetectorConstruction det)

Definition at line 98 of file XrayFluoEventAction.cc.

References G4cout, G4endl, and XrayFluoMercuryDetectorConstruction::GetDetectorType().

99  :drawFlag("all"),
100  HPGeCollID(-1),
101  eventMessenger(0),
102  printModulo(1),
103  detectorType(0)
104 {
105  eventMessenger = new XrayFluoEventActionMessenger(this);
106  detectorType = det->GetDetectorType();
107 
108  //runManager = new XrayFluoRunAction();
109  G4cout << "XrayFluoEventAction created" << G4endl;
110 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
XrayFluoEventAction::~XrayFluoEventAction ( )
virtual

Definition at line 118 of file XrayFluoEventAction.cc.

References G4cout, and G4endl.

119 {
120  delete eventMessenger;
121  eventMessenger = 0;
122  //delete runManager;
123  //runManager = 0;
124  G4cout << "XrayFluoEventAction deleted" << G4endl;
125 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Member Function Documentation

void XrayFluoEventAction::BeginOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 129 of file XrayFluoEventAction.cc.

References G4cout, G4endl, G4SDManager::GetCollectionID(), G4Event::GetEventID(), and G4SDManager::GetSDMpointer().

130 {
131 
132  G4int eventNumber = (evt->GetEventID())+1;
133  if ( eventNumber == 1){
134 
135  G4cout << "# = 100000 events" << G4endl;
136  G4cout << "1--------+---------+---------+---------+---------5e6"<<G4endl;
137  }
138 
139  if ( ((eventNumber) % 100000) == 0 ) {
140 
141  if ( eventNumber % (G4int)5e6 != 0 ) G4cout << "#" << std::flush;
142  else G4cout << "#"<< G4endl;
143  // if ( eventNumber % 5e6 == 0 ) G4cout << "#"<< G4endl;
144 #ifdef G4ANALYSIS_USE
145  XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
146  analysis->PlotCurrentResults();
147 #endif
148  }
149 
150  if (HPGeCollID==-1)
151 
152  {
154  HPGeCollID = SDman->GetCollectionID("HPGeCollection");
155  //the pointer points to the ID number of the sensitive detector
156  }
157 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
int G4int
Definition: G4Types.hh:78
G4int GetEventID() const
Definition: G4Event.hh:140
G4GLOB_DLL std::ostream G4cout
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61
void XrayFluoEventAction::EndOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 161 of file XrayFluoEventAction.cc.

References G4THitsCollection< T >::entries(), G4HCofThisEvent::GetHC(), G4Event::GetHCofThisEvent(), and XrayFluoVDetectorType::ResponseFunction().

162 {
163 
164  if (detectorType) {
165 
166  // extracted from hits, compute the total energy deposit (and total charged
167  // track length)
168  G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
169 
170  XrayFluoSensorHitsCollection* HPGeHC = 0;
171  G4int n_hit = 0;
172  G4double totEnergyDetect=0., totEnergy=0., energyD=0.;
173 
174  if (HCE) HPGeHC = (XrayFluoSensorHitsCollection*)(HCE->GetHC(HPGeCollID));
175  if(HPGeHC)
176 
177 
178  {
179  n_hit = HPGeHC->entries();
180 
181  // if (n_hit) {G4cout << "Ecco quante hit ho nel detector "<< n_hit << G4endl;}
182 
183  for (G4int i=0;i<n_hit;i++)
184  {
185 
186  totEnergy += (*HPGeHC)[i]->GetEdepTot();
187 
188 
189 
190  energyD = detectorType->ResponseFunction(totEnergy);
191  // energyD = totEnergy;
192  // G4cout << "energy deposit: "<< totEnergy << G4endl;
193 #ifdef G4ANALYSIS_USE
194  XrayFluoAnalysisManager* analysis = XrayFluoAnalysisManager::getInstance();
195  analysis->analyseEnergyDep(energyD);
196 #endif
197  totEnergyDetect += energyD;
198 
199 
200  }
201  }
202  }
203 }
int G4int
Definition: G4Types.hh:78
virtual G4double ResponseFunction(G4double)=0
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:174
double G4double
Definition: G4Types.hh:76
void XrayFluoEventAction::SetDrawFlag ( G4String  val)
inline

Definition at line 69 of file XrayFluoEventAction.hh.

Referenced by XrayFluoEventActionMessenger::SetNewValue().

69 {drawFlag = val;};
void XrayFluoEventAction::SetPrintModulo ( G4int  val)
inline

Definition at line 70 of file XrayFluoEventAction.hh.

Referenced by XrayFluoEventActionMessenger::SetNewValue().

70 {printModulo = val;};

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