CMS 3D CMS Logo

AHCalSD.cc
Go to the documentation of this file.
5 
8 
9 #include "G4LogicalVolume.hh"
10 #include "G4LogicalVolumeStore.hh"
11 #include "G4ParticleTable.hh"
12 #include "G4Track.hh"
13 #include "G4VProcess.hh"
14 
15 #include "G4PhysicalConstants.hh"
16 #include "G4SystemOfUnits.hh"
17 
18 #include <iomanip>
19 #include <map>
20 
21 //#define EDM_ML_DEBUG
22 
24  const SensitiveDetectorCatalog& clg,
25  edm::ParameterSet const& p,
26  const SimTrackManager* manager)
27  : CaloSD(name,
28  clg,
29  p,
30  manager,
31  (float)(p.getParameter<edm::ParameterSet>("AHCalSD").getParameter<double>("TimeSliceUnit")),
32  p.getParameter<edm::ParameterSet>("AHCalSD").getParameter<bool>("IgnoreTrackID")) {
33  edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("AHCalSD");
34  useBirk = m_HC.getParameter<bool>("UseBirkLaw");
35  birk1 = m_HC.getParameter<double>("BirkC1") * (CLHEP::g / (CLHEP::MeV * CLHEP::cm2));
36  birk2 = m_HC.getParameter<double>("BirkC2");
37  birk3 = m_HC.getParameter<double>("BirkC3");
38  eminHit = m_HC.getParameter<double>("EminHit") * CLHEP::MeV;
39 
40  edm::LogVerbatim("HcalSim") << "AHCalSD:: Use of Birks law is set to " << useBirk
41  << " with three constants kB = " << birk1 << ", C1 = " << birk2 << ", C2 = " << birk3
42  << "\nAHCalSD:: Threshold for storing"
43  << " hits: " << eminHit;
44 }
45 
46 double AHCalSD::getEnergyDeposit(const G4Step* aStep) {
47  double destep = aStep->GetTotalEnergyDeposit();
48  double wt2 = aStep->GetTrack()->GetWeight();
49  double weight = (wt2 > 0.0) ? wt2 : 1.0;
50 #ifdef EDM_ML_DEBUG
51  double weight0 = weight;
52 #endif
53  if (useBirk)
54  weight *= getAttenuation(aStep, birk1, birk2, birk3);
55 #ifdef EDM_ML_DEBUG
56  edm::LogVerbatim("HcalSim") << "AHCalSD: weight " << weight0 << " " << weight;
57 #endif
58  double edep = weight * destep;
59  return edep;
60 }
61 
62 uint32_t AHCalSD::setDetUnitId(const G4Step* aStep) {
63  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
64  const G4VTouchable* touch = preStepPoint->GetTouchable();
65 
66  int depth = (touch->GetReplicaNumber(1));
67  int incol = ((touch->GetReplicaNumber(0)) % AHCalParameters::kColumn_);
68  int inrow = ((touch->GetReplicaNumber(0)) / AHCalParameters::kColumn_) % AHCalParameters::kRow_;
69  int jncol = ((touch->GetReplicaNumber(0)) / AHCalParameters::kRowColumn_) % AHCalParameters::kSign_;
70  int jnrow = ((touch->GetReplicaNumber(0)) / AHCalParameters::kSignRowColumn_) % AHCalParameters::kSign_;
71  int col = (jncol == 0) ? incol : -incol;
72  int row = (jnrow == 0) ? inrow : -inrow;
73  uint32_t index = AHCalDetId(row, col, depth).rawId();
74 #ifdef EDM_ML_DEBUG
75  edm::LogVerbatim("HcalSim") << "AHCalSD: det = " << HcalOther << " depth = " << depth << " row = " << row
76  << " column = " << col << " packed index = 0x" << std::hex << index << std::dec;
77  bool flag = unpackIndex(index, row, col, depth);
78  edm::LogVerbatim("HcalSim") << "Results from unpacker for 0x" << std::hex << index << std::dec << " Flag " << flag
79  << " Row " << row << " Col " << col << " Depth " << depth;
80 #endif
81  return index;
82 }
83 
84 bool AHCalSD::unpackIndex(const uint32_t& idx, int& row, int& col, int& depth) {
85  DetId gen(idx);
86  HcalSubdetector subdet = (HcalSubdetector(gen.subdetId()));
87  bool rcode = (gen.det() == DetId::Hcal && subdet != HcalOther);
88  row = col = depth = 0;
89  if (rcode) {
90  row = AHCalDetId(idx).irow();
91  col = AHCalDetId(idx).icol();
93  }
94 #ifdef EDM_ML_DEBUG
95  edm::LogVerbatim("HcalSim") << "AHCalSD: packed index = 0x" << std::hex << idx << std::dec << " Row " << row
96  << " Column " << col << " Depth " << depth << " OK " << rcode;
97 #endif
98  return rcode;
99 }
100 
101 bool AHCalSD::filterHit(CaloG4Hit* aHit, double time) {
102  return ((time <= tmaxHit) && (aHit->getEnergyDeposit() > eminHit));
103 }
HcalOther
Definition: HcalAssistant.h:38
SimTrackManager
Definition: SimTrackManager.h:35
electrons_cff.bool
bool
Definition: electrons_cff.py:366
CaloSD::tmaxHit
double tmaxHit
Definition: CaloSD.h:141
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
AHCalSD::birk2
double birk2
Definition: AHCalSD.h:27
AHCalSD::unpackIndex
bool unpackIndex(const uint32_t &idx, int &row, int &col, int &depth)
Definition: AHCalSD.cc:84
AHCalDetId::irow
int irow() const
get the row number
Definition: AHCalDetId.cc:29
edm
HLT enums.
Definition: AlignableModifier.h:19
mps_merge.weight
weight
Definition: mps_merge.py:88
cuy.col
col
Definition: cuy.py:1009
DetId::Hcal
Definition: DetId.h:28
AHCalSD::setDetUnitId
uint32_t setDetUnitId(const G4Step *step) override
Definition: AHCalSD.cc:62
AHCalSD.h
AHCalParameters::kRow_
static constexpr int kRow_
Definition: AHCalParameters.h:28
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
MeV
const double MeV
AHCalSD::eminHit
double eminHit
Definition: AHCalSD.h:28
AHCalSD::getEnergyDeposit
double getEnergyDeposit(const G4Step *) override
Definition: AHCalSD.cc:46
AHCalSD::useBirk
bool useBirk
Definition: AHCalSD.h:26
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
DetId
Definition: DetId.h:17
AHCalSD::AHCalSD
AHCalSD(const std::string &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
Definition: AHCalSD.cc:23
AHCalDetId::depth
int depth() const
get the layer number
Definition: AHCalDetId.cc:43
CaloG4Hit::getEnergyDeposit
double getEnergyDeposit() const
Definition: CaloG4Hit.h:78
AHCalSD::birk1
double birk1
Definition: AHCalSD.h:27
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
AHCalDetId::icol
int icol() const
get the column number
Definition: AHCalDetId.cc:36
gen
Definition: PythiaDecays.h:13
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
AHCalSD::birk3
double birk3
Definition: AHCalSD.h:27
AHCalDetId
Definition: AHCalDetId.h:13
AHCalParameters::kSignRowColumn_
static constexpr int kSignRowColumn_
Definition: AHCalParameters.h:31
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ParameterSet
Definition: Functions.h:16
HcalDetId.h
TrackInformation.h
CaloG4Hit
Definition: CaloG4Hit.h:32
AHCalParameters::kColumn_
static constexpr int kColumn_
Constants used.
Definition: AHCalParameters.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
AHCalSD::filterHit
bool filterHit(CaloG4Hit *, double) override
Definition: AHCalSD.cc:101
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
AHCalParameters.h
DetId.h
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
relval_steps.gen
def gen(fragment, howMuch)
Production test section ####.
Definition: relval_steps.py:506
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
AHCalParameters::kRowColumn_
static constexpr int kRowColumn_
Definition: AHCalParameters.h:30
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
AHCalDetId.h
weight
Definition: weight.py:1
CaloSD
Definition: CaloSD.h:39
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
AHCalParameters::kSign_
static constexpr int kSign_
Definition: AHCalParameters.h:29