1 #ifndef HelpfulWatchers_EcalTBH4Trigger_h
2 #define HelpfulWatchers_EcalTBH4Trigger_h
30 #include "G4VProcess.hh"
31 #include "G4VTouchable.hh"
44 #define OBSERVES(type) public Observer<const type*>
45 #define UPDATEH4(type) void update(const type*) { }
91 throw SimG4Exception(
"Number of needed trigger events reached in ECALTBH4");
93 const G4StepPoint* pre = iStep->GetPreStepPoint();
94 const G4StepPoint* post = iStep->GetPostStepPoint();
97 const G4VTouchable* touch = iStep->GetPreStepPoint()->GetTouchable();
99 if (touch->GetHistoryDepth() > 0) {
100 for (
int ii = 0; ii <= touch->GetHistoryDepth() ; ii++) {
102 <<
": " << touch->GetVolume(ii)->GetName() <<
"["
103 << touch->GetReplicaNumber(ii) <<
"]";
107 const G4Track* theTrack = iStep->GetTrack();
108 const G4ThreeVector
pos = post->GetPosition();
109 std::cout <<
"( "<<pos.x()<<
","<<pos.y()<<
","<<pos.z()<<
") ";
110 std::cout <<
" released energy (MeV) " << iStep->GetTotalEnergyDeposit()/MeV ;
113 const G4ThreeVector mom = theTrack->GetMomentum();
114 std::cout <<
" track length (cm) " << theTrack->GetTrackLength()/cm
115 <<
" particle type " << theTrack->GetDefinition()->GetParticleName()
116 <<
" momentum " <<
"( "<<mom.x()<<
","<<mom.y()<<
","<<mom.z()<<
") ";
117 if (theTrack->GetCreatorProcess())
118 std::cout <<
" created by " << theTrack->GetCreatorProcess()->GetProcessName();
120 if(post->GetPhysicalVolume()) {
121 std::cout <<
" " << pre->GetPhysicalVolume()->GetName() <<
"->" << post->GetPhysicalVolume()->GetName();
126 if (post && post->GetPhysicalVolume())
129 if (!
m_passedTrg1 && post->GetPhysicalVolume()->GetName() ==
"TRG1")
131 if (!
m_passedTrg3 && post->GetPhysicalVolume()->GetName() ==
"TRG3")
133 if (!
m_passedTrg4 && post->GetPhysicalVolume()->GetName() ==
"TRG4")
135 if (!
m_passedTrg5 && post->GetPhysicalVolume()->GetName() ==
"TRG5")
137 if (!
m_passedTrg6 && post->GetPhysicalVolume()->GetName() ==
"TRG6")
139 if (post->GetPhysicalVolume()->GetName() ==
"CMSSE")
void update(const BeginOfEvent *anEvent)
This routine will be called when the appropriate signal arrives.
void update(const EndOfEvent *anEvent)
This routine will be called when the appropriate signal arrives.
void update(const G4Step *iStep)
This routine will be called when the appropriate signal arrives.
EcalTBH4Trigger(const edm::ParameterSet &pSet)