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 G4Step *) 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...
 

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::HGCalTBMB ( const edm::ParameterSet p)

Definition at line 51 of file HGCalTBMB.cc.

References edm::ParameterSet::getParameter(), create_public_lumi_plots::hist, mps_fire::i, edm::Service< T >::isAvailable(), gen::k, listNames_, TFileService::make(), me100_, me200_, me300_, dataset::name, nList_, stopName_, stopZ_, AlCaHLTBitMon_QueryRunRegistry::string, compare::tfile, and fftjetcommon_cfi::title.

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")
58  << "HGCalTBMB initialized for " << nList_ << " volumes";
59  for (unsigned int k = 0; k < nList_; ++k)
60  edm::LogVerbatim("HGCSim") << " [" << k << "] " << listNames_[k];
61  edm::LogVerbatim("HGCSim")
62  << "Stop after " << stopZ_ << " or reaching volume " << stopName_;
63 
65  if (!tfile.isAvailable())
66  throw cms::Exception("BadConfig") << "TFileService unavailable: "
67  << "please add it to config file";
68  char name[20], title[80];
69  TH1D* hist;
70  for (unsigned int i = 0; i <= nList_; i++) {
71  std::string named = (i == nList_) ? "Total" : listNames_[i];
72  sprintf(name, "RadL%d", i);
73  sprintf(title, "MB(X0) for (%s)", named.c_str());
74  hist = tfile->make<TH1D>(name, title, 1000, 0.0, 100.0);
75  hist->Sumw2(true);
76  me100_.push_back(hist);
77  sprintf(name, "IntL%d", i);
78  sprintf(title, "MB(L0) for (%s)", named.c_str());
79  hist = tfile->make<TH1D>(name, title, 1000, 0.0, 10.0);
80  hist->Sumw2(true);
81  me200_.push_back(hist);
82  sprintf(name, "StepL%d", i);
83  sprintf(title, "MB(Step) for (%s)", named.c_str());
84  hist = tfile->make<TH1D>(name, title, 1000, 0.0, 50000.0);
85  hist->Sumw2(true);
86  me300_.push_back(hist);
87  }
88  edm::LogVerbatim("HGCSim") << "HGCalTBMB: Booking user histos done ===";
89 }
T getParameter(std::string const &) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
double stopZ_
Definition: HGCalTBMB.cc:45
std::string stopName_
Definition: HGCalTBMB.cc:44
std::vector< TH1D * > me100_
Definition: HGCalTBMB.cc:48
bool isAvailable() const
Definition: Service.h:40
unsigned int nList_
Definition: HGCalTBMB.cc:46
std::vector< TH1D * > me300_
Definition: HGCalTBMB.cc:48
int k[5][pyjets_maxn]
std::vector< TH1D * > me200_
Definition: HGCalTBMB.cc:48
std::vector< std::string > listNames_
Definition: HGCalTBMB.cc:43
HGCalTBMB::~HGCalTBMB ( )
override

Definition at line 91 of file HGCalTBMB.cc.

91 {}
HGCalTBMB::HGCalTBMB ( const HGCalTBMB )
privatedelete

Member Function Documentation

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

Definition at line 172 of file HGCalTBMB.cc.

References DEFINE_SIMWATCHER, cuy::ii, gen::k, hcalDigis_cfi::level, listNames_, dataset::name, nList_, stopName_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by stopAfter(), and update().

172  {
173  int ivol = -1;
174  int level = (touch->GetHistoryDepth()) + 1;
175  for (int ii = 0; ii < level; ii++) {
176  std::string name = touch->GetVolume(ii)->GetName();
177  if (stop) {
178  if (strcmp(name.c_str(), stopName_.c_str()) == 0) ivol = 0;
179  } else {
180  for (unsigned int k = 0; k < nList_; ++k) {
181  if (strcmp(name.c_str(), listNames_[k].c_str()) == 0) {
182  ivol = k;
183  break;
184  }
185  }
186  }
187  if (ivol >= 0) break;
188  }
189  return ivol;
190 }
std::string stopName_
Definition: HGCalTBMB.cc:44
unsigned int nList_
Definition: HGCalTBMB.cc:46
ii
Definition: cuy.py:590
int k[5][pyjets_maxn]
std::vector< std::string > listNames_
Definition: HGCalTBMB.cc:43
const HGCalTBMB& HGCalTBMB::operator= ( const HGCalTBMB )
privatedelete
bool HGCalTBMB::stopAfter ( const G4Step *  aStep)
private

Definition at line 155 of file HGCalTBMB.cc.

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

Referenced by update().

155  {
156  bool flag(false);
157  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
158  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
159  if (aStep->GetPostStepPoint() != nullptr)
160  hitPoint = aStep->GetPostStepPoint()->GetPosition();
161  double zz = hitPoint.z();
162 
163  if ((findVolume(touch, true) == 0) || (zz > stopZ_)) flag = true;
164 #ifdef EDM_ML_DEBUG
165  edm::LogVerbatim("HGCSim")
166  << " HGCalTBMB::Name " << touch->GetVolume(0)->GetName() << " z " << zz
167  << " Flag" << flag;
168 #endif
169  return flag;
170 }
int findVolume(const G4VTouchable *touch, bool stop) const
Definition: HGCalTBMB.cc:172
double stopZ_
Definition: HGCalTBMB.cc:45
void HGCalTBMB::update ( const BeginOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 93 of file HGCalTBMB.cc.

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

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

93  {
94  radLen_ = std::vector<double>(nList_ + 1, 0);
95  intLen_ = std::vector<double>(nList_ + 1, 0);
96  stepLen_ = std::vector<double>(nList_ + 1, 0);
97 
98 #ifdef EDM_ML_DEBUG
99  const G4Track* aTrack = (*trk)(); // recover G4 pointer if wanted
100  const G4ThreeVector& mom = aTrack->GetMomentum();
101  double theEnergy = aTrack->GetTotalEnergy();
102  int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
103  edm::LogVerbatim("HGCSim")
104  << "MaterialBudgetHcalHistos: Track " << aTrack->GetTrackID() << " Code "
105  << theID << " Energy " << theEnergy / CLHEP::GeV << " GeV; Momentum "
106  << mom;
107 #endif
108 }
const double GeV
Definition: MathUtil.h:16
std::vector< double > intLen_
Definition: HGCalTBMB.cc:47
unsigned int nList_
Definition: HGCalTBMB.cc:46
std::vector< double > radLen_
Definition: HGCalTBMB.cc:47
std::vector< double > stepLen_
Definition: HGCalTBMB.cc:47
void HGCalTBMB::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 110 of file HGCalTBMB.cc.

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

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

110  {
111  G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
112  double step = aStep->GetStepLength();
113  double radl = material->GetRadlen();
114  double intl = material->GetNuclearInterLength();
115 
116  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
117  int indx = findVolume(touch, false);
118 
119  if (indx >= 0) {
120  stepLen_[indx] += step;
121  radLen_[indx] += (step / radl);
122  intLen_[indx] += (step / intl);
123  }
124  stepLen_[nList_] += step;
125  radLen_[nList_] += (step / radl);
126  intLen_[nList_] += (step / intl);
127 #ifdef EDM_ML_DEBUG
128  edm::LogVerbatim("HGCSim")
129  << "HGCalTBMB::Step in "
130  << touch->GetVolume(0)->GetLogicalVolume()->GetName() << " Index " << indx
131  << " Step " << step << " RadL " << step / radl << " IntL " << step / intl;
132 #endif
133 
134  if (stopAfter(aStep)) {
135  G4Track* track = aStep->GetTrack();
136  track->SetTrackStatus(fStopAndKill);
137  }
138 }
int findVolume(const G4VTouchable *touch, bool stop) const
Definition: HGCalTBMB.cc:172
bool stopAfter(const G4Step *)
Definition: HGCalTBMB.cc:155
std::vector< double > intLen_
Definition: HGCalTBMB.cc:47
unsigned int nList_
Definition: HGCalTBMB.cc:46
std::vector< double > radLen_
Definition: HGCalTBMB.cc:47
step
Definition: StallMonitor.cc:94
std::vector< double > stepLen_
Definition: HGCalTBMB.cc:47
void HGCalTBMB::update ( const EndOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack * >.

Definition at line 140 of file HGCalTBMB.cc.

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

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

140  {
141  for (unsigned int ii = 0; ii <= nList_; ++ii) {
142  me100_[ii]->Fill(radLen_[ii]);
143  me200_[ii]->Fill(intLen_[ii]);
144  me300_[ii]->Fill(stepLen_[ii]);
145 #ifdef EDM_ML_DEBUG
146  std::string name("Total");
147  if (ii < nList_) name = listNames_[ii];
148  edm::LogVerbatim("HGCSim")
149  << "HGCalTBMB::Volume[" << ii << "]: " << name << " == Step "
150  << stepLen_[ii] << " RadL " << radLen_[ii] << " IntL " << intLen_[ii];
151 #endif
152  }
153 }
std::vector< double > intLen_
Definition: HGCalTBMB.cc:47
std::vector< TH1D * > me100_
Definition: HGCalTBMB.cc:48
unsigned int nList_
Definition: HGCalTBMB.cc:46
ii
Definition: cuy.py:590
std::vector< TH1D * > me300_
Definition: HGCalTBMB.cc:48
std::vector< TH1D * > me200_
Definition: HGCalTBMB.cc:48
std::vector< double > radLen_
Definition: HGCalTBMB.cc:47
std::vector< std::string > listNames_
Definition: HGCalTBMB.cc:43
std::vector< double > stepLen_
Definition: HGCalTBMB.cc:47

Member Data Documentation

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

Definition at line 47 of file HGCalTBMB.cc.

Referenced by update().

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

Definition at line 43 of file HGCalTBMB.cc.

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

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

Definition at line 48 of file HGCalTBMB.cc.

Referenced by HGCalTBMB(), and update().

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

Definition at line 48 of file HGCalTBMB.cc.

Referenced by HGCalTBMB(), and update().

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

Definition at line 48 of file HGCalTBMB.cc.

Referenced by HGCalTBMB(), and update().

unsigned int HGCalTBMB::nList_
private

Definition at line 46 of file HGCalTBMB.cc.

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

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

Definition at line 47 of file HGCalTBMB.cc.

Referenced by update().

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

Definition at line 47 of file HGCalTBMB.cc.

Referenced by update().

std::string HGCalTBMB::stopName_
private

Definition at line 44 of file HGCalTBMB.cc.

Referenced by findVolume(), and HGCalTBMB().

double HGCalTBMB::stopZ_
private

Definition at line 45 of file HGCalTBMB.cc.

Referenced by HGCalTBMB(), and stopAfter().