35 #include "G4VProcess.hh" 36 #include "G4VTouchable.hh" 38 #include <CLHEP/Units/SystemOfUnits.h> 41 public Observer<const BeginOfEvent *>,
43 public Observer<const EndOfEvent *> {
57 void update(
const G4Step *iStep)
override;
82 throw SimG4Exception(
"Number of needed trigger events reached in ECALTBH4");
84 const G4StepPoint *
pre = iStep->GetPreStepPoint();
85 const G4StepPoint *
post = iStep->GetPostStepPoint();
87 std::ostringstream st1;
88 st1 <<
"++ signal G4Step";
89 const G4VTouchable *touch = iStep->GetPreStepPoint()->GetTouchable();
91 if (touch->GetHistoryDepth() > 0) {
92 for (
int ii = 0;
ii <= touch->GetHistoryDepth();
ii++) {
93 st1 <<
"EcalTBH4::Level " <<
ii <<
": " << touch->GetVolume(
ii)->GetName() <<
"[" << touch->GetReplicaNumber(
ii)
99 std::ostringstream st2;
100 const G4Track *theTrack = iStep->GetTrack();
101 const G4ThreeVector &
pos =
post->GetPosition();
102 st2 <<
"( " <<
pos.x() <<
"," <<
pos.y() <<
"," <<
pos.z() <<
") ";
103 st2 <<
" released energy (MeV) " << iStep->GetTotalEnergyDeposit() / CLHEP::MeV;
105 const G4ThreeVector mom = theTrack->GetMomentum();
106 st2 <<
" track length (cm) " << theTrack->GetTrackLength() / CLHEP::cm <<
" particle type " 107 << theTrack->GetDefinition()->GetParticleName() <<
" momentum " 108 <<
"( " << mom.x() <<
"," << mom.y() <<
"," << mom.z() <<
") ";
109 if (theTrack->GetCreatorProcess()) {
110 st2 <<
" created by " << theTrack->GetCreatorProcess()->GetProcessName();
113 if (
post->GetPhysicalVolume()) {
114 st2 <<
" " <<
pre->GetPhysicalVolume()->GetName() <<
"->" <<
post->GetPhysicalVolume()->GetName();
119 if (
post &&
post->GetPhysicalVolume()) {
130 if (
post->GetPhysicalVolume()->GetName() ==
"CMSSE")
Log< level::Info, true > LogVerbatim
#define DEFINE_SIMWATCHER(type)
void update(const BeginOfEvent *anEvent) override
This routine will be called when the appropriate signal arrives.
EcalTBH4Trigger(const edm::ParameterSet &pSet)