CMS 3D CMS Logo

CastorHardcodeCalibrations.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Original Author: Fedor Ratnikov
3 // Adapted for CASTOR by L. Mundim
4 //
5 
6 #include <memory>
7 #include <iostream>
8 
14 
24 
28 
30 
31 // class declaration
32 //
33 
34 using namespace cms;
35 
36 namespace {
37 
38 std::vector<HcalGenericDetId> allCells (bool h2_mode) {
39  static std::vector<HcalGenericDetId> result;
40  if (result.empty()) {
41 
42  CastorTopology castortopology;
43  HcalCastorDetId cell;
45 
46  for(int sector=1; sector<17; sector++) {
47  for(int module=1; module<3; module++) {
48  cell = HcalCastorDetId(section, true, sector, module);
49  if (castortopology.valid(cell)) result.push_back(cell);
50  cell = HcalCastorDetId(section, false, sector, module);
51  if (castortopology.valid(cell)) result.push_back(cell);
52  }
53  }
54 
55  section = HcalCastorDetId::HAD;
56  for(int sector= 1; sector < 17; sector++){
57  for(int module=3; module<15; module++) {
58  cell = HcalCastorDetId(section, true, sector, module);
59  if(castortopology.valid(cell)) result.push_back(cell);
60  cell = HcalCastorDetId(section, false, sector, module);
61  if(castortopology.valid(cell)) result.push_back(cell);
62  }
63  }
64 
65 }
66  return result;
67 
68  }
69 }
70 
72 
73 {
74  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::CastorHardcodeCalibrations->...";
75  //parsing record parameters
76  h2mode_=iConfig.getUntrackedParameter<bool>("H2Mode",false);
77  std::vector <std::string> toGet = iConfig.getUntrackedParameter <std::vector <std::string> > ("toGet");
78  for(std::vector <std::string>::iterator objectName = toGet.begin(); objectName != toGet.end(); ++objectName ) {
79  bool all = *objectName == "all";
80  if ((*objectName == "Pedestals") || all) {
81  setWhatProduced (this, &CastorHardcodeCalibrations::producePedestals);
82  findingRecord <CastorPedestalsRcd> ();
83  }
84  if ((*objectName == "PedestalWidths") || all) {
86  findingRecord <CastorPedestalWidthsRcd> ();
87  }
88  if ((*objectName == "Gains") || all) {
89  setWhatProduced (this, &CastorHardcodeCalibrations::produceGains);
90  findingRecord <CastorGainsRcd> ();
91  }
92  if ((*objectName == "GainWidths") || all) {
93  setWhatProduced (this, &CastorHardcodeCalibrations::produceGainWidths);
94  findingRecord <CastorGainWidthsRcd> ();
95  }
96  if ((*objectName == "QIEData") || all) {
97  setWhatProduced (this, &CastorHardcodeCalibrations::produceQIEData);
98  findingRecord <CastorQIEDataRcd> ();
99  }
100  if ((*objectName == "ChannelQuality") || (*objectName == "channelQuality") || all) {
101  setWhatProduced (this, &CastorHardcodeCalibrations::produceChannelQuality);
102  findingRecord <CastorChannelQualityRcd> ();
103  }
104  if ((*objectName == "ElectronicsMap") || (*objectName == "electronicsMap") || all) {
105  setWhatProduced (this, &CastorHardcodeCalibrations::produceElectronicsMap);
106  findingRecord <CastorElectronicsMapRcd> ();
107  }
108  if ((*objectName == "RecoParams") || all) {
109  setWhatProduced (this, &CastorHardcodeCalibrations::produceRecoParams);
110  findingRecord <CastorRecoParamsRcd> ();
111  }
112  if ((*objectName == "SaturationCorrs") || all) {
114  findingRecord <CastorSaturationCorrsRcd> ();
115  }
116  }
117 }
118 
119 
121 {
122 }
123 
124 
125 //
126 // member functions
127 //
128 void
130  std::string record = iKey.name ();
131  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::setIntervalFor-> key: " << record << " time: " << iTime.eventID() << '/' << iTime.time ().value ();
133 }
134 
135 std::unique_ptr<CastorPedestals> CastorHardcodeCalibrations::producePedestals (const CastorPedestalsRcd&) {
136  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::producePedestals-> ...";
137  auto result = std::make_unique<CastorPedestals>(false);
138  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
139  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); ++cell) {
141  result->addValues(item);
142  }
143  return result;
144 }
145 
146 std::unique_ptr<CastorPedestalWidths> CastorHardcodeCalibrations::producePedestalWidths (const CastorPedestalWidthsRcd&) {
147  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::producePedestalWidths-> ...";
148  auto result = std::make_unique<CastorPedestalWidths>(false);
149  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
150  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); ++cell) {
152  result->addValues(item);
153  }
154  return result;
155 }
156 
157 std::unique_ptr<CastorGains> CastorHardcodeCalibrations::produceGains (const CastorGainsRcd&) {
158  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceGains-> ...";
159  auto result = std::make_unique<CastorGains>();
160  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
161  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); ++cell) {
162  CastorGain item = CastorDbHardcode::makeGain (*cell);
163  result->addValues(item);
164  }
165  return result;
166 }
167 
168 std::unique_ptr<CastorGainWidths> CastorHardcodeCalibrations::produceGainWidths (const CastorGainWidthsRcd&) {
169  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceGainWidths-> ...";
170  auto result = std::make_unique<CastorGainWidths>();
171  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
172  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); ++cell) {
174  result->addValues(item);
175  }
176  return result;
177 }
178 
179 std::unique_ptr<CastorQIEData> CastorHardcodeCalibrations::produceQIEData (const CastorQIEDataRcd& rcd) {
180  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceQIEData-> ...";
181  auto result = std::make_unique<CastorQIEData>();
182  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
183  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); ++cell) {
185  result->addCoder(coder);
186  }
187  return result;
188 }
189 
190 std::unique_ptr<CastorChannelQuality> CastorHardcodeCalibrations::produceChannelQuality (const CastorChannelQualityRcd& rcd) {
191  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceChannelQuality-> ...";
192  auto result = std::make_unique<CastorChannelQuality>();
193  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
194  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); ++cell) {
196  result->addValues(item);
197  }
198  return result;
199 }
200 
201 std::unique_ptr<CastorElectronicsMap> CastorHardcodeCalibrations::produceElectronicsMap (const CastorElectronicsMapRcd& rcd) {
202  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceElectronicsMap-> ...";
203 
204  auto result = std::make_unique<CastorElectronicsMap>();
206  return result;
207 }
208 
209 std::unique_ptr<CastorRecoParams> CastorHardcodeCalibrations::produceRecoParams (const CastorRecoParamsRcd& rcd) {
210  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceRecoParams-> ...";
211  auto result = std::make_unique<CastorRecoParams>();
212  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
213  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); ++cell) {
215  result->addValues(item);
216  }
217  return result;
218 }
219 
220 std::unique_ptr<CastorSaturationCorrs> CastorHardcodeCalibrations::produceSaturationCorrs (const CastorSaturationCorrsRcd& rcd) {
221  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceSaturationCorrs-> ...";
222  auto result = std::make_unique<CastorSaturationCorrs>();
223  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
224  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); ++cell) {
226  result->addValues(item);
227  }
228  return result;
229 }
CastorPedestalWidth makePedestalWidth(HcalGenericDetId fId)
T getUntrackedParameter(std::string const &, T const &) const
CastorQIECoder makeQIECoder(HcalGenericDetId fId)
const EventID & eventID() const
Definition: IOVSyncValue.h:42
std::unique_ptr< CastorQIEData > produceQIEData(const CastorQIEDataRcd &rcd)
JetCorrectorParameters::Record record
Definition: classes.h:7
void makeHardcodeMap(CastorElectronicsMap &emap)
std::unique_ptr< CastorRecoParams > produceRecoParams(const CastorRecoParamsRcd &rcd)
std::unique_ptr< CastorChannelQuality > produceChannelQuality(const CastorChannelQualityRcd &rcd)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
std::unique_ptr< CastorPedestalWidths > producePedestalWidths(const CastorPedestalWidthsRcd &rcd)
CastorHardcodeCalibrations(const edm::ParameterSet &)
std::unique_ptr< CastorPedestals > producePedestals(const CastorPedestalsRcd &rcd)
std::unique_ptr< CastorSaturationCorrs > produceSaturationCorrs(const CastorSaturationCorrsRcd &rcd)
std::unique_ptr< CastorGainWidths > produceGainWidths(const CastorGainWidthsRcd &rcd)
static const IOVSyncValue & beginOfTime()
CastorRecoParam makeRecoParam(HcalGenericDetId fId)
std::unique_ptr< CastorElectronicsMap > produceElectronicsMap(const CastorElectronicsMapRcd &rcd)
CastorSaturationCorr makeSaturationCorr(HcalGenericDetId fId)
Namespace of DDCMS conversion namespace.
virtual bool valid(const HcalCastorDetId &id) const
CastorGainWidth makeGainWidth(HcalGenericDetId fId)
CastorPedestal makePedestal(HcalGenericDetId fId, bool fSmear=false)
CastorGain makeGain(HcalGenericDetId fId, bool fSmear=false)
std::unique_ptr< CastorGains > produceGains(const CastorGainsRcd &rcd)
const Timestamp & time() const
Definition: IOVSyncValue.h:44
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: vlib.h:208
TimeValue_t value() const
Definition: Timestamp.h:56