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.3 2009/03/26 17:49:44 mundim Exp $
4 // Adapted for CASTOR by L. Mundim
5 //
6 
7 #include <memory>
8 #include <iostream>
9 
15 
23 
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 
109  }
110 }
111 
112 
114 {
115 }
116 
117 
118 //
119 // member functions
120 //
121 void
123  std::string record = iKey.name ();
124  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::setIntervalFor-> key: " << record << " time: " << iTime.eventID() << '/' << iTime.time ().value ();
126 }
127 
128 std::auto_ptr<CastorPedestals> CastorHardcodeCalibrations::producePedestals (const CastorPedestalsRcd&) {
129  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::producePedestals-> ...";
130  std::auto_ptr<CastorPedestals> result (new CastorPedestals (false));
131  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
132  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
134  result->addValues(item);
135  }
136  return result;
137 }
138 
140  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::producePedestalWidths-> ...";
141  std::auto_ptr<CastorPedestalWidths> result (new CastorPedestalWidths (false));
142  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
143  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
145  result->addValues(item);
146  }
147  return result;
148 }
149 
150 std::auto_ptr<CastorGains> CastorHardcodeCalibrations::produceGains (const CastorGainsRcd&) {
151  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceGains-> ...";
152  std::auto_ptr<CastorGains> result (new CastorGains ());
153  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
154  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
155  CastorGain item = CastorDbHardcode::makeGain (*cell);
156  result->addValues(item);
157  }
158  return result;
159 }
160 
161 std::auto_ptr<CastorGainWidths> CastorHardcodeCalibrations::produceGainWidths (const CastorGainWidthsRcd&) {
162  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceGainWidths-> ...";
163  std::auto_ptr<CastorGainWidths> result (new CastorGainWidths ());
164  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
165  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
167  result->addValues(item);
168  }
169  return result;
170 }
171 
172 std::auto_ptr<CastorQIEData> CastorHardcodeCalibrations::produceQIEData (const CastorQIEDataRcd& rcd) {
173  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceQIEData-> ...";
174  std::auto_ptr<CastorQIEData> result (new CastorQIEData ());
175  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
176  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
178  result->addCoder(coder);
179  }
180  return result;
181 }
182 
183 std::auto_ptr<CastorChannelQuality> CastorHardcodeCalibrations::produceChannelQuality (const CastorChannelQualityRcd& rcd) {
184  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceChannelQuality-> ...";
185  std::auto_ptr<CastorChannelQuality> result (new CastorChannelQuality ());
186  std::vector <HcalGenericDetId> cells = allCells(h2mode_);
187  for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
189  result->addValues(item);
190  }
191  return result;
192 }
193 
194 std::auto_ptr<CastorElectronicsMap> CastorHardcodeCalibrations::produceElectronicsMap (const CastorElectronicsMapRcd& rcd) {
195  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceElectronicsMap-> ...";
196 
197  std::auto_ptr<CastorElectronicsMap> result (new CastorElectronicsMap ());
199  return result;
200 }
201 
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:11
void makeHardcodeMap(CastorElectronicsMap &emap)
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()
tuple result
Definition: query.py:137
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
tuple toGet
Definition: align_tpl.py:67
Definition: vlib.h:209
std::auto_ptr< CastorGains > produceGains(const CastorGainsRcd &rcd)
std::auto_ptr< CastorPedestals > producePedestals(const CastorPedestalsRcd &rcd)