CMS 3D CMS Logo

MtdSD.cc
Go to the documentation of this file.
2 
6 
8 
12 
13 #include "G4Track.hh"
14 #include "G4Step.hh"
15 #include "G4StepPoint.hh"
16 
17 #include <iostream>
18 
19 //#define EDM_ML_DEBUG
20 //-------------------------------------------------------------------
22  const edm::EventSetup& es,
23  const SensitiveDetectorCatalog& clg,
24  edm::ParameterSet const& p,
25  const SimTrackManager* manager)
26  : TimingSD(name, es, clg, p, manager), numberingScheme(nullptr) {
27  //Parameters
28  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("MtdSD");
29  int verbn = m_p.getUntrackedParameter<int>("Verbosity");
30 
31  SetVerboseLevel(verbn);
32 
33  MTDNumberingScheme* scheme = nullptr;
34  if (name == "FastTimerHitsBarrel") {
35  scheme = dynamic_cast<MTDNumberingScheme*>(new BTLNumberingScheme());
36  isBTL = true;
37  } else if (name == "FastTimerHitsEndcap") {
38  scheme = dynamic_cast<MTDNumberingScheme*>(new ETLNumberingScheme());
39  isETL = true;
40  } else {
41  scheme = nullptr;
42  edm::LogWarning("MtdSim") << "MtdSD: ReadoutName not supported";
43  }
44  if (scheme)
46 
47  double newTimeFactor = 1. / m_p.getParameter<double>("TimeSliceUnit");
48  edm::LogInfo("MtdSim") << "New time factor = " << newTimeFactor;
49  setTimeFactor(newTimeFactor);
50 
51  edm::LogVerbatim("MtdSim") << "MtdSD: Instantiation completed for " << name;
52 }
53 
55 
56 uint32_t MtdSD::setDetUnitId(const G4Step* aStep) {
57  if (numberingScheme == nullptr) {
58  return MTDDetId();
59  } else {
60  getBaseNumber(aStep);
61 #ifdef EDM_ML_DEBUG
62  edm::LogInfo("MtdSim") << "DetId = " << numberingScheme->getUnitID(theBaseNumber);
63 #endif
65  }
66 }
67 
69  if (scheme != nullptr) {
70  edm::LogInfo("MtdSim") << "MtdSD: updates numbering scheme for " << GetName();
71  if (numberingScheme)
72  delete numberingScheme;
74  }
75 }
76 
77 void MtdSD::getBaseNumber(const G4Step* aStep) {
79  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
80  int theSize = touch->GetHistoryDepth() + 1;
81  if (theBaseNumber.getCapacity() < theSize)
82  theBaseNumber.setSize(theSize);
83  //Get name and copy numbers
84  if (theSize > 1) {
85 #ifdef EDM_ML_DEBUG
86  edm::LogInfo("MtdSim") << "Building MTD basenumber:";
87 #endif
88  for (int ii = 0; ii < theSize; ii++) {
89  theBaseNumber.addLevel(touch->GetVolume(ii)->GetName(), touch->GetReplicaNumber(ii));
90 #ifdef EDM_ML_DEBUG
91  edm::LogVerbatim("MtdSim") << "MtdSD::getBaseNumber(): Adding level " << ii << ": "
92  << touch->GetVolume(ii)->GetName() << "[" << touch->GetReplicaNumber(ii) << "]";
93 #endif
94  }
95  }
96 }
MTDNumberingScheme::getUnitID
virtual uint32_t getUnitID(const MTDBaseNumber &baseNumber) const =0
SimTrackManager
Definition: SimTrackManager.h:35
MTDNumberingScheme
Definition: MTDNumberingScheme.h:8
MessageLogger.h
ESHandle.h
TimingSD::setTimeFactor
void setTimeFactor(double)
Definition: TimingSD.cc:86
MTDBaseNumber::getCapacity
int getCapacity()
Definition: MTDBaseNumber.cc:45
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MtdSD::setDetUnitId
uint32_t setDetUnitId(const G4Step *) override
Definition: MtdSD.cc:56
TimingSD
Definition: TimingSD.h:29
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
MtdSD::isBTL
bool isBTL
Definition: MtdSD.h:35
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
MTDBaseNumber::addLevel
void addLevel(const std::string &name, const int &copyNumber)
Definition: MTDBaseNumber.cc:21
MtdSD::numberingScheme
MTDNumberingScheme * numberingScheme
Definition: MtdSD.h:33
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MtdSD.h
MTDBaseNumber::setSize
void setSize(const int &size)
Definition: MTDBaseNumber.cc:10
edm::ParameterSet
Definition: ParameterSet.h:47
numberingScheme
static TrackerG4SimHitNumberingScheme & numberingScheme(const GeometricDet &det)
Definition: TkAccumulatingSensitiveDetector.cc:41
MTDDetId.h
IdealGeometryRecord.h
edm::EventSetup
Definition: EventSetup.h:57
MtdSD::MtdSD
MtdSD(const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
Definition: MtdSD.cc:21
BTLNumberingScheme.h
MtdSD::~MtdSD
~MtdSD() override
Definition: MtdSD.cc:54
generator_cfi.scheme
scheme
Definition: generator_cfi.py:22
ETLNumberingScheme.h
ETLNumberingScheme
Definition: ETLNumberingScheme.h:6
MtdSD::theBaseNumber
MTDBaseNumber theBaseNumber
Definition: MtdSD.h:34
MtdSD::setNumberingScheme
void setNumberingScheme(MTDNumberingScheme *)
Definition: MtdSD.cc:68
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
MTDDetId
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
MTDBaseNumber::reset
void reset()
Definition: MTDBaseNumber.cc:47
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
MtdSD::getBaseNumber
void getBaseNumber(const G4Step *)
Definition: MtdSD.cc:77
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MtdSD::isETL
bool isETL
Definition: MtdSD.h:36
cuy.ii
ii
Definition: cuy.py:590
BTLNumberingScheme
Definition: BTLNumberingScheme.h:6