CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalTBH4Trigger Class Reference

#include <EcalTBH4Trigger.h>

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 EndOfEvent *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...
 
- Public Member Functions inherited from SimWatcher
 SimWatcher ()
 
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

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 52 of file EcalTBH4Trigger.h.

Constructor & Destructor Documentation

◆ EcalTBH4Trigger()

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

Definition at line 65 of file EcalTBH4Trigger.h.

66  : m_verbose(pSet.getUntrackedParameter<bool>("verbose", false)),
68  trigEvents_(pSet.getUntrackedParameter<int>("trigEvents", -1)) {}

Member Function Documentation

◆ update() [1/3]

void EcalTBH4Trigger::update ( const BeginOfEvent )
inlineoverridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 80 of file EcalTBH4Trigger.h.

80  {
81  // std::cout <<"++ signal BeginOfEvent " ;
82  // m_enteringTBH4BeamLine=false;
83  // m_exitingTBH4BeamLine=false;
84  // m_passedTrigger=false;
85  m_passedTrg1 = false;
86  m_passedTrg3 = false;
87  m_passedTrg4 = false;
88  m_passedTrg5 = false;
89  m_passedTrg6 = false;
90  }

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().

◆ update() [2/3]

void EcalTBH4Trigger::update ( const EndOfEvent )
inlineoverridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent * >.

Definition at line 151 of file EcalTBH4Trigger.h.

151  {
152  // std::cout <<"++ signal BeginOfEvent " ;
153  // m_enteringTBH4BeamLine=false;
154  // m_exitingTBH4BeamLine=false;
155  // m_passedTrigger=false;
157  }

References nTriggeredEvents_.

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

◆ update() [3/3]

void EcalTBH4Trigger::update ( const G4Step *  )
inlineoverridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 93 of file EcalTBH4Trigger.h.

93  {
95  throw SimG4Exception("Number of needed trigger events reached in ECALTBH4");
96 
97  const G4StepPoint *pre = iStep->GetPreStepPoint();
98  const G4StepPoint *post = iStep->GetPostStepPoint();
99  if (m_verbose) {
100  std::cout << "++ signal G4Step";
101  const G4VTouchable *touch = iStep->GetPreStepPoint()->GetTouchable();
102  // Get name and copy numbers
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) << "]";
107  }
108  }
109  std::cout << std::endl;
110  const G4Track *theTrack = iStep->GetTrack();
111  const G4ThreeVector &pos = post->GetPosition();
112  std::cout << "( " << pos.x() << "," << pos.y() << "," << pos.z() << ") ";
113  std::cout << " released energy (MeV) " << iStep->GetTotalEnergyDeposit() / CLHEP::MeV;
114  if (theTrack) {
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();
121  }
122  }
123  if (post->GetPhysicalVolume()) {
124  std::cout << " " << pre->GetPhysicalVolume()->GetName() << "->" << post->GetPhysicalVolume()->GetName();
125  }
126  std::cout << std::endl;
127  }
128 
129  if (post && post->GetPhysicalVolume()) {
130  if (!m_passedTrg1 && post->GetPhysicalVolume()->GetName() == "TRG1")
131  m_passedTrg1 = true;
132  if (!m_passedTrg3 && post->GetPhysicalVolume()->GetName() == "TRG3")
133  m_passedTrg3 = true;
134  if (!m_passedTrg4 && post->GetPhysicalVolume()->GetName() == "TRG4")
135  m_passedTrg4 = true;
136  if (!m_passedTrg5 && post->GetPhysicalVolume()->GetName() == "TRG5")
137  m_passedTrg5 = true;
138  if (!m_passedTrg6 && post->GetPhysicalVolume()->GetName() == "TRG6")
139  m_passedTrg6 = true;
140  if (post->GetPhysicalVolume()->GetName() == "CMSSE") // Exiting TBH4BeamLine
141  if (!(m_passedTrg1 && m_passedTrg6)) // Trigger defined as Trg4 && Trg6
142  throw SimG4Exception("Event is not triggered by ECALTBH4");
143  }
144 
145  /* if (!m_enteringTBH4BeamLine && ( post->GetPhysicalVolume()->GetName()
146  * == */
147  }

References gather_cfg::cout, cuy::ii, m_passedTrg1, m_passedTrg3, m_passedTrg4, m_passedTrg5, m_passedTrg6, m_verbose, MeV, nTriggeredEvents_, and trigEvents_.

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

Member Data Documentation

◆ m_passedTrg1

bool EcalTBH4Trigger::m_passedTrg1
private

Definition at line 169 of file EcalTBH4Trigger.h.

Referenced by update().

◆ m_passedTrg3

bool EcalTBH4Trigger::m_passedTrg3
private

Definition at line 170 of file EcalTBH4Trigger.h.

Referenced by update().

◆ m_passedTrg4

bool EcalTBH4Trigger::m_passedTrg4
private

Definition at line 171 of file EcalTBH4Trigger.h.

Referenced by update().

◆ m_passedTrg5

bool EcalTBH4Trigger::m_passedTrg5
private

Definition at line 172 of file EcalTBH4Trigger.h.

Referenced by update().

◆ m_passedTrg6

bool EcalTBH4Trigger::m_passedTrg6
private

Definition at line 173 of file EcalTBH4Trigger.h.

Referenced by update().

◆ m_verbose

bool EcalTBH4Trigger::m_verbose
private

Definition at line 166 of file EcalTBH4Trigger.h.

Referenced by update().

◆ nTriggeredEvents_

int EcalTBH4Trigger::nTriggeredEvents_
private

Definition at line 174 of file EcalTBH4Trigger.h.

Referenced by update().

◆ trigEvents_

int EcalTBH4Trigger::trigEvents_
private

Definition at line 175 of file EcalTBH4Trigger.h.

Referenced by update().

EcalTBH4Trigger::m_passedTrg6
bool m_passedTrg6
Definition: EcalTBH4Trigger.h:173
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
SimG4Exception
Definition: SimG4Exception.h:13
MeV
const double MeV
EcalTBH4Trigger::m_verbose
bool m_verbose
Definition: EcalTBH4Trigger.h:166
EcalTBH4Trigger::m_passedTrg1
bool m_passedTrg1
Definition: EcalTBH4Trigger.h:169
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EcalTBH4Trigger::trigEvents_
int trigEvents_
Definition: EcalTBH4Trigger.h:175
cuy.ii
ii
Definition: cuy.py:590
EcalTBH4Trigger::m_passedTrg3
bool m_passedTrg3
Definition: EcalTBH4Trigger.h:170
EcalTBH4Trigger::m_passedTrg5
bool m_passedTrg5
Definition: EcalTBH4Trigger.h:172
EcalTBH4Trigger::m_passedTrg4
bool m_passedTrg4
Definition: EcalTBH4Trigger.h:171
EcalTBH4Trigger::nTriggeredEvents_
int nTriggeredEvents_
Definition: EcalTBH4Trigger.h:174