CMS 3D CMS Logo

DreamSD.cc
Go to the documentation of this file.
10 
11 #include "G4LogicalVolume.hh"
12 #include "G4LogicalVolumeStore.hh"
13 #include "G4Poisson.hh"
14 #include "G4Step.hh"
15 #include "G4Track.hh"
16 #include "G4VProcess.hh"
17 
18 // Histogramming
20 
21 // Cherenkov
24 
25 #include "G4PhysicalConstants.hh"
26 #include "G4SystemOfUnits.hh"
27 
28 //#define EDM_ML_DEBUG
29 
30 //________________________________________________________________________________________
32  const DDCompactView *cpvDDD,
33  const cms::DDCompactView *cpvDD4hep,
34  const SensitiveDetectorCatalog &clg,
35  edm::ParameterSet const &p,
36  const SimTrackManager *manager)
37  : CaloSD(name, clg, p, manager), cpvDDD_(cpvDDD), cpvDD4hep_(cpvDD4hep) {
38  edm::ParameterSet m_EC = p.getParameter<edm::ParameterSet>("ECalSD");
39  useBirk_ = m_EC.getParameter<bool>("UseBirkLaw");
40  doCherenkov_ = m_EC.getParameter<bool>("doCherenkov");
41  birk1_ = m_EC.getParameter<double>("BirkC1") * (CLHEP::g / (CLHEP::MeV * CLHEP::cm2));
42  birk2_ = m_EC.getParameter<double>("BirkC2");
43  birk3_ = m_EC.getParameter<double>("BirkC3");
44  slopeLY_ = m_EC.getParameter<double>("SlopeLightYield");
45  readBothSide_ = m_EC.getUntrackedParameter<bool>("ReadBothSide", false);
46  dd4hep_ = p.getParameter<bool>("g4GeometryDD4hepSource");
47 
48  chAngleIntegrals_.reset(nullptr);
49 
50  edm::LogVerbatim("EcalSim") << "Constructing a DreamSD with name " << GetName()
51  << "\nDreamSD:: Use of Birks law is set to " << useBirk_
52  << " with three constants kB = " << birk1_ << ", C1 = " << birk2_ << ", C2 = " << birk3_
53  << "\n Slope for Light yield is set to " << slopeLY_
54  << "\n Parameterization of Cherenkov is set to " << doCherenkov_
55  << ", readout both sides is " << readBothSide_ << " and dd4hep flag " << dd4hep_;
56 #ifdef EDM_ML_DEBUG
57  edm::LogVerbatim("EcalSim") << GetName() << " initialized";
58  const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
59  unsigned int k(0);
60  for (auto lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite, ++k)
61  edm::LogVerbatim("EcalSim") << "Volume[" << k << "] " << (*lvcite)->GetName();
62 #endif
63  initMap(name);
64 }
65 
66 //________________________________________________________________________________________
67 double DreamSD::getEnergyDeposit(const G4Step *aStep) {
68  // take into account light collection curve for crystals
69  double weight = curve_LY(aStep, side_);
70  if (useBirk_)
72  double edep = aStep->GetTotalEnergyDeposit() * weight;
73 
74  // Get Cerenkov contribution
75  if (doCherenkov_) {
76  edep += cherenkovDeposit_(aStep);
77  }
78 #ifdef EDM_ML_DEBUG
79  edm::LogVerbatim("EcalSim") << "DreamSD:: " << aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() << " Side "
80  << side_ << " Light Collection Efficiency " << weight << " Weighted Energy Deposit "
81  << edep / CLHEP::MeV << " MeV";
82 #endif
83  return edep;
84 }
85 
86 //________________________________________________________________________________________
88  // Get the material and set properties if needed
89  DimensionMap::const_iterator ite = xtalLMap_.begin();
90  const G4LogicalVolume *lv = (ite->first);
91  G4Material *material = lv->GetMaterial();
92 #ifdef EDM_ML_DEBUG
93  edm::LogVerbatim("EcalSim") << "DreamSD::initRun: Initializes for material " << material->GetName() << " in "
94  << lv->GetName();
95 #endif
96  materialPropertiesTable_ = material->GetMaterialPropertiesTable();
98  if (!setPbWO2MaterialProperties_(material)) {
99  edm::LogWarning("EcalSim") << "Couldn't retrieve material properties table\n Material = " << material->GetName();
100  }
101  materialPropertiesTable_ = material->GetMaterialPropertiesTable();
102  }
103 }
104 
105 //________________________________________________________________________________________
106 uint32_t DreamSD::setDetUnitId(const G4Step *aStep) {
107  const G4VTouchable *touch = aStep->GetPreStepPoint()->GetTouchable();
108  uint32_t id = (touch->GetReplicaNumber(1)) * 10 + (touch->GetReplicaNumber(0));
109  side_ = readBothSide_ ? -1 : 1;
110  if (side_ < 0) {
111  ++id;
112  }
113 #ifdef EDM_ML_DEBUG
114  edm::LogVerbatim("EcalSim") << "DreamSD:: ID " << id;
115 #endif
116  return id;
117 }
118 
119 //________________________________________________________________________________________
120 void DreamSD::initMap(const std::string &sd) {
121  if (dd4hep_) {
122  const cms::DDFilter filter("ReadOutName", sd);
124  while (fv.firstChild()) {
125  std::string name = static_cast<std::string>(dd4hep::dd::noNamespace(fv.name()));
126  std::vector<double> paras(fv.parameters());
127 #ifdef EDM_ML_DEBUG
128  edm::LogVerbatim("EcalSim") << "DreamSD::initMap (for " << sd << "): Solid " << name << " Shape "
129  << cms::dd::name(cms::DDSolidShapeMap, fv.shape()) << " Parameter 0 = " << paras[0];
130 #endif
131  // Set length to be the largest size, width the smallest
132  std::sort(paras.begin(), paras.end());
133  double length = 2.0 * k_ScaleFromDD4hepToG4 * paras.back();
134  double width = 2.0 * k_ScaleFromDD4hepToG4 * paras.front();
135  fillMap(name, length, width);
136  }
137  } else {
138  DDSpecificsMatchesValueFilter filter{DDValue("ReadOutName", sd, 0)};
139  DDFilteredView fv((*cpvDDD_), filter);
140  fv.firstChild();
141  bool dodet = true;
142  while (dodet) {
143  const DDSolid &sol = fv.logicalPart().solid();
144  std::vector<double> paras(sol.parameters());
145  std::string name = static_cast<std::string>(sol.name().name());
146 #ifdef EDM_ML_DEBUG
147  edm::LogVerbatim("EcalSim") << "DreamSD::initMap (for " << sd << "): Solid " << name << " Shape " << sol.shape()
148  << " Parameter 0 = " << paras[0];
149 #endif
150  // Set length to be the largest size, width the smallest
151  std::sort(paras.begin(), paras.end());
152  double length = 2.0 * k_ScaleFromDDDToG4 * paras.back();
153  double width = 2.0 * k_ScaleFromDDDToG4 * paras.front();
154  fillMap(name, length, width);
155  dodet = fv.next();
156  }
157  }
158 #ifdef EDM_ML_DEBUG
159  edm::LogVerbatim("EcalSim") << "DreamSD: Length Table for ReadOutName = " << sd << ":";
160 #endif
161  DimensionMap::const_iterator ite = xtalLMap_.begin();
162  int i = 0;
163  for (; ite != xtalLMap_.end(); ite++, i++) {
164  G4String name = "Unknown";
165  if (ite->first != nullptr)
166  name = (ite->first)->GetName();
167 #ifdef EDM_ML_DEBUG
168  edm::LogVerbatim("EcalSim") << " " << i << " " << ite->first << " " << name << " L = " << ite->second.first
169  << " W = " << ite->second.second;
170 #endif
171  }
172 }
173 
174 //________________________________________________________________________________________
175 void DreamSD::fillMap(const std::string &name, double length, double width) {
176  const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
177  edm::LogVerbatim("EcalSim") << "LV Store with " << lvs->size() << " elements";
178  G4LogicalVolume *lv = nullptr;
179  for (auto lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
180  edm::LogVerbatim("EcalSim") << name << " vs " << (*lvcite)->GetName();
181  std::string namex = static_cast<std::string>((*lvcite)->GetName());
182  if (name == static_cast<std::string>(dd4hep::dd::noNamespace(namex))) {
183  lv = (*lvcite);
184  break;
185  }
186  }
187 #ifdef EDM_ML_DEBUG
188  edm::LogVerbatim("EcalSim") << "DreamSD::fillMap (for " << name << " Logical Volume " << lv << " Length " << length
189  << " Width " << width;
190 #endif
191  xtalLMap_.insert(std::pair<G4LogicalVolume *, Doubles>(lv, Doubles(length, width)));
192 }
193 
194 //________________________________________________________________________________________
195 double DreamSD::curve_LY(const G4Step *aStep, int flag) {
196  auto const stepPoint = aStep->GetPreStepPoint();
197  auto const lv = stepPoint->GetTouchable()->GetVolume(0)->GetLogicalVolume();
198  G4String nameVolume = lv->GetName();
199 
200  double weight = 1.;
201  G4ThreeVector localPoint = setToLocal(stepPoint->GetPosition(), stepPoint->GetTouchable());
202  double crlength = crystalLength(lv);
203  double localz = localPoint.x();
204  double dapd = 0.5 * crlength - flag * localz; // Distance from closest APD
205  if (dapd >= -0.1 || dapd <= crlength + 0.1) {
206  if (dapd <= 100.)
207  weight = 1.0 + slopeLY_ - dapd * 0.01 * slopeLY_;
208  } else {
209  edm::LogWarning("EcalSim") << "DreamSD: light coll curve : wrong distance "
210  << "to APD " << dapd << " crlength = " << crlength << " crystal name = " << nameVolume
211  << " z of localPoint = " << localz << " take weight = " << weight;
212  }
213 #ifdef EDM_ML_DEBUG
214  edm::LogVerbatim("EcalSim") << "DreamSD, light coll curve : " << dapd << " crlength = " << crlength
215  << " crystal name = " << nameVolume << " z of localPoint = " << localz
216  << " take weight = " << weight;
217 #endif
218  return weight;
219 }
220 
221 //________________________________________________________________________________________
222 double DreamSD::crystalLength(G4LogicalVolume *lv) const {
223  double length = -1.;
224  DimensionMap::const_iterator ite = xtalLMap_.find(lv);
225  if (ite != xtalLMap_.end())
226  length = ite->second.first;
227  return length;
228 }
229 
230 //________________________________________________________________________________________
231 double DreamSD::crystalWidth(G4LogicalVolume *lv) const {
232  double width = -1.;
233  DimensionMap::const_iterator ite = xtalLMap_.find(lv);
234  if (ite != xtalLMap_.end())
235  width = ite->second.second;
236  return width;
237 }
238 
239 //________________________________________________________________________________________
240 // Calculate total cherenkov deposit
241 // Inspired by Geant4's Cherenkov implementation
242 double DreamSD::cherenkovDeposit_(const G4Step *aStep) {
243  double cherenkovEnergy = 0;
245  return cherenkovEnergy;
246  G4Material *material = aStep->GetTrack()->GetMaterial();
247 
248  // Retrieve refractive index
249  G4MaterialPropertyVector *Rindex = materialPropertiesTable_->GetProperty("RINDEX");
250  if (Rindex == nullptr) {
251  edm::LogWarning("EcalSim") << "Couldn't retrieve refractive index";
252  return cherenkovEnergy;
253  }
254 
255  // V.Ivanchenko - temporary close log output for 9.5
256  // Material refraction properties
257  int Rlength = Rindex->GetVectorLength() - 1;
258  double Pmin = Rindex->Energy(0);
259  double Pmax = Rindex->Energy(Rlength);
260 #ifdef EDM_ML_DEBUG
261  edm::LogVerbatim("EcalSim") << "Material properties: \n Pmin = " << Pmin << " Pmax = " << Pmax;
262 #endif
263  // Get particle properties
264  const G4StepPoint *pPreStepPoint = aStep->GetPreStepPoint();
265  const G4StepPoint *pPostStepPoint = aStep->GetPostStepPoint();
266  const G4ThreeVector &x0 = pPreStepPoint->GetPosition();
267  G4ThreeVector p0 = aStep->GetDeltaPosition().unit();
268  const G4DynamicParticle *aParticle = aStep->GetTrack()->GetDynamicParticle();
269  const double charge = aParticle->GetDefinition()->GetPDGCharge();
270  // beta is averaged over step
271  double beta = 0.5 * (pPreStepPoint->GetBeta() + pPostStepPoint->GetBeta());
272  double BetaInverse = 1.0 / beta;
273 
274 #ifdef EDM_ML_DEBUG
275  edm::LogVerbatim("EcalSim") << "Particle properties: \n charge = " << charge << " beta = " << beta;
276 #endif
277 
278  // Now get number of photons generated in this step
279  double meanNumberOfPhotons = getAverageNumberOfPhotons_(charge, beta, material, Rindex);
280  if (meanNumberOfPhotons <= 0.0) { // Don't do anything
281 #ifdef EDM_ML_DEBUG
282  edm::LogVerbatim("EcalSim") << "Mean number of photons is zero: " << meanNumberOfPhotons << ", stopping here";
283 #endif
284  return cherenkovEnergy;
285  }
286 
287  // number of photons is in unit of Geant4...
288  meanNumberOfPhotons *= aStep->GetStepLength();
289 
290  // Now get a poisson distribution
291  int numPhotons = static_cast<int>(G4Poisson(meanNumberOfPhotons));
292  // edm::LogVerbatim("EcalSim") << "Number of photons = " << numPhotons;
293  if (numPhotons <= 0) {
294 #ifdef EDM_ML_DEBUG
295  edm::LogVerbatim("EcalSim") << "Poission number of photons is zero: " << numPhotons << ", stopping here";
296 #endif
297  return cherenkovEnergy;
298  }
299 
300  // Material refraction properties
301  double dp = Pmax - Pmin;
302  double maxCos = BetaInverse / (*Rindex)[Rlength];
303  double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
304 
305  // Finally: get contribution of each photon
306  for (int iPhoton = 0; iPhoton < numPhotons; ++iPhoton) {
307  // Determine photon momentum
308  double randomNumber;
309  double sampledMomentum, sampledRI;
310  double cosTheta, sin2Theta;
311 
312  // sample a momentum (not sure why this is needed!)
313  do {
314  randomNumber = G4UniformRand();
315  sampledMomentum = Pmin + randomNumber * dp;
316  sampledRI = Rindex->Value(sampledMomentum);
317  cosTheta = BetaInverse / sampledRI;
318 
319  sin2Theta = (1.0 - cosTheta) * (1.0 + cosTheta);
320  randomNumber = G4UniformRand();
321 
322  } while (randomNumber * maxSin2 > sin2Theta);
323 
324  // Generate random position of photon on cone surface
325  // defined by Theta
326  randomNumber = G4UniformRand();
327 
328  double phi = twopi * randomNumber;
329  double sinPhi = sin(phi);
330  double cosPhi = cos(phi);
331 
332  // Create photon momentum direction vector
333  // The momentum direction is still w.r.t. the coordinate system where the
334  // primary particle direction is aligned with the z axis
335  double sinTheta = sqrt(sin2Theta);
336  double px = sinTheta * cosPhi;
337  double py = sinTheta * sinPhi;
338  double pz = cosTheta;
339  G4ThreeVector photonDirection(px, py, pz);
340 
341  // Rotate momentum direction back to global (crystal) reference system
342  photonDirection.rotateUz(p0);
343 
344  // Create photon position and momentum
345  randomNumber = G4UniformRand();
346  G4ThreeVector photonPosition = x0 + randomNumber * aStep->GetDeltaPosition();
347  G4ThreeVector photonMomentum = sampledMomentum * photonDirection;
348 
349  // Collect energy on APD
350  cherenkovEnergy += getPhotonEnergyDeposit_(photonMomentum, photonPosition, aStep);
351  }
352  return cherenkovEnergy;
353 }
354 
355 //________________________________________________________________________________________
356 // Returns number of photons produced per GEANT-unit (millimeter) in the current
357 // medium. From G4Cerenkov.cc
359  const double beta,
360  const G4Material *aMaterial,
361  const G4MaterialPropertyVector *Rindex) {
362  const double rFact = 369.81 / (eV * cm);
363 
364  if (beta <= 0.0)
365  return 0.0;
366 
367  double BetaInverse = 1. / beta;
368 
369  // Vectors used in computation of Cerenkov Angle Integral:
370  // - Refraction Indices for the current material
371  // - new G4PhysicsOrderedFreeVector allocated to hold CAI's
372 
373  // Min and Max photon momenta
374  int Rlength = Rindex->GetVectorLength() - 1;
375  double Pmin = Rindex->Energy(0);
376  double Pmax = Rindex->Energy(Rlength);
377 
378  // Min and Max Refraction Indices
379  double nMin = (*Rindex)[0];
380  double nMax = (*Rindex)[Rlength];
381 
382  // Max Cerenkov Angle Integral
383  double CAImax = chAngleIntegrals_.get()->GetMaxEnergy();
384 
385  double dp = 0., ge = 0., CAImin = 0.;
386 
387  // If n(Pmax) < 1/Beta -- no photons generated
388  if (nMax < BetaInverse) {
389  }
390 
391  // otherwise if n(Pmin) >= 1/Beta -- photons generated
392  else if (nMin > BetaInverse) {
393  dp = Pmax - Pmin;
394  ge = CAImax;
395  }
396  // If n(Pmin) < 1/Beta, and n(Pmax) >= 1/Beta, then
397  // we need to find a P such that the value of n(P) == 1/Beta.
398  // Interpolation is performed by the GetPhotonEnergy() and
399  // GetProperty() methods of the G4MaterialPropertiesTable and
400  // the GetValue() method of G4PhysicsVector.
401  else {
402  Pmin = Rindex->Value(BetaInverse);
403  dp = Pmax - Pmin;
404  // need boolean for current implementation of G4PhysicsVector
405  // ==> being phased out
406  double CAImin = chAngleIntegrals_->Value(Pmin);
407  ge = CAImax - CAImin;
408  }
409 
410  // Calculate number of photons
411  double numPhotons = rFact * charge / eplus * charge / eplus * (dp - ge * BetaInverse * BetaInverse);
412 
413  edm::LogVerbatim("EcalSim") << "@SUB=getAverageNumberOfPhotons\nCAImin = " << CAImin << "\nCAImax = " << CAImax
414  << "\ndp = " << dp << ", ge = " << ge << "\nnumPhotons = " << numPhotons;
415  return numPhotons;
416 }
417 
418 //________________________________________________________________________________________
419 // Set lead tungstate material properties on the fly.
420 // Values from Ts42 detector construction
421 bool DreamSD::setPbWO2MaterialProperties_(G4Material *aMaterial) {
422  std::string pbWO2Name("E_PbWO4");
423  std::string name = static_cast<std::string>(aMaterial->GetName());
424  if (static_cast<std::string>(dd4hep::dd::noNamespace(name)) != pbWO2Name) { // Wrong material!
425  edm::LogWarning("EcalSim") << "This is not the right material: "
426  << "expecting " << pbWO2Name << ", got " << aMaterial->GetName();
427  return false;
428  }
429 
430  G4MaterialPropertiesTable *table = new G4MaterialPropertiesTable();
431 
432  // Refractive index as a function of photon momentum
433  // FIXME: Should somehow put that in the configuration
434  const int nEntries = 14;
435  double PhotonEnergy[nEntries] = {1.7712 * eV,
436  1.8368 * eV,
437  1.90745 * eV,
438  1.98375 * eV,
439  2.0664 * eV,
440  2.15625 * eV,
441  2.25426 * eV,
442  2.3616 * eV,
443  2.47968 * eV,
444  2.61019 * eV,
445  2.75521 * eV,
446  2.91728 * eV,
447  3.09961 * eV,
448  3.30625 * eV};
449  double RefractiveIndex[nEntries] = {2.17728,
450  2.18025,
451  2.18357,
452  2.18753,
453  2.19285,
454  2.19813,
455  2.20441,
456  2.21337,
457  2.22328,
458  2.23619,
459  2.25203,
460  2.27381,
461  2.30282,
462  2.34666};
463 
464  table->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex, nEntries);
465  aMaterial->SetMaterialPropertiesTable(table); // FIXME: could this leak? What does G4 do?
466 
467  // Calculate Cherenkov angle integrals:
468  // This is an ad-hoc solution (we hold it in the class, not in the material)
469  chAngleIntegrals_ = std::make_unique<G4PhysicsFreeVector>(nEntries);
470 
471  int index = 0;
472  double currentRI = RefractiveIndex[index];
473  double currentPM = PhotonEnergy[index];
474  double currentCAI = 0.0;
475  chAngleIntegrals_.get()->PutValue(0, currentPM, currentCAI);
476  double prevPM = currentPM;
477  double prevCAI = currentCAI;
478  double prevRI = currentRI;
479  while (++index < nEntries) {
480  currentRI = RefractiveIndex[index];
481  currentPM = PhotonEnergy[index];
482  currentCAI = 0.5 * (1.0 / (prevRI * prevRI) + 1.0 / (currentRI * currentRI));
483  currentCAI = prevCAI + (currentPM - prevPM) * currentCAI;
484 
485  chAngleIntegrals_.get()->PutValue(index, currentPM, currentCAI);
486 
487  prevPM = currentPM;
488  prevCAI = currentCAI;
489  prevRI = currentRI;
490  }
491 
492 #ifdef EDM_ML_DEBUG
493  edm::LogVerbatim("EcalSim") << "Material properties set for " << aMaterial->GetName();
494 #endif
495  return true;
496 }
497 
498 //________________________________________________________________________________________
499 // Calculate energy deposit of a photon on APD
500 // - simple tracing to APD position (straight line);
501 // - configurable reflection probability if not straight to APD;
502 // - APD response function
503 double DreamSD::getPhotonEnergyDeposit_(const G4ThreeVector &p, const G4ThreeVector &x, const G4Step *aStep) {
504  double energy = 0;
505 
506  // Crystal dimensions
507 
508  // edm::LogVerbatim("EcalSim") << p << x;
509 
510  // 1. Check if this photon goes straight to the APD:
511  // - assume that APD is at x=xtalLength/2.0
512  // - extrapolate from x=x0 to x=xtalLength/2.0 using momentum in x-y
513 
514  G4StepPoint *stepPoint = aStep->GetPreStepPoint();
515  G4LogicalVolume *lv = stepPoint->GetTouchable()->GetVolume(0)->GetLogicalVolume();
516  G4String nameVolume = lv->GetName();
517 
518  double crlength = crystalLength(lv);
519  double crwidth = crystalWidth(lv);
520  double dapd = 0.5 * crlength - x.x(); // Distance from closest APD
521  double y = p.y() / p.x() * dapd;
522 
523 #ifdef EDM_ML_DEBUG
524  edm::LogVerbatim("EcalSim") << "Distance to APD: " << dapd << " - y at APD: " << y;
525 #endif
526  // Not straight: compute probability
527  if (std::abs(y) > crwidth * 0.5) {
528  }
529 
530  // 2. Retrieve efficiency for this wavelength (in nm, from MeV)
531  double waveLength = p.mag() * 1.239e8;
532 
533  energy = p.mag() * PMTResponse::getEfficiency(waveLength);
534 #ifdef EDM_ML_DEBUG
535  edm::LogVerbatim("EcalSim") << "Wavelength: " << waveLength << " - Energy: " << energy;
536 #endif
537  return energy;
538 }
const DDCompactView * cpvDDD_
Definition: DreamSD.h:63
Log< level::Info, true > LogVerbatim
double crystalLength(G4LogicalVolume *) const
Definition: DreamSD.cc:222
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static constexpr double k_ScaleFromDD4hepToG4
Definition: DreamSD.h:61
bool readBothSide_
Definition: DreamSD.h:66
double getPhotonEnergyDeposit_(const G4ParticleMomentum &p, const G4ThreeVector &x, const G4Step *aStep)
Returns energy deposit for a given photon.
Definition: DreamSD.cc:503
const cms::DDSolidShape shape() const
Definition: CaloSD.h:40
DimensionMap xtalLMap_
Definition: DreamSD.h:69
std::string name(Mapping a, V value)
Definition: DDSolidShapes.h:31
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void fillMap(const std::string &, double, double)
Definition: DreamSD.cc:175
uint32_t setDetUnitId(const G4Step *) override
Definition: DreamSD.cc:106
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:403
Definition: weight.py:1
bool setPbWO2MaterialProperties_(G4Material *aMaterial)
Sets material properties at run-time...
Definition: DreamSD.cc:421
static constexpr double k_ScaleFromDDDToG4
Definition: DreamSD.h:60
double birk3_
Definition: DreamSD.h:67
bool useBirk_
Definition: DreamSD.h:66
void initRun() override
Definition: DreamSD.cc:87
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
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
double crystalWidth(G4LogicalVolume *) const
Definition: DreamSD.cc:231
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
T getUntrackedParameter(std::string const &, T const &) const
std::string_view name() const
static double getEfficiency(const double &waveLengthNm)
Return efficiency for given photon wavelength (in nm)
Definition: PMTResponse.cc:6
bool next()
set current node to the next node in the filtered tree
double cherenkovDeposit_(const G4Step *aStep)
Returns the total energy due to Cherenkov radiation.
Definition: DreamSD.cc:242
T sqrt(T t)
Definition: SSEVec.h:19
bool dd4hep_
Definition: DreamSD.h:66
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::unique_ptr< G4PhysicsFreeVector > chAngleIntegrals_
Table of Cherenkov angle integrals vs photon momentum.
Definition: DreamSD.h:74
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double getAverageNumberOfPhotons_(const double charge, const double beta, const G4Material *aMaterial, const G4MaterialPropertyVector *rIndex)
Returns average number of photons created by track.
Definition: DreamSD.cc:358
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 21 > DDSolidShapeMap
Definition: DDSolidShapes.h:99
int side_
Definition: DreamSD.h:71
G4MaterialPropertiesTable * materialPropertiesTable_
Definition: DreamSD.h:75
std::pair< double, double > Doubles
Definition: DreamSD.h:39
bool firstChild()
set the current node to the first child
double curve_LY(const G4Step *, int)
Definition: DreamSD.cc:195
double birk2_
Definition: DreamSD.h:67
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
constexpr float sol
Definition: Config.h:48
DreamSD(const std::string &, const DDCompactView *, const cms::DDCompactView *, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
Definition: DreamSD.cc:31
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:666
const cms::DDCompactView * cpvDD4hep_
Definition: DreamSD.h:64
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
double getEnergyDeposit(const G4Step *) override
Definition: DreamSD.cc:67
bool doCherenkov_
Definition: DreamSD.h:66
double birk1_
Definition: DreamSD.h:67
double slopeLY_
Definition: DreamSD.h:68
bool firstChild()
set the current node to the first child ...
void initMap(const std::string &)
Definition: DreamSD.cc:120
float x
Log< level::Warning, false > LogWarning
const std::vector< double > parameters() const
extract shape parameters