CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCalTBMB Class Reference
Inheritance diagram for HGCalTBMB:
SimWatcher Observer< const BeginOfTrack * > Observer< const G4Step * > Observer< const EndOfTrack * >

Public Member Functions

 HGCalTBMB (const edm::ParameterSet &)
 
 ~HGCalTBMB () override
 
- Public Member Functions inherited from SimWatcher
 SimWatcher ()
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack * 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 EndOfTrack * >
 Observer ()
 
void slotForUpdate (const EndOfTrack * iT)
 
virtual ~Observer ()
 

Private Member Functions

int findVolume (const G4VTouchable *touch, bool stop) const
 
 HGCalTBMB (const HGCalTBMB &)=delete
 
const HGCalTBMBoperator= (const HGCalTBMB &)=delete
 
bool stopAfter (const G4Step *)
 
void update (const BeginOfTrack *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfTrack *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *) override
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

std::vector< double > intLen_
 
std::vector< std::string > listNames_
 
std::vector< TH1D * > me100_
 
std::vector< TH1D * > me200_
 
std::vector< TH1D * > me300_
 
unsigned int nList_
 
std::vector< double > radLen_
 
std::vector< double > stepLen_
 
std::string stopName_
 
double stopZ_
 

Additional Inherited Members

Detailed Description

Definition at line 24 of file HGCalTBMB.cc.

Constructor & Destructor Documentation

◆ HGCalTBMB() [1/2]

HGCalTBMB::HGCalTBMB ( const edm::ParameterSet p)

Definition at line 51 of file HGCalTBMB.cc.

51  {
52  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("HGCalTBMB");
53  listNames_ = m_p.getParameter<std::vector<std::string> >("DetectorNames");
54  stopName_ = m_p.getParameter<std::string>("StopName");
55  stopZ_ = m_p.getParameter<double>("MaximumZ");
56  nList_ = listNames_.size();
57  edm::LogVerbatim("HGCSim") << "HGCalTBMB initialized for " << nList_ << " volumes";
58  for (unsigned int k = 0; k < nList_; ++k)
59  edm::LogVerbatim("HGCSim") << " [" << k << "] " << listNames_[k];
60  edm::LogVerbatim("HGCSim") << "Stop after " << stopZ_ << " or reaching volume " << stopName_;
61 
63  if (!tfile.isAvailable())
64  throw cms::Exception("BadConfig") << "TFileService unavailable: "
65  << "please add it to config file";
66  char name[20], title[80];
67  TH1D* hist;
68  for (unsigned int i = 0; i <= nList_; i++) {
69  std::string named = (i == nList_) ? "Total" : listNames_[i];
70  sprintf(name, "RadL%d", i);
71  sprintf(title, "MB(X0) for (%s)", named.c_str());
72  hist = tfile->make<TH1D>(name, title, 100000, 0.0, 100.0);
73  hist->Sumw2(true);
74  me100_.push_back(hist);
75  sprintf(name, "IntL%d", i);
76  sprintf(title, "MB(L0) for (%s)", named.c_str());
77  hist = tfile->make<TH1D>(name, title, 100000, 0.0, 10.0);
78  hist->Sumw2(true);
79  me200_.push_back(hist);
80  sprintf(name, "StepL%d", i);
81  sprintf(title, "MB(Step) for (%s)", named.c_str());
82  hist = tfile->make<TH1D>(name, title, 100000, 0.0, 50000.0);
83  hist->Sumw2(true);
84  me300_.push_back(hist);
85  }
86  edm::LogVerbatim("HGCSim") << "HGCalTBMB: Booking user histos done ===";
87 }

References edm::ParameterSet::getParameter(), compare::hist, mps_fire::i, dqmdumpme::k, listNames_, me100_, me200_, me300_, Skims_PA_cff::name, nList_, AlCaHLTBitMon_ParallelJobs::p, stopName_, stopZ_, AlCaHLTBitMon_QueryRunRegistry::string, compare::tfile, and runGCPTkAlMap::title.

◆ ~HGCalTBMB()

HGCalTBMB::~HGCalTBMB ( )
override

Definition at line 89 of file HGCalTBMB.cc.

89 {}

◆ HGCalTBMB() [2/2]

HGCalTBMB::HGCalTBMB ( const HGCalTBMB )
privatedelete

Member Function Documentation

◆ findVolume()

int HGCalTBMB::findVolume ( const G4VTouchable *  touch,
bool  stop 
) const
private

Definition at line 165 of file HGCalTBMB.cc.

165  {
166  int ivol = -1;
167  int level = (touch->GetHistoryDepth()) + 1;
168  for (int ii = 0; ii < level; ii++) {
169  std::string name = touch->GetVolume(ii)->GetName();
170  if (stop) {
171  if (strcmp(name.c_str(), stopName_.c_str()) == 0)
172  ivol = 0;
173  } else {
174  for (unsigned int k = 0; k < nList_; ++k) {
175  if (strcmp(name.c_str(), listNames_[k].c_str()) == 0) {
176  ivol = k;
177  break;
178  }
179  }
180  }
181  if (ivol >= 0)
182  break;
183  }
184  return ivol;
185 }

References cuy::ii, dqmdumpme::k, personalPlayback::level, listNames_, Skims_PA_cff::name, nList_, stopName_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by stopAfter(), and update().

◆ operator=()

const HGCalTBMB& HGCalTBMB::operator= ( const HGCalTBMB )
privatedelete

◆ stopAfter()

bool HGCalTBMB::stopAfter ( const G4Step *  aStep)
private

Definition at line 149 of file HGCalTBMB.cc.

149  {
150  bool flag(false);
151  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
152  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
153  if (aStep->GetPostStepPoint() != nullptr)
154  hitPoint = aStep->GetPostStepPoint()->GetPosition();
155  double zz = hitPoint.z();
156 
157  if ((findVolume(touch, true) == 0) || (zz > stopZ_))
158  flag = true;
159 #ifdef EDM_ML_DEBUG
160  edm::LogVerbatim("HGCSim") << " HGCalTBMB::Name " << touch->GetVolume(0)->GetName() << " z " << zz << " Flag" << flag;
161 #endif
162  return flag;
163 }

References findVolume(), RemoveAddSevLevel::flag, stopZ_, and geometryCSVtoXML::zz.

Referenced by update().

◆ update() [1/3]

void HGCalTBMB::update ( const BeginOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 91 of file HGCalTBMB.cc.

91  {
92  radLen_ = std::vector<double>(nList_ + 1, 0);
93  intLen_ = std::vector<double>(nList_ + 1, 0);
94  stepLen_ = std::vector<double>(nList_ + 1, 0);
95 
96 #ifdef EDM_ML_DEBUG
97  const G4Track* aTrack = (*trk)(); // recover G4 pointer if wanted
98  const G4ThreeVector& mom = aTrack->GetMomentum();
99  double theEnergy = aTrack->GetTotalEnergy();
100  int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
101  edm::LogVerbatim("HGCSim") << "MaterialBudgetHcalHistos: Track " << aTrack->GetTrackID() << " Code " << theID
102  << " Energy " << theEnergy / CLHEP::GeV << " GeV; Momentum " << mom;
103 #endif
104 }

References GeV, createfilelist::int, intLen_, nList_, radLen_, and stepLen_.

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

◆ update() [2/3]

void HGCalTBMB::update ( const EndOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack * >.

Definition at line 134 of file HGCalTBMB.cc.

134  {
135  for (unsigned int ii = 0; ii <= nList_; ++ii) {
136  me100_[ii]->Fill(radLen_[ii]);
137  me200_[ii]->Fill(intLen_[ii]);
138  me300_[ii]->Fill(stepLen_[ii]);
139 #ifdef EDM_ML_DEBUG
140  std::string name("Total");
141  if (ii < nList_)
142  name = listNames_[ii];
143  edm::LogVerbatim("HGCSim") << "HGCalTBMB::Volume[" << ii << "]: " << name << " == Step " << stepLen_[ii] << " RadL "
144  << radLen_[ii] << " IntL " << intLen_[ii];
145 #endif
146  }
147 }

References cuy::ii, intLen_, listNames_, me100_, me200_, me300_, Skims_PA_cff::name, nList_, radLen_, stepLen_, and AlCaHLTBitMon_QueryRunRegistry::string.

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

◆ update() [3/3]

void HGCalTBMB::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 106 of file HGCalTBMB.cc.

106  {
107  G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
108  double step = aStep->GetStepLength();
109  double radl = material->GetRadlen();
110  double intl = material->GetNuclearInterLength();
111 
112  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
113  int indx = findVolume(touch, false);
114 
115  if (indx >= 0) {
116  stepLen_[indx] += step;
117  radLen_[indx] += (step / radl);
118  intLen_[indx] += (step / intl);
119  }
120  stepLen_[nList_] += step;
121  radLen_[nList_] += (step / radl);
122  intLen_[nList_] += (step / intl);
123 #ifdef EDM_ML_DEBUG
124  edm::LogVerbatim("HGCSim") << "HGCalTBMB::Step in " << touch->GetVolume(0)->GetLogicalVolume()->GetName() << " Index "
125  << indx << " Step " << step << " RadL " << step / radl << " IntL " << step / intl;
126 #endif
127 
128  if (stopAfter(aStep)) {
129  G4Track* track = aStep->GetTrack();
130  track->SetTrackStatus(fStopAndKill);
131  }
132 }

References findVolume(), intLen_, nList_, radLen_, stepLen_, stopAfter(), and HLT_FULL_cff::track.

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

Member Data Documentation

◆ intLen_

std::vector<double> HGCalTBMB::intLen_
private

Definition at line 47 of file HGCalTBMB.cc.

Referenced by update().

◆ listNames_

std::vector<std::string> HGCalTBMB::listNames_
private

Definition at line 43 of file HGCalTBMB.cc.

Referenced by findVolume(), HGCalTBMB(), and update().

◆ me100_

std::vector<TH1D*> HGCalTBMB::me100_
private

Definition at line 48 of file HGCalTBMB.cc.

Referenced by HGCalTBMB(), and update().

◆ me200_

std::vector<TH1D*> HGCalTBMB::me200_
private

Definition at line 48 of file HGCalTBMB.cc.

Referenced by HGCalTBMB(), and update().

◆ me300_

std::vector<TH1D*> HGCalTBMB::me300_
private

Definition at line 48 of file HGCalTBMB.cc.

Referenced by HGCalTBMB(), and update().

◆ nList_

unsigned int HGCalTBMB::nList_
private

Definition at line 46 of file HGCalTBMB.cc.

Referenced by findVolume(), HGCalTBMB(), and update().

◆ radLen_

std::vector<double> HGCalTBMB::radLen_
private

Definition at line 47 of file HGCalTBMB.cc.

Referenced by update().

◆ stepLen_

std::vector<double> HGCalTBMB::stepLen_
private

Definition at line 47 of file HGCalTBMB.cc.

Referenced by update().

◆ stopName_

std::string HGCalTBMB::stopName_
private

Definition at line 44 of file HGCalTBMB.cc.

Referenced by findVolume(), and HGCalTBMB().

◆ stopZ_

double HGCalTBMB::stopZ_
private

Definition at line 45 of file HGCalTBMB.cc.

Referenced by HGCalTBMB(), and stopAfter().

personalPlayback.level
level
Definition: personalPlayback.py:22
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
HGCalTBMB::listNames_
std::vector< std::string > listNames_
Definition: HGCalTBMB.cc:43
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11776
HGCalTBMB::stepLen_
std::vector< double > stepLen_
Definition: HGCalTBMB.cc:47
step
step
Definition: StallMonitor.cc:94
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HGCalTBMB::me100_
std::vector< TH1D * > me100_
Definition: HGCalTBMB.cc:48
compare.hist
hist
Definition: compare.py:376
tfile
Definition: tfile.py:1
HGCalTBMB::nList_
unsigned int nList_
Definition: HGCalTBMB.cc:46
HGCalTBMB::stopZ_
double stopZ_
Definition: HGCalTBMB.cc:45
HGCalTBMB::me200_
std::vector< TH1D * > me200_
Definition: HGCalTBMB.cc:48
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
HGCalTBMB::radLen_
std::vector< double > radLen_
Definition: HGCalTBMB.cc:47
GeV
const double GeV
Definition: MathUtil.h:16
edm::Service< TFileService >
createfilelist.int
int
Definition: createfilelist.py:10
HGCalTBMB::intLen_
std::vector< double > intLen_
Definition: HGCalTBMB.cc:47
HGCalTBMB::stopName_
std::string stopName_
Definition: HGCalTBMB.cc:44
compare.tfile
tfile
Definition: compare.py:325
HGCalTBMB::me300_
std::vector< TH1D * > me300_
Definition: HGCalTBMB.cc:48
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGCalTBMB::findVolume
int findVolume(const G4VTouchable *touch, bool stop) const
Definition: HGCalTBMB.cc:165
cms::Exception
Definition: Exception.h:70
edm::Log
Definition: MessageLogger.h:70
HGCalTBMB::stopAfter
bool stopAfter(const G4Step *)
Definition: HGCalTBMB.cc:149
cuy.ii
ii
Definition: cuy.py:590
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116