CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.size () <= 0) {
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::auto_ptr<CastorPedestals> CastorHardcodeCalibrations::producePedestals (const CastorPedestalsRcd&) {
136  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::producePedestals-> ...";
137  std::auto_ptr<CastorPedestals> result (new 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 
147  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::producePedestalWidths-> ...";
148  std::auto_ptr<CastorPedestalWidths> result (new 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::auto_ptr<CastorGains> CastorHardcodeCalibrations::produceGains (const CastorGainsRcd&) {
158  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceGains-> ...";
159  std::auto_ptr<CastorGains> result (new 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::auto_ptr<CastorGainWidths> CastorHardcodeCalibrations::produceGainWidths (const CastorGainWidthsRcd&) {
169  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceGainWidths-> ...";
170  std::auto_ptr<CastorGainWidths> result (new 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::auto_ptr<CastorQIEData> CastorHardcodeCalibrations::produceQIEData (const CastorQIEDataRcd& rcd) {
180  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceQIEData-> ...";
181  std::auto_ptr<CastorQIEData> result (new 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::auto_ptr<CastorChannelQuality> CastorHardcodeCalibrations::produceChannelQuality (const CastorChannelQualityRcd& rcd) {
191  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceChannelQuality-> ...";
192  std::auto_ptr<CastorChannelQuality> result (new 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::auto_ptr<CastorElectronicsMap> CastorHardcodeCalibrations::produceElectronicsMap (const CastorElectronicsMapRcd& rcd) {
202  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceElectronicsMap-> ...";
203 
204  std::auto_ptr<CastorElectronicsMap> result (new CastorElectronicsMap ());
206  return result;
207 }
208 
209 std::auto_ptr<CastorRecoParams> CastorHardcodeCalibrations::produceRecoParams (const CastorRecoParamsRcd& rcd) {
210  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceRecoParams-> ...";
211  std::auto_ptr<CastorRecoParams> result (new 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::auto_ptr<CastorSaturationCorrs> CastorHardcodeCalibrations::produceSaturationCorrs (const CastorSaturationCorrsRcd& rcd) {
221  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceSaturationCorrs-> ...";
222  std::auto_ptr<CastorSaturationCorrs> result (new 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)
std::auto_ptr< CastorGainWidths > produceGainWidths(const CastorGainWidthsRcd &rcd)
T getUntrackedParameter(std::string const &, T const &) const
CastorQIECoder makeQIECoder(HcalGenericDetId fId)
std::auto_ptr< CastorChannelQuality > produceChannelQuality(const CastorChannelQualityRcd &rcd)
const EventID & eventID() const
Definition: IOVSyncValue.h:42
JetCorrectorParameters::Record record
Definition: classes.h:7
void makeHardcodeMap(CastorElectronicsMap &emap)
std::auto_ptr< CastorSaturationCorrs > produceSaturationCorrs(const CastorSaturationCorrsRcd &rcd)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
CastorHardcodeCalibrations(const edm::ParameterSet &)
tuple result
Definition: mps_fire.py:84
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const IOVSyncValue & beginOfTime()
CastorRecoParam makeRecoParam(HcalGenericDetId fId)
CastorSaturationCorr makeSaturationCorr(HcalGenericDetId fId)
std::auto_ptr< CastorRecoParams > produceRecoParams(const CastorRecoParamsRcd &rcd)
std::auto_ptr< CastorQIEData > produceQIEData(const CastorQIEDataRcd &rcd)
virtual bool valid(const HcalCastorDetId &id) const
CastorGainWidth makeGainWidth(HcalGenericDetId fId)
CastorPedestal makePedestal(HcalGenericDetId fId, bool fSmear=false)
std::auto_ptr< CastorElectronicsMap > produceElectronicsMap(const CastorElectronicsMapRcd &rcd)
CastorGain makeGain(HcalGenericDetId fId, bool fSmear=false)
virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
std::auto_ptr< CastorPedestalWidths > producePedestalWidths(const CastorPedestalWidthsRcd &rcd)
const Timestamp & time() const
Definition: IOVSyncValue.h:44
Definition: vlib.h:208
TimeValue_t value() const
Definition: Timestamp.h:56
std::auto_ptr< CastorGains > produceGains(const CastorGainsRcd &rcd)
std::auto_ptr< CastorPedestals > producePedestals(const CastorPedestalsRcd &rcd)