1 #ifndef HelpfulWatchers_EcalTBH4Trigger_h
2 #define HelpfulWatchers_EcalTBH4Trigger_h
31 #include "G4VProcess.hh"
32 #include "G4VTouchable.hh"
34 #include "CLHEP/Units/SystemOfUnits.h"
47 #define OBSERVES(type) \
49 Observer<const type *>
50 #define UPDATEH4(type) \
51 void update(const type *) {}
93 void update(
const G4Step *iStep)
override {
95 throw SimG4Exception(
"Number of needed trigger events reached in ECALTBH4");
97 const G4StepPoint *pre = iStep->GetPreStepPoint();
98 const G4StepPoint *post = iStep->GetPostStepPoint();
101 const G4VTouchable *touch = iStep->GetPreStepPoint()->GetTouchable();
103 if (touch->GetHistoryDepth() > 0) {
104 for (
int ii = 0;
ii <= touch->GetHistoryDepth();
ii++) {
105 std::cout <<
"EcalTBH4::Level " <<
ii <<
": " << touch->GetVolume(
ii)->GetName() <<
"["
106 << touch->GetReplicaNumber(
ii) <<
"]";
110 const G4Track *theTrack = iStep->GetTrack();
111 const G4ThreeVector &
pos = post->GetPosition();
115 const G4ThreeVector mom = theTrack->GetMomentum();
116 std::cout <<
" track length (cm) " << theTrack->GetTrackLength() / CLHEP::cm <<
" particle type "
117 << theTrack->GetDefinition()->GetParticleName() <<
" momentum "
118 <<
"( " << mom.x() <<
"," << mom.y() <<
"," << mom.z() <<
") ";
119 if (theTrack->GetCreatorProcess()) {
120 std::cout <<
" created by " << theTrack->GetCreatorProcess()->GetProcessName();
123 if (post->GetPhysicalVolume()) {
124 std::cout <<
" " << pre->GetPhysicalVolume()->GetName() <<
"->" << post->GetPhysicalVolume()->GetName();
129 if (post && post->GetPhysicalVolume()) {
130 if (!
m_passedTrg1 && post->GetPhysicalVolume()->GetName() ==
"TRG1")
132 if (!
m_passedTrg3 && post->GetPhysicalVolume()->GetName() ==
"TRG3")
134 if (!
m_passedTrg4 && post->GetPhysicalVolume()->GetName() ==
"TRG4")
136 if (!
m_passedTrg5 && post->GetPhysicalVolume()->GetName() ==
"TRG5")
138 if (!
m_passedTrg6 && post->GetPhysicalVolume()->GetName() ==
"TRG6")
140 if (post->GetPhysicalVolume()->GetName() ==
"CMSSE")