1 #ifndef HelpfulWatchers_EcalTBH4Trigger_h 2 #define HelpfulWatchers_EcalTBH4Trigger_h 29 #include "G4VProcess.hh" 30 #include "G4VTouchable.hh" 32 #include "CLHEP/Units/SystemOfUnits.h" 45 #define OBSERVES(type) public Observer<const type*> 46 #define UPDATEH4(type) void update(const type*) { } 89 void update(
const G4Step* iStep)
override 92 throw SimG4Exception(
"Number of needed trigger events reached in ECALTBH4");
94 const G4StepPoint* pre = iStep->GetPreStepPoint();
95 const G4StepPoint* post = iStep->GetPostStepPoint();
98 const G4VTouchable* touch = iStep->GetPreStepPoint()->GetTouchable();
100 if (touch->GetHistoryDepth() > 0) {
101 for (
int ii = 0;
ii <= touch->GetHistoryDepth() ;
ii++) {
103 <<
": " << touch->GetVolume(
ii)->GetName() <<
"[" 104 << touch->GetReplicaNumber(
ii) <<
"]";
108 const G4Track* theTrack = iStep->GetTrack();
109 const G4ThreeVector&
pos = post->GetPosition();
110 std::cout <<
"( "<<pos.x()<<
","<<pos.y()<<
","<<pos.z()<<
") ";
112 << iStep->GetTotalEnergyDeposit()/
CLHEP::MeV ;
115 const G4ThreeVector mom = theTrack->GetMomentum();
116 std::cout <<
" track length (cm) " << theTrack->GetTrackLength()/CLHEP::cm
117 <<
" particle type " << theTrack->GetDefinition()->GetParticleName()
118 <<
" momentum " <<
"( "<<mom.x()<<
","<<mom.y()<<
","<<mom.z()<<
") ";
119 if (theTrack->GetCreatorProcess()) {
121 << theTrack->GetCreatorProcess()->GetProcessName();
124 if(post->GetPhysicalVolume()) {
125 std::cout <<
" " << pre->GetPhysicalVolume()->GetName()
126 <<
"->" << post->GetPhysicalVolume()->GetName();
131 if (post && post->GetPhysicalVolume())
134 if (!
m_passedTrg1 && post->GetPhysicalVolume()->GetName() ==
"TRG1")
136 if (!
m_passedTrg3 && post->GetPhysicalVolume()->GetName() ==
"TRG3")
138 if (!
m_passedTrg4 && post->GetPhysicalVolume()->GetName() ==
"TRG4")
140 if (!
m_passedTrg5 && post->GetPhysicalVolume()->GetName() ==
"TRG5")
142 if (!
m_passedTrg6 && post->GetPhysicalVolume()->GetName() ==
"TRG6")
144 if (post->GetPhysicalVolume()->GetName() ==
"CMSSE")
void update(const BeginOfEvent *anEvent) override
This routine will be called when the appropriate signal arrives.
EcalTBH4Trigger(const edm::ParameterSet &pSet)
void update(const EndOfEvent *anEvent) override
This routine will be called when the appropriate signal arrives.
void update(const G4Step *iStep) override
This routine will be called when the appropriate signal arrives.