CMS 3D CMS Logo

MaterialBudgetHcalHistos.cc
Go to the documentation of this file.
2 
12 
13 #include "DD4hep/Filter.h"
14 
15 #include <string>
16 #include <vector>
17 
18 using namespace geant_units::operators;
19 
21  binEta_ = p.getUntrackedParameter<int>("NBinEta", 260);
22  binPhi_ = p.getUntrackedParameter<int>("NBinPhi", 180);
23  maxEta_ = p.getUntrackedParameter<double>("MaxEta", 5.2);
24  etaLow_ = p.getUntrackedParameter<double>("EtaLow", -5.2);
25  etaHigh_ = p.getUntrackedParameter<double>("EtaHigh", 5.2);
26  fillHistos_ = p.getUntrackedParameter<bool>("FillHisto", true);
27  printSum_ = p.getUntrackedParameter<bool>("PrintSummary", false);
28  etaMinP_ = p.getUntrackedParameter<double>("EtaMinP", 5.2);
29  etaMaxP_ = p.getUntrackedParameter<double>("EtaMaxP", 0.0);
30  etaLowMin_ = p.getUntrackedParameter<double>("EtaLowMin", 0.783);
31  etaLowMax_ = p.getUntrackedParameter<double>("EtaLowMax", 0.870);
32  etaMidMin_ = p.getUntrackedParameter<double>("EtaMidMin", 2.650);
33  etaMidMax_ = p.getUntrackedParameter<double>("EtaMidMax", 2.868);
34  etaHighMin_ = p.getUntrackedParameter<double>("EtaHighMin", 2.868);
35  etaHighMax_ = p.getUntrackedParameter<double>("EtaHighMax", 3.000);
36  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalHistos: FillHisto : " << fillHistos_ << " PrintSummary "
37  << printSum_ << " == Eta plot: NX " << binEta_ << " Range " << -maxEta_ << ":"
38  << maxEta_ << " Phi plot: NX " << binPhi_ << " Range " << -1._pi << ":" << 1._pi
39  << " (Eta limit " << etaLow_ << ":" << etaHigh_ << ")"
40  << " Eta range (" << etaLowMin_ << ":" << etaLowMax_ << "), (" << etaMidMin_ << ":"
41  << etaMidMax_ << "), (" << etaHighMin_ << ":" << etaHighMax_
42  << ") Debug for eta range " << etaMinP_ << ":" << etaMaxP_;
43  if (fillHistos_)
44  book();
45 }
46 
48  constexpr int32_t addLevel = 0;
49  if (fillHistos_) {
50  std::string attribute = "ReadOutName";
51  std::string value = "HcalHits";
52  DDSpecificsMatchesValueFilter filter1{DDValue(attribute, value, 0)};
53  DDFilteredView fv1(cpv, filter1);
54  sensitives_ = getNames(fv1);
55  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Names to be tested for " << attribute << " = "
56  << value << " has " << sensitives_.size() << " elements";
57  for (unsigned int i = 0; i < sensitives_.size(); i++)
58  edm::LogVerbatim("MaterialBudgetFull")
59  << "MaterialBudgetHcalHistos: sensitives[" << i << "] = " << sensitives_[i];
60  attribute = "Volume";
61  value = "HF";
62  DDSpecificsMatchesValueFilter filter2{DDValue(attribute, value, 0)};
63  DDFilteredView fv2(cpv, filter2);
64  hfNames_ = getNames(fv2);
65  fv2.firstChild();
67  std::vector<double> temp = getDDDArray("Levels", sv);
68  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Names to be tested for " << attribute << " = "
69  << value << " has " << hfNames_.size() << " elements";
70  for (unsigned int i = 0; i < hfNames_.size(); i++) {
71  int level = static_cast<int>(temp[i]);
72  hfLevels_.push_back(level + addLevel);
73  edm::LogVerbatim("MaterialBudgetFull")
74  << "MaterialBudgetHcalHistos: HF[" << i << "] = " << hfNames_[i] << " at level " << hfLevels_[i];
75  }
76 
77  const std::string ecalRO[2] = {"EcalHitsEB", "EcalHitsEE"};
78  attribute = "ReadOutName";
79  for (int k = 0; k < 2; k++) {
80  value = ecalRO[k];
81  DDSpecificsMatchesValueFilter filter3{DDValue(attribute, value, 0)};
82  DDFilteredView fv3(cpv, filter3);
83  std::vector<std::string> senstmp = getNames(fv3);
84  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Names to be tested for " << attribute
85  << " = " << value << " has " << senstmp.size() << " elements";
86  for (unsigned int i = 0; i < senstmp.size(); i++)
87  sensitiveEC_.push_back(senstmp[i]);
88  }
89  for (unsigned int i = 0; i < sensitiveEC_.size(); i++)
90  edm::LogVerbatim("MaterialBudgetFull")
91  << "MaterialBudgetHcalHistos:sensitiveEC[" << i << "] = " << sensitiveEC_[i];
92  }
93 }
94 
96  constexpr int32_t addLevel = 1;
97  if (fillHistos_) {
98  std::string attribute = "ReadOutName";
99  std::string value = "HcalHits";
100  const cms::DDFilter filter1(attribute, value);
101  cms::DDFilteredView fv1(cpv, filter1);
102  sensitives_ = getNames(fv1);
103  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Names to be tested for " << attribute << " = "
104  << value << " has " << sensitives_.size() << " elements";
105  for (unsigned int i = 0; i < sensitives_.size(); i++)
106  edm::LogVerbatim("MaterialBudgetFull")
107  << "MaterialBudgetHcalHistos: sensitives[" << i << "] = " << sensitives_[i];
108  attribute = "Volume";
109  value = "HF";
110  const cms::DDFilter filter2(attribute, value);
111  cms::DDFilteredView fv2(cpv, filter2);
112  std::vector<int> temp = fv2.get<std::vector<int> >("hf", "Levels");
113  hfNames_ = getNames(fv2);
114  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Names to be tested for " << attribute << " = "
115  << value << " has " << hfNames_.size() << " elements";
116  for (unsigned int i = 0; i < hfNames_.size(); i++) {
117  hfLevels_.push_back(temp[i] + addLevel);
118  edm::LogVerbatim("MaterialBudgetFull")
119  << "MaterialBudgetHcalHistos: HF[" << i << "] = " << hfNames_[i] << " at level " << hfLevels_[i];
120  }
121 
122  const std::string ecalRO[2] = {"EcalHitsEB", "EcalHitsEE"};
123  attribute = "ReadOutName";
124  for (int k = 0; k < 2; k++) {
125  value = ecalRO[k];
126  const cms::DDFilter filter(attribute, value);
127  cms::DDFilteredView fv(cpv, filter);
128  std::vector<std::string> senstmp = getNames(fv);
129  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Names to be tested for " << attribute
130  << " = " << value << " has " << senstmp.size() << " elements";
131  for (unsigned int i = 0; i < senstmp.size(); i++)
132  sensitiveEC_.push_back(senstmp[i]);
133  }
134  for (unsigned int i = 0; i < sensitiveEC_.size(); i++)
135  edm::LogVerbatim("MaterialBudgetFull")
136  << "MaterialBudgetHcalHistos:sensitiveEC[" << i << "] = " << sensitiveEC_[i];
137  }
138 }
139 
140 void MaterialBudgetHcalHistos::fillStartTrack(const G4Track* aTrack) {
141  id_ = layer_ = steps_ = 0;
142  radLen_ = intLen_ = stepLen_ = 0;
143  nlayHB_ = nlayHE_ = nlayHF_ = nlayHO_ = 0;
144 
145  const G4ThreeVector& dir = aTrack->GetMomentum();
146  if (dir.theta() != 0) {
147  eta_ = dir.eta();
148  } else {
149  eta_ = -99;
150  }
151  phi_ = dir.phi();
152  double theEnergy = aTrack->GetTotalEnergy();
153  int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
154 
155  if (printSum_) {
156  matList_.clear();
157  stepLength_.clear();
158  radLength_.clear();
159  intLength_.clear();
160  }
161 
162  if ((std::abs(eta_) >= etaMinP_) && (std::abs(eta_) <= etaMaxP_))
163  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalHistos: Track " << aTrack->GetTrackID() << " Code "
164  << theID << " Energy " << convertUnitsTo(1._GeV, theEnergy) << " GeV; Eta "
165  << eta_ << " Phi " << convertRadToDeg(phi_) << " PT "
166  << convertUnitsTo(1._GeV, dir.perp()) << " GeV *****";
167 }
168 
169 void MaterialBudgetHcalHistos::fillPerStep(const G4Step* aStep) {
170  G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
171  double step = aStep->GetStepLength();
172  double radl = material->GetRadlen();
173  double intl = material->GetNuclearInterLength();
174  double density = convertUnitsTo(1._g_per_cm3, material->GetDensity());
175 
176  int idOld = id_;
177  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
178  std::string name = (static_cast<std::string>(dd4hep::dd::noNamespace(touch->GetVolume(0)->GetName())));
179  std::string matName = (static_cast<std::string>(dd4hep::dd::noNamespace(material->GetName())));
180  if (printSum_) {
181  bool found = false;
182  for (unsigned int ii = 0; ii < matList_.size(); ii++) {
183  if (matList_[ii] == matName) {
184  stepLength_[ii] += step;
185  radLength_[ii] += (step / radl);
186  intLength_[ii] += (step / intl);
187  found = true;
188  break;
189  }
190  }
191  if (!found) {
192  matList_.push_back(matName);
193  stepLength_.push_back(step);
194  radLength_.push_back(step / radl);
195  intLength_.push_back(step / intl);
196  }
197  if ((std::abs(eta_) >= etaMinP_) && (std::abs(eta_) <= etaMaxP_))
198  edm::LogVerbatim("MaterialBudget") << "Volume " << name << " id " << id_ << ":" << idOld << " Step " << step
199  << " Material " << matName << " Old Length " << stepLen_ << " X0 "
200  << step / radl << ":" << radLen_ << " Lambda " << step / intl << ":"
201  << intLen_;
202  } else {
203  if ((std::abs(eta_) >= etaMinP_) && (std::abs(eta_) <= etaMaxP_))
204  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalHistos: Step at " << name << " id " << id_ << ":"
205  << idOld << " Length " << step << " in " << matName << " of density "
206  << density << " g/cc; Radiation Length " << radl << " mm; Interaction Length "
207  << intl << " mm\n Position "
208  << aStep->GetPreStepPoint()->GetPosition() << " Cylindrical R "
209  << aStep->GetPreStepPoint()->GetPosition().perp() << " Length (so far) "
210  << stepLen_ << " L/X0 " << step / radl << "/" << radLen_ << " L/Lambda "
211  << step / intl << "/" << intLen_;
212  }
213 
214  int det = 0, lay = 0;
215  double abseta = std::abs(eta_);
216  if (fillHistos_) {
217  if (isItEC(name)) {
218  det = 1;
219  lay = 1;
220  } else {
221  if (isSensitive(name)) {
222  if (isItHF(touch)) {
223  det = 5;
224  lay = 21;
225  if (lay != layer_)
226  ++nlayHF_;
227  } else {
228  det = (touch->GetReplicaNumber(1)) / 1000;
229  lay = (touch->GetReplicaNumber(0) / 10) % 100 + 3;
230  if (det == 4) {
231  if (abseta < 1.479)
232  lay = layer_ + 1;
233  else
234  lay--;
235  if (lay < 3)
236  lay = 3;
237  if (lay == layer_)
238  lay++;
239  if (lay > 20)
240  lay = 20;
241  if (lay != layer_)
242  ++nlayHE_;
243  } else if (lay != layer_) {
244  if (lay >= 20)
245  ++nlayHO_;
246  else
247  ++nlayHB_;
248  }
249  }
250  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Det " << det << " Layer " << lay << " Eta "
251  << eta_ << " Phi " << convertRadToDeg(phi_);
252  } else if (layer_ == 1) {
253  det = -1;
254  lay = 2;
255  }
256  }
257  if (det != 0) {
258  if (lay != layer_) {
259  id_ = lay;
260  layer_ = lay;
261  }
262  }
263 
264  if (id_ > idOld) {
265  if ((abseta >= etaMinP_) && (abseta <= etaMaxP_))
266  edm::LogVerbatim("MaterialBudget")
267  << "MaterialBudgetHcalHistos: Step at " << name << " calls filHisto with " << (id_ - 1);
268  fillHisto(id_ - 1);
269  }
270  }
271 
272  stepLen_ += step;
273  radLen_ += (step / radl);
274  intLen_ += (step / intl);
275  if (fillHistos_) {
276  if (id_ == 21) {
277  if (!isItHF(aStep->GetPostStepPoint()->GetTouchable())) {
278  if ((abseta >= etaMinP_) && (abseta <= etaMaxP_))
279  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalHistos: After HF in " << name << ":"
280  << static_cast<std::string>(dd4hep::dd::noNamespace(
281  aStep->GetPostStepPoint()->GetTouchable()->GetVolume(0)->GetName()))
282  << " calls fillHisto with " << id_;
283  fillHisto(idOld);
284  ++id_;
285  layer_ = 0;
286  }
287  }
288  }
289 }
290 
292  if ((std::abs(eta_) >= etaMinP_) && (std::abs(eta_) <= etaMaxP_))
293  edm::LogVerbatim("MaterialBudget") << "Number of layers hit in HB:" << nlayHB_ << " HE:" << nlayHE_
294  << " HO:" << nlayHO_ << " HF:" << nlayHF_;
295  if (fillHistos_) {
296  fillHisto(maxSet_ - 1);
297  fillLayer();
298  }
299  if (printSum_) {
300  for (unsigned int ii = 0; ii < matList_.size(); ii++) {
301  edm::LogVerbatim("MaterialBudget") << matList_[ii] << "\t" << stepLength_[ii] << "\t" << radLength_[ii] << "\t"
302  << intLength_[ii];
303  }
304  }
305 }
306 
308  // Book histograms
310 
311  if (!tfile.isAvailable())
312  throw cms::Exception("BadConfig") << "TFileService unavailable: "
313  << "please add it to config file";
314 
315  double maxPhi = 1._pi;
316  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos: Booking user histos === with " << binEta_
317  << " bins in eta from " << -maxEta_ << " to " << maxEta_ << " and " << binPhi_
318  << " bins in phi from " << -maxPhi << " to " << maxPhi;
319 
320  std::string iter;
321  std::string range0 = "(" + std::to_string(etaMidMin_) + ":" + std::to_string(etaMidMax_) + ") ";
322  std::string range1 = "(" + std::to_string(etaHighMin_) + ":" + std::to_string(etaHighMax_) + ") ";
323  std::string range2 = "(" + std::to_string(etaLowMin_) + ":" + std::to_string(etaLowMax_) + ") ";
324  // total X0
325  for (int i = 0; i < maxSet_; i++) {
326  iter = std::to_string(i);
327  me100[i] = tfile->make<TProfile>(
328  std::to_string(i + 100).c_str(), ("MB(X0) prof Eta in region " + iter).c_str(), binEta_, -maxEta_, maxEta_);
329  me200[i] = tfile->make<TProfile>(
330  std::to_string(i + 200).c_str(), ("MB(L0) prof Eta in region " + iter).c_str(), binEta_, -maxEta_, maxEta_);
331  me300[i] = tfile->make<TProfile>(
332  std::to_string(i + 300).c_str(), ("MB(Step) prof Eta in region " + iter).c_str(), binEta_, -maxEta_, maxEta_);
333  me400[i] = tfile->make<TH1F>(
334  std::to_string(i + 400).c_str(), ("Eta in region " + iter).c_str(), binEta_, -maxEta_, maxEta_);
335  me500[i] = tfile->make<TProfile>(
336  std::to_string(i + 500).c_str(), ("MB(X0) prof Ph in region " + iter).c_str(), binPhi_, -maxPhi, maxPhi);
337  me600[i] = tfile->make<TProfile>(
338  std::to_string(i + 600).c_str(), ("MB(L0) prof Ph in region " + iter).c_str(), binPhi_, -maxPhi, maxPhi);
339  me700[i] = tfile->make<TProfile>(
340  std::to_string(i + 700).c_str(), ("MB(Step) prof Ph in region " + iter).c_str(), binPhi_, -maxPhi, maxPhi);
341  me800[i] =
342  tfile->make<TH1F>(std::to_string(i + 800).c_str(), ("Phi in region " + iter).c_str(), binPhi_, -maxPhi, maxPhi);
343  me900[i] = tfile->make<TProfile2D>(std::to_string(i + 900).c_str(),
344  ("MB(X0) prof Eta Phi in region " + iter).c_str(),
345  binEta_ / 2,
346  -maxEta_,
347  maxEta_,
348  binPhi_ / 2,
349  -maxPhi,
350  maxPhi);
351  me1000[i] = tfile->make<TProfile2D>(std::to_string(i + 1000).c_str(),
352  ("MB(L0) prof Eta Phi in region " + iter).c_str(),
353  binEta_ / 2,
354  -maxEta_,
355  maxEta_,
356  binPhi_ / 2,
357  -maxPhi,
358  maxPhi);
359  me1100[i] = tfile->make<TProfile2D>(std::to_string(i + 1100).c_str(),
360  ("MB(Step) prof Eta Phi in region " + iter).c_str(),
361  binEta_ / 2,
362  -maxEta_,
363  maxEta_,
364  binPhi_ / 2,
365  -maxPhi,
366  maxPhi);
367  me1200[i] = tfile->make<TH2F>(std::to_string(i + 1200).c_str(),
368  ("Eta vs Phi in region " + iter).c_str(),
369  binEta_ / 2,
370  -maxEta_,
371  maxEta_,
372  binPhi_ / 2,
373  -maxPhi,
374  maxPhi);
375  me1600[i] = tfile->make<TProfile>(std::to_string(i + 1600).c_str(),
376  ("MB(X0) prof Ph in region " + range0 + iter).c_str(),
377  binPhi_,
378  -maxPhi,
379  maxPhi);
380  me1700[i] = tfile->make<TProfile>(std::to_string(i + 1700).c_str(),
381  ("MB(L0) prof Ph in region " + range0 + iter).c_str(),
382  binPhi_,
383  -maxPhi,
384  maxPhi);
385  me1800[i] = tfile->make<TProfile>(std::to_string(i + 1800).c_str(),
386  ("MB(Step) prof Ph in region " + range0 + iter).c_str(),
387  binPhi_,
388  -maxPhi,
389  maxPhi);
390  me1900[i] = tfile->make<TProfile>(std::to_string(i + 1900).c_str(),
391  ("MB(X0) prof Ph in region " + range1 + iter).c_str(),
392  binPhi_,
393  -maxPhi,
394  maxPhi);
395  me2000[i] = tfile->make<TProfile>(std::to_string(i + 2000).c_str(),
396  ("MB(L0) prof Ph in region " + range1 + iter).c_str(),
397  binPhi_,
398  -maxPhi,
399  maxPhi);
400  me2100[i] = tfile->make<TProfile>(std::to_string(i + 2100).c_str(),
401  ("MB(Step) prof Ph in region " + range1 + iter).c_str(),
402  binPhi_,
403  -maxPhi,
404  maxPhi);
405  me2200[i] = tfile->make<TProfile>(std::to_string(i + 2200).c_str(),
406  ("MB(X0) prof Ph in region " + range2 + iter).c_str(),
407  binPhi_,
408  -maxPhi,
409  maxPhi);
410  me2300[i] = tfile->make<TProfile>(std::to_string(i + 2300).c_str(),
411  ("MB(L0) prof Ph in region " + range2 + iter).c_str(),
412  binPhi_,
413  -maxPhi,
414  maxPhi);
415  me2400[i] = tfile->make<TProfile>(std::to_string(i + 2400).c_str(),
416  ("MB(Step) prof Ph in region " + range2 + iter).c_str(),
417  binPhi_,
418  -maxPhi,
419  maxPhi);
420  }
421  for (int i = 0; i < maxSet2_; i++) {
422  iter = std::to_string(i);
423  me1300[i] = tfile->make<TH1F>(std::to_string(i + 1300).c_str(),
424  ("Events with layers Hit (0 all, 1 HB, ..) for " + iter).c_str(),
425  binEta_,
426  -maxEta_,
427  maxEta_);
428  me1400[i] = tfile->make<TH2F>(std::to_string(i + 1400).c_str(),
429  ("Eta vs Phi for layers hit in " + iter).c_str(),
430  binEta_ / 2,
431  -maxEta_,
432  maxEta_,
433  binPhi_ / 2,
434  -maxPhi,
435  maxPhi);
436  me1500[i] = tfile->make<TProfile>(std::to_string(i + 1500).c_str(),
437  ("Number of layers crossed (0 all, 1 HB, ..) for " + iter).c_str(),
438  binEta_,
439  -maxEta_,
440  maxEta_);
441  }
442 
443  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalHistos: Booking user histos done ===";
444 }
445 
447  if ((std::abs(eta_) >= etaMinP_) && (std::abs(eta_) <= etaMaxP_))
448  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalHistos:FillHisto called with index " << ii
449  << " integrated step " << stepLen_ << " X0 " << radLen_ << " Lamda " << intLen_;
450 
451  if (ii >= 0 && ii < maxSet_) {
452  me100[ii]->Fill(eta_, radLen_);
453  me200[ii]->Fill(eta_, intLen_);
454  me300[ii]->Fill(eta_, stepLen_);
455  me400[ii]->Fill(eta_);
456 
457  if (eta_ >= etaLow_ && eta_ <= etaHigh_) {
458  me500[ii]->Fill(phi_, radLen_);
459  me600[ii]->Fill(phi_, intLen_);
460  me700[ii]->Fill(phi_, stepLen_);
461  me800[ii]->Fill(phi_);
462  }
463 
464  me900[ii]->Fill(eta_, phi_, radLen_);
465  me1000[ii]->Fill(eta_, phi_, intLen_);
466  me1100[ii]->Fill(eta_, phi_, stepLen_);
467  me1200[ii]->Fill(eta_, phi_);
468 
469  if ((std::abs(eta_) >= etaMidMin_) && (std::abs(eta_) <= etaMidMax_)) {
470  me1600[ii]->Fill(phi_, radLen_);
471  me1700[ii]->Fill(phi_, intLen_);
472  me1800[ii]->Fill(phi_, stepLen_);
473  }
474 
475  if ((std::abs(eta_) >= etaHighMin_) && (std::abs(eta_) <= etaHighMax_)) {
476  me1900[ii]->Fill(phi_, radLen_);
477  me2000[ii]->Fill(phi_, intLen_);
478  me2100[ii]->Fill(phi_, stepLen_);
479  }
480 
481  if ((std::abs(eta_) >= etaLowMin_) && (std::abs(eta_) <= etaLowMax_)) {
482  me2200[ii]->Fill(phi_, radLen_);
483  me2300[ii]->Fill(phi_, intLen_);
484  me2400[ii]->Fill(phi_, stepLen_);
485  }
486  }
487 }
488 
490  me1300[0]->Fill(eta_);
491  me1400[0]->Fill(eta_, phi_);
492  if (nlayHB_ > 0) {
493  me1300[1]->Fill(eta_);
494  me1400[1]->Fill(eta_, phi_);
495  }
496  if (nlayHB_ >= 16) {
497  me1300[2]->Fill(eta_);
498  me1400[2]->Fill(eta_, phi_);
499  }
500  if (nlayHE_ > 0) {
501  me1300[3]->Fill(eta_);
502  me1400[3]->Fill(eta_, phi_);
503  }
504  if (nlayHE_ >= 16) {
505  me1300[4]->Fill(eta_);
506  me1400[4]->Fill(eta_, phi_);
507  }
508  if (nlayHO_ > 0) {
509  me1300[5]->Fill(eta_);
510  me1400[5]->Fill(eta_, phi_);
511  }
512  if (nlayHO_ >= 2) {
513  me1300[6]->Fill(eta_);
514  me1400[6]->Fill(eta_, phi_);
515  }
516  if (nlayHF_ > 0) {
517  me1300[7]->Fill(eta_);
518  me1400[7]->Fill(eta_, phi_);
519  }
520  if (nlayHB_ > 0 || nlayHE_ > 0 || (nlayHF_ > 0 && std::abs(eta_) > 3.0)) {
521  me1300[8]->Fill(eta_);
522  me1400[8]->Fill(eta_, phi_);
523  }
524  me1500[0]->Fill(eta_, (double)(nlayHB_ + nlayHO_ + nlayHE_ + nlayHF_));
525  me1500[1]->Fill(eta_, (double)(nlayHB_));
526  me1500[2]->Fill(eta_, (double)(nlayHE_));
527  me1500[4]->Fill(eta_, (double)(nlayHF_));
528 }
529 
531  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcalHistos: Save user histos ===";
532 }
533 
534 std::vector<std::string> MaterialBudgetHcalHistos::getNames(DDFilteredView& fv) {
535  std::vector<std::string> tmp;
536  bool dodet = fv.firstChild();
537  while (dodet) {
538  const DDLogicalPart& log = fv.logicalPart();
539  std::string namx = log.name().name();
540  if (std::find(tmp.begin(), tmp.end(), namx) == tmp.end())
541  tmp.push_back(namx);
542  dodet = fv.next();
543  }
544  return tmp;
545 }
546 
548  std::vector<std::string> tmp;
549  const std::vector<std::string> notIn = {"CALO",
550  "HCal",
551  "MBBTL",
552  "MBBTR",
553  "MBBTC",
554  "MBAT",
555  "MBBT_R1M",
556  "MBBT_R1P",
557  "MBBT_R1MX",
558  "MBBT_R1PX",
559  "VCAL",
560  "HVQF"};
561  while (fv.firstChild()) {
562  const std::string n{fv.name().data(), fv.name().size()};
563  if (std::find(notIn.begin(), notIn.end(), n) == notIn.end()) {
564  std::string::size_type pos = n.find(':');
565  const std::string namx = (pos == std::string::npos) ? n : std::string(n, pos + 1, n.size() - 1);
566  if (std::find(tmp.begin(), tmp.end(), namx) == tmp.end())
567  tmp.push_back(namx);
568  }
569  }
570  return tmp;
571 }
572 
574  edm::LogVerbatim("MaterialBudgetFull") << "MaterialBudgetHcalHistos:getDDDArray called for " << str;
575  DDValue value(str);
576  if (DDfetch(&sv, value)) {
577  edm::LogVerbatim("MaterialBudgetFull") << value;
578  const std::vector<double>& fvec = value.doubles();
579  int nval = fvec.size();
580  if (nval < 1) {
581  throw cms::Exception("MaterialBudgetHcalHistos") << "nval = " << nval << " < 1 for array " << str << "\n";
582  }
583 
584  return fvec;
585  } else {
586  throw cms::Exception("MaterialBudgetHcalHistos") << "cannot get array " << str << "\n";
587  }
588 }
589 
591  std::vector<std::string>::const_iterator it = sensitives_.begin();
592  std::vector<std::string>::const_iterator itEnd = sensitives_.end();
593  for (; it != itEnd; ++it)
594  if (name == *it)
595  return true;
596  return false;
597 }
598 
599 bool MaterialBudgetHcalHistos::isItHF(const G4VTouchable* touch) {
600  int levels = ((touch->GetHistoryDepth()) + 1);
601  for (unsigned int it = 0; it < hfNames_.size(); it++) {
602  if (levels >= hfLevels_[it]) {
603  std::string name =
604  (static_cast<std::string>(dd4hep::dd::noNamespace(touch->GetVolume(levels - hfLevels_[it])->GetName())));
605  if (name == hfNames_[it]) {
606  return true;
607  }
608  }
609  }
610  return false;
611 }
612 
614  std::vector<std::string>::const_iterator it = sensitiveEC_.begin();
615  std::vector<std::string>::const_iterator itEnd = sensitiveEC_.end();
616  for (; it != itEnd; ++it)
617  if (name == *it)
618  return true;
619  return false;
620 }
personalPlayback.level
level
Definition: personalPlayback.py:22
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
step
step
Definition: StallMonitor.cc:94
MaterialBudgetHcalHistos::getNames
std::vector< std::string > getNames(DDFilteredView &fv)
Definition: MaterialBudgetHcalHistos.cc:534
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
geant_units::operators::convertUnitsTo
constexpr NumType convertUnitsTo(long double desiredUnits, NumType val)
Definition: GeantUnits.h:99
DDFilteredView::mergedSpecifics
DDsvalues_type mergedSpecifics() const
Definition: DDFilteredView.cc:42
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MaterialBudgetHcalHistos::fillPerStep
void fillPerStep(const G4Step *)
Definition: MaterialBudgetHcalHistos.cc:169
DDFilteredView::logicalPart
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
Definition: DDFilteredView.cc:16
DDSplit.h
pos
Definition: PixelAliasList.h:18
MaterialBudgetHcalHistos::hend
void hend()
Definition: MaterialBudgetHcalHistos.cc:530
MaterialBudgetHcalHistos::isItHF
bool isItHF(const G4VTouchable *)
Definition: MaterialBudgetHcalHistos.cc:599
geant_units::operators
Definition: GeantUnits.h:18
cms::DDFilteredView
Definition: DDFilteredView.h:70
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
cms::DDFilteredView::name
std::string_view name() const
Definition: DDFilteredView.cc:854
HLT_FULL_cff.maxPhi
maxPhi
Definition: HLT_FULL_cff.py:52987
MaterialBudgetHcalHistos::book
void book()
Definition: MaterialBudgetHcalHistos.cc:307
cms::DDFilteredView::get
T get(const std::string &)
extract attribute value
MaterialBudgetHcalHistos::fillHisto
void fillHisto(int ii)
Definition: MaterialBudgetHcalHistos.cc:446
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
cms::DDFilter
Definition: DDFilteredView.h:59
Service.h
DDFilteredView::next
bool next()
set current node to the next node in the filtered tree
Definition: DDFilteredView.cc:67
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
tfile
Definition: tfile.py:1
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:352
str
#define str(s)
Definition: TestProcessor.cc:52
cms::DDFilteredView::firstChild
bool firstChild()
set the current node to the first child
Definition: DDFilteredView.cc:268
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
dqmdumpme.k
k
Definition: dqmdumpme.py:60
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
DDValue.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TFileService.h
edm::ParameterSet
Definition: ParameterSet.h:47
MaterialBudgetHcalHistos::fillLayer
void fillLayer()
Definition: MaterialBudgetHcalHistos.cc:489
GeantUnits.h
MaterialBudgetHcalHistos::isItEC
bool isItEC(std::string)
Definition: MaterialBudgetHcalHistos.cc:613
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
edm::Service< TFileService >
createfilelist.int
int
Definition: createfilelist.py:10
DDFilter.h
value
Definition: value.py:1
DDLogicalPart.h
compare.tfile
tfile
Definition: compare.py:325
MaterialBudgetHcalHistos::fillEndTrack
void fillEndTrack()
Definition: MaterialBudgetHcalHistos.cc:291
DDValue
Definition: DDValue.h:21
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:245
cms::DDCompactView
Definition: DDCompactView.h:31
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
Exception.h
MaterialBudgetHcalHistos.h
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
MaterialBudgetHcalHistos::fillStartTrack
void fillStartTrack(const G4Track *)
Definition: MaterialBudgetHcalHistos.cc:140
DDFilteredView
Definition: DDFilteredView.h:20
MaterialBudgetHcalHistos::isSensitive
bool isSensitive(std::string)
Definition: MaterialBudgetHcalHistos.cc:590
cms::Exception
Definition: Exception.h:70
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MsgTools::getNames
void getNames(uint8 *from, uint32 from_len, Strings &to)
Definition: MsgTools.h:85
sistrip::layer_
static const char layer_[]
Definition: ConstantsForGranularity.h:30
edm::Log
Definition: MessageLogger.h:70
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
cuy.ii
ii
Definition: cuy.py:590
MaterialBudgetHcalHistos::getDDDArray
std::vector< double > getDDDArray(const std::string &str, const DDsvalues_type &sv)
Definition: MaterialBudgetHcalHistos.cc:573
jets_cff.levels
levels
Definition: jets_cff.py:21
fastSimProducer_cff.density
density
Definition: fastSimProducer_cff.py:61
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
MaterialBudgetHcalHistos::fillBeginJob
void fillBeginJob(const DDCompactView &)
Definition: MaterialBudgetHcalHistos.cc:47
MaterialBudgetHcalHistos::MaterialBudgetHcalHistos
MaterialBudgetHcalHistos(const edm::ParameterSet &p)
Definition: MaterialBudgetHcalHistos.cc:20