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 // $Id: CastorHardcodeCalibrations.cc,v 1.6 2012/11/14 13:28:52 mundim Exp $
4 // Adapted for CASTOR by L. Mundim
5 //
6 
7 #include <memory>
8 #include <iostream>
9 
15 
25 
29 
31 
32 // class declaration
33 //
34 
35 using namespace cms;
36 
37 namespace {
38 
39 std::vector<HcalGenericDetId> allCells (bool h2_mode) {
40  static std::vector<HcalGenericDetId> result;
41  if (result.size () <= 0) {
42 
43  CastorTopology castortopology;
44  HcalCastorDetId cell;
46 
47  for(int sector=1; sector<17; sector++) {
48  for(int module=1; module<3; module++) {
49  cell = HcalCastorDetId(section, true, sector, module);
50  if (castortopology.valid(cell)) result.push_back(cell);
51  cell = HcalCastorDetId(section, false, sector, module);
52  if (castortopology.valid(cell)) result.push_back(cell);
53  }
54  }
55 
56  section = HcalCastorDetId::HAD;
57  for(int sector= 1; sector < 17; sector++){
58  for(int module=3; module<15; module++) {
59  cell = HcalCastorDetId(section, true, sector, module);
60  if(castortopology.valid(cell)) result.push_back(cell);
61  cell = HcalCastorDetId(section, false, sector, module);
62  if(castortopology.valid(cell)) result.push_back(cell);
63  }
64  }
65 
66 }
67  return result;
68 
69  }
70 }
71 
73 
74 {
75  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::CastorHardcodeCalibrations->...";
76  //parsing record parameters
77  h2mode_=iConfig.getUntrackedParameter<bool>("H2Mode",false);
78  std::vector <std::string> toGet = iConfig.getUntrackedParameter <std::vector <std::string> > ("toGet");
79  for(std::vector <std::string>::iterator objectName = toGet.begin(); objectName != toGet.end(); ++objectName ) {
80  bool all = *objectName == "all";
81  if ((*objectName == "Pedestals") || all) {
82  setWhatProduced (this, &CastorHardcodeCalibrations::producePedestals);
83  findingRecord <CastorPedestalsRcd> ();
84  }
85  if ((*objectName == "PedestalWidths") || all) {
87  findingRecord <CastorPedestalWidthsRcd> ();
88  }
89  if ((*objectName == "Gains") || all) {
90  setWhatProduced (this, &CastorHardcodeCalibrations::produceGains);
91  findingRecord <CastorGainsRcd> ();
92  }
93  if ((*objectName == "GainWidths") || all) {
94  setWhatProduced (this, &CastorHardcodeCalibrations::produceGainWidths);
95  findingRecord <CastorGainWidthsRcd> ();
96  }
97  if ((*objectName == "QIEData") || all) {
98  setWhatProduced (this, &CastorHardcodeCalibrations::produceQIEData);
99  findingRecord <CastorQIEDataRcd> ();
100  }
101  if ((*objectName == "ChannelQuality") || (*objectName == "channelQuality") || all) {
102  setWhatProduced (this, &CastorHardcodeCalibrations::produceChannelQuality);
103  findingRecord <CastorChannelQualityRcd> ();
104  }
105  if ((*objectName == "ElectronicsMap") || (*objectName == "electronicsMap") || all) {
106  setWhatProduced (this, &CastorHardcodeCalibrations::produceElectronicsMap);
107  findingRecord <CastorElectronicsMapRcd> ();
108  }
109  if ((*objectName == "RecoParams") || all) {
110  setWhatProduced (this, &CastorHardcodeCalibrations::produceRecoParams);
111  findingRecord <CastorRecoParamsRcd> ();
112  }
113  if ((*objectName == "SaturationCorrs") || all) {
115  findingRecord <CastorSaturationCorrsRcd> ();
116  }
117  }
118 }
119 
120 
122 {
123 }
124 
125 
126 //
127 // member functions
128 //
129 void
131  std::string record = iKey.name ();
132  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::setIntervalFor-> key: " << record << " time: " << iTime.eventID() << '/' << iTime.time ().value ();
134 }
135 
136 std::auto_ptr<CastorPedestals> CastorHardcodeCalibrations::producePedestals (const CastorPedestalsRcd&) {
137  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::producePedestals-> ...";
138  std::auto_ptr<CastorPedestals> result (new CastorPedestals (false));
139  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
140  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
142  result->addValues(item);
143  }
144  return result;
145 }
146 
148  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::producePedestalWidths-> ...";
149  std::auto_ptr<CastorPedestalWidths> result (new CastorPedestalWidths (false));
150  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
151  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
153  result->addValues(item);
154  }
155  return result;
156 }
157 
158 std::auto_ptr<CastorGains> CastorHardcodeCalibrations::produceGains (const CastorGainsRcd&) {
159  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceGains-> ...";
160  std::auto_ptr<CastorGains> result (new CastorGains ());
161  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
162  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
163  CastorGain item = CastorDbHardcode::makeGain (*cell);
164  result->addValues(item);
165  }
166  return result;
167 }
168 
169 std::auto_ptr<CastorGainWidths> CastorHardcodeCalibrations::produceGainWidths (const CastorGainWidthsRcd&) {
170  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceGainWidths-> ...";
171  std::auto_ptr<CastorGainWidths> result (new CastorGainWidths ());
172  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
173  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
175  result->addValues(item);
176  }
177  return result;
178 }
179 
180 std::auto_ptr<CastorQIEData> CastorHardcodeCalibrations::produceQIEData (const CastorQIEDataRcd& rcd) {
181  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceQIEData-> ...";
182  std::auto_ptr<CastorQIEData> result (new CastorQIEData ());
183  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
184  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
186  result->addCoder(coder);
187  }
188  return result;
189 }
190 
191 std::auto_ptr<CastorChannelQuality> CastorHardcodeCalibrations::produceChannelQuality (const CastorChannelQualityRcd& rcd) {
192  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceChannelQuality-> ...";
193  std::auto_ptr<CastorChannelQuality> result (new CastorChannelQuality ());
194  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
195  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
197  result->addValues(item);
198  }
199  return result;
200 }
201 
202 std::auto_ptr<CastorElectronicsMap> CastorHardcodeCalibrations::produceElectronicsMap (const CastorElectronicsMapRcd& rcd) {
203  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceElectronicsMap-> ...";
204 
205  std::auto_ptr<CastorElectronicsMap> result (new CastorElectronicsMap ());
207  return result;
208 }
209 
210 std::auto_ptr<CastorRecoParams> CastorHardcodeCalibrations::produceRecoParams (const CastorRecoParamsRcd& rcd) {
211  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceRecoParams-> ...";
212  std::auto_ptr<CastorRecoParams> result (new CastorRecoParams ());
213  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
214  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
216  result->addValues(item);
217  }
218  return result;
219 }
220 
221 std::auto_ptr<CastorSaturationCorrs> CastorHardcodeCalibrations::produceSaturationCorrs (const CastorSaturationCorrsRcd& rcd) {
222  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceSaturationCorrs-> ...";
223  std::auto_ptr<CastorSaturationCorrs> result (new CastorSaturationCorrs ());
224  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
225  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
227  result->addValues(item);
228  }
229  return result;
230 }
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:13
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 &)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
static const IOVSyncValue & beginOfTime()
CastorRecoParam makeRecoParam(HcalGenericDetId fId)
tuple result
Definition: query.py:137
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)
TimeValue_t value() const
Definition: Timestamp.cc:72
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:209
std::auto_ptr< CastorGains > produceGains(const CastorGainsRcd &rcd)
std::auto_ptr< CastorPedestals > producePedestals(const CastorPedestalsRcd &rcd)