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
28 
31 
32 //
33 // constructors and destructor
34 //
36  //the following line is needed to tell the framework what
37  // data is being produced
38 
39  barrelfileinpath_ = iConfig.getUntrackedParameter<std::string>("fileNameBarrel", "");
40  endcapfileinpath_ = iConfig.getUntrackedParameter<std::string>("fileNameEndcap", "");
41 
42  edm::FileInPath barrelfiletmp("CalibCalorimetry/CaloMiscalibTools/data/" + barrelfileinpath_);
43  edm::FileInPath endcapfiletmp("CalibCalorimetry/CaloMiscalibTools/data/" + endcapfileinpath_);
44 
45  barrelfile_ = barrelfiletmp.fullPath();
46  endcapfile_ = endcapfiletmp.fullPath();
47 
48  std::cout << "Barrel file is:" << barrelfile_ << std::endl;
49  std::cout << "endcap file is:" << endcapfile_ << std::endl;
50 
51  // added by Zhen (changed since 1_2_0)
53  findingRecord<EcalIntercalibConstantsRcd>();
54  //now do what ever other initialization is needed
55 }
56 
58  // do anything here that needs to be done at desctruction time
59  // (e.g. close files, deallocate resources etc.)
60 }
61 
62 //
63 // member functions
64 //
65 
66 // ------------ method called to produce the data ------------
69  map.prefillMap();
70  MiscalibReaderFromXMLEcalBarrel barrelreader_(map);
71  MiscalibReaderFromXMLEcalEndcap endcapreader_(map);
72  if (!barrelfile_.empty())
73  barrelreader_.parseXMLMiscalibFile(barrelfile_);
74  if (!endcapfile_.empty())
75  endcapreader_.parseXMLMiscalibFile(endcapfile_);
76  map.print();
77  // Added by Zhen, need a new object so to not be deleted at exit
78  // std::cout<<"about to copy"<<std::endl;
79  CaloMiscalibTools::ReturnType mydata = std::make_unique<EcalIntercalibConstants>(map.get());
80  // std::cout<<"mydata "<<mydata<<std::endl;
81  return mydata;
82 }
83 
85  const edm::IOVSyncValue&,
86  edm::ValidityInterval& oValidity) {
88 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
T getUntrackedParameter(std::string const &, T const &) const
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:19
std::string endcapfileinpath_
const EcalIntercalibConstants & get()
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 &)
std::string fullPath() const
Definition: FileInPath.cc:163