CMS 3D CMS Logo

HCalSD.cc
Go to the documentation of this file.
1 // File: HCalSD.cc
3 // Description: Sensitive Detector class for calorimeters
5 
12 
22 
23 #include "G4LogicalVolumeStore.hh"
24 #include "G4LogicalVolume.hh"
25 #include "G4Step.hh"
26 #include "G4Track.hh"
27 
28 #include "G4SystemOfUnits.hh"
29 #include "G4PhysicalConstants.hh"
30 #include "Randomize.hh"
31 
32 #include <iostream>
33 #include <fstream>
34 #include <iomanip>
35 #include <sstream>
36 
37 //#define EDM_ML_DEBUG
38 //#define plotDebug
39 
40 #ifdef plotDebug
41 #include <TH1F.h>
42 #endif
43 
45  const edm::EventSetup& es,
46  const SensitiveDetectorCatalog& clg,
47  edm::ParameterSet const& p,
48  const SimTrackManager* manager)
49  : CaloSD(name,
50  es,
51  clg,
52  p,
53  manager,
54  (float)(p.getParameter<edm::ParameterSet>("HCalSD").getParameter<double>("TimeSliceUnit")),
55  p.getParameter<edm::ParameterSet>("HCalSD").getParameter<bool>("IgnoreTrackID")),
56  hcalConstants_(nullptr),
57  hcalSimConstants_(nullptr),
58  m_HBDarkening(nullptr),
59  m_HEDarkening(nullptr),
60  isHF(false),
61  weight_(1.0),
62  depth_(1) {
63  numberingFromDDD.reset(nullptr);
64  numberingScheme.reset(nullptr);
65  showerLibrary.reset(nullptr);
66  hfshower.reset(nullptr);
67  showerParam.reset(nullptr);
68  showerPMT.reset(nullptr);
69  showerBundle.reset(nullptr);
70  m_HFDarkening.reset(nullptr);
71  m_HcalTestNS.reset(nullptr);
72 
73  //static SimpleConfigurable<double> bk1(0.013, "HCalSD:BirkC1");
74  //static SimpleConfigurable<double> bk2(0.0568,"HCalSD:BirkC2");
75  //static SimpleConfigurable<double> bk3(1.75, "HCalSD:BirkC3");
76  // Values from NIM 80 (1970) 239-244: as implemented in Geant3
77 
78  edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HCalSD");
79  useBirk = m_HC.getParameter<bool>("UseBirkLaw");
80  birk1 = m_HC.getParameter<double>("BirkC1") * (g / (MeV * cm2));
81  birk2 = m_HC.getParameter<double>("BirkC2");
82  birk3 = m_HC.getParameter<double>("BirkC3");
83  useShowerLibrary = m_HC.getParameter<bool>("UseShowerLibrary");
84  useParam = m_HC.getParameter<bool>("UseParametrize");
85  testNumber = m_HC.getParameter<bool>("TestNumberingScheme");
86  neutralDensity = m_HC.getParameter<bool>("doNeutralDensityFilter");
87  usePMTHit = m_HC.getParameter<bool>("UsePMTHits");
88  betaThr = m_HC.getParameter<double>("BetaThreshold");
89  eminHitHB = m_HC.getParameter<double>("EminHitHB") * MeV;
90  eminHitHE = m_HC.getParameter<double>("EminHitHE") * MeV;
91  eminHitHO = m_HC.getParameter<double>("EminHitHO") * MeV;
92  eminHitHF = m_HC.getParameter<double>("EminHitHF") * MeV;
93  useFibreBundle = m_HC.getParameter<bool>("UseFibreBundleHits");
94  deliveredLumi = m_HC.getParameter<double>("DelivLuminosity");
95  agingFlagHB = m_HC.getParameter<bool>("HBDarkening");
96  agingFlagHE = m_HC.getParameter<bool>("HEDarkening");
97  bool agingFlagHF = m_HC.getParameter<bool>("HFDarkening");
98  useHF = m_HC.getUntrackedParameter<bool>("UseHF", true);
99  bool forTBHC = m_HC.getUntrackedParameter<bool>("ForTBHCAL", false);
100  bool forTBH2 = m_HC.getUntrackedParameter<bool>("ForTBH2", false);
101  useLayerWt = m_HC.getUntrackedParameter<bool>("UseLayerWt", false);
102  std::string file = m_HC.getUntrackedParameter<std::string>("WtFile", "None");
103  testNS_ = m_HC.getUntrackedParameter<bool>("TestNS", false);
104  edm::ParameterSet m_HF = p.getParameter<edm::ParameterSet>("HFShower");
105  applyFidCut = m_HF.getParameter<bool>("ApplyFiducialCut");
106 
107 #ifdef EDM_ML_DEBUG
108  edm::LogVerbatim("HcalSim") << "***************************************************"
109  << "\n"
110  << "* Constructing a HCalSD with name " << name << "\n"
111  << "\n"
112  << "***************************************************";
113 #endif
114  edm::LogVerbatim("HcalSim") << "HCalSD:: Use of HF code is set to " << useHF
115  << "\nUse of shower parametrization set to " << useParam
116  << "\nUse of shower library is set to " << useShowerLibrary << "\nUse PMT Hit is set to "
117  << usePMTHit << " with beta Threshold " << betaThr << "\nUSe of FibreBundle Hit set to "
118  << useFibreBundle << "\n Use of Birks law is set to " << useBirk
119  << " with three constants kB = " << birk1 << ", C1 = " << birk2 << ", C2 = " << birk3;
120  edm::LogVerbatim("HcalSim") << "HCalSD:: Suppression Flag " << suppressHeavy << " protons below " << kmaxProton
121  << " MeV,"
122  << " neutrons below " << kmaxNeutron << " MeV and"
123  << " ions below " << kmaxIon << " MeV\n"
124  << " Threshold for storing hits in HB: " << eminHitHB << " HE: " << eminHitHE
125  << " HO: " << eminHitHO << " HF: " << eminHitHF << "\n"
126  << "Delivered luminosity for Darkening " << deliveredLumi << " Flag (HE) " << agingFlagHE
127  << " Flag (HB) " << agingFlagHB << " Flag (HF) " << agingFlagHF << "\n"
128  << "Application of Fiducial Cut " << applyFidCut
129  << "Flag for test number|neutral density filter " << testNumber << " " << neutralDensity;
130 
131  // Get pointers to HcalDDDConstant and HcalSimulationParameters
133  es.get<HcalSimNumberingRecord>().get(hdc);
134  if (hdc.isValid()) {
135  hcalConstants_ = hdc.product();
136  } else {
137  edm::LogError("HcalSim") << "HCalSD : Cannot find HcalDDDSimConstant";
138  throw cms::Exception("Unknown", "HCalSD") << "Cannot find HcalDDDSimConstant\n";
139  }
140  if (forTBHC) {
141  useHF = false;
142  matNames.emplace_back("Scintillator");
143  } else {
145  es.get<HcalSimNumberingRecord>().get(hdsc);
146  if (hdsc.isValid()) {
147  hcalSimConstants_ = hdsc.product();
149  } else {
150  edm::LogError("HcalSim") << "HCalSD : Cannot find HcalDDDSimulationConstant";
151  throw cms::Exception("Unknown", "HCalSD") << "Cannot find HcalDDDSimulationConstant\n";
152  }
153  }
154 
156  if (testNumber || forTBH2) {
157  scheme = dynamic_cast<HcalNumberingScheme*>(new HcalTestNumberingScheme(forTBH2));
158  } else {
159  scheme = new HcalNumberingScheme();
160  }
162 
163  // always call getFromLibrary() method to identify HF region
164  setParameterized(true);
165 
166  const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
167  // std::vector<G4LogicalVolume *>::const_iterator lvcite;
168  const G4LogicalVolume* lv;
169  std::string attribute, value;
170 
171  if (useHF) {
172  if (useParam) {
173  showerParam = std::make_unique<HFShowerParam>(name, hcalConstants_, hcalSimConstants_->hcalsimpar(), p);
174  } else {
175  if (useShowerLibrary) {
176  showerLibrary = std::make_unique<HFShowerLibrary>(name, hcalConstants_, hcalSimConstants_->hcalsimpar(), p);
177  }
178  hfshower = std::make_unique<HFShower>(name, hcalConstants_, hcalSimConstants_->hcalsimpar(), p, 0);
179  }
180 
181  // HF volume names
183  const std::vector<int>& temp = hcalSimConstants_->hcalsimpar()->hfLevels_;
184 #ifdef EDM_ML_DEBUG
185  std::stringstream ss0;
186  ss0 << "HCalSD: Names to be tested for Volume = HF has " << hfNames.size() << " elements";
187 #endif
188  for (unsigned int i = 0; i < hfNames.size(); ++i) {
189  G4String namv = static_cast<G4String>(hfNames[i]);
190  lv = nullptr;
191  for (auto lvol : *lvs) {
192  if (lvol->GetName() == namv) {
193  lv = lvol;
194  break;
195  }
196  }
197  hfLV.emplace_back(lv);
198  hfLevels.emplace_back(temp[i]);
199 #ifdef EDM_ML_DEBUG
200  ss0 << "\n HF[" << i << "] = " << namv << " LV " << lv << " at level " << temp[i];
201 #endif
202  }
203 #ifdef EDM_ML_DEBUG
204  edm::LogVerbatim("HcalSim") << ss0.str();
205 #endif
206  // HF Fibre volume names
209  const std::vector<std::string>& pmtNames = hcalSimConstants_->hcalsimpar()->hfPMTNames_;
210  fillLogVolumeVector("HFPMT", pmtNames, pmtLV);
211  const std::vector<std::string>& straightNames = hcalSimConstants_->hcalsimpar()->hfFibreStraightNames_;
212  fillLogVolumeVector("HFFibreBundleStraight", straightNames, fibre1LV);
213  const std::vector<std::string>& conicalNames = hcalSimConstants_->hcalsimpar()->hfFibreConicalNames_;
214  fillLogVolumeVector("HFFibreBundleConical", conicalNames, fibre2LV);
215  }
216 
217  //Material list for HB/HE/HO sensitive detectors
218  const G4MaterialTable* matTab = G4Material::GetMaterialTable();
219  std::vector<G4Material*>::const_iterator matite;
220  for (auto const& namx : matNames) {
221  const G4Material* mat = nullptr;
222  for (matite = matTab->begin(); matite != matTab->end(); ++matite) {
223  if ((*matite)->GetName() == static_cast<G4String>(namx)) {
224  mat = (*matite);
225  break;
226  }
227  }
228  materials.emplace_back(mat);
229  }
230 #ifdef EDM_ML_DEBUG
231  std::stringstream ss1;
232  for (unsigned int i = 0; i < matNames.size(); ++i) {
233  if (i / 10 * 10 == i) {
234  ss1 << "\n";
235  }
236  ss1 << " " << matNames[i];
237  }
238  edm::LogVerbatim("HcalSim") << "HCalSD: Material names for HCAL: " << ss1.str();
239 #endif
240  if (useLayerWt) {
242  }
243  numberingFromDDD = std::make_unique<HcalNumberingFromDDD>(hcalConstants_);
244 
245  //Special Geometry parameters
247 #ifdef EDM_ML_DEBUG
248  std::stringstream ss2;
249  for (unsigned int ig = 0; ig < gpar.size(); ig++) {
250  ss2 << "\n gpar[" << ig << "] = " << gpar[ig] / cm << " cm";
251  }
252  edm::LogVerbatim("HcalSim") << "Maximum depth for HF " << hcalConstants_->getMaxDepth(2) << gpar.size()
253  << " gpar (cm)" << ss2.str();
254 #endif
255 
256  //Test Hcal Numbering Scheme
257  if (testNS_)
258  m_HcalTestNS = std::make_unique<HcalTestNS>(&es);
259 
260  if (agingFlagHB) {
262  es.get<HBHEDarkeningRecord>().get("HB", hdark);
263  m_HBDarkening = &*hdark;
264  }
265  if (agingFlagHE) {
267  es.get<HBHEDarkeningRecord>().get("HE", hdark);
268  m_HEDarkening = &*hdark;
269  }
270 
271  for (int i = 0; i < 9; ++i) {
272  hit_[i] = time_[i] = dist_[i] = nullptr;
273  }
274  hzvem = hzvhad = nullptr;
275 
276  if (agingFlagHF) {
277  m_HFDarkening = std::make_unique<HFDarkening>(m_HC.getParameter<edm::ParameterSet>("HFDarkeningParameterBlock"));
278  }
279 #ifdef plotDebug
281 
282  if (tfile.isAvailable()) {
283  static const char* const labels[] = {"HB",
284  "HE",
285  "HO",
286  "HF Absorber",
287  "HF PMT",
288  "HF Absorber Long",
289  "HF Absorber Short",
290  "HF PMT Long",
291  "HF PMT Short"};
292  TFileDirectory hcDir = tfile->mkdir("ProfileFromHCalSD");
293  char name[20], title[60];
294  for (int i = 0; i < 9; ++i) {
295  sprintf(title, "Hit energy in %s", labels[i]);
296  sprintf(name, "HCalSDHit%d", i);
297  hit_[i] = hcDir.make<TH1F>(name, title, 2000, 0., 2000.);
298  sprintf(title, "Energy (MeV)");
299  hit_[i]->GetXaxis()->SetTitle(title);
300  hit_[i]->GetYaxis()->SetTitle("Hits");
301  sprintf(title, "Time of the hit in %s", labels[i]);
302  sprintf(name, "HCalSDTime%d", i);
303  time_[i] = hcDir.make<TH1F>(name, title, 2000, 0., 2000.);
304  sprintf(title, "Time (ns)");
305  time_[i]->GetXaxis()->SetTitle(title);
306  time_[i]->GetYaxis()->SetTitle("Hits");
307  sprintf(title, "Longitudinal profile in %s", labels[i]);
308  sprintf(name, "HCalSDDist%d", i);
309  dist_[i] = hcDir.make<TH1F>(name, title, 2000, 0., 2000.);
310  sprintf(title, "Distance (mm)");
311  dist_[i]->GetXaxis()->SetTitle(title);
312  dist_[i]->GetYaxis()->SetTitle("Hits");
313  }
314  if (useHF && (!useParam)) {
315  hzvem = hcDir.make<TH1F>("hzvem", "Longitudinal Profile (EM Part)", 330, 0.0, 1650.0);
316  hzvem->GetXaxis()->SetTitle("Longitudinal Profile (EM Part)");
317  hzvhad = hcDir.make<TH1F>("hzvhad", "Longitudinal Profile (Had Part)", 330, 0.0, 1650.0);
318  hzvhad->GetXaxis()->SetTitle("Longitudinal Profile (Hadronic Part)");
319  }
320  }
321 #endif
322 }
323 
325  const std::vector<std::string>& lvnames,
326  std::vector<const G4LogicalVolume*>& lvvec) {
327  const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
328  const G4LogicalVolume* lv;
329  std::stringstream ss3;
330  ss3 << "HCalSD: " << lvnames.size() << " names to be tested for Volume <" << value << ">:";
331  for (unsigned int i = 0; i < lvnames.size(); ++i) {
332  G4String namv = static_cast<G4String>(lvnames[i]);
333  lv = nullptr;
334  for (auto lvol : *lvs) {
335  if (lvol->GetName() == namv) {
336  lv = lvol;
337  break;
338  }
339  }
340  lvvec.emplace_back(lv);
341  if (i / 10 * 10 == i) {
342  ss3 << "\n";
343  }
344  ss3 << " " << namv;
345  }
346  edm::LogVerbatim("HcalSim") << ss3.str();
347 }
348 
349 bool HCalSD::getFromLibrary(const G4Step* aStep) {
350  auto const track = aStep->GetTrack();
351  depth_ = (aStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber(0)) % 10;
352  weight_ = 1.0;
353  bool kill(false);
354  isHF = isItHF(aStep);
355  if (isHF) {
356  if (m_HFDarkening) {
357  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
358  const double invcm = 1. / CLHEP::cm;
359  double r = hitPoint.perp() * invcm;
360  double z = std::abs(hitPoint.z()) * invcm;
361  double dose_acquired = 0.;
363  unsigned int hfZLayer = (unsigned int)((z - HFDarkening::lowZLimit) / 5);
364  if (hfZLayer >= HFDarkening::upperZLimit)
365  hfZLayer = (HFDarkening::upperZLimit - 1);
366  float normalized_lumi = m_HFDarkening->int_lumi(deliveredLumi);
367  for (int i = hfZLayer; i != HFDarkening::numberOfZLayers; ++i) {
368  dose_acquired = m_HFDarkening->dose(i, r);
369  weight_ *= m_HFDarkening->degradation(normalized_lumi * dose_acquired);
370  }
371  }
372 #ifdef EDM_ML_DEBUG
373  edm::LogVerbatim("HcalSim") << "HCalSD::getFromLibrary: HFLumiDarkening at "
374  << "r= " << r << ", z= " << z << " Dose= " << dose_acquired << " weight= " << weight_;
375 #endif
376  }
377 
378  if (useParam) {
379  getFromParam(aStep, kill);
380 #ifdef EDM_ML_DEBUG
381  G4String nameVolume = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
382  edm::LogVerbatim("HcalSim") << "HCalSD: " << getNumberOfHits() << " hits from parametrization in " << nameVolume
383  << " for Track " << track->GetTrackID() << " ("
384  << track->GetDefinition()->GetParticleName() << ")";
385 #endif
388 #ifdef EDM_ML_DEBUG
389  auto nameVolume = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
390  edm::LogVerbatim("HcalSim") << "HCalSD: Starts shower library from " << nameVolume << " for Track "
391  << track->GetTrackID() << " (" << track->GetDefinition()->GetParticleName() << ")";
392 
393 #endif
394  getFromHFLibrary(aStep, kill);
395  }
396  }
397  }
398 #ifdef EDM_ML_DEBUG
399  edm::LogVerbatim("HcalSim") << "HCalSD::getFromLibrary ID= " << track->GetTrackID() << " ("
400  << track->GetDefinition()->GetParticleName() << ") kill= " << kill
401  << " weight= " << weight_ << " depth= " << depth_ << " isHF: " << isHF;
402 #endif
403  return kill;
404 }
405 
406 double HCalSD::getEnergyDeposit(const G4Step* aStep) {
407  double destep(0.0);
408  auto const lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
409  auto const theTrack = aStep->GetTrack();
410 
411  if (isHF) {
412  if (useShowerLibrary && G4TrackToParticleID::isMuon(theTrack) && isItFibre(lv)) {
413 #ifdef EDM_ML_DEBUG
414  edm::LogVerbatim("HcalSim") << "HCalSD: Hit at Fibre in LV " << lv->GetName() << " for track "
415  << aStep->GetTrack()->GetTrackID() << " ("
416  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
417 #endif
418  hitForFibre(aStep);
419  }
420  return destep;
421  }
422 
423  if (isItPMT(lv)) {
424  if (usePMTHit && showerPMT) {
425  getHitPMT(aStep);
426  }
427 #ifdef EDM_ML_DEBUG
428  edm::LogVerbatim("HcalSim") << "HCalSD: Hit from PMT parametrization in LV " << lv->GetName() << " for Track "
429  << aStep->GetTrack()->GetTrackID() << " ("
430  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
431 #endif
432  return destep;
433 
434  } else if (isItStraightBundle(lv)) {
435  if (useFibreBundle && showerBundle) {
436  getHitFibreBundle(aStep, false);
437  }
438 #ifdef EDM_ML_DEBUG
439  edm::LogVerbatim("HcalSim") << "HCalSD: Hit from straight FibreBundle in LV: " << lv->GetName() << " for track "
440  << aStep->GetTrack()->GetTrackID() << " ("
441  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
442 #endif
443  return destep;
444 
445  } else if (isItConicalBundle(lv)) {
446  if (useFibreBundle && showerBundle) {
447  getHitFibreBundle(aStep, true);
448  }
449 #ifdef EDM_ML_DEBUG
450  edm::LogVerbatim("HcalSim") << "HCalSD: Hit from conical FibreBundle PV: " << lv->GetName() << " for track "
451  << aStep->GetTrack()->GetTrackID() << " ("
452  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
453 #endif
454  return destep;
455  }
456 
457  // normal hit
458  destep = aStep->GetTotalEnergyDeposit();
459 
460  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
461  uint32_t detid = setDetUnitId(aStep);
462  int det(0), ieta(0), phi(0), z(0), lay, depth(-1);
463  if (testNumber) {
464  HcalTestNumbering::unpackHcalIndex(detid, det, z, depth, ieta, phi, lay);
465  if (z == 0) {
466  z = -1;
467  }
468  } else {
469  HcalDetId hcid(detid);
470  det = hcid.subdetId();
471  ieta = hcid.ietaAbs();
472  phi = hcid.iphi();
473  z = hcid.zside();
474  }
475  lay = (touch->GetReplicaNumber(0) / 10) % 100 + 1;
476 #ifdef EDM_ML_DEBUG
477  edm::LogVerbatim("HcalSim") << "HCalSD: det: " << det << " ieta: " << ieta << " iphi: " << phi << " zside " << z
478  << " lay: " << lay - 2;
479 #endif
480  if (depth_ == 0 && (det == 1 || det == 2) && ((!testNumber) || neutralDensity))
482  if (useLayerWt) {
483  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
484  weight_ = layerWeight(det + 2, hitPoint, depth_, lay);
485  }
486 
487  if (m_HBDarkening && det == 1) {
488  double dweight = m_HBDarkening->degradation(deliveredLumi, ieta, lay);
489  weight_ *= dweight;
490 #ifdef EDM_ML_DEBUG
491  edm::LogVerbatim("HcalSim") << "HCalSD: HB Lumi: " << deliveredLumi << " coefficient = " << dweight
492  << " Weight= " << weight_;
493 #endif
494  }
495 
496  if (m_HEDarkening && det == 2) {
497  double dweight = m_HEDarkening->degradation(deliveredLumi, ieta, lay);
498  weight_ *= dweight;
499 #ifdef EDM_ML_DEBUG
500  edm::LogVerbatim("HcalSim") << "HCalSD: HB Lumi: " << deliveredLumi << " coefficient = " << dweight
501  << " Weight= " << weight_;
502 #endif
503  }
504 
505  if (suppressHeavy) {
506  TrackInformation* trkInfo = (TrackInformation*)(theTrack->GetUserInformation());
507  if (trkInfo) {
508  int pdg = theTrack->GetDefinition()->GetPDGEncoding();
509  if (!(trkInfo->isPrimary())) { // Only secondary particles
510  double ke = theTrack->GetKineticEnergy();
511  if (pdg / 1000000000 == 1 && (pdg / 10000) % 100 > 0 && (pdg / 10) % 100 > 0 && ke < kmaxIon)
512  weight_ = 0;
513  if ((pdg == 2212) && (ke < kmaxProton))
514  weight_ = 0;
515  if ((pdg == 2112) && (ke < kmaxNeutron))
516  weight_ = 0;
517  }
518  }
519  }
520  if (useBirk) {
521  const G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
522  if (isItScintillator(mat))
523  weight_ *= getAttenuation(aStep, birk1, birk2, birk3);
524  }
525  double wt1 = getResponseWt(theTrack);
526  double wt2 = theTrack->GetWeight();
527  double edep = weight_ * wt1 * destep;
528  if (wt2 > 0.0) {
529  edep *= wt2;
530  }
531 #ifdef EDM_ML_DEBUG
532  edm::LogVerbatim("HcalSim") << "HCalSD: edep= " << edep << " Det: " << det + 2 << " depth= " << depth_
533  << " weight= " << weight_ << " wt1= " << wt1 << " wt2= " << wt2;
534 #endif
535  return edep;
536 }
537 
538 uint32_t HCalSD::setDetUnitId(const G4Step* aStep) {
539  auto const prePoint = aStep->GetPreStepPoint();
540  auto const touch = prePoint->GetTouchable();
541  const G4ThreeVector& hitPoint = prePoint->GetPosition();
542 
543  int depth = (touch->GetReplicaNumber(0)) % 10 + 1;
544  int lay = (touch->GetReplicaNumber(0) / 10) % 100 + 1;
545  int det = (touch->GetReplicaNumber(1)) / 1000;
546 
547  return setDetUnitId(det, hitPoint, depth, lay);
548 }
549 
551  if (scheme != nullptr) {
552  edm::LogVerbatim("HcalSim") << "HCalSD: updates numbering scheme for " << GetName();
553  numberingScheme.reset(scheme);
554  }
555 }
556 
557 void HCalSD::update(const BeginOfJob* job) {}
558 
560 
561 bool HCalSD::filterHit(CaloG4Hit* aHit, double time) {
562  double threshold = 0;
563  DetId theId(aHit->getUnitID());
564  switch (theId.subdetId()) {
565  case HcalBarrel:
567  break;
568  case HcalEndcap:
570  break;
571  case HcalOuter:
573  break;
574  case HcalForward:
576  break;
577  default:
578  break;
579  }
580  return ((time <= tmaxHit) && (aHit->getEnergyDeposit() > threshold));
581 }
582 
583 uint32_t HCalSD::setDetUnitId(int det, const G4ThreeVector& pos, int depth, int lay = 1) {
584  uint32_t id = 0;
585  if (numberingFromDDD.get()) {
586  //get the ID's as eta, phi, depth, ... indices
588  numberingFromDDD->unitID(det, math::XYZVectorD(pos.x(), pos.y(), pos.z()), depth, lay);
589  id = setDetUnitId(tmp);
590  }
591  return id;
592 }
593 
595  modifyDepth(tmp);
596  uint32_t id = (numberingScheme.get()) ? numberingScheme->getUnitID(tmp) : 0;
597  if ((!testNumber) && m_HcalTestNS.get()) {
598  bool ok = m_HcalTestNS->compare(tmp, id);
599  if (!ok)
600  edm::LogWarning("HcalSim") << "Det ID from HCalSD " << HcalDetId(id) << " " << std::hex << id << std::dec
601  << " does not match one from relabller for " << tmp.subdet << ":" << tmp.etaR << ":"
602  << tmp.phi << ":" << tmp.phis << ":" << tmp.depth << ":" << tmp.lay << std::endl;
603  }
604  return id;
605 }
606 
607 bool HCalSD::isItHF(const G4Step* aStep) {
608  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
609  int levels = (touch->GetHistoryDepth()) + 1;
610  for (unsigned int it = 0; it < hfNames.size(); ++it) {
611  if (levels >= hfLevels[it]) {
612  const G4LogicalVolume* lv = touch->GetVolume(levels - hfLevels[it])->GetLogicalVolume();
613  if (lv == hfLV[it])
614  return true;
615  }
616  }
617  return false;
618 }
619 
620 bool HCalSD::isItHF(const G4String& name) {
621  for (auto nam : hfNames)
622  if (name == static_cast<G4String>(nam)) {
623  return true;
624  }
625  return false;
626 }
627 
628 bool HCalSD::isItFibre(const G4LogicalVolume* lv) {
629  for (auto lvol : fibreLV)
630  if (lv == lvol) {
631  return true;
632  }
633  return false;
634 }
635 
636 bool HCalSD::isItFibre(const G4String& name) {
637  for (auto nam : fibreNames)
638  if (name == static_cast<G4String>(nam)) {
639  return true;
640  }
641  return false;
642 }
643 
644 bool HCalSD::isItPMT(const G4LogicalVolume* lv) {
645  for (auto lvol : pmtLV)
646  if (lv == lvol) {
647  return true;
648  }
649  return false;
650 }
651 
652 bool HCalSD::isItStraightBundle(const G4LogicalVolume* lv) {
653  for (auto lvol : fibre1LV)
654  if (lv == lvol) {
655  return true;
656  }
657  return false;
658 }
659 
660 bool HCalSD::isItConicalBundle(const G4LogicalVolume* lv) {
661  for (auto lvol : fibre2LV)
662  if (lv == lvol) {
663  return true;
664  }
665  return false;
666 }
667 
668 bool HCalSD::isItScintillator(const G4Material* mat) {
669  for (auto amat : materials)
670  if (amat == mat) {
671  return true;
672  }
673  return false;
674 }
675 
676 bool HCalSD::isItinFidVolume(const G4ThreeVector& hitPoint) {
677  bool flag = true;
678  if (applyFidCut) {
679  int npmt = HFFibreFiducial::PMTNumber(hitPoint);
680 #ifdef EDM_ML_DEBUG
681  edm::LogVerbatim("HcalSim") << "HCalSD::isItinFidVolume:#PMT= " << npmt << " for hit point " << hitPoint;
682 #endif
683  if (npmt <= 0)
684  flag = false;
685  }
686 #ifdef EDM_ML_DEBUG
687  edm::LogVerbatim("HcalSim") << "HCalSD::isItinFidVolume: point " << hitPoint << " return flag " << flag;
688 #endif
689  return flag;
690 }
691 
692 void HCalSD::getFromHFLibrary(const G4Step* aStep, bool& isKilled) {
693  std::vector<HFShowerLibrary::Hit> hits = showerLibrary->getHits(aStep, isKilled, weight_, false);
694  if (!isKilled || hits.empty()) {
695  return;
696  }
697 
698  int primaryID = setTrackID(aStep);
699 
700  // Reset entry point for new primary
701  resetForNewPrimary(aStep);
702 
703  auto const theTrack = aStep->GetTrack();
704  int det = 5;
705 
707  edepositEM = 1. * GeV;
708  edepositHAD = 0.;
709  } else {
710  edepositEM = 0.;
711  edepositHAD = 1. * GeV;
712  }
713 #ifdef EDM_ML_DEBUG
714  edm::LogVerbatim("HcalSim") << "HCalSD::getFromLibrary " << hits.size() << " hits for " << GetName() << " of "
715  << primaryID << " with " << theTrack->GetDefinition()->GetParticleName() << " of "
716  << aStep->GetPreStepPoint()->GetKineticEnergy() / GeV << " GeV";
717 #endif
718  for (unsigned int i = 0; i < hits.size(); ++i) {
719  G4ThreeVector hitPoint = hits[i].position;
720  if (isItinFidVolume(hitPoint)) {
721  int depth = hits[i].depth;
722  double time = hits[i].time;
723  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
724  currentID.setID(unitID, time, primaryID, 0);
725 #ifdef plotDebug
726  plotProfile(aStep, hitPoint, 1.0 * GeV, time, depth);
727  bool emType = G4TrackToParticleID::isGammaElectronPositron(theTrack->GetDefinition()->GetPDGEncoding());
728  plotHF(hitPoint, emType);
729 #endif
730  processHit(aStep);
731  }
732  }
733 }
734 
735 void HCalSD::hitForFibre(const G4Step* aStep) { // if not ParamShower
736 
737  std::vector<HFShower::Hit> hits = hfshower->getHits(aStep, weight_);
738  if (hits.empty()) {
739  return;
740  }
741 
742  auto const theTrack = aStep->GetTrack();
743  int primaryID = setTrackID(aStep);
744  int det = 5;
745 
747  edepositEM = 1. * GeV;
748  edepositHAD = 0.;
749  } else {
750  edepositEM = 0.;
751  edepositHAD = 1. * GeV;
752  }
753 
754 #ifdef EDM_ML_DEBUG
755  edm::LogVerbatim("HcalSim") << "HCalSD::hitForFibre " << hits.size() << " hits for " << GetName() << " of "
756  << primaryID << " with " << theTrack->GetDefinition()->GetParticleName() << " of "
757  << aStep->GetPreStepPoint()->GetKineticEnergy() / GeV << " GeV in detector type " << det;
758 #endif
759 
760  for (unsigned int i = 0; i < hits.size(); ++i) {
761  G4ThreeVector hitPoint = hits[i].position;
762  if (isItinFidVolume(hitPoint)) {
763  int depth = hits[i].depth;
764  double time = hits[i].time;
765  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
766  currentID.setID(unitID, time, primaryID, 0);
767 #ifdef plotDebug
768  plotProfile(aStep, hitPoint, edepositEM, time, depth);
769  bool emType = (edepositEM > 0.) ? true : false;
770  plotHF(hitPoint, emType);
771 #endif
772  processHit(aStep);
773  }
774  }
775 }
776 
777 void HCalSD::getFromParam(const G4Step* aStep, bool& isKilled) {
778  std::vector<HFShowerParam::Hit> hits = showerParam->getHits(aStep, weight_, isKilled);
779  if (!isKilled || hits.empty()) {
780  return;
781  }
782 
783  int primaryID = setTrackID(aStep);
784  int det = 5;
785 
786 #ifdef EDM_ML_DEBUG
787  edm::LogVerbatim("HcalSim") << "HCalSD::getFromParam " << hits.size() << " hits for " << GetName() << " of "
788  << primaryID << " with " << aStep->GetTrack()->GetDefinition()->GetParticleName()
789  << " of " << aStep->GetPreStepPoint()->GetKineticEnergy() / GeV
790  << " GeV in detector type " << det;
791 #endif
792  for (unsigned int i = 0; i < hits.size(); ++i) {
793  G4ThreeVector hitPoint = hits[i].position;
794  int depth = hits[i].depth;
795  double time = hits[i].time;
796  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
797  currentID.setID(unitID, time, primaryID, 0);
798  edepositEM = hits[i].edep * GeV;
799  edepositHAD = 0.;
800 #ifdef plotDebug
801  plotProfile(aStep, hitPoint, edepositEM, time, depth);
802 #endif
803  processHit(aStep);
804  }
805 }
806 
807 void HCalSD::getHitPMT(const G4Step* aStep) {
808  auto const preStepPoint = aStep->GetPreStepPoint();
809  auto const theTrack = aStep->GetTrack();
810  double edep = showerPMT->getHits(aStep);
811 
812  if (edep >= 0.) {
813  edep *= GeV;
814  double etrack = preStepPoint->GetKineticEnergy();
815  int primaryID = 0;
816  if (etrack >= energyCut) {
817  primaryID = theTrack->GetTrackID();
818  } else {
819  primaryID = theTrack->GetParentID();
820  if (primaryID == 0)
821  primaryID = theTrack->GetTrackID();
822  }
823  // Reset entry point for new primary
824  resetForNewPrimary(aStep);
825  //
826  int det = static_cast<int>(HcalForward);
827  const G4ThreeVector& hitPoint = preStepPoint->GetPosition();
828  double rr = (hitPoint.x() * hitPoint.x() + hitPoint.y() * hitPoint.y());
829  double phi = (rr == 0. ? 0. : atan2(hitPoint.y(), hitPoint.x()));
830  double etaR = showerPMT->getRadius();
831  int depth = 1;
832  if (etaR < 0) {
833  depth = 2;
834  etaR = -etaR;
835  }
836  if (hitPoint.z() < 0)
837  etaR = -etaR;
838 #ifdef EDM_ML_DEBUG
839  edm::LogVerbatim("HcalSim") << "HCalSD::Hit for Detector " << det << " etaR " << etaR << " phi " << phi / deg
840  << " depth " << depth;
841 #endif
842  double time = (aStep->GetPostStepPoint()->GetGlobalTime());
843  uint32_t unitID = 0;
844  if (numberingFromDDD) {
845  HcalNumberingFromDDD::HcalID tmp = numberingFromDDD->unitID(det, etaR, phi, depth, 1);
846  unitID = setDetUnitId(tmp);
847  }
848  currentID.setID(unitID, time, primaryID, 1);
849 
850  edepositHAD = aStep->GetTotalEnergyDeposit();
851  edepositEM = -edepositHAD + edep;
852 #ifdef plotDebug
853  plotProfile(aStep, hitPoint, edep, time, depth);
854 #endif
855 #ifdef EDM_ML_DEBUG
856  double beta = preStepPoint->GetBeta();
857  edm::LogVerbatim("HcalSim") << "HCalSD::getHitPMT 1 hit for " << GetName() << " of " << primaryID << " with "
858  << theTrack->GetDefinition()->GetParticleName() << " of "
859  << preStepPoint->GetKineticEnergy() / GeV << " GeV with velocity " << beta << " UnitID "
860  << std::hex << unitID << std::dec;
861 #endif
862  processHit(aStep);
863  }
864 }
865 
866 void HCalSD::getHitFibreBundle(const G4Step* aStep, bool type) {
867  auto const preStepPoint = aStep->GetPreStepPoint();
868  auto const theTrack = aStep->GetTrack();
869  double edep = showerBundle->getHits(aStep, type);
870 
871  if (edep >= 0.0) {
872  edep *= GeV;
873  double etrack = preStepPoint->GetKineticEnergy();
874  int primaryID = 0;
875  if (etrack >= energyCut) {
876  primaryID = theTrack->GetTrackID();
877  } else {
878  primaryID = theTrack->GetParentID();
879  if (primaryID == 0)
880  primaryID = theTrack->GetTrackID();
881  }
882  // Reset entry point for new primary
883  resetForNewPrimary(aStep);
884  //
885  int det = static_cast<int>(HcalForward);
886  const G4ThreeVector& hitPoint = preStepPoint->GetPosition();
887  double rr = hitPoint.x() * hitPoint.x() + hitPoint.y() * hitPoint.y();
888  double phi = rr == 0. ? 0. : atan2(hitPoint.y(), hitPoint.x());
889  double etaR = showerBundle->getRadius();
890  int depth = 1;
891  if (etaR < 0.) {
892  depth = 2;
893  etaR = -etaR;
894  }
895  if (hitPoint.z() < 0.)
896  etaR = -etaR;
897 #ifdef EDM_ML_DEBUG
898  edm::LogVerbatim("HcalSim") << "HCalSD::Hit for Detector " << det << " etaR " << etaR << " phi " << phi / deg
899  << " depth " << depth;
900 #endif
901  double time = (aStep->GetPostStepPoint()->GetGlobalTime());
902  uint32_t unitID = 0;
903  if (numberingFromDDD) {
904  HcalNumberingFromDDD::HcalID tmp = numberingFromDDD->unitID(det, etaR, phi, depth, 1);
905  unitID = setDetUnitId(tmp);
906  }
907  if (type)
908  currentID.setID(unitID, time, primaryID, 3);
909  else
910  currentID.setID(unitID, time, primaryID, 2);
911 
912  edepositHAD = aStep->GetTotalEnergyDeposit();
913  edepositEM = -edepositHAD + edep;
914 #ifdef plotDebug
915  plotProfile(aStep, hitPoint, edep, time, depth);
916 #endif
917 #ifdef EDM_ML_DEBUG
918  double beta = preStepPoint->GetBeta();
919  edm::LogVerbatim("HcalSim") << "HCalSD::getHitFibreBundle 1 hit for " << GetName() << " of " << primaryID
920  << " with " << theTrack->GetDefinition()->GetParticleName() << " of "
921  << preStepPoint->GetKineticEnergy() / GeV << " GeV with velocity " << beta << " UnitID "
922  << std::hex << unitID << std::dec;
923 #endif
924  processHit(aStep);
925  } // non-zero energy deposit
926 }
927 
929  std::ifstream infile;
930  int entry = 0;
931  infile.open(fName.c_str(), std::ios::in);
932  if (infile) {
933  int det, zside, etaR, phi, lay;
934  double wt;
935  while (infile >> det >> zside >> etaR >> phi >> lay >> wt) {
936  uint32_t id = HcalTestNumbering::packHcalIndex(det, zside, 1, etaR, phi, lay);
937  layerWeights.insert(std::pair<uint32_t, double>(id, wt));
938  ++entry;
939 #ifdef EDM_ML_DEBUG
940  edm::LogVerbatim("HcalSim") << "HCalSD::readWeightFromFile:Entry " << entry << " ID " << std::hex << id
941  << std::dec << " (" << det << "/" << zside << "/1/" << etaR << "/" << phi << "/"
942  << lay << ") Weight " << wt;
943 #endif
944  }
945  infile.close();
946  }
947  edm::LogVerbatim("HcalSim") << "HCalSD::readWeightFromFile: reads " << entry << " weights from " << fName;
948  if (entry <= 0)
949  useLayerWt = false;
950 }
951 
952 double HCalSD::layerWeight(int det, const G4ThreeVector& pos, int depth, int lay) {
953  double wt = 1.;
954  if (numberingFromDDD) {
955  //get the ID's as eta, phi, depth, ... indices
957  numberingFromDDD->unitID(det, math::XYZVectorD(pos.x(), pos.y(), pos.z()), depth, lay);
958  modifyDepth(tmp);
959  uint32_t id = HcalTestNumbering::packHcalIndex(tmp.subdet, tmp.zside, 1, tmp.etaR, tmp.phis, tmp.lay);
960  std::map<uint32_t, double>::const_iterator ite = layerWeights.find(id);
961  if (ite != layerWeights.end())
962  wt = ite->second;
963 #ifdef EDM_ML_DEBUG
964  edm::LogVerbatim("HcalSim") << "HCalSD::layerWeight: ID " << std::hex << id << std::dec << " (" << tmp.subdet << "/"
965  << tmp.zside << "/1/" << tmp.etaR << "/" << tmp.phis << "/" << tmp.lay << ") Weight "
966  << wt;
967 #endif
968  }
969  return wt;
970 }
971 
972 void HCalSD::plotProfile(const G4Step* aStep, const G4ThreeVector& global, double edep, double time, int id) {
973  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
974  static const G4String modName[8] = {"HEModule", "HVQF", "HBModule", "MBAT", "MBBT", "MBBTC", "MBBT_R1P", "MBBT_R1M"};
975  G4ThreeVector local;
976  bool found = false;
977  double depth = -2000;
978  int idx = 4;
979  for (int n = 0; n < touch->GetHistoryDepth(); ++n) {
980  G4String name = touch->GetVolume(n)->GetName();
981 #ifdef EDM_ML_DEBUG
982  edm::LogVerbatim("HcalSim") << "plotProfile Depth " << n << " Name " << name;
983 #endif
984  for (unsigned int ii = 0; ii < 8; ++ii) {
985  if (name == modName[ii]) {
986  found = true;
987  int dn = touch->GetHistoryDepth() - n;
988  local = touch->GetHistory()->GetTransform(dn).TransformPoint(global);
989  if (ii == 0) {
990  depth = local.z() - 4006.5;
991  idx = 1;
992  } else if (ii == 1) {
993  depth = local.z() + 825.0;
994  idx = 3;
995  } else if (ii == 2) {
996  depth = local.x() - 1775.;
997  idx = 0;
998  } else {
999  depth = local.y() + 15.;
1000  idx = 2;
1001  }
1002  break;
1003  }
1004  }
1005  if (found)
1006  break;
1007  }
1008  if (!found)
1009  depth = std::abs(global.z()) - 11500;
1010 #ifdef EDM_ML_DEBUG
1011  edm::LogVerbatim("HcalSim") << "plotProfile Found " << found << " Global " << global << " Local " << local
1012  << " depth " << depth << " ID " << id << " EDEP " << edep << " Time " << time;
1013 #endif
1014  if (hit_[idx] != nullptr)
1015  hit_[idx]->Fill(edep);
1016  if (time_[idx] != nullptr)
1017  time_[idx]->Fill(time, edep);
1018  if (dist_[idx] != nullptr)
1019  dist_[idx]->Fill(depth, edep);
1020  int jd = 2 * idx + id - 7;
1021  if (jd >= 0 && jd < 4) {
1022  jd += 5;
1023  if (hit_[jd] != nullptr)
1024  hit_[jd]->Fill(edep);
1025  if (time_[jd] != nullptr)
1026  time_[jd]->Fill(time, edep);
1027  if (dist_[jd] != nullptr)
1028  dist_[jd]->Fill(depth, edep);
1029  }
1030 }
1031 
1032 void HCalSD::plotHF(const G4ThreeVector& hitPoint, bool emType) {
1033  double zv = std::abs(hitPoint.z()) - gpar[4];
1034  if (emType) {
1035  if (hzvem != nullptr)
1036  hzvem->Fill(zv);
1037  } else {
1038  if (hzvhad != nullptr)
1039  hzvhad->Fill(zv);
1040  }
1041 }
1042 
1044  if (id.subdet == 4) {
1045  int ieta = (id.zside == 0) ? -id.etaR : id.etaR;
1046  if (hcalConstants_->maxHFDepth(ieta, id.phis) > 2) {
1047  if (id.depth <= 2) {
1048  if (G4UniformRand() > 0.5)
1049  id.depth += 2;
1050  }
1051  }
1052  } else if ((id.subdet == 1 || id.subdet == 2) && testNumber) {
1053  id.depth = (depth_ == 0) ? 1 : 2;
1054  }
1055 }
HBHEDarkeningRecord
Definition: HBHEDarkeningRecord.h:4
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
HCalSD::fibreLV
std::vector< const G4LogicalVolume * > fibreLV
Definition: HCalSD.h:112
HCalSD::isItStraightBundle
bool isItStraightBundle(const G4LogicalVolume *)
Definition: HCalSD.cc:652
CaloSD::edepositHAD
float edepositHAD
Definition: CaloSD.h:129
SimTrackManager
Definition: SimTrackManager.h:35
HcalDDDSimulationConstants::hcalsimpar
const HcalSimulationParameters * hcalsimpar() const
Definition: HcalDDDSimulationConstants.h:20
HCalSD::testNS_
bool testNS_
Definition: HCalSD.h:99
HCalSD::hfLevels
std::vector< int > hfLevels
Definition: HCalSD.h:107
electrons_cff.bool
bool
Definition: electrons_cff.py:372
CaloSD::tmaxHit
double tmaxHit
Definition: CaloSD.h:133
mps_fire.i
i
Definition: mps_fire.py:355
HCalSD::getFromHFLibrary
void getFromHFLibrary(const G4Step *step, bool &isKilled)
Definition: HCalSD.cc:692
ESTransientHandle.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
funct::false
false
Definition: Factorize.h:34
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HcalNumberingFromDDD::HcalID
Definition: HcalNumberingFromDDD.h:21
HBHEDarkeningRecord.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
CaloSD::kmaxProton
double kmaxProton
Definition: CaloSD.h:138
ESHandle.h
HcalSimNumberingRecord.h
HcalDetId::iphi
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
HcalSimulationParameters::hfPMTNames_
std::vector< std::string > hfPMTNames_
Definition: HcalSimulationParameters.h:24
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
CaloG4Hit::getUnitID
uint32_t getUnitID() const
Definition: CaloG4Hit.h:65
findQualityFiles.rr
string rr
Definition: findQualityFiles.py:185
TFileDirectory::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileDirectory.h:53
HCalSD::agingFlagHE
bool agingFlagHE
Definition: HCalSD.h:97
HCalSD::m_HBDarkening
const HBHEDarkening * m_HBDarkening
Definition: HCalSD.h:91
edm
HLT enums.
Definition: AlignableModifier.h:19
HCalSD::getFromParam
void getFromParam(const G4Step *step, bool &isKilled)
Definition: HCalSD.cc:777
zMuMuMuonUserData.beta
beta
Definition: zMuMuMuonUserData.py:10
mps_splice.entry
entry
Definition: mps_splice.py:68
HFFibreFiducial.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HCalSD::pmtLV
std::vector< const G4LogicalVolume * > pmtLV
Definition: HCalSD.h:112
HcalSimulationParameters::hfLevels_
std::vector< int > hfLevels_
Definition: HcalSimulationParameters.h:21
pos
Definition: PixelAliasList.h:18
HCalSD::neutralDensity
bool neutralDensity
Definition: HCalSD.h:99
HCalSD::getHitFibreBundle
void getHitFibreBundle(const G4Step *step, bool type)
Definition: HCalSD.cc:866
HCalSD::getEnergyDeposit
double getEnergyDeposit(const G4Step *) override
Definition: HCalSD.cc:406
HCalSD::hit_
TH1F * hit_[9]
Definition: HCalSD.h:114
CaloSD::getAttenuation
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:435
HcalDDDSimConstants::getGparHF
const std::vector< double > & getGparHF() const
Definition: HcalDDDSimConstants.h:45
CaloSD::edepositEM
float edepositEM
Definition: CaloSD.h:129
HCalSD::HCalSD
HCalSD(const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
Definition: HCalSD.cc:44
MeV
const double MeV
HcalSimulationParameters::hfFibreStraightNames_
std::vector< std::string > hfFibreStraightNames_
Definition: HcalSimulationParameters.h:25
HCalSD::isItPMT
bool isItPMT(const G4LogicalVolume *)
Definition: HCalSD.cc:644
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
TFileDirectory
Definition: TFileDirectory.h:24
G4TrackToParticleID::isMuon
static bool isMuon(int pdgCode)
Definition: G4TrackToParticleID.cc:27
HcalBarrel
Definition: HcalAssistant.h:33
HCalSD::useBirk
bool useBirk
Definition: HCalSD.h:98
HCalSD::isItinFidVolume
bool isItinFidVolume(const G4ThreeVector &)
Definition: HCalSD.cc:676
HCalSD::isHF
bool isHF
Definition: HCalSD.h:96
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
training_settings.idx
idx
Definition: training_settings.py:16
HCalSD::depth_
int depth_
Definition: HCalSD.h:105
HcalSimulationParameters::hfFibreNames_
std::vector< std::string > hfFibreNames_
Definition: HcalSimulationParameters.h:23
CaloSD::kmaxIon
double kmaxIon
Definition: CaloSD.h:138
HFFibreFiducial::PMTNumber
int PMTNumber(const G4ThreeVector &pe_effect)
Definition: HFFibreFiducial.cc:9
HCalSD::applyFidCut
bool applyFidCut
Definition: HCalSD.h:101
G4TrackToParticleID::isGammaElectronPositron
static bool isGammaElectronPositron(int pdgCode)
Definition: G4TrackToParticleID.cc:17
MainPageGenerator.fName
fName
Definition: MainPageGenerator.py:301
CaloSD::setTrackID
virtual int setTrackID(const G4Step *)
Definition: CaloSD.cc:592
HCalSD::getHitPMT
void getHitPMT(const G4Step *step)
Definition: HCalSD.cc:807
CaloSD::getResponseWt
double getResponseWt(const G4Track *)
Definition: CaloSD.cc:627
HCalSD::layerWeight
double layerWeight(int, const G4ThreeVector &, int, int)
Definition: HCalSD.cc:952
DetId
Definition: DetId.h:17
HCalSD::m_HcalTestNS
std::unique_ptr< HcalTestNS > m_HcalTestNS
Definition: HCalSD.h:94
HCalSD::layerWeights
std::map< uint32_t, double > layerWeights
Definition: HCalSD.h:113
HcalTestNumbering::unpackHcalIndex
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
Definition: HcalTestNumbering.cc:18
CaloHitID::setID
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:40
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackInformation::isPrimary
bool isPrimary() const
Definition: TrackInformation.h:23
HCalSD::hfNames
std::vector< std::string > hfNames
Definition: HCalSD.h:108
HCalSD::fibre1LV
std::vector< const G4LogicalVolume * > fibre1LV
Definition: HCalSD.h:112
Service.h
HCalSD::eminHitHO
double eminHitHO
Definition: HCalSD.h:102
HcalObjRepresent::isHF
bool isHF(int etabin, int depth)
Definition: HcalObjRepresent.h:880
tfile
Definition: tfile.py:1
CaloG4Hit::getEnergyDeposit
double getEnergyDeposit() const
Definition: CaloG4Hit.h:77
DDAxes::z
HCalSD::hzvem
TH1F * hzvem
Definition: HCalSD.h:114
HFDarkening::numberOfZLayers
static const unsigned int numberOfZLayers
Definition: HFDarkening.h:24
edm::ESHandle
Definition: DTSurvey.h:22
HCalSD::update
void update(const BeginOfJob *) override
This routine will be called when the appropriate signal arrives.
Definition: HCalSD.cc:557
HcalOuter
Definition: HcalAssistant.h:35
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
CaloSD::processHit
void processHit(const G4Step *step)
Definition: CaloSD.h:103
HCalSD::initRun
void initRun() override
Definition: HCalSD.cc:559
HCalSD::birk1
double birk1
Definition: HCalSD.h:100
BeginOfJob
Definition: BeginOfJob.h:8
HcalSimulationParameters.h
EDM_ML_DEBUG
#define EDM_ML_DEBUG
Definition: HcalHBHEMuonSimAnalyzer.cc:41
HCalSD::filterHit
bool filterHit(CaloG4Hit *, double) override
Definition: HCalSD.cc:561
CaloSD::currentID
CaloHitID currentID
Definition: CaloSD.h:131
HcalDDDSimConstants::maxHFDepth
int maxHFDepth(const int &ieta, const int &iphi) const
Definition: HcalDDDSimConstants.cc:655
HCalSD::hcalSimConstants_
const HcalDDDSimulationConstants * hcalSimConstants_
Definition: HCalSD.h:90
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HCalSD::modifyDepth
void modifyDepth(HcalNumberingFromDDD::HcalID &id)
Definition: HCalSD.cc:1043
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
CaloSD::energyCut
double energyCut
Definition: CaloSD.h:133
HCalSD::useHF
bool useHF
Definition: HCalSD.h:101
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
TFileService.h
math::XYZVectorD
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
HCalSD::readWeightFromFile
void readWeightFromFile(const std::string &)
Definition: HCalSD.cc:928
HCalSD::hfLV
std::vector< const G4LogicalVolume * > hfLV
Definition: HCalSD.h:112
HCalSD::eminHitHF
double eminHitHF
Definition: HCalSD.h:102
HCalSD::useParam
bool useParam
Definition: HCalSD.h:101
funct::true
true
Definition: Factorize.h:173
HCalSD::eminHitHE
double eminHitHE
Definition: HCalSD.h:102
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
edm::ParameterSet
Definition: ParameterSet.h:36
HcalDDDSimConstants::getLayer0Wt
double getLayer0Wt(const int &det, const int &phi, const int &zside) const
Definition: HcalDDDSimConstants.cc:361
HcalSimulationParameters::hfFibreConicalNames_
std::vector< std::string > hfFibreConicalNames_
Definition: HcalSimulationParameters.h:26
HcalTestNumbering::packHcalIndex
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
Definition: HcalTestNumbering.cc:7
HCalSD::isItConicalBundle
bool isItConicalBundle(const G4LogicalVolume *)
Definition: HCalSD.cc:660
edm::LogError
Definition: MessageLogger.h:183
HCalSD::numberingFromDDD
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
Definition: HCalSD.h:81
HcalTestNumberingScheme
Definition: HcalTestNumberingScheme.h:11
ParameterSet
Definition: Functions.h:16
HCalSD::time_
TH1F * time_[9]
Definition: HCalSD.h:114
ke
int ke
Definition: CascadeWrapper.h:13
HCalSD::showerBundle
std::unique_ptr< HFShowerFibreBundle > showerBundle
Definition: HCalSD.h:87
GeV
const double GeV
Definition: MathUtil.h:16
CaloSD::kmaxNeutron
double kmaxNeutron
Definition: CaloSD.h:138
HCalSD::hitForFibre
void hitForFibre(const G4Step *step)
Definition: HCalSD.cc:735
HcalDetId.h
HcalSimulationParameters::hcalMaterialNames_
std::vector< std::string > hcalMaterialNames_
Definition: HcalSimulationParameters.h:27
recoMuon::in
Definition: RecoMuonEnumerators.h:6
HCalSD::isItHF
bool isItHF(const G4Step *)
Definition: HCalSD.cc:607
HCalSD::hcalConstants_
const HcalDDDSimConstants * hcalConstants_
Definition: HCalSD.h:89
HCalSD::agingFlagHB
bool agingFlagHB
Definition: HCalSD.h:97
TrackInformation
Definition: TrackInformation.h:8
HCalSD::showerLibrary
std::unique_ptr< HFShowerLibrary > showerLibrary
Definition: HCalSD.h:83
HFDarkening::lowZLimit
static const unsigned int lowZLimit
Definition: HFDarkening.h:27
HcalDetId
Definition: HcalDetId.h:12
edm::Service< TFileService >
createfilelist.int
int
Definition: createfilelist.py:10
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
HCalSD::isItScintillator
bool isItScintillator(const G4Material *)
Definition: HCalSD.cc:668
value
Definition: value.py:1
edm::LogVerbatim
Definition: MessageLogger.h:297
CaloSD::resetForNewPrimary
void resetForNewPrimary(const G4Step *)
Definition: CaloSD.cc:422
HCalSD::fibreNames
std::vector< std::string > fibreNames
Definition: HCalSD.h:109
HCalSD::hfshower
std::unique_ptr< HFShower > hfshower
Definition: HCalSD.h:84
edm::EventSetup
Definition: EventSetup.h:57
TrackInformation.h
CaloG4Hit
Definition: CaloG4Hit.h:32
HCalSD::dist_
TH1F * dist_[9]
Definition: HCalSD.h:114
HCalSD::gpar
std::vector< double > gpar
Definition: HCalSD.h:106
HCalSD::useFibreBundle
bool useFibreBundle
Definition: HCalSD.h:98
HCalSD::m_HFDarkening
std::unique_ptr< HFDarkening > m_HFDarkening
Definition: HCalSD.h:93
get
#define get
HCalSD::fibre2LV
std::vector< const G4LogicalVolume * > fibre2LV
Definition: HCalSD.h:112
HCalSD::betaThr
double betaThr
Definition: HCalSD.h:100
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
HcalNumberingScheme
Definition: HcalNumberingScheme.h:13
HCalSD.h
generator_cfi.scheme
scheme
Definition: generator_cfi.py:22
alignCSCRings.r
r
Definition: alignCSCRings.py:93
compare.tfile
tfile
Definition: compare.py:325
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
HcalForward
Definition: HcalAssistant.h:36
DDAxes::phi
HCalSD::setNumberingScheme
void setNumberingScheme(HcalNumberingScheme *)
Definition: HCalSD.cc:550
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HCalSD::plotHF
void plotHF(const G4ThreeVector &pos, bool emType)
Definition: HCalSD.cc:1032
HCalSD::usePMTHit
bool usePMTHit
Definition: HCalSD.h:98
HCalSD::eminHitHB
double eminHitHB
Definition: HCalSD.h:102
G4TrackToParticleID.h
type
type
Definition: HCALResponse.h:21
HCalSD::plotProfile
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:972
HCalSD::materials
std::vector< const G4Material * > materials
Definition: HCalSD.h:111
CaloSD::getNumberOfHits
int getNumberOfHits()
Definition: CaloSD.cc:343
G4TrackToParticleID::isStableHadronIon
static bool isStableHadronIon(const G4Track *)
Definition: G4TrackToParticleID.cc:40
HCalSD::getFromLibrary
bool getFromLibrary(const G4Step *) override
Definition: HCalSD.cc:349
HBHEDarkening::degradation
float degradation(float intlumi, int ieta, int lay) const
Definition: HBHEDarkening.cc:98
HcalEndcap
Definition: HcalAssistant.h:34
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
HCalSD::setDetUnitId
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:538
CaloSD::setParameterized
void setParameterized(bool val)
Definition: CaloSD.h:100
HCalSD::showerPMT
std::unique_ptr< HFShowerPMT > showerPMT
Definition: HCalSD.h:86
HCalSD::useShowerLibrary
bool useShowerLibrary
Definition: HCalSD.h:101
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:246
HCalSD::birk2
double birk2
Definition: HCalSD.h:100
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
HCalSD::isItFibre
bool isItFibre(const G4LogicalVolume *)
Definition: HCalSD.cc:628
pdg
Definition: pdg_functions.h:28
Exception.h
HFDarkening::upperZLimit
static const unsigned int upperZLimit
Definition: HFDarkening.h:28
timingPdfMaker.infile
infile
Definition: timingPdfMaker.py:350
HcalDDDSimConstants::getMaxDepth
int getMaxDepth(const int &type) const
Definition: HcalDDDSimConstants.h:53
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
HCalSD::matNames
std::vector< std::string > matNames
Definition: HCalSD.h:110
HCalSD::testNumber
bool testNumber
Definition: HCalSD.h:99
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HcalSimulationParameters::hfNames_
std::vector< std::string > hfNames_
Definition: HcalSimulationParameters.h:22
HcalDetId::ietaAbs
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
HCalSD::hzvhad
TH1F * hzvhad
Definition: HCalSD.h:114
HcalDetId::zside
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
HCalSD::fillLogVolumeVector
void fillLogVolumeVector(const std::string &, const std::vector< std::string > &, std::vector< const G4LogicalVolume * > &)
Definition: HCalSD.cc:324
ntuplemaker.time
time
Definition: ntuplemaker.py:310
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
HcalTestNumberingScheme.h
HCalSD::m_HEDarkening
const HBHEDarkening * m_HEDarkening
Definition: HCalSD.h:92
CaloSD::suppressHeavy
bool suppressHeavy
Definition: CaloSD.h:137
HcalSimNumberingRecord
Definition: HcalSimNumberingRecord.h:25
HCalSD::showerParam
std::unique_ptr< HFShowerParam > showerParam
Definition: HCalSD.h:85
HCalSD::weight_
double weight_
Definition: HCalSD.h:104
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
cuy.ii
ii
Definition: cuy.py:590
HCalSD::useLayerWt
bool useLayerWt
Definition: HCalSD.h:98
CaloSD
Definition: CaloSD.h:38
jets_cff.levels
levels
Definition: jets_cff.py:23
HCalSD::deliveredLumi
double deliveredLumi
Definition: HCalSD.h:103
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
HCalSD::birk3
double birk3
Definition: HCalSD.h:100
HCalSD::numberingScheme
std::unique_ptr< HcalNumberingScheme > numberingScheme
Definition: HCalSD.h:82