CMS 3D CMS Logo

HcalSensitiveDetectorBuilder.cc
Go to the documentation of this file.
1 
2 // system include files
3 #include <string>
4 #include <vector>
5 
6 // user include files
10 
19 
26 
28 public:
30  : hdscToken_{cc.esConsumes<edm::Transition::BeginRun>()},
33  hbdkToken_{
35  hedkToken_{
37  hcalDDSim_{nullptr},
38  hcalDDRec_{nullptr},
39  hcalSimConstants_{nullptr},
40  hbDarkening_{nullptr},
41  heDarkening_{nullptr} {
42  edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HCalSD");
43  agingFlagHB_ = m_HC.getParameter<bool>("HBDarkening");
44  agingFlagHE_ = m_HC.getParameter<bool>("HEDarkening");
45  forTBHC_ = m_HC.getUntrackedParameter<bool>("ForTBHCAL", false);
46  forTBH2_ = m_HC.getUntrackedParameter<bool>("ForTBH2", false);
47  }
48 
49  void beginRun(const edm::EventSetup& es) final {
50  hcalDDSim_ = &es.getData(hdscToken_);
51  if ((!forTBHC_) && (!forTBH2_))
52  hcalDDRec_ = &es.getData(hdrcToken_);
54  if (hscs.isValid())
55  hcalSimConstants_ = hscs.product();
56  else
57  edm::LogWarning("HcalSim") << "HcalSensitiveDetectorBuilder does not find record for HcalSimulationConstants";
58  if (agingFlagHB_) {
59  edm::ESHandle<HBHEDarkening> hbdark = es.getHandle(hbdkToken_);
60  if (hbdark.isValid())
61  hbDarkening_ = hbdark.product();
62  else
63  edm::LogVerbatim("HcalSim") << "HcalSensitiveDetectorBuilder does not find record for HBDarkening";
64  }
65  if (agingFlagHE_) {
66  edm::ESHandle<HBHEDarkening> hedark = es.getHandle(hedkToken_);
67  if (hedark.isValid())
68  heDarkening_ = hedark.product();
69  else
70  edm::LogVerbatim("HcalSim") << "HcalSensitiveDetectorBuilder does not find record for HEDarkening";
71  }
72  }
73 
74  std::unique_ptr<SensitiveDetector> make(const std::string& iname,
75  const SensitiveDetectorCatalog& clg,
76  const edm::ParameterSet& p,
77  const SimTrackManager* man,
78  SimActivityRegistry& reg) const final {
79  auto sd = std::make_unique<HCalSD>(
82  return sd;
83  }
84 
85 private:
98 };
99 
Log< level::Info, true > LogVerbatim
const edm::ESGetToken< HBHEDarkening, HBHEDarkeningRecord > hedkToken_
const HcalDDDSimConstants * hcalDDSim_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
const edm::ESGetToken< HBHEDarkening, HBHEDarkeningRecord > hbdkToken_
HCalSD HcalSensitiveDetector
void beginRun(const edm::EventSetup &es) final
T getUntrackedParameter(std::string const &, T const &) const
static void enroll(SimActivityRegistry &iReg, T *iObj)
const edm::ESGetToken< HcalSimulationConstants, HcalSimNumberingRecord > hscsToken_
Definition: HCalSD.h:38
std::unique_ptr< SensitiveDetector > make(const std::string &iname, const SensitiveDetectorCatalog &clg, const edm::ParameterSet &p, const SimTrackManager *man, SimActivityRegistry &reg) const final
#define DEFINE_SENSITIVEDETECTORBUILDER(type, name)
T const * product() const
Definition: ESHandle.h:86
const HcalDDDRecConstants * hcalDDRec_
const HcalSimulationConstants * hcalSimConstants_
const edm::ESGetToken< HcalDDDSimConstants, HcalSimNumberingRecord > hdscToken_
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > hdrcToken_
bool isValid() const
Definition: ESHandle.h:44
HcalSensitiveDetectorBuilder(edm::ParameterSet const &p, edm::ConsumesCollector cc)
Log< level::Warning, false > LogWarning