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