CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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:
33  hbdkToken_{
35  hedkToken_{
36  cc.esConsumes<HBHEDarkening, HBHEDarkeningRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", "HE"})},
37  hcalDDSim_{nullptr},
38  hcalDDRec_{nullptr},
39  hcalSimConstants_{nullptr},
40  hbDarkening_{nullptr},
41  heDarkening_{nullptr} {
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_
T getUntrackedParameter(std::string const &, T const &) const
const HcalDDDSimConstants * hcalDDSim_
const edm::ESGetToken< HBHEDarkening, HBHEDarkeningRecord > hbdkToken_
HCalSD HcalSensitiveDetector
void beginRun(const edm::EventSetup &es) final
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)
const HcalDDDRecConstants * hcalDDRec_
const HcalSimulationConstants * hcalSimConstants_
const edm::ESGetToken< HcalDDDSimConstants, HcalSimNumberingRecord > hdscToken_
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > hdrcToken_
HcalSensitiveDetectorBuilder(edm::ParameterSet const &p, edm::ConsumesCollector cc)
double sd
T const * product() const
Definition: ESHandle.h:86
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Log< level::Warning, false > LogWarning
bool isValid() const
Definition: ESHandle.h:44