CMS 3D CMS Logo

CaloMiscalibToolsMC.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CaloMiscalibToolsMC
4 // Class: CaloMiscalibToolsMC
5 //
13 //
14 // Original Author: Lorenzo AGOSTINO
15 // Created: Wed May 31 10:37:45 CEST 2006
16 //
17 // Modified : Luca Malgeri
18 // Date: : 11/09/2006
19 // Reason : split class definition (.h) from source code (.cc)
20 //
21 //
22 
23 
24 // system include files
25 
26 // user include files
29 
32 
33 //
34 // constructors and destructor
35 //
37 {
38  //the following line is needed to tell the framework what
39  // data is being produced
40 
41  barrelfileinpath_=iConfig.getUntrackedParameter<std::string> ("fileNameBarrel","");
42  endcapfileinpath_=iConfig.getUntrackedParameter<std::string> ("fileNameEndcap","");
43 
44  edm::FileInPath barrelfiletmp("CalibCalorimetry/CaloMiscalibTools/data/"+barrelfileinpath_);
45  edm::FileInPath endcapfiletmp("CalibCalorimetry/CaloMiscalibTools/data/"+endcapfileinpath_);
46 
47 
48  barrelfile_=barrelfiletmp.fullPath();
49  endcapfile_=endcapfiletmp.fullPath();
50 
51  std::cout <<"Barrel file is:"<< barrelfile_<<std::endl;
52  std::cout <<"endcap file is:"<< endcapfile_<<std::endl;
53 
54 
55  // added by Zhen (changed since 1_2_0)
57  findingRecord<EcalIntercalibConstantsMCRcd>();
58  //now do what ever other initialization is needed
59 }
60 
61 
63 {
64 
65  // do anything here that needs to be done at desctruction time
66  // (e.g. close files, deallocate resources etc.)
67 
68 }
69 
70 
71 //
72 // member functions
73 //
74 
75 // ------------ method called to produce the data ------------
78 {
80  map.prefillMap();
81  MiscalibReaderFromXMLEcalBarrel barrelreader_(map);
82  MiscalibReaderFromXMLEcalEndcap endcapreader_(map);
83  if(!barrelfile_.empty()) barrelreader_.parseXMLMiscalibFile(barrelfile_);
84  if(!endcapfile_.empty())endcapreader_.parseXMLMiscalibFile(endcapfile_);
85  map.print();
86  // Added by Zhen, need a new object so to not be deleted at exit
87  // std::cout<<"about to copy"<<std::endl;
88  CaloMiscalibToolsMC::ReturnType mydata = std::make_unique<EcalIntercalibConstantsMC>(map.get());
89  // std::cout<<"mydata "<<mydata<<std::endl;
90  return mydata;
91 }
92 
94  edm::ValidityInterval & oValidity)
95  {
97 
98  }
99 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:116
T getUntrackedParameter(std::string const &, T const &) const
ReturnType produce(const EcalIntercalibConstantsMCRcd &)
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
bool parseXMLMiscalibFile(std::string configFile)
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
std::unique_ptr< EcalIntercalibConstantsMC > ReturnType
const EcalIntercalibConstants & get()
static const IOVSyncValue & beginOfTime()
std::string fullPath() const
Definition: FileInPath.cc:197
CaloMiscalibToolsMC(const edm::ParameterSet &)