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