00001
00002
00003
00004
00005
00006
00007 #include <memory>
00008 #include <iostream>
00009
00010 #include "FWCore/Framework/interface/ValidityInterval.h"
00011 #include "FWCore/Framework/interface/ESHandle.h"
00012 #include "DataFormats/HcalDetId/interface/HcalZDCDetId.h"
00013 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00014 #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
00015 #include "CalibCalorimetry/HcalAlgos/interface/HcalDbHardcode.h"
00016
00017 #include "CondFormats/DataRecord/interface/HcalAllRcds.h"
00018 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00019
00020 #include "Geometry/ForwardGeometry/interface/ZdcTopology.h"
00021 #include "Geometry/CaloTopology/interface/HcalTopology.h"
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023
00024 #include "HcalHardcodeCalibrations.h"
00025
00026
00027
00028
00029 using namespace cms;
00030
00031 namespace {
00032
00033 std::vector<HcalGenericDetId> allCells (const HcalTopology& hcaltopology) {
00034 static std::vector<HcalGenericDetId> result;
00035 int maxDepthHB=hcaltopology.maxDepthHB();
00036 int maxDepthHE=hcaltopology.maxDepthHE();
00037
00038
00039
00040
00041
00042
00043 if (result.size () <= 0) {
00044 for (int eta = -50; eta < 50; eta++) {
00045 for (int phi = 0; phi < 100; phi++) {
00046 for (int depth = 1; depth < maxDepthHB + maxDepthHE; depth++) {
00047 for (int det = 1; det < 5; det++) {
00048 HcalDetId cell ((HcalSubdetector) det, eta, phi, depth);
00049 if (hcaltopology.valid(cell)) result.push_back (cell);
00050
00051
00052
00053
00054
00055
00056
00057 }
00058 }
00059 }
00060 }
00061 ZdcTopology zdctopology;
00062 HcalZDCDetId zcell;
00063 HcalZDCDetId::Section section = HcalZDCDetId::EM;
00064 for(int depth= 1; depth < 6; depth++){
00065 zcell = HcalZDCDetId(section, true, depth);
00066 if(zdctopology.valid(zcell)) result.push_back(zcell);
00067 zcell = HcalZDCDetId(section, false, depth);
00068 if(zdctopology.valid(zcell)) result.push_back(zcell);
00069 }
00070 section = HcalZDCDetId::HAD;
00071 for(int depth= 1; depth < 5; depth++){
00072 zcell = HcalZDCDetId(section, true, depth);
00073 if(zdctopology.valid(zcell)) result.push_back(zcell);
00074 zcell = HcalZDCDetId(section, false, depth);
00075 if(zdctopology.valid(zcell)) result.push_back(zcell);
00076 }
00077 section = HcalZDCDetId::LUM;
00078 for(int depth= 1; depth < 3; depth++){
00079 zcell = HcalZDCDetId(section, true, depth);
00080 if(zdctopology.valid(zcell)) result.push_back(zcell);
00081 zcell = HcalZDCDetId(section, false, depth);
00082 if(zdctopology.valid(zcell)) result.push_back(zcell);
00083 }
00084
00085
00086
00087
00088
00089
00090 for (int eta = -32; eta <= 32; eta++) {
00091 if(abs(eta) <= 28 && (eta != 0)) {
00092 for (int phi = 1; phi <= 72; phi++) {
00093 HcalTrigTowerDetId cell(eta, phi);
00094 result.push_back (cell);
00095 }
00096 }
00097 else if (abs(eta) > 28) {
00098 for (int phi = 1; phi <= 69;) {
00099 HcalTrigTowerDetId cell(eta, phi);
00100 result.push_back (cell);
00101 phi += 4;
00102 }
00103 }
00104 }
00105 }
00106 return result;
00107 }
00108
00109 }
00110
00111 HcalHardcodeCalibrations::HcalHardcodeCalibrations ( const edm::ParameterSet& iConfig ): he_recalibration(0), hf_recalibration(0)
00112 {
00113 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::HcalHardcodeCalibrations->...";
00114
00115 if ( iConfig.exists("GainWidthsForTrigPrims") )
00116 switchGainWidthsForTrigPrims = iConfig.getParameter<bool>("GainWidthsForTrigPrims");
00117 else switchGainWidthsForTrigPrims = false;
00118
00119
00120
00121 iLumi = 0.;
00122 if ( iConfig.exists("iLumi") )
00123 iLumi=iConfig.getParameter<double>("iLumi");
00124
00125 if( iLumi > 0.0 ) {
00126 bool he_recalib = iConfig.getParameter<bool>("HERecalibration");
00127 bool hf_recalib = iConfig.getParameter<bool>("HFRecalibration");
00128 if(he_recalib) he_recalibration = new HERecalibration(iLumi);
00129 if(hf_recalib) hf_recalibration = new HFRecalibration();
00130
00131
00132 }
00133
00134 bool relabel_=false;
00135 edm::ParameterSet ps0;
00136 if ( iConfig.exists("HcalReLabel") ) {
00137 ps0 = iConfig.getParameter<edm::ParameterSet>("HcalReLabel");
00138 relabel_= ps0.getUntrackedParameter<bool>("RelabelHits",false);
00139 }
00140
00141 if (relabel_) {
00142 std::vector<std::vector<int>> m_segmentation;
00143 m_segmentation.resize(29);
00144 edm::ParameterSet ps1 = ps0.getUntrackedParameter<edm::ParameterSet>("RelabelRules");
00145 for (int i = 0; i < 29; i++) {
00146 char name[10];
00147 snprintf(name,10,"Eta%d",i+1);
00148 if (i > 0) {
00149 m_segmentation[i]=
00150 ps1.getUntrackedParameter<std::vector<int>>(name,m_segmentation[i-1]);
00151 } else {
00152 m_segmentation[i]=ps1.getUntrackedParameter<std::vector<int> >(name);
00153 }
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163 }
00164
00165 if(he_recalibration !=0) he_recalibration->setDsegm(m_segmentation);
00166 }
00167
00168
00169 std::vector <std::string> toGet = iConfig.getUntrackedParameter <std::vector <std::string> > ("toGet");
00170 for(std::vector <std::string>::iterator objectName = toGet.begin(); objectName != toGet.end(); ++objectName ) {
00171 bool all = *objectName == "all";
00172 if ((*objectName == "Pedestals") || all) {
00173 setWhatProduced (this, &HcalHardcodeCalibrations::producePedestals);
00174 findingRecord <HcalPedestalsRcd> ();
00175 }
00176 if ((*objectName == "PedestalWidths") || all) {
00177 setWhatProduced (this, &HcalHardcodeCalibrations::producePedestalWidths);
00178 findingRecord <HcalPedestalWidthsRcd> ();
00179 }
00180 if ((*objectName == "Gains") || all) {
00181 setWhatProduced (this, &HcalHardcodeCalibrations::produceGains);
00182 findingRecord <HcalGainsRcd> ();
00183 }
00184 if ((*objectName == "GainWidths") || all) {
00185 setWhatProduced (this, &HcalHardcodeCalibrations::produceGainWidths);
00186 findingRecord <HcalGainWidthsRcd> ();
00187 }
00188 if ((*objectName == "QIEData") || all) {
00189 setWhatProduced (this, &HcalHardcodeCalibrations::produceQIEData);
00190 findingRecord <HcalQIEDataRcd> ();
00191 }
00192 if ((*objectName == "ChannelQuality") || (*objectName == "channelQuality") || all) {
00193 setWhatProduced (this, &HcalHardcodeCalibrations::produceChannelQuality);
00194 findingRecord <HcalChannelQualityRcd> ();
00195 }
00196 if ((*objectName == "ElectronicsMap") || (*objectName == "electronicsMap") || all) {
00197 setWhatProduced (this, &HcalHardcodeCalibrations::produceElectronicsMap);
00198 findingRecord <HcalElectronicsMapRcd> ();
00199 }
00200 if ((*objectName == "ZSThresholds") || (*objectName == "zsThresholds") || all) {
00201 setWhatProduced (this, &HcalHardcodeCalibrations::produceZSThresholds);
00202 findingRecord <HcalZSThresholdsRcd> ();
00203 }
00204 if ((*objectName == "RespCorrs") || (*objectName == "ResponseCorrection") || all) {
00205 setWhatProduced (this, &HcalHardcodeCalibrations::produceRespCorrs);
00206 findingRecord <HcalRespCorrsRcd> ();
00207 }
00208 if ((*objectName == "LUTCorrs") || (*objectName == "LUTCorrection") || all) {
00209 setWhatProduced (this, &HcalHardcodeCalibrations::produceLUTCorrs);
00210 findingRecord <HcalLUTCorrsRcd> ();
00211 }
00212 if ((*objectName == "PFCorrs") || (*objectName == "PFCorrection") || all) {
00213 setWhatProduced (this, &HcalHardcodeCalibrations::producePFCorrs);
00214 findingRecord <HcalPFCorrsRcd> ();
00215 }
00216 if ((*objectName == "TimeCorrs") || (*objectName == "TimeCorrection") || all) {
00217 setWhatProduced (this, &HcalHardcodeCalibrations::produceTimeCorrs);
00218 findingRecord <HcalTimeCorrsRcd> ();
00219 }
00220 if ((*objectName == "L1TriggerObjects") || (*objectName == "L1Trigger") || all) {
00221 setWhatProduced (this, &HcalHardcodeCalibrations::produceL1TriggerObjects);
00222 findingRecord <HcalL1TriggerObjectsRcd> ();
00223 }
00224 if ((*objectName == "ValidationCorrs") || (*objectName == "ValidationCorrection") || all) {
00225 setWhatProduced (this, &HcalHardcodeCalibrations::produceValidationCorrs);
00226 findingRecord <HcalValidationCorrsRcd> ();
00227 }
00228 if ((*objectName == "LutMetadata") || (*objectName == "lutMetadata") || all) {
00229 setWhatProduced (this, &HcalHardcodeCalibrations::produceLutMetadata);
00230 findingRecord <HcalLutMetadataRcd> ();
00231 }
00232 if ((*objectName == "DcsValues") || all) {
00233 setWhatProduced (this, &HcalHardcodeCalibrations::produceDcsValues);
00234 findingRecord <HcalDcsRcd> ();
00235 }
00236 if ((*objectName == "DcsMap") || (*objectName == "dcsMap") || all) {
00237 setWhatProduced (this, &HcalHardcodeCalibrations::produceDcsMap);
00238 findingRecord <HcalDcsMapRcd> ();
00239 }
00240 if ((*objectName == "RecoParams") || all) {
00241 setWhatProduced (this, &HcalHardcodeCalibrations::produceRecoParams);
00242 findingRecord <HcalRecoParamsRcd> ();
00243 }
00244 if ((*objectName == "LongRecoParams") || all) {
00245 setWhatProduced (this, &HcalHardcodeCalibrations::produceLongRecoParams);
00246 findingRecord <HcalLongRecoParamsRcd> ();
00247 }
00248 if ((*objectName == "MCParams") || all) {
00249 setWhatProduced (this, &HcalHardcodeCalibrations::produceMCParams);
00250 findingRecord <HcalMCParamsRcd> ();
00251 }
00252 if ((*objectName == "FlagHFDigiTimeParams") || all) {
00253 setWhatProduced (this, &HcalHardcodeCalibrations::produceFlagHFDigiTimeParams);
00254 findingRecord <HcalFlagHFDigiTimeParamsRcd> ();
00255 }
00256 if ((*objectName == "CholeskyMatrices") || all) {
00257 setWhatProduced (this, &HcalHardcodeCalibrations::produceCholeskyMatrices);
00258 findingRecord <HcalCholeskyMatricesRcd> ();
00259 }
00260 if ((*objectName == "CovarianceMatrices") || all) {
00261 setWhatProduced (this, &HcalHardcodeCalibrations::produceCovarianceMatrices);
00262 findingRecord <HcalCovarianceMatricesRcd> ();
00263 }
00264 }
00265 }
00266
00267
00268 HcalHardcodeCalibrations::~HcalHardcodeCalibrations()
00269 {
00270 if (he_recalibration != 0 ) delete he_recalibration;
00271 if (hf_recalibration != 0 ) delete hf_recalibration;
00272 }
00273
00274
00275
00276
00277 void
00278 HcalHardcodeCalibrations::setIntervalFor( const edm::eventsetup::EventSetupRecordKey& iKey, const edm::IOVSyncValue& iTime, edm::ValidityInterval& oInterval ) {
00279 std::string record = iKey.name ();
00280 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::setIntervalFor-> key: " << record << " time: " << iTime.eventID() << '/' << iTime.time ().value ();
00281 oInterval = edm::ValidityInterval (edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime());
00282 }
00283
00284 std::auto_ptr<HcalPedestals> HcalHardcodeCalibrations::producePedestals (const HcalPedestalsRcd& rec) {
00285 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::producePedestals-> ...";
00286 edm::ESHandle<HcalTopology> htopo;
00287 rec.getRecord<IdealGeometryRecord>().get(htopo);
00288 const HcalTopology* topo=&(*htopo);
00289
00290 std::auto_ptr<HcalPedestals> result (new HcalPedestals (topo,false));
00291 std::vector <HcalGenericDetId> cells = allCells(*topo);
00292 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00293 HcalPedestal item = HcalDbHardcode::makePedestal (*cell, false, iLumi);
00294 result->addValues(item);
00295 }
00296 return result;
00297 }
00298
00299 std::auto_ptr<HcalPedestalWidths> HcalHardcodeCalibrations::producePedestalWidths (const HcalPedestalWidthsRcd& rec) {
00300 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::producePedestalWidths-> ...";
00301 edm::ESHandle<HcalTopology> htopo;
00302 rec.getRecord<IdealGeometryRecord>().get(htopo);
00303 const HcalTopology* topo=&(*htopo);
00304
00305 std::auto_ptr<HcalPedestalWidths> result (new HcalPedestalWidths (topo,false));
00306 std::vector <HcalGenericDetId> cells = allCells(*htopo);
00307 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00308 HcalPedestalWidth item = HcalDbHardcode::makePedestalWidth (*cell, iLumi);
00309 result->addValues(item);
00310 }
00311 return result;
00312 }
00313
00314 std::auto_ptr<HcalGains> HcalHardcodeCalibrations::produceGains (const HcalGainsRcd& rec) {
00315 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceGains-> ...";
00316 edm::ESHandle<HcalTopology> htopo;
00317 rec.getRecord<IdealGeometryRecord>().get(htopo);
00318 const HcalTopology* topo=&(*htopo);
00319
00320 std::auto_ptr<HcalGains> result (new HcalGains (topo));
00321 std::vector <HcalGenericDetId> cells = allCells(*topo);
00322 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00323 HcalGain item = HcalDbHardcode::makeGain (*cell);
00324 result->addValues(item);
00325 }
00326 return result;
00327 }
00328
00329 std::auto_ptr<HcalGainWidths> HcalHardcodeCalibrations::produceGainWidths (const HcalGainWidthsRcd& rec) {
00330 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceGainWidths-> ...";
00331 edm::ESHandle<HcalTopology> htopo;
00332 rec.getRecord<IdealGeometryRecord>().get(htopo);
00333 const HcalTopology* topo=&(*htopo);
00334
00335 std::auto_ptr<HcalGainWidths> result (new HcalGainWidths (topo));
00336 std::vector <HcalGenericDetId> cells = allCells(*topo);
00337 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00338
00339
00340 if(switchGainWidthsForTrigPrims) {
00341 HcalGainWidth item = HcalDbHardcode::makeGainWidth (*cell);
00342 result->addValues(item);
00343 } else if (!cell->isHcalTrigTowerDetId()) {
00344 HcalGainWidth item = HcalDbHardcode::makeGainWidth (*cell);
00345 result->addValues(item);
00346 }
00347 }
00348 return result;
00349 }
00350
00351 std::auto_ptr<HcalQIEData> HcalHardcodeCalibrations::produceQIEData (const HcalQIEDataRcd& rcd) {
00352 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceQIEData-> ...";
00353
00354
00355
00356
00357
00358
00359 edm::ESHandle<HcalTopology> htopo;
00360 rcd.getRecord<IdealGeometryRecord>().get(htopo);
00361 const HcalTopology* topo=&(*htopo);
00362
00363 std::auto_ptr<HcalQIEData> result (new HcalQIEData (topo));
00364 std::vector <HcalGenericDetId> cells = allCells(*topo);
00365 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00366 HcalQIECoder coder = HcalDbHardcode::makeQIECoder (*cell);
00367 result->addCoder (coder);
00368 }
00369 return result;
00370 }
00371
00372 std::auto_ptr<HcalChannelQuality> HcalHardcodeCalibrations::produceChannelQuality (const HcalChannelQualityRcd& rcd) {
00373 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceChannelQuality-> ...";
00374 edm::ESHandle<HcalTopology> htopo;
00375 rcd.getRecord<IdealGeometryRecord>().get(htopo);
00376 const HcalTopology* topo=&(*htopo);
00377
00378 std::auto_ptr<HcalChannelQuality> result (new HcalChannelQuality (topo));
00379 std::vector <HcalGenericDetId> cells = allCells(*topo);
00380 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00381 HcalChannelStatus item(cell->rawId(),0);
00382 result->addValues(item);
00383 }
00384 return result;
00385 }
00386
00387
00388 std::auto_ptr<HcalRespCorrs> HcalHardcodeCalibrations::produceRespCorrs (const HcalRespCorrsRcd& rcd) {
00389 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceRespCorrs-> ...";
00390 edm::ESHandle<HcalTopology> htopo;
00391 rcd.getRecord<IdealGeometryRecord>().get(htopo);
00392 const HcalTopology* topo=&(*htopo);
00393
00394 std::auto_ptr<HcalRespCorrs> result (new HcalRespCorrs (topo));
00395 std::vector <HcalGenericDetId> cells = allCells(*topo);
00396 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00397
00398 double corr = 1.0;
00399
00400 if ((he_recalibration != 0 ) &&
00401 ((*cell).genericSubdet() == HcalGenericDetId::HcalGenEndcap)) {
00402
00403 int depth_ = HcalDetId(*cell).depth();
00404 int ieta_ = HcalDetId(*cell).ieta();
00405 corr = he_recalibration->getCorr(ieta_, depth_);
00406
00407
00408
00409
00410
00411
00412 }
00413 else if ((hf_recalibration != 0 ) &&
00414 ((*cell).genericSubdet() == HcalGenericDetId::HcalGenForward)) {
00415 int depth_ = HcalDetId(*cell).depth();
00416 int ieta_ = HcalDetId(*cell).ieta();
00417 corr = hf_recalibration->getCorr(ieta_, depth_, iLumi);
00418
00419
00420
00421
00422
00423
00424 }
00425
00426 HcalRespCorr item(cell->rawId(),corr);
00427 result->addValues(item);
00428 }
00429 return result;
00430 }
00431
00432 std::auto_ptr<HcalLUTCorrs> HcalHardcodeCalibrations::produceLUTCorrs (const HcalLUTCorrsRcd& rcd) {
00433 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceLUTCorrs-> ...";
00434 edm::ESHandle<HcalTopology> htopo;
00435 rcd.getRecord<IdealGeometryRecord>().get(htopo);
00436 const HcalTopology* topo=&(*htopo);
00437
00438 std::auto_ptr<HcalLUTCorrs> result (new HcalLUTCorrs (topo));
00439 std::vector <HcalGenericDetId> cells = allCells(*topo);
00440 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00441 HcalLUTCorr item(cell->rawId(),1.0);
00442 result->addValues(item);
00443 }
00444 return result;
00445 }
00446
00447 std::auto_ptr<HcalPFCorrs> HcalHardcodeCalibrations::producePFCorrs (const HcalPFCorrsRcd& rcd) {
00448 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::producePFCorrs-> ...";
00449 edm::ESHandle<HcalTopology> htopo;
00450 rcd.getRecord<IdealGeometryRecord>().get(htopo);
00451 const HcalTopology* topo=&(*htopo);
00452
00453 std::auto_ptr<HcalPFCorrs> result (new HcalPFCorrs (topo));
00454 std::vector <HcalGenericDetId> cells = allCells(*topo);
00455 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00456 HcalPFCorr item(cell->rawId(),1.0);
00457 result->addValues(item);
00458 }
00459 return result;
00460 }
00461
00462 std::auto_ptr<HcalTimeCorrs> HcalHardcodeCalibrations::produceTimeCorrs (const HcalTimeCorrsRcd& rcd) {
00463 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceTimeCorrs-> ...";
00464 edm::ESHandle<HcalTopology> htopo;
00465 rcd.getRecord<IdealGeometryRecord>().get(htopo);
00466 const HcalTopology* topo=&(*htopo);
00467
00468 std::auto_ptr<HcalTimeCorrs> result (new HcalTimeCorrs (topo));
00469 std::vector <HcalGenericDetId> cells = allCells(*topo);
00470 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00471 HcalTimeCorr item(cell->rawId(),0.0);
00472 result->addValues(item);
00473 }
00474 return result;
00475 }
00476
00477 std::auto_ptr<HcalZSThresholds> HcalHardcodeCalibrations::produceZSThresholds (const HcalZSThresholdsRcd& rcd) {
00478 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceZSThresholds-> ...";
00479 edm::ESHandle<HcalTopology> htopo;
00480 rcd.getRecord<IdealGeometryRecord>().get(htopo);
00481 const HcalTopology* topo=&(*htopo);
00482
00483 std::auto_ptr<HcalZSThresholds> result (new HcalZSThresholds (topo));
00484 std::vector <HcalGenericDetId> cells = allCells(*topo);
00485 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00486 HcalZSThreshold item(cell->rawId(),0);
00487 result->addValues(item);
00488 }
00489 return result;
00490 }
00491
00492
00493 std::auto_ptr<HcalL1TriggerObjects> HcalHardcodeCalibrations::produceL1TriggerObjects (const HcalL1TriggerObjectsRcd& rcd) {
00494 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceL1TriggerObjects-> ...";
00495 edm::ESHandle<HcalTopology> htopo;
00496 rcd.getRecord<IdealGeometryRecord>().get(htopo);
00497 const HcalTopology* topo=&(*htopo);
00498
00499 std::auto_ptr<HcalL1TriggerObjects> result (new HcalL1TriggerObjects (topo));
00500 std::vector <HcalGenericDetId> cells = allCells(*topo);
00501 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00502 HcalL1TriggerObject item(cell->rawId(),0., 1., 0);
00503 result->addValues(item);
00504 }
00505
00506 result->setTagString("hardcoded");
00507 result->setAlgoString("hardcoded");
00508 return result;
00509 }
00510
00511
00512
00513
00514 std::auto_ptr<HcalElectronicsMap> HcalHardcodeCalibrations::produceElectronicsMap (const HcalElectronicsMapRcd& rcd) {
00515 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceElectronicsMap-> ...";
00516
00517 std::auto_ptr<HcalElectronicsMap> result (new HcalElectronicsMap ());
00518 HcalDbHardcode::makeHardcodeMap(*result);
00519 return result;
00520 }
00521
00522 std::auto_ptr<HcalValidationCorrs> HcalHardcodeCalibrations::produceValidationCorrs (const HcalValidationCorrsRcd& rcd) {
00523 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceValidationCorrs-> ...";
00524 edm::ESHandle<HcalTopology> htopo;
00525 rcd.getRecord<IdealGeometryRecord>().get(htopo);
00526 const HcalTopology* topo=&(*htopo);
00527
00528 std::auto_ptr<HcalValidationCorrs> result (new HcalValidationCorrs (topo));
00529 std::vector <HcalGenericDetId> cells = allCells(*topo);
00530 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00531 HcalValidationCorr item(cell->rawId(),1.0);
00532 result->addValues(item);
00533 }
00534 return result;
00535 }
00536
00537 std::auto_ptr<HcalLutMetadata> HcalHardcodeCalibrations::produceLutMetadata (const HcalLutMetadataRcd& rcd) {
00538 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceLutMetadata-> ...";
00539 edm::ESHandle<HcalTopology> htopo;
00540 rcd.getRecord<IdealGeometryRecord>().get(htopo);
00541 const HcalTopology* topo=&(*htopo);
00542
00543 std::auto_ptr<HcalLutMetadata> result (new HcalLutMetadata (topo));
00544
00545 result->setRctLsb( 0.5 );
00546 result->setNominalGain(0.003333);
00547
00548 std::vector <HcalGenericDetId> cells = allCells(*topo);
00549 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561 HcalLutMetadatum item(cell->rawId(),1.0,1,1);
00562 result->addValues(item);
00563 }
00564
00565 return result;
00566 }
00567
00568 std::auto_ptr<HcalDcsValues>
00569 HcalHardcodeCalibrations::produceDcsValues (const HcalDcsRcd& rcd) {
00570 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceDcsValues-> ...";
00571 std::auto_ptr<HcalDcsValues> result(new HcalDcsValues);
00572 return result;
00573 }
00574
00575 std::auto_ptr<HcalDcsMap> HcalHardcodeCalibrations::produceDcsMap (const HcalDcsMapRcd& rcd) {
00576 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceDcsMap-> ...";
00577
00578 std::auto_ptr<HcalDcsMap> result (new HcalDcsMap ());
00579 HcalDbHardcode::makeHardcodeDcsMap(*result);
00580 return result;
00581 }
00582
00583 std::auto_ptr<HcalRecoParams> HcalHardcodeCalibrations::produceRecoParams (const HcalRecoParamsRcd& rec) {
00584 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceRecoParams-> ...";
00585 edm::ESHandle<HcalTopology> htopo;
00586 rec.getRecord<IdealGeometryRecord>().get(htopo);
00587 const HcalTopology* topo=&(*htopo);
00588
00589 std::auto_ptr<HcalRecoParams> result (new HcalRecoParams (topo));
00590 std::vector <HcalGenericDetId> cells = allCells(*topo);
00591 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00592 HcalRecoParam item = HcalDbHardcode::makeRecoParam (*cell);
00593 result->addValues(item);
00594 }
00595 return result;
00596 }
00597 std::auto_ptr<HcalTimingParams> HcalHardcodeCalibrations::produceTimingParams (const HcalTimingParamsRcd& rec) {
00598 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceTimingParams-> ...";
00599 edm::ESHandle<HcalTopology> htopo;
00600 rec.getRecord<IdealGeometryRecord>().get(htopo);
00601 const HcalTopology* topo=&(*htopo);
00602
00603 std::auto_ptr<HcalTimingParams> result (new HcalTimingParams (topo));
00604 std::vector <HcalGenericDetId> cells = allCells(*topo);
00605 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00606 HcalTimingParam item = HcalDbHardcode::makeTimingParam (*cell);
00607 result->addValues(item);
00608 }
00609 return result;
00610 }
00611 std::auto_ptr<HcalLongRecoParams> HcalHardcodeCalibrations::produceLongRecoParams (const HcalLongRecoParamsRcd& rec) {
00612 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceLongRecoParams-> ...";
00613 edm::ESHandle<HcalTopology> htopo;
00614 rec.getRecord<IdealGeometryRecord>().get(htopo);
00615 const HcalTopology* topo=&(*htopo);
00616
00617 std::auto_ptr<HcalLongRecoParams> result (new HcalLongRecoParams (topo));
00618 std::vector <HcalGenericDetId> cells = allCells(*topo);
00619 std::vector <unsigned int> mSignal;
00620 mSignal.push_back(4);
00621 mSignal.push_back(5);
00622 mSignal.push_back(6);
00623 std::vector <unsigned int> mNoise;
00624 mNoise.push_back(1);
00625 mNoise.push_back(2);
00626 mNoise.push_back(3);
00627 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00628 if (cell->isHcalZDCDetId())
00629 {
00630 HcalLongRecoParam item(cell->rawId(),mSignal,mNoise);
00631 result->addValues(item);
00632 }
00633 }
00634 return result;
00635 }
00636
00637 std::auto_ptr<HcalMCParams> HcalHardcodeCalibrations::produceMCParams (const HcalMCParamsRcd& rec) {
00638
00639
00640
00641
00642 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceMCParams-> ...";
00643 edm::ESHandle<HcalTopology> htopo;
00644 rec.getRecord<IdealGeometryRecord>().get(htopo);
00645 const HcalTopology* topo=&(*htopo);
00646 std::auto_ptr<HcalMCParams> result (new HcalMCParams (topo));
00647 std::vector <HcalGenericDetId> cells = allCells(*topo);
00648 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00649
00650
00651 HcalMCParam item = HcalDbHardcode::makeMCParam (*cell);
00652 result->addValues(item);
00653 }
00654 return result;
00655 }
00656
00657
00658 std::auto_ptr<HcalFlagHFDigiTimeParams> HcalHardcodeCalibrations::produceFlagHFDigiTimeParams (const HcalFlagHFDigiTimeParamsRcd& rec) {
00659 edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceFlagHFDigiTimeParams-> ...";
00660 edm::ESHandle<HcalTopology> htopo;
00661 rec.getRecord<IdealGeometryRecord>().get(htopo);
00662 const HcalTopology* topo=&(*htopo);
00663
00664 std::auto_ptr<HcalFlagHFDigiTimeParams> result (new HcalFlagHFDigiTimeParams (topo));
00665 std::vector <HcalGenericDetId> cells = allCells(*topo);
00666
00667 std::vector<double> coef;
00668 coef.push_back(0.93);
00669 coef.push_back(-0.38275);
00670 coef.push_back(-0.012667);
00671
00672 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00673 HcalFlagHFDigiTimeParam item(cell->rawId(),
00674 1,
00675 3,
00676 2,
00677 40.,
00678 coef
00679 );
00680 result->addValues(item);
00681 }
00682 return result;
00683 }
00684
00685
00686 std::auto_ptr<HcalCholeskyMatrices> HcalHardcodeCalibrations::produceCholeskyMatrices (const HcalCholeskyMatricesRcd& rec) {
00687
00688 edm::ESHandle<HcalTopology> htopo;
00689 rec.getRecord<IdealGeometryRecord>().get(htopo);
00690 const HcalTopology* topo=&(*htopo);
00691 std::auto_ptr<HcalCholeskyMatrices> result (new HcalCholeskyMatrices (topo));
00692
00693 std::vector <HcalGenericDetId> cells = allCells(*topo);
00694 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00695
00696 int sub = cell->genericSubdet();
00697
00698 if (sub == HcalGenericDetId::HcalGenBarrel ||
00699 sub == HcalGenericDetId::HcalGenEndcap ||
00700 sub == HcalGenericDetId::HcalGenOuter ||
00701 sub == HcalGenericDetId::HcalGenForward ) {
00702 HcalCholeskyMatrix item(cell->rawId());
00703 result->addValues(item);
00704 }
00705 }
00706 return result;
00707
00708 }
00709 std::auto_ptr<HcalCovarianceMatrices> HcalHardcodeCalibrations::produceCovarianceMatrices (const HcalCovarianceMatricesRcd& rec) {
00710
00711 edm::ESHandle<HcalTopology> htopo;
00712 rec.getRecord<IdealGeometryRecord>().get(htopo);
00713 const HcalTopology* topo=&(*htopo);
00714 std::auto_ptr<HcalCovarianceMatrices> result (new HcalCovarianceMatrices (topo));
00715 std::vector <HcalGenericDetId> cells = allCells(*topo);
00716 for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
00717
00718 HcalCovarianceMatrix item(cell->rawId());
00719 result->addValues(item);
00720 }
00721 return result;
00722 }