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)
15  {
17  es.get<Record>().get(p);
18  return new Data(*p.product());
19  }
20 }
21 
22 std::unique_ptr<AbsHcalAlgoData>
24 {
25  AbsHcalAlgoData* data = 0;
26 
27  // Compare with possibe class names
28  //
29  if (className == "HFPhase1PMTParams")
30  data = fetchHcalAlgoDataHelper<HFPhase1PMTParams, HFPhase1PMTParamsRcd>(es);
31 
32  return std::unique_ptr<AbsHcalAlgoData>(data);
33 }
std::unique_ptr< AbsHcalAlgoData > fetchHcalAlgoData(const std::string &className, const edm::EventSetup &es)
const T & get() const
Definition: EventSetup.h:55
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
T const * product() const
Definition: ESHandle.h:86
std::string className(const T &t)
Definition: ClassName.h:30