CMS 3D CMS Logo

TotemT2ScintSD.cc
Go to the documentation of this file.
4 
5 #include "G4SDManager.hh"
6 #include "G4Step.hh"
7 #include "G4Track.hh"
8 #include "G4VProcess.hh"
9 #include "G4ios.hh"
10 #include "G4Cerenkov.hh"
11 #include "G4ParticleTable.hh"
12 #include "CLHEP/Units/GlobalSystemOfUnits.h"
13 #include "CLHEP/Units/GlobalPhysicalConstants.h"
14 #include "Randomize.hh"
15 #include "G4Poisson.hh"
16 
17 //#define EDM_ML_DEBUG
18 
20  const edm::EventSetup& es,
21  const SensitiveDetectorCatalog& clg,
22  edm::ParameterSet const& p,
23  const SimTrackManager* manager)
24  : CaloSD(name,
25  es,
26  clg,
27  p,
28  manager,
29  (float)(p.getParameter<edm::ParameterSet>("TotemT2ScintSD").getParameter<double>("TimeSliceUnit")),
30  p.getParameter<edm::ParameterSet>("TotemT2ScintSD").getParameter<bool>("IgnoreTrackID")) {
31  edm::ParameterSet m_T2SD = p.getParameter<edm::ParameterSet>("TotemT2ScintSD");
32  useBirk_ = m_T2SD.getParameter<bool>("UseBirkLaw");
33  birk1_ = m_T2SD.getParameter<double>("BirkC1") * (g / (MeV * cm2));
34  birk2_ = m_T2SD.getParameter<double>("BirkC2");
35  birk3_ = m_T2SD.getParameter<double>("BirkC3");
37 
38  edm::LogVerbatim("ForwardSim") << "***************************************************\n"
39  << "* *\n"
40  << "* Constructing a TotemT2ScintSD with name " << name << " *\n"
41  << "* *\n"
42  << "***************************************************";
43 
44  edm::LogVerbatim("ForwardSim") << "\nUse of Birks law is set to " << useBirk_
45  << " with three constants kB = " << birk1_ << ", C1 = " << birk2_
46  << ", C2 = " << birk3_;
47 }
48 
49 uint32_t TotemT2ScintSD::setDetUnitId(const G4Step* aStep) {
50  auto const prePoint = aStep->GetPreStepPoint();
51  auto const touch = prePoint->GetTouchable();
52 
53  int iphi = (touch->GetReplicaNumber(0)) % 10;
54  int lay = (touch->GetReplicaNumber(0) / 10) % 10 + 1;
55  int zside = (((touch->GetReplicaNumber(1)) == 1) ? 1 : -1);
56 
57  return setDetUnitId(zside, lay, iphi);
58 }
59 
61  if (scheme != nullptr) {
62  edm::LogVerbatim("ForwardSim") << "TotemT2ScintSD: updates numbering scheme for " << GetName();
63  numberingScheme.reset(scheme);
64  }
65 }
66 
67 double TotemT2ScintSD::getEnergyDeposit(const G4Step* aStep) {
68  double destep = aStep->GetTotalEnergyDeposit();
69  double weight = ((useBirk_) ? getAttenuation(aStep, birk1_, birk2_, birk3_) : 1.0);
70  double edep = weight * destep;
71 #ifdef EDM_ML_DEBUG
72  edm::LogVerbatim("ForwardSim") << "TotemT2ScintSD: edep= " << destep << ":" << weight << ":" << edep;
73 #endif
74  return edep;
75 }
76 
77 uint32_t TotemT2ScintSD::setDetUnitId(const int& zside, const int& lay, const int& iphi) {
78  uint32_t id = ((numberingScheme.get()) ? numberingScheme->packID(zside, lay, iphi) : 0);
79 #ifdef EDM_ML_DEBUG
80  edm::LogVerbatim("ForwardSim") << "TotemT2ScintSD: zside " << zside << " layer " << lay << " phi " << iphi << " ID "
81  << std::hex << id << std::dec;
82 #endif
83  return id;
84 }
TotemT2ScintSD::setDetUnitId
uint32_t setDetUnitId(const G4Step *step) override
Definition: TotemT2ScintSD.cc:49
SimTrackManager
Definition: SimTrackManager.h:35
electrons_cff.bool
bool
Definition: electrons_cff.py:393
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
TotemT2ScintSD::numberingScheme
std::unique_ptr< TotemT2ScintNumberingScheme > numberingScheme
Definition: TotemT2ScintSD.h:27
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CaloSD::getAttenuation
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:517
MeV
const double MeV
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
TotemT2ScintSD::birk2_
double birk2_
Definition: TotemT2ScintSD.h:25
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TotemT2ScintSD::useBirk_
bool useBirk_
Definition: TotemT2ScintSD.h:24
edm::ParameterSet
Definition: ParameterSet.h:47
ParameterSet
Definition: Functions.h:16
edm::EventSetup
Definition: EventSetup.h:57
TrackInformation.h
generator_cfi.scheme
scheme
Definition: generator_cfi.py:22
TotemT2ScintSD::birk3_
double birk3_
Definition: TotemT2ScintSD.h:25
TotemT2ScintSD::TotemT2ScintSD
TotemT2ScintSD(const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
Definition: TotemT2ScintSD.cc:19
TotemT2ScintSD::birk1_
double birk1_
Definition: TotemT2ScintSD.h:25
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
TotemT2ScintSD.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TotemT2ScintSD::setNumberingScheme
void setNumberingScheme(TotemT2ScintNumberingScheme *scheme)
Definition: TotemT2ScintSD.cc:60
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
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
TotemT2ScintNumberingScheme
Definition: TotemT2ScintNumberingScheme.h:6
TotemT2ScintSD::getEnergyDeposit
double getEnergyDeposit(const G4Step *) override
Definition: TotemT2ScintSD.cc:67