CMS 3D CMS Logo

CaloMiscalibTools.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CaloMiscalibTools
4 // Class: CaloMiscalibTools
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 // system include files
24 
25 // user include files
29 
32 
33 //
34 // constructors and destructor
35 //
37  //the following line is needed to tell the framework what
38  // data is being produced
39 
40  barrelfileinpath_ = iConfig.getUntrackedParameter<std::string>("fileNameBarrel", "");
41  endcapfileinpath_ = iConfig.getUntrackedParameter<std::string>("fileNameEndcap", "");
42 
43  edm::FileInPath barrelfiletmp("CalibCalorimetry/CaloMiscalibTools/data/" + barrelfileinpath_);
44  edm::FileInPath endcapfiletmp("CalibCalorimetry/CaloMiscalibTools/data/" + endcapfileinpath_);
45 
46  barrelfile_ = barrelfiletmp.fullPath();
47  endcapfile_ = endcapfiletmp.fullPath();
48 
49  edm::LogVerbatim("CaloMiscalibTools") << "Barrel file is:" << barrelfile_;
50  edm::LogVerbatim("CaloMiscalibTools") << "endcap file is:" << endcapfile_;
51 
52  // added by Zhen (changed since 1_2_0)
54  findingRecord<EcalIntercalibConstantsRcd>();
55  //now do what ever other initialization is needed
56 }
57 
59  // do anything here that needs to be done at desctruction time
60  // (e.g. close files, deallocate resources etc.)
61 }
62 
63 //
64 // member functions
65 //
66 
67 // ------------ method called to produce the data ------------
70  map.prefillMap();
71  MiscalibReaderFromXMLEcalBarrel barrelreader_(map);
72  MiscalibReaderFromXMLEcalEndcap endcapreader_(map);
73  if (!barrelfile_.empty())
74  barrelreader_.parseXMLMiscalibFile(barrelfile_);
75  if (!endcapfile_.empty())
76  endcapreader_.parseXMLMiscalibFile(endcapfile_);
77  map.print();
78  // Added by Zhen, need a new object so to not be deleted at exit
79  CaloMiscalibTools::ReturnType mydata = std::make_unique<EcalIntercalibConstants>(map.get());
80  return mydata;
81 }
82 
84  const edm::IOVSyncValue&,
85  edm::ValidityInterval& oValidity) {
87 }
Log< level::Info, true > LogVerbatim
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
bool parseXMLMiscalibFile(std::string configFile)
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
T getUntrackedParameter(std::string const &, T const &) const
std::string endcapfileinpath_
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
std::unique_ptr< EcalIntercalibConstants > ReturnType
std::string endcapfile_
CaloMiscalibTools(const edm::ParameterSet &)
std::string barrelfile_
std::string barrelfileinpath_
~CaloMiscalibTools() override
ReturnType produce(const EcalIntercalibConstantsRcd &)
const std::string & fullPath() const
Definition: FileInPath.cc:144