CMS 3D CMS Logo

fetchHcalAlgoData.cc
Go to the documentation of this file.
3 
4 // Includes for AbsHcalAlgoData descendants
5 // and their corresponding records
8 
9 namespace {
10  // Class Data must inherit from AbsHcalAlgoData
11  // and must have a copy constructor. This function
12  // returns an object allocated on the heap.
13  template <class Data, class Record>
14  Data* fetchHcalAlgoDataHelper(const edm::EventSetup& es) {
16  es.get<Record>().get(p);
17  return new Data(*p.product());
18  }
19 } // namespace
20 
21 std::unique_ptr<AbsHcalAlgoData> fetchHcalAlgoData(const std::string& className, const edm::EventSetup& es) {
22  AbsHcalAlgoData* data = nullptr;
23 
24  // Compare with possibe class names
25  //
26  if (className == "HFPhase1PMTParams")
27  data = fetchHcalAlgoDataHelper<HFPhase1PMTParams, HFPhase1PMTParamsRcd>(es);
28 
29  return std::unique_ptr<AbsHcalAlgoData>(data);
30 }
std::unique_ptr< AbsHcalAlgoData > fetchHcalAlgoData(const std::string &className, const edm::EventSetup &es)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
std::string className(const T &t)
Definition: ClassName.h:31