CMS 3D CMS Logo

EcalTBH4BeamSD.cc
Go to the documentation of this file.
1 // File: EcalTBH4BeamSD.cc
3 // Description: Sensitive Detector class for electromagnetic calorimeters
13 
15 
16 #include "G4Step.hh"
17 #include "G4Track.hh"
18 #include "G4VProcess.hh"
19 
20 #include "G4SystemOfUnits.hh"
21 
23  const edm::EventSetup &es,
24  const SensitiveDetectorCatalog &clg,
25  edm::ParameterSet const &p,
26  const SimTrackManager *manager)
27  : CaloSD(name, es, clg, p, manager), numberingScheme(nullptr) {
28  edm::ParameterSet m_EcalTBH4BeamSD = p.getParameter<edm::ParameterSet>("EcalTBH4BeamSD");
29  useBirk = m_EcalTBH4BeamSD.getParameter<bool>("UseBirkLaw");
30  birk1 = m_EcalTBH4BeamSD.getParameter<double>("BirkC1") * (g / (MeV * cm2));
31  birk2 = m_EcalTBH4BeamSD.getParameter<double>("BirkC2");
32  birk3 = m_EcalTBH4BeamSD.getParameter<double>("BirkC3");
33 
34  EcalNumberingScheme *scheme = nullptr;
35  if (name == "EcalTBH4BeamHits") {
36  scheme = dynamic_cast<EcalNumberingScheme *>(new EcalHodoscopeNumberingScheme());
37  } else {
38  edm::LogWarning("EcalTBSim") << "EcalTBH4BeamSD: ReadoutName not supported\n";
39  }
40 
41  if (scheme)
43  edm::LogInfo("EcalTBSim") << "Constructing a EcalTBH4BeamSD with name " << GetName();
44  edm::LogInfo("EcalTBSim") << "EcalTBH4BeamSD:: Use of Birks law is set to " << useBirk
45  << " with three constants kB = " << birk1 << ", C1 = " << birk2
46  << ", C2 = " << birk3;
47 }
48 
50  if (numberingScheme)
51  delete numberingScheme;
52 }
53 
54 double EcalTBH4BeamSD::getEnergyDeposit(const G4Step *aStep) {
55  // take into account light collection curve for crystals
56  double weight = 1.;
57  if (useBirk)
58  weight *= getAttenuation(aStep, birk1, birk2, birk3);
59  double edep = aStep->GetTotalEnergyDeposit() * weight;
60  LogDebug("EcalTBSim") << "EcalTBH4BeamSD:: " << aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()
61  << " Light Collection Efficiency " << weight << " Weighted Energy Deposit " << edep / MeV
62  << " MeV";
63  return edep;
64 }
65 
66 uint32_t EcalTBH4BeamSD::setDetUnitId(const G4Step *aStep) {
67  getBaseNumber(aStep);
68  return (numberingScheme == nullptr ? 0 : numberingScheme->getUnitID(theBaseNumber));
69 }
70 
72  if (scheme != nullptr) {
73  edm::LogInfo("EcalTBSim") << "EcalTBH4BeamSD: updates numbering scheme for " << GetName() << "\n";
74  if (numberingScheme)
75  delete numberingScheme;
77  }
78 }
79 
80 void EcalTBH4BeamSD::getBaseNumber(const G4Step *aStep) {
82  const G4VTouchable *touch = aStep->GetPreStepPoint()->GetTouchable();
83  int theSize = touch->GetHistoryDepth() + 1;
84  if (theBaseNumber.getCapacity() < theSize)
85  theBaseNumber.setSize(theSize);
86  // Get name and copy numbers
87  if (theSize > 1) {
88  for (int ii = 0; ii < theSize; ii++) {
89  theBaseNumber.addLevel(touch->GetVolume(ii)->GetName(), touch->GetReplicaNumber(ii));
90  LogDebug("EcalTBSim") << "EcalTBH4BeamSD::getBaseNumber(): Adding level " << ii << ": "
91  << touch->GetVolume(ii)->GetName() << "[" << touch->GetReplicaNumber(ii) << "]";
92  }
93  }
94 }
EcalTBH4BeamSD::birk3
double birk3
Definition: EcalTBH4BeamSD.h:39
SimTrackManager
Definition: SimTrackManager.h:35
EcalTBH4BeamSD.h
EcalTBH4BeamSD::birk1
double birk1
Definition: EcalTBH4BeamSD.h:39
mps_merge.weight
weight
Definition: mps_merge.py:88
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
DDSplit.h
EcalBaseNumber::getCapacity
int getCapacity()
Definition: EcalBaseNumber.cc:37
EcalBaseNumber::addLevel
void addLevel(const std::string &name, const int &copyNumber)
Definition: EcalBaseNumber.cc:16
CaloSD::getAttenuation
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:517
MeV
const double MeV
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
EcalTBH4BeamSD::setNumberingScheme
void setNumberingScheme(EcalNumberingScheme *scheme)
Definition: EcalTBH4BeamSD.cc:71
EcalTBH4BeamSD::birk2
double birk2
Definition: EcalTBH4BeamSD.h:39
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
EcalTBH4BeamSD::getEnergyDeposit
double getEnergyDeposit(const G4Step *) override
Definition: EcalTBH4BeamSD.cc:54
EcalNumberingScheme
Definition: EcalNumberingScheme.h:14
DDFilteredView.h
EcalTBH4BeamSD::EcalTBH4BeamSD
EcalTBH4BeamSD(const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
Definition: EcalTBH4BeamSD.cc:22
EcalTBH4BeamSD::setDetUnitId
uint32_t setDetUnitId(const G4Step *step) override
Definition: EcalTBH4BeamSD.cc:66
DDSolid.h
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
DDValue.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
numberingScheme
static TrackerG4SimHitNumberingScheme & numberingScheme(const GeometricDet &det)
Definition: TkAccumulatingSensitiveDetector.cc:41
EcalHodoscopeNumberingScheme.h
EcalBaseNumber::reset
void reset()
Definition: EcalBaseNumber.cc:39
DDFilter.h
EcalTBH4BeamSD::useBirk
bool useBirk
Definition: EcalTBH4BeamSD.h:38
EcalTBH4BeamSD::getBaseNumber
void getBaseNumber(const G4Step *aStep)
Definition: EcalTBH4BeamSD.cc:80
edm::EventSetup
Definition: EventSetup.h:57
EcalBaseNumber.h
generator_cfi.scheme
scheme
Definition: generator_cfi.py:22
EcalTBH4BeamSD::theBaseNumber
EcalBaseNumber theBaseNumber
Definition: EcalTBH4BeamSD.h:40
EcalTBH4BeamSD::~EcalTBH4BeamSD
~EcalTBH4BeamSD() override
Definition: EcalTBH4BeamSD.cc:49
EcalNumberingScheme::getUnitID
virtual uint32_t getUnitID(const EcalBaseNumber &baseNumber) const =0
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalHodoscopeNumberingScheme
Definition: EcalHodoscopeNumberingScheme.h:10
EcalTBH4BeamSD::numberingScheme
EcalNumberingScheme * numberingScheme
Definition: EcalTBH4BeamSD.h:36
EcalBaseNumber::setSize
void setSize(const int &size)
Definition: EcalBaseNumber.cc:11
cuy.ii
ii
Definition: cuy.py:590
weight
Definition: weight.py:1
CaloSD
Definition: CaloSD.h:38
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