CMS 3D CMS Logo

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