CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
ECalSD Class Reference

#include <ECalSD.h>

Inheritance diagram for ECalSD:
CaloSD SensitiveCaloDetector Observer< const BeginOfRun * > Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const EndOfTrack * > Observer< const EndOfEvent * > SensitiveDetector

Public Member Functions

 ECalSD (const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &p, const SimTrackManager *)
 
uint32_t setDetUnitId (const G4Step *) override
 
void setNumberingScheme (EcalNumberingScheme *)
 
 ~ECalSD () override
 
- Public Member Functions inherited from CaloSD
 CaloSD (const std::string &aSDname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
 
void clear () override
 
void clearHits () override
 
void DrawAll () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PCaloHitContainer &, const std::string &) override
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
bool ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *) override
 
G4bool ProcessHits (G4Step *step, G4TouchableHistory *) override
 
void reset () override
 
 ~CaloSD () override
 
- Public Member Functions inherited from SensitiveCaloDetector
 SensitiveCaloDetector (const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
bool isCaloSD () const
 
 SensitiveDetector (const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &, edm::ParameterSet const &p, bool calo)
 
 ~SensitiveDetector () override
 
- Public Member Functions inherited from Observer< const BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack * >
 Observer ()
 
void slotForUpdate (const EndOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent * >
 Observer ()
 
void slotForUpdate (const EndOfEvent * iT)
 
virtual ~Observer ()
 

Protected Member Functions

uint16_t getDepth (const G4Step *) override
 
double getEnergyDeposit (const G4Step *) override
 
int getTrackID (const G4Track *) override
 
- Protected Member Functions inherited from CaloSD
bool checkHit ()
 
CaloG4HitcreateNewHit (const G4Step *, const G4Track *)
 
virtual void endEvent ()
 
virtual bool filterHit (CaloG4Hit *, double)
 
double getAttenuation (const G4Step *aStep, double birk1, double birk2, double birk3) const
 
virtual bool getFromLibrary (const G4Step *step)
 
int getNumberOfHits ()
 
double getResponseWt (const G4Track *)
 
bool hitExists (const G4Step *)
 
virtual void initEvent (const BeginOfEvent *)
 
virtual void initRun ()
 
void processHit (const G4Step *step)
 
void resetForNewPrimary (const G4Step *)
 
void setNumberCheckedHits (int val)
 
void setParameterized (bool val)
 
G4ThreeVector setToGlobal (const G4ThreeVector &, const G4VTouchable *) const
 
G4ThreeVector setToLocal (const G4ThreeVector &, const G4VTouchable *) const
 
virtual int setTrackID (const G4Step *)
 
void setUseMap (bool val)
 
void update (const ::EndOfEvent *) override
 
void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfRun *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void updateHit (CaloG4Hit *)
 
- Protected Member Functions inherited from SensitiveDetector
TrackInformationcmsTrackInformation (const G4Track *aTrack)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point) const
 
Local3DPoint FinalStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint InitialStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint LocalPostStepPosition (const G4Step *step) const
 
Local3DPoint LocalPreStepPosition (const G4Step *step) const
 
void NaNTrap (const G4Step *step) const
 
void setNames (const std::vector< std::string > &)
 
- Protected Member Functions inherited from Observer< const EndOfEvent * >
virtual void update (const EndOfEvent *)=0
 This routine will be called when the appropriate signal arrives. More...
 

Private Member Functions

double curve_LY (const G4LogicalVolume *)
 
void getBaseNumber (const G4Step *)
 
double getBirkL3 (const G4Step *)
 
uint16_t getLayerIDForTimeSim ()
 
uint16_t getRadiationLength (const G4StepPoint *hitPoint, const G4LogicalVolume *lv)
 
void initMap ()
 

Private Attributes

EnergyResolutionVsLumi ageing
 
bool ageingWithSlopeLY
 
double birk1
 
double birk2
 
double birk3
 
double birkCut
 
double birkSlope
 
double crystalDepth
 
double crystalLength
 
std::string crystalMat
 
G4ThreeVector currentLocalPoint
 
uint16_t depth
 
std::string depth1Name
 
std::string depth2Name
 
const EcalSimulationParametersecalSimParameters_
 
std::vector< const G4LogicalVolume * > noWeight
 
EcalNumberingSchemenumberingScheme_
 
double scaleRL
 
double slopeLY
 
bool storeLayerTimeSim
 
bool storeRL
 
bool storeTrack
 
EcalBaseNumber theBaseNumber
 
bool useBirk
 
bool useBirkL3
 
std::vector< const G4LogicalVolume * > useDepth1
 
std::vector< const G4LogicalVolume * > useDepth2
 
bool useWeight
 
std::map< const G4LogicalVolume *, double > xtalLMap
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Protected Attributes inherited from CaloSD
CaloG4HitcurrentHit
 
CaloHitID currentID
 
float edepositEM
 
float edepositHAD
 
double eminHit
 
double energyCut
 
G4ThreeVector entranceLocal
 
G4ThreeVector entrancePoint
 
bool forceSave
 
float incidentEnergy
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
G4ThreeVector posGlobal
 
CaloHitID previousID
 
bool suppressHeavy
 
double tmaxHit
 

Detailed Description

Definition at line 30 of file ECalSD.h.

Constructor & Destructor Documentation

◆ ECalSD()

ECalSD::ECalSD ( const std::string &  name,
const edm::EventSetup es,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 38 of file ECalSD.cc.

43  : CaloSD(name,
44  es,
45  clg,
46  p,
47  manager,
48  (float)(p.getParameter<edm::ParameterSet>("ECalSD").getParameter<double>("TimeSliceUnit")),
49  p.getParameter<edm::ParameterSet>("ECalSD").getParameter<bool>("IgnoreTrackID")),
50  ecalSimParameters_(nullptr),
51  numberingScheme_(nullptr) {
52  // static SimpleConfigurable<bool> on1(false, "ECalSD:UseBirkLaw");
53  // static SimpleConfigurable<double> bk1(0.00463,"ECalSD:BirkC1");
54  // static SimpleConfigurable<double> bk2(-0.03, "ECalSD:BirkC2");
55  // static SimpleConfigurable<double> bk3(1.0, "ECalSD:BirkC3");
56  // Values from NIM A484 (2002) 239-244: as implemented in Geant3
57  // useBirk = on1.value();
58  // birk1 = bk1.value()*(g/(MeV*cm2));
59  // birk2 = bk2.value()*(g/(MeV*cm2))*(g/(MeV*cm2));
60  edm::ParameterSet m_EC = p.getParameter<edm::ParameterSet>("ECalSD");
61  useBirk = m_EC.getParameter<bool>("UseBirkLaw");
62  useBirkL3 = m_EC.getParameter<bool>("BirkL3Parametrization");
63  birk1 = m_EC.getParameter<double>("BirkC1") * (g / (MeV * cm2));
64  birk2 = m_EC.getParameter<double>("BirkC2");
65  birk3 = m_EC.getParameter<double>("BirkC3");
66  birkSlope = m_EC.getParameter<double>("BirkSlope");
67  birkCut = m_EC.getParameter<double>("BirkCut");
68  slopeLY = m_EC.getParameter<double>("SlopeLightYield");
69  storeTrack = m_EC.getParameter<bool>("StoreSecondary");
70  crystalMat = m_EC.getUntrackedParameter<std::string>("XtalMat", "E_PbWO4");
71  bool isItTB = m_EC.getUntrackedParameter<bool>("TestBeam", false);
72  bool nullNS = m_EC.getUntrackedParameter<bool>("NullNumbering", false);
73  storeRL = m_EC.getUntrackedParameter<bool>("StoreRadLength", false);
74  scaleRL = m_EC.getUntrackedParameter<double>("ScaleRadLength", 1.0);
75 
76  //Changes for improved timing simulation
77  storeLayerTimeSim = m_EC.getUntrackedParameter<bool>("StoreLayerTimeSim", false);
78 
79  ageingWithSlopeLY = m_EC.getUntrackedParameter<bool>("AgeingWithSlopeLY", false);
81  ageing.setLumies(p.getParameter<edm::ParameterSet>("ECalSD").getParameter<double>("DelivLuminosity"),
82  p.getParameter<edm::ParameterSet>("ECalSD").getParameter<double>("InstLuminosity"));
83 
85  es.get<IdealGeometryRecord>().get(name, esp);
86  if (esp.isValid()) {
88  } else {
89  edm::LogError("EcalSim") << "ECalSD : Cannot find EcalSimulationParameters for " << name;
90  throw cms::Exception("Unknown", "ECalSD") << "Cannot find EcalSimulationParameters for " << name << "\n";
91  }
92 
93  // Use of Weight
95 #ifdef EDM_ML_DEBUG
96  edm::LogVerbatim("EcalSim") << "ECalSD:: useWeight " << useWeight;
97 #endif
100 #ifdef EDM_ML_DEBUG
101  edm::LogVerbatim("EcalSim") << "Names (Depth 1):" << depth1Name << " (Depth 2):" << depth2Name << std::endl;
102 #endif
103  EcalNumberingScheme* scheme = nullptr;
104  if (nullNS) {
105  scheme = nullptr;
106  } else if (name == "EcalHitsEB") {
107  scheme = dynamic_cast<EcalNumberingScheme*>(new EcalBarrelNumberingScheme());
108  } else if (name == "EcalHitsEE") {
109  scheme = dynamic_cast<EcalNumberingScheme*>(new EcalEndcapNumberingScheme());
110  } else if (name == "EcalHitsES") {
111  if (isItTB)
112  scheme = dynamic_cast<EcalNumberingScheme*>(new ESTBNumberingScheme());
113  else
114  scheme = dynamic_cast<EcalNumberingScheme*>(new EcalPreshowerNumberingScheme());
115  useWeight = false;
116  } else {
117  edm::LogWarning("EcalSim") << "ECalSD: ReadoutName not supported";
118  }
119 
120  if (scheme)
122 #ifdef EDM_ML_DEBUG
123  edm::LogVerbatim("EcalSim") << "Constructing a ECalSD with name " << GetName();
124 #endif
125  if (useWeight) {
126  edm::LogVerbatim("EcalSim") << "ECalSD:: Use of Birks law is set to " << useBirk
127  << " with three constants kB = " << birk1 << ", C1 = " << birk2
128  << ", C2 = " << birk3 << "\n Use of L3 parametrization " << useBirkL3
129  << " with slope " << birkSlope << " and cut off " << birkCut << "\n"
130  << " Slope for Light yield is set to " << slopeLY;
131  } else {
132  edm::LogVerbatim("EcalSim") << "ECalSD:: energy deposit is not corrected "
133  << " by Birk or light yield curve";
134  }
135 
136  edm::LogVerbatim("EcalSim") << "ECalSD:: Suppression Flag " << suppressHeavy << "\tprotons below " << kmaxProton
137  << " MeV,"
138  << "\tneutrons below " << kmaxNeutron << " MeV"
139  << "\tions below " << kmaxIon << " MeV"
140  << "\n\tDepth1 Name = " << depth1Name << "\tDepth2 Name = " << depth2Name << "\n\tstoreRL"
141  << storeRL << ":" << scaleRL << "\tstoreLayerTimeSim " << storeLayerTimeSim
142  << "\n\ttime Granularity "
143  << p.getParameter<edm::ParameterSet>("ECalSD").getParameter<double>("TimeSliceUnit")
144  << " ns";
145  if (useWeight)
146  initMap();
147 #ifdef plotDebug
149  if (tfile.isAvailable()) {
150  TFileDirectory ecDir = tfile->mkdir("ProfileFromECalSD");
151  static const std::string ctype[4] = {"EB", "EBref", "EE", "EERef"};
152  for (int k = 0; k < 4; ++k) {
153  std::string name = "ECLL_" + ctype[k];
154  std::string title = "Local vs Global for " + ctype[k];
155  double xmin = (k > 1) ? 3000.0 : 1000.0;
156  g2L_[k] = ecDir.make<TH2F>(name.c_str(), title.c_str(), 100, xmin, xmin + 1000., 100, 0.0, 3000.);
157  }
158  } else {
159  for (int k = 0; k < 4; ++k)
160  g2L_[k] = 0;
161  }
162 #endif
163 }

References ageing, ageingWithSlopeLY, birk1, birk2, birk3, birkCut, birkSlope, crystalMat, depth1Name, EcalSimulationParameters::depth1Name_, depth2Name, EcalSimulationParameters::depth2Name_, ecalSimParameters_, Exception, g, edm::EventSetup::get(), get, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), initMap(), edm::ESHandleBase::isValid(), dqmdumpme::k, CaloSD::kmaxIon, CaloSD::kmaxNeutron, CaloSD::kmaxProton, TFileDirectory::make(), MeV, Skims_PA_cff::name, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), scaleRL, generator_cfi::scheme, EnergyResolutionVsLumi::setLumies(), setNumberingScheme(), slopeLY, storeLayerTimeSim, storeRL, storeTrack, AlCaHLTBitMon_QueryRunRegistry::string, CaloSD::suppressHeavy, compare::tfile, overlapproblemtsosanalyzer_cfi::title, useBirk, useBirkL3, useWeight, EcalSimulationParameters::useWeight_, and TrackerOfflineValidation_Dqm_cff::xmin.

◆ ~ECalSD()

ECalSD::~ECalSD ( )
override

Definition at line 165 of file ECalSD.cc.

165 { delete numberingScheme_; }

References numberingScheme_.

Member Function Documentation

◆ curve_LY()

double ECalSD::curve_LY ( const G4LogicalVolume *  lv)
private

Definition at line 392 of file ECalSD.cc.

392  {
393  double weight = 1.;
394  if (ageingWithSlopeLY) {
395  //position along the crystal in mm from 0 to 230 (in EB)
396  if (crystalDepth >= -0.1 || crystalDepth <= crystalLength + 0.1)
398  } else {
399  double dapd = crystalLength - crystalDepth;
400  if (dapd >= -0.1 || dapd <= crystalLength + 0.1) {
401  if (dapd <= 100.)
402  weight = 1.0 + slopeLY - dapd * 0.01 * slopeLY;
403  } else {
404  edm::LogWarning("EcalSim") << "ECalSD: light coll curve : wrong distance "
405  << "to APD " << dapd << " crlength = " << crystalLength
406  << " crystal name = " << lv->GetName()
407  << " z of localPoint = " << currentLocalPoint.z() << " take weight = " << weight;
408  }
409  }
410  return weight;
411 }

References ageing, ageingWithSlopeLY, EnergyResolutionVsLumi::calcLightCollectionEfficiencyWeighted(), crystalDepth, crystalLength, CaloSD::currentID, currentLocalPoint, slopeLY, CaloHitID::unitID(), and mps_merge::weight.

Referenced by getEnergyDeposit().

◆ getBaseNumber()

void ECalSD::getBaseNumber ( const G4Step *  aStep)
private

Definition at line 413 of file ECalSD.cc.

413  {
415  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
416  int theSize = touch->GetHistoryDepth() + 1;
417  if (theBaseNumber.getCapacity() < theSize)
418  theBaseNumber.setSize(theSize);
419  //Get name and copy numbers
420  if (theSize > 1) {
421  for (int ii = 0; ii < theSize; ii++) {
422  theBaseNumber.addLevel(touch->GetVolume(ii)->GetName(), touch->GetReplicaNumber(ii));
423 #ifdef EDM_ML_DEBUG
424  edm::LogVerbatim("EcalSim") << "ECalSD::getBaseNumber(): Adding level " << ii << ": "
425  << touch->GetVolume(ii)->GetName() << "[" << touch->GetReplicaNumber(ii) << "]";
426 #endif
427  }
428  }
429 }

References EcalBaseNumber::addLevel(), EcalBaseNumber::getCapacity(), cuy::ii, EcalBaseNumber::reset(), EcalBaseNumber::setSize(), and theBaseNumber.

Referenced by setDetUnitId().

◆ getBirkL3()

double ECalSD::getBirkL3 ( const G4Step *  aStep)
private

Definition at line 431 of file ECalSD.cc.

431  {
432  double weight = 1.;
433  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
434  double charge = preStepPoint->GetCharge();
435 
436  if (charge != 0. && aStep->GetStepLength() > 0.) {
437  const G4Material* mat = preStepPoint->GetMaterial();
438  double density = mat->GetDensity();
439  double dedx = aStep->GetTotalEnergyDeposit() / aStep->GetStepLength();
440  double rkb = birk1 / density;
441  if (dedx > 0) {
442  weight = 1. - birkSlope * log(rkb * dedx);
443  if (weight < birkCut)
444  weight = birkCut;
445  else if (weight > 1.)
446  weight = 1.;
447  }
448 #ifdef EDM_ML_DEBUG
449  edm::LogVerbatim("EcalSim") << "ECalSD::getBirkL3 in " << mat->GetName() << " Charge " << charge << " dE/dx "
450  << dedx << " Birk Const " << rkb << " Weight = " << weight << " dE "
451  << aStep->GetTotalEnergyDeposit();
452 #endif
453  }
454  return weight;
455 }

References birk1, birkCut, birkSlope, ALCARECOTkAlJpsiMuMu_cff::charge, fastSimProducer_cff::density, dqm-mbProfile::log, and mps_merge::weight.

Referenced by getEnergyDeposit().

◆ getDepth()

uint16_t ECalSD::getDepth ( const G4Step *  aStep)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 225 of file ECalSD.cc.

225  {
226  // this method should be called first at a step
227  const G4StepPoint* hitPoint = aStep->GetPreStepPoint();
228  currentLocalPoint = setToLocal(hitPoint->GetPosition(), hitPoint->GetTouchable());
229  const G4LogicalVolume* lv = hitPoint->GetTouchable()->GetVolume(0)->GetLogicalVolume();
230 
231  auto ite = xtalLMap.find(lv);
232  crystalLength = (ite == xtalLMap.end()) ? 230.0 : std::abs(ite->second);
233  crystalDepth = (ite == xtalLMap.end()) ? 0.0 : (std::abs(0.5 * (ite->second) + currentLocalPoint.z()));
234  depth = any(useDepth1, lv) ? 1 : (any(useDepth2, lv) ? 2 : 0);
235  uint16_t depth1(0), depth2(0);
236  if (storeRL) {
237  depth1 = (ite == xtalLMap.end()) ? 0 : (((ite->second) >= 0) ? 0 : PCaloHit::kEcalDepthRefz);
238  depth2 = getRadiationLength(hitPoint, lv);
239  depth |= (((depth2 & PCaloHit::kEcalDepthMask) << PCaloHit::kEcalDepthOffset) | depth1);
240  } else if (storeLayerTimeSim) {
241  depth2 = getLayerIDForTimeSim();
243  }
244 #ifdef EDM_ML_DEBUG
245  edm::LogVerbatim("EcalSim") << "ECalSD::Depth " << std::hex << depth1 << ":" << depth2 << ":" << depth << std::dec
246  << " L " << (ite == xtalLMap.end()) << ":" << ite->second;
247 #endif
248  return depth;
249 }

References funct::abs(), any(), crystalDepth, crystalLength, currentLocalPoint, TauDecayModes::dec, depth, getLayerIDForTimeSim(), getRadiationLength(), PCaloHit::kEcalDepthMask, PCaloHit::kEcalDepthOffset, PCaloHit::kEcalDepthRefz, CaloSD::setToLocal(), storeLayerTimeSim, storeRL, useDepth1, useDepth2, and xtalLMap.

◆ getEnergyDeposit()

double ECalSD::getEnergyDeposit ( const G4Step *  aStep)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 167 of file ECalSD.cc.

167  {
168  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
169  const G4Track* theTrack = aStep->GetTrack();
170  double edep = aStep->GetTotalEnergyDeposit();
171 
172  // take into account light collection curve for crystals
173  double weight = 1.;
174  if (suppressHeavy) {
175  TrackInformation* trkInfo = (TrackInformation*)(theTrack->GetUserInformation());
176  if (trkInfo) {
177  int pdg = theTrack->GetDefinition()->GetPDGEncoding();
178  if (!(trkInfo->isPrimary())) { // Only secondary particles
179  double ke = theTrack->GetKineticEnergy();
180  if (((pdg / 1000000000 == 1 && ((pdg / 10000) % 100) > 0 && ((pdg / 10) % 100) > 0)) && (ke < kmaxIon))
181  weight = 0;
182  if ((pdg == 2212) && (ke < kmaxProton))
183  weight = 0;
184  if ((pdg == 2112) && (ke < kmaxNeutron))
185  weight = 0;
186  }
187  }
188  }
189  const G4LogicalVolume* lv = preStepPoint->GetTouchable()->GetVolume(0)->GetLogicalVolume();
190  double wt1 = 1.0;
191  if (useWeight && !any(noWeight, lv)) {
192  weight *= curve_LY(lv);
193  if (useBirk) {
194  if (useBirkL3)
195  weight *= getBirkL3(aStep);
196  else
197  weight *= getAttenuation(aStep, birk1, birk2, birk3);
198  }
199  wt1 = getResponseWt(theTrack);
200  }
201  edep *= weight * wt1;
202  // Russian Roulette
203  double wt2 = theTrack->GetWeight();
204  if (wt2 > 0.0) {
205  edep *= wt2;
206  }
207 #ifdef EDM_ML_DEBUG
208  edm::LogVerbatim("EcalSim") << lv->GetName() << " Light Collection Efficiency " << weight << ":" << wt1
209  << " wt2= " << wt2 << " Weighted Energy Deposit " << edep / MeV << " MeV";
210 #endif
211  return edep;
212 }

References any(), birk1, birk2, birk3, curve_LY(), CaloSD::getAttenuation(), getBirkL3(), CaloSD::getResponseWt(), TrackInformation::isPrimary(), ke, CaloSD::kmaxIon, CaloSD::kmaxNeutron, CaloSD::kmaxProton, MeV, noWeight, CaloSD::suppressHeavy, useBirk, useBirkL3, and useWeight.

◆ getLayerIDForTimeSim()

uint16_t ECalSD::getLayerIDForTimeSim ( )
private

Definition at line 276 of file ECalSD.cc.

276  {
277  const double invLayerSize = 0.1; //layer size in 1/mm
278  return (int)crystalDepth * invLayerSize;
279 }

References crystalDepth.

Referenced by getDepth(), and getRadiationLength().

◆ getRadiationLength()

uint16_t ECalSD::getRadiationLength ( const G4StepPoint *  hitPoint,
const G4LogicalVolume *  lv 
)
private

Definition at line 251 of file ECalSD.cc.

251  {
252  uint16_t thisX0 = 0;
253  if (useWeight) {
254  double radl = hitPoint->GetMaterial()->GetRadlen();
255  thisX0 = (uint16_t)floor(scaleRL * crystalDepth / radl);
256 #ifdef plotDebug
257  const std::string& lvname = lv->GetName();
258  int k1 = (lvname.find("EFRY") != std::string::npos) ? 2 : 0;
259  int k2 = (lvname.find("refl") != std::string::npos) ? 1 : 0;
260  int kk = k1 + k2;
261  double rz = (k1 == 0) ? (hitPoint->GetPosition()).rho() : std::abs((hitPoint->GetPosition()).z());
262  edm::LogVerbatim("EcalSim") << lvname << " # " << k1 << ":" << k2 << ":" << kk << " rz " << rz << " D " << thisX0;
263  g2L_[kk]->Fill(rz, thisX0);
264 #endif
265 #ifdef EDM_ML_DEBUG
266  G4ThreeVector localPoint = setToLocal(hitPoint->GetPosition(), hitPoint->GetTouchable());
267  edm::LogVerbatim("EcalSim") << lv->GetName() << " Global " << hitPoint->GetPosition() << ":"
268  << (hitPoint->GetPosition()).rho() << " Local " << localPoint << " Crystal Length "
269  << crystalLength << " Radl " << radl << " crystalDepth " << crystalDepth << " Index "
270  << thisX0 << " : " << getLayerIDForTimeSim();
271 #endif
272  }
273  return thisX0;
274 }

References funct::abs(), crystalDepth, crystalLength, getLayerIDForTimeSim(), GetRecoTauVFromDQM_MC_cff::kk, rho, scaleRL, CaloSD::setToLocal(), AlCaHLTBitMon_QueryRunRegistry::string, useWeight, and z.

Referenced by getDepth().

◆ getTrackID()

int ECalSD::getTrackID ( const G4Track *  aTrack)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 214 of file ECalSD.cc.

214  {
215  int primaryID(0);
216  if (storeTrack && depth > 0) {
217  forceSave = true;
218  primaryID = aTrack->GetTrackID();
219  } else {
220  primaryID = CaloSD::getTrackID(aTrack);
221  }
222  return primaryID;
223 }

References depth, CaloSD::forceSave, CaloSD::getTrackID(), and storeTrack.

◆ initMap()

void ECalSD::initMap ( )
private

Definition at line 299 of file ECalSD.cc.

299  {
300  std::vector<const G4LogicalVolume*> lvused;
301  const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
302  std::map<const std::string, const G4LogicalVolume*> nameMap;
303  for (auto lvi = lvs->begin(), lve = lvs->end(); lvi != lve; ++lvi)
304  nameMap.emplace((*lvi)->GetName(), *lvi);
305 
306  for (unsigned int it = 0; it < ecalSimParameters_->lvNames_.size(); ++it) {
307  const std::string& matname = ecalSimParameters_->matNames_[it];
308  const std::string& lvname = ecalSimParameters_->lvNames_[it];
309  const G4LogicalVolume* lv = nameMap[lvname];
310  int ibec = (lvname.find("EFRY") == std::string::npos) ? 0 : 1;
311  int iref = (lvname.find("refl") == std::string::npos) ? 0 : 1;
312  int type = (ibec + iref == 1) ? 1 : -1;
313  if (depth1Name != " ") {
314  if (strncmp(lvname.c_str(), depth1Name.c_str(), 4) == 0) {
315  if (!any(useDepth1, lv)) {
316  useDepth1.push_back(lv);
317 #ifdef EDM_ML_DEBUG
318  edm::LogVerbatim("EcalSim") << "ECalSD::initMap Logical Volume " << lvname << " in Depth 1 volume list";
319 #endif
320  }
321  const G4LogicalVolume* lvr = nameMap[lvname + "_refl"];
322  if (lvr != nullptr && !any(useDepth1, lvr)) {
323  useDepth1.push_back(lvr);
324 #ifdef EDM_ML_DEBUG
325  edm::LogVerbatim("EcalSim") << "ECalSD::initMap Logical Volume " << lvname << "_refl"
326  << " in Depth 1 volume list";
327 #endif
328  }
329  }
330  }
331  if (depth2Name != " ") {
332  if (strncmp(lvname.c_str(), depth2Name.c_str(), 4) == 0) {
333  if (!any(useDepth2, lv)) {
334  useDepth2.push_back(lv);
335 #ifdef EDM_ML_DEBUG
336  edm::LogVerbatim("EcalSim") << "ECalSD::initMap Logical Volume " << lvname << " in Depth 2 volume list";
337 #endif
338  }
339  const G4LogicalVolume* lvr = nameMap[lvname + "_refl"];
340  if (lvr != nullptr && !any(useDepth2, lvr)) {
341  useDepth2.push_back(lvr);
342 #ifdef EDM_ML_DEBUG
343  edm::LogVerbatim("EcalSim") << "ECalSD::initMap Logical Volume " << lvname << "_refl"
344  << " in Depth 2 volume list";
345 #endif
346  }
347  }
348  }
349  if (lv != nullptr) {
350  if (crystalMat.size() == matname.size() && !strcmp(crystalMat.c_str(), matname.c_str())) {
351  if (!any(lvused, lv)) {
352  lvused.push_back(lv);
353  double dz = ecalSimParameters_->dzs_[it];
354  xtalLMap.insert(std::pair<const G4LogicalVolume*, double>(lv, dz * type));
355  lv = nameMap[lvname + "_refl"];
356  if (lv != nullptr) {
357  xtalLMap.insert(std::pair<const G4LogicalVolume*, double>(lv, -dz * type));
358  }
359  }
360  } else {
361  if (!any(noWeight, lv)) {
362  noWeight.push_back(lv);
363 #ifdef EDM_ML_DEBUG
364  edm::LogVerbatim("EcalSim") << "ECalSD::initMap Logical Volume " << lvname << " Material " << matname
365  << " in noWeight list";
366 #endif
367  }
368  lv = nameMap[lvname];
369  if (lv != nullptr && !any(noWeight, lv)) {
370  noWeight.push_back(lv);
371 #ifdef EDM_ML_DEBUG
372  edm::LogVerbatim("EcalSim") << "ECalSD::initMap Logical Volume " << lvname << " Material " << matname
373  << " in noWeight list";
374 #endif
375  }
376  }
377  }
378  }
379 #ifdef EDM_ML_DEBUG
380  edm::LogVerbatim("EcalSim") << "ECalSD: Length Table:";
381  int i = 0;
382  for (auto ite : xtalLMap) {
383  G4String name("Unknown");
384  if (ite.first != 0)
385  name = (ite.first)->GetName();
386  edm::LogVerbatim("EcalSim") << " " << i << " " << ite.first << " " << name << " L = " << ite.second;
387  ++i;
388  }
389 #endif
390 }

References any(), crystalMat, depth1Name, depth2Name, PVValHelper::dz, EcalSimulationParameters::dzs_, ecalSimParameters_, mps_fire::i, EcalSimulationParameters::lvNames_, EcalSimulationParameters::matNames_, Skims_PA_cff::name, noWeight, AlCaHLTBitMon_QueryRunRegistry::string, useDepth1, useDepth2, and xtalLMap.

Referenced by ECalSD().

◆ setDetUnitId()

uint32_t ECalSD::setDetUnitId ( const G4Step *  aStep)
overridevirtual

Implements CaloSD.

Definition at line 281 of file ECalSD.cc.

281  {
282  if (numberingScheme_ == nullptr) {
283  return EBDetId(1, 1)();
284  } else {
285  getBaseNumber(aStep);
287  }
288 }

References getBaseNumber(), EcalNumberingScheme::getUnitID(), numberingScheme_, and theBaseNumber.

◆ setNumberingScheme()

void ECalSD::setNumberingScheme ( EcalNumberingScheme scheme)

Definition at line 290 of file ECalSD.cc.

290  {
291  if (scheme != nullptr) {
292  edm::LogVerbatim("EcalSim") << "EcalSD: updates numbering scheme for " << GetName();
293  if (numberingScheme_)
294  delete numberingScheme_;
296  }
297 }

References numberingScheme_, and generator_cfi::scheme.

Referenced by ECalSD(), and HcalTB04Analysis::update().

Member Data Documentation

◆ ageing

EnergyResolutionVsLumi ECalSD::ageing
private

Definition at line 66 of file ECalSD.h.

Referenced by curve_LY(), and ECalSD().

◆ ageingWithSlopeLY

bool ECalSD::ageingWithSlopeLY
private

Definition at line 67 of file ECalSD.h.

Referenced by curve_LY(), and ECalSD().

◆ birk1

double ECalSD::birk1
private

Definition at line 60 of file ECalSD.h.

Referenced by ECalSD(), getBirkL3(), and getEnergyDeposit().

◆ birk2

double ECalSD::birk2
private

Definition at line 60 of file ECalSD.h.

Referenced by ECalSD(), and getEnergyDeposit().

◆ birk3

double ECalSD::birk3
private

Definition at line 60 of file ECalSD.h.

Referenced by ECalSD(), and getEnergyDeposit().

◆ birkCut

double ECalSD::birkCut
private

Definition at line 60 of file ECalSD.h.

Referenced by ECalSD(), and getBirkL3().

◆ birkSlope

double ECalSD::birkSlope
private

Definition at line 60 of file ECalSD.h.

Referenced by ECalSD(), and getBirkL3().

◆ crystalDepth

double ECalSD::crystalDepth
private

Definition at line 72 of file ECalSD.h.

Referenced by curve_LY(), getDepth(), getLayerIDForTimeSim(), and getRadiationLength().

◆ crystalLength

double ECalSD::crystalLength
private

Definition at line 71 of file ECalSD.h.

Referenced by curve_LY(), getDepth(), and getRadiationLength().

◆ crystalMat

std::string ECalSD::crystalMat
private

Definition at line 62 of file ECalSD.h.

Referenced by ECalSD(), and initMap().

◆ currentLocalPoint

G4ThreeVector ECalSD::currentLocalPoint
private

Definition at line 70 of file ECalSD.h.

Referenced by curve_LY(), and getDepth().

◆ depth

uint16_t ECalSD::depth
private

◆ depth1Name

std::string ECalSD::depth1Name
private

Definition at line 62 of file ECalSD.h.

Referenced by ECalSD(), and initMap().

◆ depth2Name

std::string ECalSD::depth2Name
private

Definition at line 62 of file ECalSD.h.

Referenced by ECalSD(), and initMap().

◆ ecalSimParameters_

const EcalSimulationParameters* ECalSD::ecalSimParameters_
private

Definition at line 56 of file ECalSD.h.

Referenced by ECalSD(), and initMap().

◆ noWeight

std::vector<const G4LogicalVolume *> ECalSD::noWeight
private

Definition at line 64 of file ECalSD.h.

Referenced by getEnergyDeposit(), and initMap().

◆ numberingScheme_

EcalNumberingScheme* ECalSD::numberingScheme_
private

Definition at line 57 of file ECalSD.h.

Referenced by setDetUnitId(), setNumberingScheme(), and ~ECalSD().

◆ scaleRL

double ECalSD::scaleRL
private

Definition at line 61 of file ECalSD.h.

Referenced by ECalSD(), and getRadiationLength().

◆ slopeLY

double ECalSD::slopeLY
private

Definition at line 61 of file ECalSD.h.

Referenced by curve_LY(), and ECalSD().

◆ storeLayerTimeSim

bool ECalSD::storeLayerTimeSim
private

Definition at line 58 of file ECalSD.h.

Referenced by ECalSD(), and getDepth().

◆ storeRL

bool ECalSD::storeRL
private

Definition at line 58 of file ECalSD.h.

Referenced by ECalSD(), and getDepth().

◆ storeTrack

bool ECalSD::storeTrack
private

Definition at line 58 of file ECalSD.h.

Referenced by ECalSD(), and getTrackID().

◆ theBaseNumber

EcalBaseNumber ECalSD::theBaseNumber
private

Definition at line 65 of file ECalSD.h.

Referenced by getBaseNumber(), and setDetUnitId().

◆ useBirk

bool ECalSD::useBirk
private

Definition at line 59 of file ECalSD.h.

Referenced by ECalSD(), and getEnergyDeposit().

◆ useBirkL3

bool ECalSD::useBirkL3
private

Definition at line 59 of file ECalSD.h.

Referenced by ECalSD(), and getEnergyDeposit().

◆ useDepth1

std::vector<const G4LogicalVolume *> ECalSD::useDepth1
private

Definition at line 64 of file ECalSD.h.

Referenced by getDepth(), and initMap().

◆ useDepth2

std::vector<const G4LogicalVolume *> ECalSD::useDepth2
private

Definition at line 64 of file ECalSD.h.

Referenced by getDepth(), and initMap().

◆ useWeight

bool ECalSD::useWeight
private

Definition at line 58 of file ECalSD.h.

Referenced by ECalSD(), getEnergyDeposit(), and getRadiationLength().

◆ xtalLMap

std::map<const G4LogicalVolume *, double> ECalSD::xtalLMap
private

Definition at line 63 of file ECalSD.h.

Referenced by getDepth(), and initMap().

EcalBarrelNumberingScheme
Definition: EcalBarrelNumberingScheme.h:10
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
ESTBNumberingScheme
Definition: ESTBNumberingScheme.h:6
mps_fire.i
i
Definition: mps_fire.py:355
ECalSD::currentLocalPoint
G4ThreeVector currentLocalPoint
Definition: ECalSD.h:70
ECalSD::scaleRL
double scaleRL
Definition: ECalSD.h:61
ECalSD::numberingScheme_
EcalNumberingScheme * numberingScheme_
Definition: ECalSD.h:57
CaloSD::kmaxProton
double kmaxProton
Definition: CaloSD.h:138
ECalSD::depth2Name
std::string depth2Name
Definition: ECalSD.h:62
ECalSD::storeLayerTimeSim
bool storeLayerTimeSim
Definition: ECalSD.h:58
TFileDirectory::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileDirectory.h:53
EBDetId
Definition: EBDetId.h:17
mps_merge.weight
weight
Definition: mps_merge.py:88
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ECalSD::crystalMat
std::string crystalMat
Definition: ECalSD.h:62
EcalBaseNumber::getCapacity
int getCapacity()
Definition: EcalBaseNumber.cc:36
EnergyResolutionVsLumi::calcLightCollectionEfficiencyWeighted
double calcLightCollectionEfficiencyWeighted(DetId id, double z)
Definition: EnergyResolutionVsLumi.cc:92
EcalBaseNumber::addLevel
void addLevel(const std::string &name, const int &copyNumber)
Definition: EcalBaseNumber.cc:15
CaloSD::getAttenuation
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:435
ECalSD::getRadiationLength
uint16_t getRadiationLength(const G4StepPoint *hitPoint, const G4LogicalVolume *lv)
Definition: ECalSD.cc:251
ECalSD::useBirkL3
bool useBirkL3
Definition: ECalSD.h:59
MeV
const double MeV
PCaloHit::kEcalDepthOffset
static const int kEcalDepthOffset
Definition: PCaloHit.h:62
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ECalSD::storeTrack
bool storeTrack
Definition: ECalSD.h:58
TFileDirectory
Definition: TFileDirectory.h:24
CaloHitID::unitID
uint32_t unitID() const
Definition: CaloHitID.h:20
ECalSD::birk2
double birk2
Definition: ECalSD.h:60
CaloSD::kmaxIon
double kmaxIon
Definition: CaloSD.h:138
ECalSD::curve_LY
double curve_LY(const G4LogicalVolume *)
Definition: ECalSD.cc:392
EcalSimulationParameters::dzs_
std::vector< double > dzs_
Definition: EcalSimulationParameters.h:22
any
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:34
ECalSD::depth
uint16_t depth
Definition: ECalSD.h:73
ECalSD::useDepth2
std::vector< const G4LogicalVolume * > useDepth2
Definition: ECalSD.h:64
CaloSD::getResponseWt
double getResponseWt(const G4Track *)
Definition: CaloSD.cc:627
EcalNumberingScheme
Definition: EcalNumberingScheme.h:14
ECalSD::noWeight
std::vector< const G4LogicalVolume * > noWeight
Definition: ECalSD.h:64
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackInformation::isPrimary
bool isPrimary() const
Definition: TrackInformation.h:23
CaloSD::setToLocal
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:291
ECalSD::ecalSimParameters_
const EcalSimulationParameters * ecalSimParameters_
Definition: ECalSD.h:56
ECalSD::setNumberingScheme
void setNumberingScheme(EcalNumberingScheme *)
Definition: ECalSD.cc:290
tfile
Definition: tfile.py:1
DDAxes::z
edm::ESHandle
Definition: DTSurvey.h:22
ECalSD::ageingWithSlopeLY
bool ageingWithSlopeLY
Definition: ECalSD.h:67
GetRecoTauVFromDQM_MC_cff.kk
kk
Definition: GetRecoTauVFromDQM_MC_cff.py:84
dqmdumpme.k
k
Definition: dqmdumpme.py:60
EcalPreshowerNumberingScheme
Definition: EcalPreshowerNumberingScheme.h:10
CaloSD::currentID
CaloHitID currentID
Definition: CaloSD.h:131
ECalSD::birk3
double birk3
Definition: ECalSD.h:60
DDAxes::rho
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
ECalSD::initMap
void initMap()
Definition: ECalSD.cc:299
ECalSD::getBaseNumber
void getBaseNumber(const G4Step *)
Definition: ECalSD.cc:413
ke
int ke
Definition: CascadeWrapper.h:13
EnergyResolutionVsLumi::setLumies
void setLumies(double x, double y)
Definition: EnergyResolutionVsLumi.h:47
CaloSD::kmaxNeutron
double kmaxNeutron
Definition: CaloSD.h:138
ECalSD::depth1Name
std::string depth1Name
Definition: ECalSD.h:62
ECalSD::theBaseNumber
EcalBaseNumber theBaseNumber
Definition: ECalSD.h:65
EcalBaseNumber::reset
void reset()
Definition: EcalBaseNumber.cc:38
TrackInformation
Definition: TrackInformation.h:8
edm::Service< TFileService >
CaloSD::CaloSD
CaloSD(const std::string &aSDname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
Definition: CaloSD.cc:27
edm::LogVerbatim
Definition: MessageLogger.h:297
PCaloHit::kEcalDepthMask
static const int kEcalDepthMask
Definition: PCaloHit.h:61
EcalSimulationParameters::depth1Name_
std::string depth1Name_
Definition: EcalSimulationParameters.h:18
get
#define get
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
ECalSD::crystalDepth
double crystalDepth
Definition: ECalSD.h:72
generator_cfi.scheme
scheme
Definition: generator_cfi.py:22
compare.tfile
tfile
Definition: compare.py:325
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ECalSD::ageing
EnergyResolutionVsLumi ageing
Definition: ECalSD.h:66
ECalSD::useWeight
bool useWeight
Definition: ECalSD.h:58
CaloSD::getTrackID
virtual int getTrackID(const G4Track *)
Definition: CaloSD.cc:573
EcalSimulationParameters::matNames_
std::vector< std::string > matNames_
Definition: EcalSimulationParameters.h:21
type
type
Definition: HCALResponse.h:21
ECalSD::birkCut
double birkCut
Definition: ECalSD.h:60
PVValHelper::dz
Definition: PVValidationHelpers.h:50
Exception
Definition: hltDiff.cc:246
EcalSimulationParameters::lvNames_
std::vector< std::string > lvNames_
Definition: EcalSimulationParameters.h:20
EcalSimulationParameters::depth2Name_
std::string depth2Name_
Definition: EcalSimulationParameters.h:19
ECalSD::crystalLength
double crystalLength
Definition: ECalSD.h:71
EcalNumberingScheme::getUnitID
virtual uint32_t getUnitID(const EcalBaseNumber &baseNumber) const =0
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
pdg
Definition: pdg_functions.h:28
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
ECalSD::useDepth1
std::vector< const G4LogicalVolume * > useDepth1
Definition: ECalSD.h:64
CaloSD::forceSave
bool forceSave
Definition: CaloSD.h:140
ECalSD::useBirk
bool useBirk
Definition: ECalSD.h:59
ECalSD::birkSlope
double birkSlope
Definition: ECalSD.h:60
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ECalSD::storeRL
bool storeRL
Definition: ECalSD.h:58
ECalSD::slopeLY
double slopeLY
Definition: ECalSD.h:61
EcalEndcapNumberingScheme
Definition: EcalEndcapNumberingScheme.h:10
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
ECalSD::getBirkL3
double getBirkL3(const G4Step *)
Definition: ECalSD.cc:431
EcalSimulationParameters::useWeight_
bool useWeight_
Definition: EcalSimulationParameters.h:17
CaloSD::suppressHeavy
bool suppressHeavy
Definition: CaloSD.h:137
EcalBaseNumber::setSize
void setSize(const int &size)
Definition: EcalBaseNumber.cc:10
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
ECalSD::birk1
double birk1
Definition: ECalSD.h:60
cuy.ii
ii
Definition: cuy.py:590
PCaloHit::kEcalDepthRefz
static const int kEcalDepthRefz
Definition: PCaloHit.h:63
ECalSD::getLayerIDForTimeSim
uint16_t getLayerIDForTimeSim()
Definition: ECalSD.cc:276
weight
Definition: weight.py:1
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
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
fastSimProducer_cff.density
density
Definition: fastSimProducer_cff.py:61
ECalSD::xtalLMap
std::map< const G4LogicalVolume *, double > xtalLMap
Definition: ECalSD.h:63