CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
MaterialBudgetHcalProducer Class Reference
Inheritance diagram for MaterialBudgetHcalProducer:
SimProducer Observer< const BeginOfJob * > Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const G4Step * > Observer< const EndOfTrack * > SimWatcher

Public Member Functions

 MaterialBudgetHcalProducer (const edm::ParameterSet &)
 
 MaterialBudgetHcalProducer (const MaterialBudgetHcalProducer &)=delete
 
const MaterialBudgetHcalProduceroperator= (const MaterialBudgetHcalProducer &)=delete
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~MaterialBudgetHcalProducer () override=default
 
- Public Member Functions inherited from SimProducer
const SimProduceroperator= (const SimProducer &)=delete
 
void registerProducts (edm::ProducesCollector producesCollector)
 
 SimProducer ()
 
 SimProducer (const SimProducer &)=delete
 
- 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 BeginOfJob * >
 Observer ()
 
void slotForUpdate (const BeginOfJob *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent *iT)
 
virtual ~Observer ()
 
- 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

std::vector< double > getDDDArray (const std::string &str, const DDsvalues_type &sv)
 
std::vector< std::string > getNames (DDFilteredView &fv)
 
std::vector< std::string > getNames (cms::DDFilteredView &fv)
 
bool isItEC (const std::string &)
 
bool isItHF (const G4VTouchable *)
 
bool isSensitive (const std::string &)
 
bool stopAfter (const G4Step *)
 
void update (const BeginOfJob *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
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

double eta_
 
double etaMaxP_
 
double etaMinP_
 
bool fromdd4hep_
 
std::vector< int > hfLevels_
 
std::vector< std::string > hfNames_
 
int id_
 
double intLen_
 
std::vector< double > intLength_
 
double intLens_ [maxSet_]
 
int layer_
 
MaterialAccountingCaloCollection matcoll_
 
std::vector< std::string > matList_
 
std::string name_
 
int nlayHB_
 
int nlayHE_
 
int nlayHF_
 
int nlayHO_
 
double phi_
 
bool printSum_
 
double radLen_
 
std::vector< double > radLength_
 
double radLens_ [maxSet_]
 
double rMax_
 
std::vector< std::string > sensitiveEC_
 
std::vector< std::string > sensitives_
 
double stepLen_
 
std::vector< double > stepLength_
 
double stepLens_ [maxSet_]
 
int steps_
 
double zMax_
 

Static Private Attributes

static const int maxSet2_ = 9
 
static const int maxSet_ = 25
 

Additional Inherited Members

- Protected Member Functions inherited from SimProducer
template<class T >
void produces ()
 
template<class T >
void produces (const std::string &instanceName)
 
- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

Detailed Description

Definition at line 44 of file MaterialBudgetHcalProducer.cc.

Constructor & Destructor Documentation

MaterialBudgetHcalProducer::MaterialBudgetHcalProducer ( const edm::ParameterSet p)

Definition at line 90 of file MaterialBudgetHcalProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), visualization-live-secondInstance_cfg::m, and AlCaHLTBitMon_QueryRunRegistry::string.

90  {
91  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("MaterialBudgetHcalProducer");
92  rMax_ = m_p.getUntrackedParameter<double>("RMax", 4.5) * CLHEP::m;
93  zMax_ = m_p.getUntrackedParameter<double>("ZMax", 13.0) * CLHEP::m;
94  etaMinP_ = m_p.getUntrackedParameter<double>("EtaMinP", 5.2);
95  etaMaxP_ = m_p.getUntrackedParameter<double>("EtaMaxP", 0.0);
96  fromdd4hep_ = m_p.getUntrackedParameter<bool>("Fromdd4hep", false);
97  printSum_ = m_p.getUntrackedParameter<bool>("PrintSummary", false);
98  name_ = m_p.getUntrackedParameter<std::string>("Name", "Hcal");
99  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalProducer initialized with rMax " << rMax_ << " mm and zMax "
100  << zMax_ << " mm printSummary is set to " << printSum_ << " and Fromdd4hep to "
101  << fromdd4hep_;
102 
103  produces<MaterialAccountingCaloCollection>(Form("%sMatBCalo", name_.c_str()));
104 }
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MaterialBudgetHcalProducer::~MaterialBudgetHcalProducer ( )
overridedefault
MaterialBudgetHcalProducer::MaterialBudgetHcalProducer ( const MaterialBudgetHcalProducer )
delete

Member Function Documentation

std::vector< double > MaterialBudgetHcalProducer::getDDDArray ( const std::string &  str,
const DDsvalues_type sv 
)
private

Definition at line 450 of file MaterialBudgetHcalProducer.cc.

References DDfetch(), DDValue::doubles(), Exception, str, and relativeConstraints::value.

450  {
451  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalProducer:getDDDArray called for " << str;
452  DDValue value(str);
453  if (DDfetch(&sv, value)) {
454  edm::LogVerbatim("MaterialBudgetFull") << value;
455  const std::vector<double>& fvec = value.doubles();
456  int nval = fvec.size();
457  if (nval < 1) {
458  throw cms::Exception("MaterialBudgetHcalProducer") << "nval = " << nval << " < 1 for array " << str << "\n";
459  }
460 
461  return fvec;
462  } else {
463  throw cms::Exception("MaterialBudgetHcalProducer") << "cannot get array " << str << "\n";
464  }
465 }
Log< level::Info, true > LogVerbatim
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
#define str(s)
std::vector< std::string > MaterialBudgetHcalProducer::getNames ( DDFilteredView fv)
private

Definition at line 421 of file MaterialBudgetHcalProducer.cc.

References spr::find(), DDFilteredView::firstChild(), log, DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), DDFilteredView::next(), AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

421  {
422  std::vector<std::string> tmp;
423  bool dodet = fv.firstChild();
424  while (dodet) {
425  const DDLogicalPart& log = fv.logicalPart();
426  std::string namx = log.name().name();
427  if (std::find(tmp.begin(), tmp.end(), namx) == tmp.end())
428  tmp.push_back(namx);
429  dodet = fv.next();
430  }
431  return tmp;
432 }
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
static std::vector< std::string > checklist log
const N & name() const
Definition: DDBase.h:59
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
bool next()
set current node to the next node in the filtered tree
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
bool firstChild()
set the current node to the first child ...
tmp
align.sh
Definition: createJobs.py:716
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
std::vector< std::string > MaterialBudgetHcalProducer::getNames ( cms::DDFilteredView fv)
private

Definition at line 434 of file MaterialBudgetHcalProducer.cc.

References spr::find(), cms::DDFilteredView::firstChild(), dqmiodumpmetadata::n, cms::DDFilteredView::name(), AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

434  {
435  std::vector<std::string> tmp;
436  const std::vector<std::string> notIn = {
437  "CALO", "HCal", "MBBTL", "MBBTR", "MBBTC", "MBAT", "MBBT_R1M", "MBBT_R1P", "MBBT_R1MX", "MBBT_R1PX", "VCAL"};
438  while (fv.firstChild()) {
439  const std::string n{fv.name().data(), fv.name().size()};
440  if (std::find(notIn.begin(), notIn.end(), n) == notIn.end()) {
441  std::string::size_type pos = n.find(':');
442  const std::string namx = (pos == std::string::npos) ? n : std::string(n, pos + 1, n.size() - 1);
443  if (std::find(tmp.begin(), tmp.end(), namx) == tmp.end())
444  tmp.push_back(namx);
445  }
446  }
447  return tmp;
448 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
uint16_t size_type
std::string_view name() const
bool firstChild()
set the current node to the first child
tmp
align.sh
Definition: createJobs.py:716
bool MaterialBudgetHcalProducer::isItEC ( const std::string &  name)
private

Definition at line 492 of file MaterialBudgetHcalProducer.cc.

492  {
493  std::vector<std::string>::const_iterator it = sensitiveEC_.begin();
494  std::vector<std::string>::const_iterator itEnd = sensitiveEC_.end();
495  for (; it != itEnd; ++it)
496  if (name.substr(0, 4) == *it)
497  return true;
498  return false;
499 }
std::vector< std::string > sensitiveEC_
bool MaterialBudgetHcalProducer::isItHF ( const G4VTouchable *  touch)
private

Definition at line 477 of file MaterialBudgetHcalProducer.cc.

References jetCorrFactors_cfi::levels, mergeVDriftHistosByStation::name, and AlCaHLTBitMon_QueryRunRegistry::string.

477  {
478  int levels = ((touch->GetHistoryDepth()) + 1);
479  for (unsigned int it = 0; it < hfNames_.size(); it++) {
480  if (levels >= hfLevels_[it]) {
481  std::string name =
482  (static_cast<std::string>(dd4hep::dd::noNamespace(touch->GetVolume(levels - hfLevels_[it])->GetName())))
483  .substr(0, 4);
484  if (name == hfNames_[it]) {
485  return true;
486  }
487  }
488  }
489  return false;
490 }
std::vector< std::string > hfNames_
bool MaterialBudgetHcalProducer::isSensitive ( const std::string &  name)
private

Definition at line 467 of file MaterialBudgetHcalProducer.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

467  {
468  std::vector<std::string>::const_iterator it = sensitives_.begin();
469  std::vector<std::string>::const_iterator itEnd = sensitives_.end();
470  std::string namx = (name.find('_') == std::string::npos) ? name : name.substr(0, name.find('_'));
471  for (; it != itEnd; ++it)
472  if (namx == *it)
473  return true;
474  return false;
475 }
std::vector< std::string > sensitives_
const MaterialBudgetHcalProducer& MaterialBudgetHcalProducer::operator= ( const MaterialBudgetHcalProducer )
delete
void MaterialBudgetHcalProducer::produce ( edm::Event e,
const edm::EventSetup  
)
overridevirtual

Implements SimProducer.

Definition at line 106 of file MaterialBudgetHcalProducer.cc.

References eostools::move(), and edm::Event::put().

106  {
107  std::unique_ptr<MaterialAccountingCaloCollection> hgc(new MaterialAccountingCaloCollection);
108  for (auto const& mbc : matcoll_) {
109  hgc->emplace_back(mbc);
110  }
111  e.put(std::move(hgc), Form("%sMatBCalo", name_.c_str()));
112 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< MaterialAccountingCalo > MaterialAccountingCaloCollection
def move
Definition: eostools.py:511
MaterialAccountingCaloCollection matcoll_
bool MaterialBudgetHcalProducer::stopAfter ( const G4Step *  aStep)
private

Definition at line 408 of file MaterialBudgetHcalProducer.cc.

References funct::abs(), and findQualityFiles::rr.

408  {
409  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
410  double rr = hitPoint.perp();
411  double zz = std::abs(hitPoint.z());
412 
413  if (rr > rMax_ || zz > zMax_) {
414  edm::LogVerbatim("MaterialBudget") << " MaterialBudgetHcalProducer::StopAfter R = " << rr << " and Z = " << zz;
415  return true;
416  } else {
417  return false;
418  }
419 }
Log< level::Info, true > LogVerbatim
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void MaterialBudgetHcalProducer::update ( const BeginOfJob )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob * >.

Definition at line 114 of file MaterialBudgetHcalProducer.cc.

References alcazmumu_cfi::filter, spr::find(), DDFilteredView::firstChild(), cms::DDFilteredView::get(), MsgTools::getNames(), mps_fire::i, isotrackApplyRegressor::k, testEve_cfg::level, DDFilteredView::mergedSpecifics(), mergeVDriftHistosByStation::name, names, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, and relativeConstraints::value.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

114  {
115  //----- Check that selected volumes are indeed part of the geometry
116  // Numbering From DDD
117  if (fromdd4hep_) {
119  (*job)()->get<IdealGeometryRecord>().get(pDD);
120  const cms::DDCompactView cpv = *pDD;
121  constexpr int32_t addLevel = 1;
122  std::string attribute = "ReadOutName";
123  std::string value = "HcalHits";
124  const cms::DDFilter filter1(attribute, value);
125  cms::DDFilteredView fv1(cpv, filter1);
126  std::vector<std::string> names = getNames(fv1);
127  for (auto& name : names) {
128  std::string namx = (name.find('_') == std::string::npos) ? name : name.substr(0, name.find('_'));
129  if (std::find(sensitives_.begin(), sensitives_.end(), namx) == sensitives_.end())
130  sensitives_.emplace_back(namx);
131  }
132  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalProducer: Names to be tested for " << attribute
133  << " = " << value << " has " << sensitives_.size() << " elements";
134  for (unsigned int i = 0; i < sensitives_.size(); i++)
135  edm::LogVerbatim("MaterialBudgetFull")
136  << "MaterialBudgetHcalProducer: sensitives[" << i << "] = " << sensitives_[i];
137  attribute = "Volume";
138  value = "HF";
139  const cms::DDFilter filter2(attribute, value);
140  cms::DDFilteredView fv2(cpv, filter2);
141  std::vector<int> temp = fv2.get<std::vector<int> >("hf", "Levels");
142  hfNames_ = getNames(fv2);
143  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalProducer: Names to be tested for " << attribute
144  << " = " << value << " has " << hfNames_.size() << " elements";
145  for (unsigned int i = 0; i < hfNames_.size(); i++) {
146  hfLevels_.push_back(temp[i] + addLevel);
147  edm::LogVerbatim("MaterialBudgetFull")
148  << "MaterialBudgetHcalProducer: HF[" << i << "] = " << hfNames_[i] << " at level " << hfLevels_[i];
149  }
150 
151  const std::string ecalRO[2] = {"EcalHitsEB", "EcalHitsEE"};
152  attribute = "ReadOutName";
153  for (int k = 0; k < 2; k++) {
154  value = ecalRO[k];
155  const cms::DDFilter filter(attribute, value);
156  cms::DDFilteredView fv(cpv, filter);
157  std::vector<std::string> senstmp = getNames(fv);
158  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalProducer: Names to be tested for " << attribute
159  << " = " << value << " has " << senstmp.size() << " elements";
160  for (unsigned int i = 0; i < senstmp.size(); i++) {
161  std::string name = senstmp[i].substr(0, 4);
162  if (std::find(sensitiveEC_.begin(), sensitiveEC_.end(), name) == sensitiveEC_.end())
163  sensitiveEC_.push_back(name);
164  }
165  }
166  for (unsigned int i = 0; i < sensitiveEC_.size(); i++)
167  edm::LogVerbatim("MaterialBudgetFull")
168  << "MaterialBudgetHcalProducer:sensitiveEC[" << i << "] = " << sensitiveEC_[i];
169  } else { // if not from dd4hep --> ddd
171  (*job)()->get<IdealGeometryRecord>().get(pDD);
172  const DDCompactView& cpv = *pDD;
173  constexpr int32_t addLevel = 0;
174  std::string attribute = "ReadOutName";
175  std::string value = "HcalHits";
176  DDSpecificsMatchesValueFilter filter1{DDValue(attribute, value, 0)};
177  DDFilteredView fv1(cpv, filter1);
178  std::vector<std::string> names = getNames(fv1);
179  for (auto& name : names) {
180  std::string namx = (name.find('_') == std::string::npos) ? name : name.substr(0, name.find('_'));
181  if (std::find(sensitives_.begin(), sensitives_.end(), namx) == sensitives_.end())
182  sensitives_.emplace_back(namx);
183  }
184  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalProducer: Names to be tested for " << attribute
185  << " = " << value << " has " << sensitives_.size() << " elements";
186  for (unsigned int i = 0; i < sensitives_.size(); i++)
187  edm::LogVerbatim("MaterialBudgetFull")
188  << "MaterialBudgetHcalProducer: sensitives[" << i << "] = " << sensitives_[i];
189  attribute = "Volume";
190  value = "HF";
191  DDSpecificsMatchesValueFilter filter2{DDValue(attribute, value, 0)};
192  DDFilteredView fv2(cpv, filter2);
193  hfNames_ = getNames(fv2);
194  fv2.firstChild();
195  DDsvalues_type sv(fv2.mergedSpecifics());
196  std::vector<double> temp = getDDDArray("Levels", sv);
197  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalProducer: Names to be tested for " << attribute
198  << " = " << value << " has " << hfNames_.size() << " elements";
199  for (unsigned int i = 0; i < hfNames_.size(); i++) {
200  int level = static_cast<int>(temp[i]);
201  hfLevels_.push_back(level + addLevel);
202  edm::LogVerbatim("MaterialBudgetFull")
203  << "MaterialBudgetHcalProducer: HF[" << i << "] = " << hfNames_[i] << " at level " << hfLevels_[i];
204  }
205 
206  const std::string ecalRO[2] = {"EcalHitsEB", "EcalHitsEE"};
207  attribute = "ReadOutName";
208  for (int k = 0; k < 2; k++) {
209  value = ecalRO[k];
210  DDSpecificsMatchesValueFilter filter3{DDValue(attribute, value, 0)};
211  DDFilteredView fv3(cpv, filter3);
212  std::vector<std::string> senstmp = getNames(fv3);
213  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalProducer: Names to be tested for " << attribute
214  << " = " << value << " has " << senstmp.size() << " elements";
215  for (unsigned int i = 0; i < senstmp.size(); i++) {
216  std::string name = senstmp[i].substr(0, 4);
217  if (std::find(sensitiveEC_.begin(), sensitiveEC_.end(), name) == sensitiveEC_.end())
218  sensitiveEC_.push_back(name);
219  }
220  }
221  for (unsigned int i = 0; i < sensitiveEC_.size(); i++)
222  edm::LogVerbatim("MaterialBudgetFull")
223  << "MaterialBudgetHcalProducer:sensitiveEC[" << i << "] = " << sensitiveEC_[i];
224  }
225 }
Log< level::Info, true > LogVerbatim
std::vector< std::string > sensitiveEC_
std::vector< std::string > hfNames_
std::vector< double > getDDDArray(const std::string &str, const DDsvalues_type &sv)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
const std::string names[nVars_]
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< std::string > sensitives_
tuple level
Definition: testEve_cfg.py:47
std::vector< std::string > getNames(DDFilteredView &fv)
void MaterialBudgetHcalProducer::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 227 of file MaterialBudgetHcalProducer.cc.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

227 { matcoll_.clear(); }
MaterialAccountingCaloCollection matcoll_
void MaterialBudgetHcalProducer::update ( const BeginOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 229 of file MaterialBudgetHcalProducer.cc.

References DeadROC_duringRun::dir, mps_fire::i, and sistrip::layer_.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

229  {
230  const G4Track* aTrack = (*trk)(); // recover G4 pointer if wanted
231 
232  id_ = layer_ = steps_ = 0;
233  radLen_ = intLen_ = stepLen_ = 0;
234  nlayHB_ = nlayHE_ = nlayHF_ = nlayHO_ = 0;
235  for (int i = 0; i < maxSet_; ++i)
236  stepLens_[i] = radLens_[i] = intLens_[i] = 0;
237 
238  const G4ThreeVector& dir = aTrack->GetMomentum();
239  if (dir.theta() != 0) {
240  eta_ = dir.eta();
241  } else {
242  eta_ = -99;
243  }
244  phi_ = dir.phi();
245  edm::LogVerbatim("MaterialBudget") << "Start track with (eta, phi) = (" << eta_ << ", " << phi_ << " Energy "
246  << aTrack->GetTotalEnergy() << " and ID "
247  << (aTrack->GetDefinition()->GetPDGEncoding());
248 
249  if (printSum_) {
250  matList_.clear();
251  stepLength_.clear();
252  radLength_.clear();
253  intLength_.clear();
254  }
255 }
Log< level::Info, true > LogVerbatim
std::vector< std::string > matList_
void MaterialBudgetHcalProducer::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 257 of file MaterialBudgetHcalProducer.cc.

References funct::abs(), angle_units::operators::convertRadToDeg(), geant_units::operators::convertUnitsTo(), newFWLiteAna::found, cuy::ii, sistrip::layer_, mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, and HLT_FULL_cff::track.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

257  {
258  //---------- each step
259  G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
260  double step = aStep->GetStepLength();
261  double radl = material->GetRadlen();
262  double intl = material->GetNuclearInterLength();
263  double density = convertUnitsTo(1._g_per_cm3, material->GetDensity());
264 
265  int idOld = id_;
266  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
267  std::string name = (static_cast<std::string>(dd4hep::dd::noNamespace(touch->GetVolume(0)->GetName())));
268  std::string matName = (static_cast<std::string>(dd4hep::dd::noNamespace(material->GetName())));
269  if (printSum_) {
270  bool found = false;
271  for (unsigned int ii = 0; ii < matList_.size(); ii++) {
272  if (matList_[ii] == matName) {
273  stepLength_[ii] += step;
274  radLength_[ii] += (step / radl);
275  intLength_[ii] += (step / intl);
276  found = true;
277  break;
278  }
279  }
280  if (!found) {
281  matList_.push_back(matName);
282  stepLength_.push_back(step);
283  radLength_.push_back(step / radl);
284  intLength_.push_back(step / intl);
285  }
286  if ((std::abs(eta_) >= etaMinP_) && (std::abs(eta_) <= etaMaxP_))
287  edm::LogVerbatim("MaterialBudget") << "Volume " << name << " id " << id_ << ":" << idOld << " Step " << step
288  << " Material " << matName << " Old Length " << stepLen_ << " X0 "
289  << step / radl << ":" << radLen_ << " Lambda " << step / intl << ":"
290  << intLen_;
291  } else {
292  if ((std::abs(eta_) >= etaMinP_) && (std::abs(eta_) <= etaMaxP_))
293  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalProducer: Step at " << name << " id " << id_ << ":"
294  << idOld << " Length " << step << " in " << matName << " of density "
295  << density << " g/cc; Radiation Length " << radl << " mm; Interaction Length "
296  << intl << " mm\n Position "
297  << aStep->GetPreStepPoint()->GetPosition() << " Cylindrical R "
298  << aStep->GetPreStepPoint()->GetPosition().perp() << " Length (so far) "
299  << stepLen_ << " L/X0 " << step / radl << "/" << radLen_ << " L/Lambda "
300  << step / intl << "/" << intLen_;
301  }
302 
303  int det = 0, lay = 0;
304  double abseta = std::abs(eta_);
305  edm::LogVerbatim("MaterialBudgetFull") << "Volume " << name << ":" << matName << " EC:Sensitive:HF " << isItEC(name)
306  << ":" << isSensitive(name) << ":" << isItHF(touch) << " Eta " << abseta
307  << " HC " << ((touch->GetReplicaNumber(1)) / 1000) << ":"
308  << ((touch->GetReplicaNumber(0) / 10) % 100 + 3) << " X0 "
309  << (radLen_ + (step / radl)) << " Lambda " << (intLen_ + (step / intl));
310 
311  if (isItEC(name)) {
312  det = 1;
313  lay = 1;
314  } else {
315  if (isSensitive(name)) {
316  if (isItHF(touch)) {
317  det = 5;
318  lay = 21;
319  if (lay != layer_)
320  ++nlayHF_;
321  } else {
322  det = (touch->GetReplicaNumber(1)) / 1000;
323  lay = (touch->GetReplicaNumber(0) / 10) % 100 + 3;
324  if (det == 4) {
325  if (abseta < 1.479)
326  lay = layer_ + 1;
327  else
328  lay--;
329  if (lay < 3)
330  lay = 3;
331  if (lay == layer_)
332  lay++;
333  if (lay > 20)
334  lay = 20;
335  if (lay != layer_)
336  ++nlayHE_;
337  } else if (lay != layer_) {
338  if (lay >= 20)
339  ++nlayHO_;
340  else
341  ++nlayHB_;
342  }
343  }
344  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalProducer: Det " << det << " Layer " << lay << " Eta "
345  << eta_ << " Phi " << convertRadToDeg(phi_);
346  } else if (layer_ == 1) {
347  det = -1;
348  lay = 2;
349  }
350  }
351  if (det != 0) {
352  if (lay != layer_) {
353  id_ = lay;
354  layer_ = lay;
355  }
356  }
357 
358  if (id_ > idOld) {
359  if ((abseta >= etaMinP_) && (abseta <= etaMaxP_))
360  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalProducer: Step at " << name << " calls filHisto with "
361  << (id_ - 1);
362  stepLens_[id_ - 1] = stepLen_;
363  radLens_[id_ - 1] = radLen_;
364  intLens_[id_ - 1] = intLen_;
365  }
366 
367  stepLen_ += step;
368  radLen_ += (step / radl);
369  intLen_ += (step / intl);
370  if (id_ == 21) {
371  if (!isItHF(aStep->GetPostStepPoint()->GetTouchable())) {
372  if ((abseta >= etaMinP_) && (abseta <= etaMaxP_))
373  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalProducer: After HF in " << name << ":"
374  << static_cast<std::string>(dd4hep::dd::noNamespace(
375  aStep->GetPostStepPoint()->GetTouchable()->GetVolume(0)->GetName()))
376  << " calls fillHisto with " << id_;
377  stepLens_[idOld] = stepLen_;
378  radLens_[idOld] = radLen_;
379  intLens_[idOld] = intLen_;
380  ++id_;
381  layer_ = 0;
382  }
383  }
384 
385  //----- Stop tracking after selected position
386  if (stopAfter(aStep)) {
387  G4Track* track = aStep->GetTrack();
388  track->SetTrackStatus(fStopAndKill);
389  }
390 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
bool isSensitive(const std::string &)
int ii
Definition: cuy.py:589
constexpr NumType convertUnitsTo(double desiredUnits, NumType val)
Definition: GeantUnits.h:100
bool isItHF(const G4VTouchable *)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::string > matList_
step
Definition: StallMonitor.cc:94
void MaterialBudgetHcalProducer::update ( const EndOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack * >.

Definition at line 392 of file MaterialBudgetHcalProducer.cc.

References isotrackApplyRegressor::k, MaterialAccountingCalo::m_eta, MaterialAccountingCalo::m_intLen, MaterialAccountingCalo::m_layers, MaterialAccountingCalo::m_phi, MaterialAccountingCalo::m_radLen, and MaterialAccountingCalo::m_stepLen.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

392  {
393  MaterialAccountingCalo matCalo;
394  matCalo.m_eta = eta_;
395  matCalo.m_phi = phi_;
396  for (int k = 0; k < maxSet_; ++k) {
397  matCalo.m_stepLen.emplace_back(stepLens_[k]);
398  matCalo.m_radLen.emplace_back(radLens_[k]);
399  matCalo.m_intLen.emplace_back(intLens_[k]);
400  }
401  matCalo.m_layers.emplace_back(nlayHB_);
402  matCalo.m_layers.emplace_back(nlayHE_);
403  matCalo.m_layers.emplace_back(nlayHO_);
404  matCalo.m_layers.emplace_back(nlayHF_);
405  matcoll_.emplace_back(matCalo);
406 }
std::vector< double > m_radLen
MaterialAccountingCaloCollection matcoll_
std::vector< double > m_intLen
std::vector< double > m_stepLen

Member Data Documentation

double MaterialBudgetHcalProducer::eta_
private

Definition at line 86 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::etaMaxP_
private

Definition at line 75 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::etaMinP_
private

Definition at line 75 of file MaterialBudgetHcalProducer.cc.

bool MaterialBudgetHcalProducer::fromdd4hep_
private

Definition at line 76 of file MaterialBudgetHcalProducer.cc.

std::vector<int> MaterialBudgetHcalProducer::hfLevels_
private

Definition at line 79 of file MaterialBudgetHcalProducer.cc.

std::vector<std::string> MaterialBudgetHcalProducer::hfNames_
private

Definition at line 78 of file MaterialBudgetHcalProducer.cc.

int MaterialBudgetHcalProducer::id_
private

Definition at line 84 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::intLen_
private

Definition at line 85 of file MaterialBudgetHcalProducer.cc.

std::vector<double> MaterialBudgetHcalProducer::intLength_
private

Definition at line 83 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::intLens_[maxSet_]
private

Definition at line 81 of file MaterialBudgetHcalProducer.cc.

int MaterialBudgetHcalProducer::layer_
private

Definition at line 84 of file MaterialBudgetHcalProducer.cc.

MaterialAccountingCaloCollection MaterialBudgetHcalProducer::matcoll_
private

Definition at line 80 of file MaterialBudgetHcalProducer.cc.

std::vector<std::string> MaterialBudgetHcalProducer::matList_
private

Definition at line 82 of file MaterialBudgetHcalProducer.cc.

const int MaterialBudgetHcalProducer::maxSet2_ = 9
staticprivate

Definition at line 74 of file MaterialBudgetHcalProducer.cc.

const int MaterialBudgetHcalProducer::maxSet_ = 25
staticprivate

Definition at line 74 of file MaterialBudgetHcalProducer.cc.

std::string MaterialBudgetHcalProducer::name_
private

Definition at line 77 of file MaterialBudgetHcalProducer.cc.

int MaterialBudgetHcalProducer::nlayHB_
private

Definition at line 87 of file MaterialBudgetHcalProducer.cc.

int MaterialBudgetHcalProducer::nlayHE_
private

Definition at line 87 of file MaterialBudgetHcalProducer.cc.

int MaterialBudgetHcalProducer::nlayHF_
private

Definition at line 87 of file MaterialBudgetHcalProducer.cc.

int MaterialBudgetHcalProducer::nlayHO_
private

Definition at line 87 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::phi_
private

Definition at line 86 of file MaterialBudgetHcalProducer.cc.

bool MaterialBudgetHcalProducer::printSum_
private

Definition at line 76 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::radLen_
private

Definition at line 85 of file MaterialBudgetHcalProducer.cc.

std::vector<double> MaterialBudgetHcalProducer::radLength_
private

Definition at line 83 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::radLens_[maxSet_]
private

Definition at line 81 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::rMax_
private

Definition at line 75 of file MaterialBudgetHcalProducer.cc.

std::vector<std::string> MaterialBudgetHcalProducer::sensitiveEC_
private

Definition at line 78 of file MaterialBudgetHcalProducer.cc.

std::vector<std::string> MaterialBudgetHcalProducer::sensitives_
private

Definition at line 78 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::stepLen_
private

Definition at line 85 of file MaterialBudgetHcalProducer.cc.

std::vector<double> MaterialBudgetHcalProducer::stepLength_
private

Definition at line 83 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::stepLens_[maxSet_]
private

Definition at line 81 of file MaterialBudgetHcalProducer.cc.

int MaterialBudgetHcalProducer::steps_
private

Definition at line 84 of file MaterialBudgetHcalProducer.cc.

double MaterialBudgetHcalProducer::zMax_
private

Definition at line 75 of file MaterialBudgetHcalProducer.cc.