CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalTBH4Trigger Class Reference
Inheritance diagram for EcalTBH4Trigger:
SimWatcher Observer< const BeginOfEvent *> Observer< const G4Step *> Observer< const EndOfEvent *>

Public Member Functions

 EcalTBH4Trigger (const edm::ParameterSet &pSet)
 
void update (const BeginOfEvent *anEvent) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *iStep) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfEvent *anEvent) override
 This routine will be called when the appropriate signal arrives. More...
 
- Public Member Functions inherited from SimWatcher
virtual void beginRun (edm::EventSetup const &)
 
bool isMT () const
 
const SimWatcheroperator= (const SimWatcher &)=delete
 
virtual void registerConsumes (edm::ConsumesCollector)
 
 SimWatcher ()
 
 SimWatcher (const SimWatcher &)=delete
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent *>
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const G4Step *>
 Observer ()
 
void slotForUpdate (const G4Step * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent *>
 Observer ()
 
void slotForUpdate (const EndOfEvent * iT)
 
virtual ~Observer ()
 

Private Attributes

bool m_passedTrg1
 
bool m_passedTrg3
 
bool m_passedTrg4
 
bool m_passedTrg5
 
bool m_passedTrg6
 
bool m_verbose
 
int nTriggeredEvents_
 
int trigEvents_
 

Additional Inherited Members

- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

Detailed Description

SimG4Core/HelpfulWatchers/interface/EcalTBH4Trigger.h

Description: Simulates ECALTBH4 trigger an throw exception in case of non triggering event

Usage: <usage>

Definition at line 40 of file EcalTBH4Trigger.cc.

Constructor & Destructor Documentation

◆ EcalTBH4Trigger()

EcalTBH4Trigger::EcalTBH4Trigger ( const edm::ParameterSet pSet)
inline

Definition at line 45 of file EcalTBH4Trigger.cc.

46  : m_verbose(pSet.getUntrackedParameter<bool>("verbose", false)),
48  trigEvents_(pSet.getUntrackedParameter<int>("trigEvents", -1)) {}
T getUntrackedParameter(std::string const &, T const &) const

Member Function Documentation

◆ update() [1/3]

void EcalTBH4Trigger::update ( const BeginOfEvent )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent *>.

Definition at line 72 of file EcalTBH4Trigger.cc.

References m_passedTrg1, m_passedTrg3, m_passedTrg4, m_passedTrg5, and m_passedTrg6.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

72  {
73  m_passedTrg1 = false;
74  m_passedTrg3 = false;
75  m_passedTrg4 = false;
76  m_passedTrg5 = false;
77  m_passedTrg6 = false;
78 }

◆ update() [2/3]

void EcalTBH4Trigger::update ( const G4Step *  )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step *>.

Definition at line 80 of file EcalTBH4Trigger.cc.

References cuy::ii, m_passedTrg1, m_passedTrg3, m_passedTrg4, m_passedTrg5, m_passedTrg6, m_verbose, nTriggeredEvents_, findAndChange::post, findAndChange::pre, and trigEvents_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

80  {
82  throw SimG4Exception("Number of needed trigger events reached in ECALTBH4");
83 
84  const G4StepPoint *pre = iStep->GetPreStepPoint();
85  const G4StepPoint *post = iStep->GetPostStepPoint();
86  if (m_verbose) {
87  std::ostringstream st1;
88  st1 << "++ signal G4Step";
89  const G4VTouchable *touch = iStep->GetPreStepPoint()->GetTouchable();
90  // Get name and copy numbers
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)
94  << "]";
95  }
96  }
97  edm::LogVerbatim("EcalTBInfo") << st1.str();
98 
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;
104  if (theTrack) {
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();
111  }
112  }
113  if (post->GetPhysicalVolume()) {
114  st2 << " " << pre->GetPhysicalVolume()->GetName() << "->" << post->GetPhysicalVolume()->GetName();
115  }
116  edm::LogVerbatim("EcalTBInfo") << st2.str();
117  }
118 
119  if (post && post->GetPhysicalVolume()) {
120  if (!m_passedTrg1 && post->GetPhysicalVolume()->GetName() == "TRG1")
121  m_passedTrg1 = true;
122  if (!m_passedTrg3 && post->GetPhysicalVolume()->GetName() == "TRG3")
123  m_passedTrg3 = true;
124  if (!m_passedTrg4 && post->GetPhysicalVolume()->GetName() == "TRG4")
125  m_passedTrg4 = true;
126  if (!m_passedTrg5 && post->GetPhysicalVolume()->GetName() == "TRG5")
127  m_passedTrg5 = true;
128  if (!m_passedTrg6 && post->GetPhysicalVolume()->GetName() == "TRG6")
129  m_passedTrg6 = true;
130  if (post->GetPhysicalVolume()->GetName() == "CMSSE") // Exiting TBH4BeamLine
131  if (!(m_passedTrg1 && m_passedTrg6)) // Trigger defined as Trg4 && Trg6
132  throw SimG4Exception("Event is not triggered by ECALTBH4");
133  }
134 
135  /* if (!m_enteringTBH4BeamLine && ( post->GetPhysicalVolume()->GetName()
136  * == */
137 }
Log< level::Info, true > LogVerbatim
ii
Definition: cuy.py:589

◆ update() [3/3]

void EcalTBH4Trigger::update ( const EndOfEvent )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent *>.

Definition at line 139 of file EcalTBH4Trigger.cc.

References nTriggeredEvents_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

139  {
140  edm::LogVerbatim("EcalTBInfo") << "++ signal BeginOfEvent ";
142 }
Log< level::Info, true > LogVerbatim

Member Data Documentation

◆ m_passedTrg1

bool EcalTBH4Trigger::m_passedTrg1
private

Definition at line 63 of file EcalTBH4Trigger.cc.

Referenced by update().

◆ m_passedTrg3

bool EcalTBH4Trigger::m_passedTrg3
private

Definition at line 64 of file EcalTBH4Trigger.cc.

Referenced by update().

◆ m_passedTrg4

bool EcalTBH4Trigger::m_passedTrg4
private

Definition at line 65 of file EcalTBH4Trigger.cc.

Referenced by update().

◆ m_passedTrg5

bool EcalTBH4Trigger::m_passedTrg5
private

Definition at line 66 of file EcalTBH4Trigger.cc.

Referenced by update().

◆ m_passedTrg6

bool EcalTBH4Trigger::m_passedTrg6
private

Definition at line 67 of file EcalTBH4Trigger.cc.

Referenced by update().

◆ m_verbose

bool EcalTBH4Trigger::m_verbose
private

Definition at line 62 of file EcalTBH4Trigger.cc.

Referenced by update().

◆ nTriggeredEvents_

int EcalTBH4Trigger::nTriggeredEvents_
private

Definition at line 68 of file EcalTBH4Trigger.cc.

Referenced by update().

◆ trigEvents_

int EcalTBH4Trigger::trigEvents_
private

Definition at line 69 of file EcalTBH4Trigger.cc.

Referenced by update().