File indexing completed on 2024-04-06 11:57:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h"
0027 #include "FWCore/ParameterSet/interface/FileInPath.h"
0028 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0029
0030 #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLEcalBarrel.h"
0031 #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLEcalEndcap.h"
0032
0033
0034
0035
0036 CaloMiscalibTools::CaloMiscalibTools(const edm::ParameterSet& iConfig) {
0037
0038
0039
0040 barrelfileinpath_ = iConfig.getUntrackedParameter<std::string>("fileNameBarrel", "");
0041 endcapfileinpath_ = iConfig.getUntrackedParameter<std::string>("fileNameEndcap", "");
0042
0043 edm::FileInPath barrelfiletmp("CalibCalorimetry/CaloMiscalibTools/data/" + barrelfileinpath_);
0044 edm::FileInPath endcapfiletmp("CalibCalorimetry/CaloMiscalibTools/data/" + endcapfileinpath_);
0045
0046 barrelfile_ = barrelfiletmp.fullPath();
0047 endcapfile_ = endcapfiletmp.fullPath();
0048
0049 edm::LogVerbatim("CaloMiscalibTools") << "Barrel file is:" << barrelfile_;
0050 edm::LogVerbatim("CaloMiscalibTools") << "endcap file is:" << endcapfile_;
0051
0052
0053 setWhatProduced(this, &CaloMiscalibTools::produce);
0054 findingRecord<EcalIntercalibConstantsRcd>();
0055
0056 }
0057
0058 CaloMiscalibTools::~CaloMiscalibTools() {
0059
0060
0061 }
0062
0063
0064
0065
0066
0067
0068 CaloMiscalibTools::ReturnType CaloMiscalibTools::produce(const EcalIntercalibConstantsRcd& iRecord) {
0069 CaloMiscalibMapEcal map;
0070 map.prefillMap();
0071 MiscalibReaderFromXMLEcalBarrel barrelreader_(map);
0072 MiscalibReaderFromXMLEcalEndcap endcapreader_(map);
0073 if (!barrelfile_.empty())
0074 barrelreader_.parseXMLMiscalibFile(barrelfile_);
0075 if (!endcapfile_.empty())
0076 endcapreader_.parseXMLMiscalibFile(endcapfile_);
0077 map.print();
0078
0079 CaloMiscalibTools::ReturnType mydata = std::make_unique<EcalIntercalibConstants>(map.get());
0080 return mydata;
0081 }
0082
0083 void CaloMiscalibTools::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
0084 const edm::IOVSyncValue&,
0085 edm::ValidityInterval& oValidity) {
0086 oValidity = edm::ValidityInterval(edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime());
0087 }