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  CastorTopology castortopology;
42  HcalCastorDetId cell;
44 
45  for (int sector = 1; sector < 17; sector++) {
46  for (int module = 1; module < 3; module++) {
47  cell = HcalCastorDetId(section, true, sector, module);
48  if (castortopology.valid(cell))
49  result.push_back(cell);
50  cell = HcalCastorDetId(section, false, sector, module);
51  if (castortopology.valid(cell))
52  result.push_back(cell);
53  }
54  }
55 
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))
61  result.push_back(cell);
62  cell = HcalCastorDetId(section, false, sector, module);
63  if (castortopology.valid(cell))
64  result.push_back(cell);
65  }
66  }
67  }
68  return result;
69  }
70 } // namespace
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) {
103  findingRecord<CastorChannelQualityRcd>();
104  }
105  if ((*objectName == "ElectronicsMap") || (*objectName == "electronicsMap") || all) {
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 
121 
122 //
123 // member functions
124 //
126  const edm::IOVSyncValue& iTime,
127  edm::ValidityInterval& oInterval) {
128  std::string record = iKey.name();
129  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::setIntervalFor-> key: " << record << " time: " << iTime.eventID()
130  << '/' << iTime.time().value();
132 }
133 
134 std::unique_ptr<CastorPedestals> CastorHardcodeCalibrations::producePedestals(const CastorPedestalsRcd&) {
135  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::producePedestals-> ...";
136  auto result = std::make_unique<CastorPedestals>(false);
137  std::vector<HcalGenericDetId> cells = allCells(h2mode_);
138  for (std::vector<HcalGenericDetId>::const_iterator cell = cells.begin(); cell != cells.end(); ++cell) {
140  result->addValues(item);
141  }
142  return result;
143 }
144 
145 std::unique_ptr<CastorPedestalWidths> CastorHardcodeCalibrations::producePedestalWidths(const CastorPedestalWidthsRcd&) {
146  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::producePedestalWidths-> ...";
147  auto result = std::make_unique<CastorPedestalWidths>(false);
148  std::vector<HcalGenericDetId> cells = allCells(h2mode_);
149  for (std::vector<HcalGenericDetId>::const_iterator cell = cells.begin(); cell != cells.end(); ++cell) {
151  result->addValues(item);
152  }
153  return result;
154 }
155 
156 std::unique_ptr<CastorGains> CastorHardcodeCalibrations::produceGains(const CastorGainsRcd&) {
157  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceGains-> ...";
158  auto result = std::make_unique<CastorGains>();
159  std::vector<HcalGenericDetId> cells = allCells(h2mode_);
160  for (std::vector<HcalGenericDetId>::const_iterator cell = cells.begin(); cell != cells.end(); ++cell) {
162  result->addValues(item);
163  }
164  return result;
165 }
166 
167 std::unique_ptr<CastorGainWidths> CastorHardcodeCalibrations::produceGainWidths(const CastorGainWidthsRcd&) {
168  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceGainWidths-> ...";
169  auto result = std::make_unique<CastorGainWidths>();
170  std::vector<HcalGenericDetId> cells = allCells(h2mode_);
171  for (std::vector<HcalGenericDetId>::const_iterator cell = cells.begin(); cell != cells.end(); ++cell) {
173  result->addValues(item);
174  }
175  return result;
176 }
177 
178 std::unique_ptr<CastorQIEData> CastorHardcodeCalibrations::produceQIEData(const CastorQIEDataRcd& rcd) {
179  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceQIEData-> ...";
180  auto result = std::make_unique<CastorQIEData>();
181  std::vector<HcalGenericDetId> cells = allCells(h2mode_);
182  for (std::vector<HcalGenericDetId>::const_iterator cell = cells.begin(); cell != cells.end(); ++cell) {
184  result->addCoder(coder);
185  }
186  return result;
187 }
188 
189 std::unique_ptr<CastorChannelQuality> CastorHardcodeCalibrations::produceChannelQuality(
190  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(
202  const CastorElectronicsMapRcd& rcd) {
203  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceElectronicsMap-> ...";
204 
205  auto result = std::make_unique<CastorElectronicsMap>();
207  return result;
208 }
209 
210 std::unique_ptr<CastorRecoParams> CastorHardcodeCalibrations::produceRecoParams(const CastorRecoParamsRcd& rcd) {
211  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceRecoParams-> ...";
212  auto result = std::make_unique<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::unique_ptr<CastorSaturationCorrs> CastorHardcodeCalibrations::produceSaturationCorrs(
222  const CastorSaturationCorrsRcd& rcd) {
223  edm::LogInfo("HCAL") << "CastorHardcodeCalibrations::produceSaturationCorrs-> ...";
224  auto result = std::make_unique<CastorSaturationCorrs>();
225  std::vector<HcalGenericDetId> cells = allCells(h2mode_);
226  for (std::vector<HcalGenericDetId>::const_iterator cell = cells.begin(); cell != cells.end(); ++cell) {
228  result->addValues(item);
229  }
230  return result;
231 }
CastorChannelQualityRcd.h
DBConfiguration_cff.toGet
toGet
Definition: DBConfiguration_cff.py:10
CastorPedestalsRcd.h
CastorDbHardcode::makePedestalWidth
CastorPedestalWidth makePedestalWidth(HcalGenericDetId fId)
Definition: CastorDbHardcode.cc:28
MessageLogger.h
CastorDbHardcode::makeRecoParam
CastorRecoParam makeRecoParam(HcalGenericDetId fId)
Definition: CastorDbHardcode.cc:96
CastorDbHardcode::makeGain
CastorGain makeGain(HcalGenericDetId fId, bool fSmear=false)
Definition: CastorDbHardcode.cc:47
CastorHardcodeCalibrations::produceGains
std::unique_ptr< CastorGains > produceGains(const CastorGainsRcd &rcd)
Definition: CastorHardcodeCalibrations.cc:156
CastorDbHardcode::makeSaturationCorr
CastorSaturationCorr makeSaturationCorr(HcalGenericDetId fId)
Definition: CastorDbHardcode.cc:101
CastorSaturationCorrsRcd
Definition: CastorSaturationCorrsRcd.h:4
CastorQIEDataRcd.h
ValidityInterval.h
CastorQIEDataRcd
Definition: CastorQIEDataRcd.h:24
edm::ValidityInterval
Definition: ValidityInterval.h:28
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
cells
const caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple cms::cuda::AtomicPairCounter const GPUCACell *__restrict__ cells
Definition: CAHitNtupletGeneratorKernelsImpl.h:33
HcalGenericDetId.h
CastorHardcodeCalibrations::produceElectronicsMap
std::unique_ptr< CastorElectronicsMap > produceElectronicsMap(const CastorElectronicsMapRcd &rcd)
Definition: CastorHardcodeCalibrations.cc:201
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Timestamp::value
TimeValue_t value() const
Definition: Timestamp.h:45
CastorPedestalWidthsRcd
Definition: CastorPedestalWidthsRcd.h:24
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
HcalCastorDetId::Section
Section
Definition: HcalCastorDetId.h:25
CastorPedestal
Definition: CastorPedestal.h:16
CastorPedestalWidth
Definition: CastorPedestalWidth.h:16
CastorHardcodeCalibrations::produceGainWidths
std::unique_ptr< CastorGainWidths > produceGainWidths(const CastorGainWidthsRcd &rcd)
Definition: CastorHardcodeCalibrations.cc:167
CastorGainWidthsRcd.h
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
python.cmstools.all
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:26
CastorRecoParam
Definition: CastorRecoParam.h:13
CastorDbHardcode::makeGainWidth
CastorGainWidth makeGainWidth(HcalGenericDetId fId)
Definition: CastorDbHardcode.cc:66
CastorHardcodeCalibrations::producePedestals
std::unique_ptr< CastorPedestals > producePedestals(const CastorPedestalsRcd &rcd)
Definition: CastorHardcodeCalibrations.cc:134
CastorChannelStatus::GOOD
Definition: CastorChannelStatus.h:27
CastorHardcodeCalibrations::~CastorHardcodeCalibrations
~CastorHardcodeCalibrations() override
Definition: CastorHardcodeCalibrations.cc:120
CastorElectronicsMapRcd.h
CastorRecoParamsRcd
Definition: CastorRecoParamsRcd.h:4
edm::eventsetup::EventSetupRecordKey::name
const char * name() const
Definition: EventSetupRecordKey.h:46
CastorDbHardcode.h
CastorHardcodeCalibrations::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: CastorHardcodeCalibrations.cc:125
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
CastorGainWidth
Definition: CastorGainWidth.h:12
CastorPedestalWidthsRcd.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalCastorDetId
Definition: HcalCastorDetId.h:23
CastorHardcodeCalibrations.h
edm::IOVSyncValue::eventID
const EventID & eventID() const
Definition: IOVSyncValue.h:40
edm::ParameterSet
Definition: ParameterSet.h:47
CastorDbHardcode::makeHardcodeMap
void makeHardcodeMap(CastorElectronicsMap &emap)
Definition: CastorDbHardcode.cc:117
CastorTopology::valid
virtual bool valid(const HcalCastorDetId &id) const
Definition: CastorTopology.cc:19
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
CastorChannelQualityRcd
Definition: CastorChannelQualityRcd.h:24
CastorRecoParamsRcd.h
CastorTopology
Definition: CastorTopology.h:13
CastorGainsRcd.h
HcalDetId.h
CastorHardcodeCalibrations::produceSaturationCorrs
std::unique_ptr< CastorSaturationCorrs > produceSaturationCorrs(const CastorSaturationCorrsRcd &rcd)
Definition: CastorHardcodeCalibrations.cc:221
CastorHardcodeCalibrations::produceRecoParams
std::unique_ptr< CastorRecoParams > produceRecoParams(const CastorRecoParamsRcd &rcd)
Definition: CastorHardcodeCalibrations.cc:210
CastorGain
Definition: CastorGain.h:13
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
CastorDbHardcode::makePedestal
CastorPedestal makePedestal(HcalGenericDetId fId, bool fSmear=false)
Definition: CastorDbHardcode.cc:12
HcalTopology.h
CastorChannelStatus
Definition: CastorChannelStatus.h:15
edm::IOVSyncValue::time
const Timestamp & time() const
Definition: IOVSyncValue.h:42
CastorHardcodeCalibrations::produceQIEData
std::unique_ptr< CastorQIEData > produceQIEData(const CastorQIEDataRcd &rcd)
Definition: CastorHardcodeCalibrations.cc:178
cond::ValidityInterval
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
CastorHardcodeCalibrations::produceChannelQuality
std::unique_ptr< CastorChannelQuality > produceChannelQuality(const CastorChannelQualityRcd &rcd)
Definition: CastorHardcodeCalibrations.cc:189
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CastorTopology.h
CastorHardcodeCalibrations::producePedestalWidths
std::unique_ptr< CastorPedestalWidths > producePedestalWidths(const CastorPedestalWidthsRcd &rcd)
Definition: CastorHardcodeCalibrations.cc:145
CastorElectronicsMapRcd
Definition: CastorElectronicsMapRcd.h:4
hgcalPlots.section
section
Definition: hgcalPlots.py:2670
HcalCastorDetId::HAD
Definition: HcalCastorDetId.h:25
CastorSaturationCorr
Definition: CastorSaturationCorr.h:13
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
CastorDbHardcode::makeQIECoder
CastorQIECoder makeQIECoder(HcalGenericDetId fId)
Definition: CastorDbHardcode.cc:72
CastorHardcodeCalibrations::CastorHardcodeCalibrations
CastorHardcodeCalibrations(const edm::ParameterSet &)
Definition: CastorHardcodeCalibrations.cc:72
CastorQIECoder
Definition: CastorQIECoder.h:21
mps_fire.result
result
Definition: mps_fire.py:311
HcalCastorDetId.h
CastorGainsRcd
Definition: CastorGainsRcd.h:24
CastorPedestalsRcd
Definition: CastorPedestalsRcd.h:24
CastorGainWidthsRcd
Definition: CastorGainWidthsRcd.h:24
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
HcalCastorDetId::EM
Definition: HcalCastorDetId.h:25
CastorSaturationCorrsRcd.h
summarizeEdmComparisonLogfiles.objectName
objectName
Definition: summarizeEdmComparisonLogfiles.py:105