CMS 3D CMS Logo

CastorTextCalibrations.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <iostream>
3 #include <fstream>
4 
7 
9 
11 
19 
29 
30 #include "CastorTextCalibrations.h"
31 //
32 // class decleration
33 //
34 
35 using namespace cms;
36 
38 
39 {
40  //parsing parameters
41  std::vector<edm::ParameterSet> data = iConfig.getParameter<std::vector<edm::ParameterSet> >("input");
42  std::vector<edm::ParameterSet>::iterator request = data.begin();
43  for (; request != data.end(); ++request) {
44  std::string objectName = request->getParameter<std::string>("object");
45  edm::FileInPath fp = request->getParameter<edm::FileInPath>("file");
46  mInputs[objectName] = fp.fullPath();
47  if (objectName == "Pedestals") {
48  setWhatProduced(this, &CastorTextCalibrations::producePedestals);
49  findingRecord<CastorPedestalsRcd>();
50  } else if (objectName == "PedestalWidths") {
51  setWhatProduced(this, &CastorTextCalibrations::producePedestalWidths);
52  findingRecord<CastorPedestalWidthsRcd>();
53  } else if (objectName == "Gains") {
54  setWhatProduced(this, &CastorTextCalibrations::produceGains);
55  findingRecord<CastorGainsRcd>();
56  } else if (objectName == "GainWidths") {
57  setWhatProduced(this, &CastorTextCalibrations::produceGainWidths);
58  findingRecord<CastorGainWidthsRcd>();
59  } else if (objectName == "QIEData") {
60  setWhatProduced(this, &CastorTextCalibrations::produceQIEData);
61  findingRecord<CastorQIEDataRcd>();
62  } else if (objectName == "ChannelQuality") {
63  setWhatProduced(this, &CastorTextCalibrations::produceChannelQuality);
64  findingRecord<CastorChannelQualityRcd>();
65  } else if (objectName == "ElectronicsMap") {
66  setWhatProduced(this, &CastorTextCalibrations::produceElectronicsMap);
67  findingRecord<CastorElectronicsMapRcd>();
68  } else if (objectName == "RecoParams") {
69  setWhatProduced(this, &CastorTextCalibrations::produceRecoParams);
70  findingRecord<CastorRecoParamsRcd>();
71  } else if (objectName == "SaturationCorrs") {
72  setWhatProduced(this, &CastorTextCalibrations::produceSaturationCorrs);
73  findingRecord<CastorSaturationCorrsRcd>();
74  } else {
75  std::cerr << "CastorTextCalibrations-> Unknown object name '" << objectName << "', known names are: "
76  << "Pedestals PedestalWidths Gains GainWidths QIEData ChannelQuality ElectronicsMap RecoParams "
77  "SaturationCorrs"
78  << std::endl;
79  }
80  }
81  // setWhatProduced(this);
82 }
83 
85 
86 //
87 // member functions
88 //
90  const edm::IOVSyncValue& iTime,
91  edm::ValidityInterval& oInterval) {
92  std::string record = iKey.name();
94 }
95 
96 template <class T>
97 std::unique_ptr<T> produce_impl(const std::string& fFile) {
98  std::unique_ptr<T> result(new T());
99  std::ifstream inStream(fFile.c_str());
100  if (!inStream.good()) {
101  std::cerr << "CastorTextCalibrations-> Unable to open file '" << fFile << "'" << std::endl;
102  throw cms::Exception("FileNotFound") << "Unable to open '" << fFile << "'" << std::endl;
103  }
104  if (!CastorDbASCIIIO::getObject(inStream, *result)) {
105  std::cerr << "CastorTextCalibrations-> Can not read object from file '" << fFile << "'" << std::endl;
106  throw cms::Exception("ReadError") << "Can not read object from file '" << fFile << "'" << std::endl;
107  }
108  return result;
109 }
110 
111 std::unique_ptr<CastorPedestals> CastorTextCalibrations::producePedestals(const CastorPedestalsRcd&) {
112  return produce_impl<CastorPedestals>(mInputs["Pedestals"]);
113 }
114 
115 std::unique_ptr<CastorPedestalWidths> CastorTextCalibrations::producePedestalWidths(const CastorPedestalWidthsRcd&) {
116  return produce_impl<CastorPedestalWidths>(mInputs["PedestalWidths"]);
117 }
118 
119 std::unique_ptr<CastorGains> CastorTextCalibrations::produceGains(const CastorGainsRcd&) {
120  return produce_impl<CastorGains>(mInputs["Gains"]);
121 }
122 
123 std::unique_ptr<CastorGainWidths> CastorTextCalibrations::produceGainWidths(const CastorGainWidthsRcd&) {
124  return produce_impl<CastorGainWidths>(mInputs["GainWidths"]);
125 }
126 
127 std::unique_ptr<CastorQIEData> CastorTextCalibrations::produceQIEData(const CastorQIEDataRcd& rcd) {
128  return produce_impl<CastorQIEData>(mInputs["QIEData"]);
129 }
130 
131 std::unique_ptr<CastorChannelQuality> CastorTextCalibrations::produceChannelQuality(const CastorChannelQualityRcd& rcd) {
132  return produce_impl<CastorChannelQuality>(mInputs["ChannelQuality"]);
133 }
134 
135 std::unique_ptr<CastorElectronicsMap> CastorTextCalibrations::produceElectronicsMap(const CastorElectronicsMapRcd& rcd) {
136  return produce_impl<CastorElectronicsMap>(mInputs["ElectronicsMap"]);
137 }
138 
139 std::unique_ptr<CastorRecoParams> CastorTextCalibrations::produceRecoParams(const CastorRecoParamsRcd& rcd) {
140  return produce_impl<CastorRecoParams>(mInputs["RecoParams"]);
141 }
142 
143 std::unique_ptr<CastorSaturationCorrs> CastorTextCalibrations::produceSaturationCorrs(
144  const CastorSaturationCorrsRcd& rcd) {
145  return produce_impl<CastorSaturationCorrs>(mInputs["SaturationCorrs"]);
146 }
CastorChannelQualityRcd.h
CastorPedestalsRcd.h
CastorPedestalWidths.h
CastorTextCalibrations::produceChannelQuality
std::unique_ptr< CastorChannelQuality > produceChannelQuality(const CastorChannelQualityRcd &rcd)
Definition: CastorTextCalibrations.cc:131
CastorSaturationCorrsRcd
Definition: CastorSaturationCorrsRcd.h:4
CastorQIEDataRcd.h
CastorTextCalibrations::produceRecoParams
std::unique_ptr< CastorRecoParams > produceRecoParams(const CastorRecoParamsRcd &rcd)
Definition: CastorTextCalibrations.cc:139
ValidityInterval.h
CastorQIEDataRcd
Definition: CastorQIEDataRcd.h:24
edm::ValidityInterval
Definition: ValidityInterval.h:28
CastorTextCalibrations::~CastorTextCalibrations
~CastorTextCalibrations() override
Definition: CastorTextCalibrations.cc:84
CastorTextCalibrations::produceGains
std::unique_ptr< CastorGains > produceGains(const CastorGainsRcd &rcd)
Definition: CastorTextCalibrations.cc:119
personalPlayback.fp
fp
Definition: personalPlayback.py:523
CastorElectronicsMap.h
CastorGainWidths.h
CastorPedestalWidthsRcd
Definition: CastorPedestalWidthsRcd.h:24
CastorGainWidthsRcd.h
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
CastorTextCalibrations::produceQIEData
std::unique_ptr< CastorQIEData > produceQIEData(const CastorQIEDataRcd &rcd)
Definition: CastorTextCalibrations.cc:127
produce_impl
std::unique_ptr< T > produce_impl(const std::string &fFile)
Definition: CastorTextCalibrations.cc:97
edm::FileInPath
Definition: FileInPath.h:61
CastorQIEData.h
CastorElectronicsMapRcd.h
CastorRecoParamsRcd
Definition: CastorRecoParamsRcd.h:4
edm::eventsetup::EventSetupRecordKey::name
const char * name() const
Definition: EventSetupRecordKey.h:46
CastorTextCalibrations::produceElectronicsMap
std::unique_ptr< CastorElectronicsMap > produceElectronicsMap(const CastorElectronicsMapRcd &rcd)
Definition: CastorTextCalibrations.cc:135
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
CastorTextCalibrations::producePedestals
std::unique_ptr< CastorPedestals > producePedestals(const CastorPedestalsRcd &rcd)
Definition: CastorTextCalibrations.cc:111
CastorPedestalWidthsRcd.h
FileInPath.h
edm::ParameterSet
Definition: ParameterSet.h:47
CastorTextCalibrations::CastorTextCalibrations
CastorTextCalibrations(const edm::ParameterSet &)
Definition: CastorTextCalibrations.cc:37
CastorTextCalibrations::produceSaturationCorrs
std::unique_ptr< CastorSaturationCorrs > produceSaturationCorrs(const CastorSaturationCorrsRcd &rcd)
Definition: CastorTextCalibrations.cc:143
CastorTextCalibrations::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: CastorTextCalibrations.cc:89
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
CastorChannelQualityRcd
Definition: CastorChannelQualityRcd.h:24
CastorDbASCIIIO::getObject
bool getObject(std::istream &fInput, CastorPedestals &fObject)
Definition: CastorDbASCIIIO.cc:245
CastorRecoParamsRcd.h
CastorGainsRcd.h
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
CastorTextCalibrations::producePedestalWidths
std::unique_ptr< CastorPedestalWidths > producePedestalWidths(const CastorPedestalWidthsRcd &rcd)
Definition: CastorTextCalibrations.cc:115
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CastorDbASCIIIO.h
CastorPedestals.h
cond::ValidityInterval
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
CastorTextCalibrations.h
T
long double T
Definition: Basic3DVectorLD.h:48
Exception
Definition: hltDiff.cc:245
CastorElectronicsMapRcd
Definition: CastorElectronicsMapRcd.h:4
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
CastorChannelQuality.h
mps_fire.result
result
Definition: mps_fire.py:311
CastorGainsRcd
Definition: CastorGainsRcd.h:24
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
CastorTextCalibrations::produceGainWidths
std::unique_ptr< CastorGainWidths > produceGainWidths(const CastorGainWidthsRcd &rcd)
Definition: CastorTextCalibrations.cc:123
CastorPedestalsRcd
Definition: CastorPedestalsRcd.h:24
CastorGainWidthsRcd
Definition: CastorGainWidthsRcd.h:24
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
CastorSaturationCorrsRcd.h
summarizeEdmComparisonLogfiles.objectName
objectName
Definition: summarizeEdmComparisonLogfiles.py:104
CastorGains.h