23#include "G4Version.hh"
31#include "G4Electron.hh"
33#include "G4Positron.hh"
34#include "G4Neutron.hh"
37#include "GaudiKernel/ITHistSvc.h"
49#if G4VERSION_NUMBER < 1100
52 return G4StrUtil::contains(s, v);
58 return s.find(v) != std::string_view::npos;
89 G4cout<<
"TestActionTimer::Constructor: Labels "
91 for (
int i(0); i <
eMax; ++i) G4cout <<
m_report.timeName[i] <<
" ";
92 G4cout <<
"Particle Dead" << G4endl;
100 for (
int i(0); i <
eMax; ++i) {
101 G4Timer* timer =
new G4Timer();
112 G4cout <<
"TestActionTimer::Constructor done" << G4endl;
148 std::cerr<<
"TestActionTimer::EndOfRunAction "<<
m_report.runTime <<std::endl;
159 G4Track* track = aStep->GetTrack();
161 G4String thePrePVname = track->GetVolume()->GetName();
162 G4String thePostPVname;
163 if (track->GetNextVolume() != 0) {
164 thePostPVname = track->GetNextVolume()->GetName();
166 thePostPVname =
"OutOfWorld";
173 if (thePrePVname != thePostPVname){
184 if (timer->IsValid()) {
190 if (track->GetDefinition() == G4Electron::ElectronDefinition() ){
197 if (track->GetDefinition() == G4Positron::PositronDefinition() ){
204 if (track->GetDefinition() == G4Gamma::GammaDefinition() &&
210 if (track->GetDefinition() == G4Neutron::NeutronDefinition() &&
221 if (timer == 0)
return -999.;
223 return (timer->GetUserElapsed() + timer->GetSystemElapsed());
229 G4cout <<
"TestActionTimer::PPanic" << G4endl;
236 G4cout <<
"TestActionTimer::PPanic stopping counter i:" << i <<
" " << timer << G4endl;
238 if (!timer->IsValid()){
244 G4cout <<
"TestActionTimer::PPanic done" << G4endl;
251 G4cout <<
"TestActionTimer::VPanic" << G4endl;
255 for (
int i(0); i <=
eOther; ++i) {
258 G4cout <<
"TestActionTimer::VPanic stopping counter i:" << i <<
" " << timer << G4endl;
260 if (!timer->IsValid()){
266 G4cout <<
"TestActionTimer::VPanic done" << G4endl;
272 std::string_view nom(nomstr);
273 if( nom.length() >= 17 &&
274 nom.substr(13,4) ==
"EMEC" ){
277 else if ( nom.length() >= 16 &&
278 nom.substr(13,3) ==
"EMB" ){
281 else if( nom.length() >= 25 &&
282 nom.substr(21,4) ==
"Cryo" ) {
285 else if( nom.length() >= 26 &&
286 nom.substr(13,13) ==
"FCAL::Module1"){
289 else if( nom.length() >= 25 &&
290 nom.substr(13,12) ==
"FCAL::Module" ){
293 else if ( nom.length() >= 17 &&
294 nom.substr(13,4) ==
"FCAL" ){
297 else if ( nom.length() >= 16 &&
298 nom.substr(13,3) ==
"HEC" ){
301 else if( nom.length() >= 31 &&
302 nom.substr(21,10) ==
"Presampler" ) {
305 else if ( nom.length() >= 3 &&
306 nom.substr(0,3) ==
"LAr" ){
309 else if( ( (nom.length() >= 4 &&
310 nom.substr(0,4) ==
"Muon") ||
311 nom.substr(0,4) ==
"MUON" ) ||
312 ( nom.length() >= 9 &&
313 nom.substr(0,9) ==
"DriftTube" ) ||
315 ( nom.length() >= 12 &&
316 nom.substr(0,12) ==
"SensitiveGas" ) ||
321 else if ( nom.length() >= 8 &&
322 nom.substr(0,8) ==
"ITkPixel" ){
325 else if ( nom.length() >= 8 &&
326 nom.substr(0,8) ==
"ITkStrip" ){
329 else if ((nom.length() >= 5 &&
330 nom.substr(0,5) ==
"Pixel") ||
331 nom ==
"Outside Barrel Service"){
334 else if ( nom.length() >= 3 &&
335 nom.substr(0,3) ==
"SCT" ){
338 else if ( ( nom.length() >= 3 &&
339 nom.substr(0,3) ==
"TRT" ) ||
343 else if ( nom.length() >= 4 &&
344 nom.substr(0,4) ==
"HGTD"){
347 else if ( nom.length() >= 4 &&
348 nom.substr(0,4) ==
"Tile"){
351 else if ( ( nom.length() >= 12 &&
352 nom.substr(0,12) ==
"InDetServMat" ) ||
353 ( nom.length() >= 4 &&
354 nom.substr(0,4) ==
"IDET" ) ||
355 ( nom.length() >= 3 &&
356 nom.substr(0,3) ==
"ITK" ) ||
357 ( nom.length() >= 8 &&
358 nom.substr(0,8) ==
"BeamPipe" ) ||
359 ( nom.length() >= 7 &&
360 nom.substr(0,7) ==
"Section" ) ||
361 ( nom.length() >= 3 &&
362 ( nom.substr(0,3) ==
"BLM" ||
363 nom.substr(0,3) ==
"BCM" ||
364 nom.substr(0,3) ==
"PLR" ) ) ||
365 ( nom.length() >= 8 &&
366 nom.substr(0,8) ==
"BCMPrime" ) ){
G4Timer * m_runTimer
Timer for the entire run.
int ClassifyVolume(G4String &) const
Method to sort out which volume we are in.
TestActionTimer()
constructor
double TimerSum(G4Timer *timer) const
Gets the appropriate time from the timer for adding to the sum.
G4Timer * m_eventTimer
Timer for this event.
std::vector< G4Timer * > m_timer
Vector of timers for each of the enum.
virtual void UserSteppingAction(const G4Step *) override
virtual void EndOfRunAction(const G4Run *) override
double m_eventTime
Double for storing this event.
virtual void BeginOfRunAction(const G4Run *) override
virtual void EndOfEventAction(const G4Event *) override
virtual void BeginOfEventAction(const G4Event *) override
void PPanic()
Method to shut down all particle timers.
void VPanic()
Method to shut down all volume timers.
bool G4StrContains(const G4String &s, const char *v)