File indexing completed on 2024-04-06 12:07:35
0001 #include "DQM/HcalTasks/interface/RecHitTask.h"
0002 #include <cmath>
0003
0004 using namespace hcaldqm;
0005 using namespace hcaldqm::constants;
0006 using namespace hcaldqm::filter;
0007
0008 RecHitTask::RecHitTask(edm::ParameterSet const& ps)
0009 : DQTask(ps), hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
0010 _tagHBHE = ps.getUntrackedParameter<edm::InputTag>("tagHBHE", edm::InputTag("hbhereco"));
0011 _tagHO = ps.getUntrackedParameter<edm::InputTag>("tagHO", edm::InputTag("horeco"));
0012 _tagHF = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hfreco"));
0013 _tagPreHF = ps.getUntrackedParameter<edm::InputTag>("tagPreHF", edm::InputTag(""));
0014 _hfPreRecHitsAvailable = ps.getUntrackedParameter<bool>("hfPreRecHitsAvailable", false);
0015
0016 _tokHBHE = consumes<HBHERecHitCollection>(_tagHBHE);
0017 _tokHO = consumes<HORecHitCollection>(_tagHO);
0018 _tokHF = consumes<HFRecHitCollection>(_tagHF);
0019 _tokPreHF = consumes<HFPreRecHitCollection>(_tagPreHF);
0020
0021 _cutE_HBHE = ps.getUntrackedParameter<double>("cutE_HBHE", 5);
0022 _cutE_HO = ps.getUntrackedParameter<double>("cutE_HO", 5);
0023 _cutE_HF = ps.getUntrackedParameter<double>("cutE_HF", 5);
0024 _thresh_unihf = ps.getUntrackedParameter<double>("thresh_unihf", 0.2);
0025
0026
0027 _vflags.resize(nRecoFlag);
0028 _vflags[fUni] = flag::Flag("UniSlotHF");
0029 _vflags[fTCDS] = flag::Flag("TCDS");
0030 _vflags[fUnknownIds] = flag::Flag("UnknownIds");
0031 }
0032
0033 void RecHitTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
0034 DQTask::bookHistograms(ib, r, es);
0035
0036
0037 edm::ESHandle<HcalDbService> dbs = es.getHandle(hcalDbServiceToken_);
0038 _emap = dbs->getHcalMapping();
0039
0040 std::vector<uint32_t> vVME;
0041 std::vector<uint32_t> vuTCA;
0042 vVME.push_back(
0043 HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId());
0044 vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0045 _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vVME);
0046 _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vuTCA);
0047 std::vector<uint32_t> vhashHF;
0048 vhashHF.push_back(
0049 hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalForward, 29, 1, 1)));
0050
0051 _filter_HF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, vhashHF);
0052
0053
0054
0055 _cEnergy_Subdet.initialize(_name,
0056 "Energy",
0057 hcaldqm::hashfunctions::fSubdet,
0058 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy),
0059 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0060 0);
0061 _cEnergy_depth.initialize(_name,
0062 "Energy",
0063 hcaldqm::hashfunctions::fdepth,
0064 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0065 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0066 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy, true),
0067 0);
0068
0069
0070 _cTimingCut_SubdetPM.initialize(_name,
0071 "TimingCut",
0072 hcaldqm::hashfunctions::fSubdetPM,
0073 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0074 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0075 0);
0076 _cTimingvsEnergy_SubdetPM.initialize(_name,
0077 "TimingvsEnergy",
0078 hcaldqm::hashfunctions::fSubdetPM,
0079 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy, true),
0080 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0081 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0082 0);
0083
0084 _cTimingCut_HBHEPartition.initialize(_name,
0085 "TimingCut",
0086 hcaldqm::hashfunctions::fHBHEPartition,
0087 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0088 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0089 0);
0090 _cTimingCut_depth.initialize(_name,
0091 "TimingCut",
0092 hcaldqm::hashfunctions::fdepth,
0093 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0094 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0095 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0096 0);
0097 _cTimingCutvsLS_SubdetPM.initialize(_name,
0098 "TimingCutvsLS",
0099 hcaldqm::hashfunctions::fSubdetPM,
0100 new hcaldqm::quantity::LumiSection(_maxLS),
0101 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0102 0);
0103
0104
0105 _cOccupancy_depth.initialize(_name,
0106 "Occupancy",
0107 hcaldqm::hashfunctions::fdepth,
0108 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0109 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0110 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0111 0);
0112
0113 _cOccupancyvsLS_Subdet.initialize(_name,
0114 "OccupancyvsLS",
0115 hcaldqm::hashfunctions::fSubdet,
0116 new hcaldqm::quantity::LumiSection(_maxLS),
0117 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),
0118 0);
0119
0120 _cOccupancyCut_depth.initialize(_name,
0121 "OccupancyCut",
0122 hcaldqm::hashfunctions::fdepth,
0123 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0124 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0125 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0126 0);
0127
0128 if (_hfPreRecHitsAvailable) {
0129 _cDAAsymmetryVsCharge_SubdetPM.initialize(
0130 _name,
0131 "ChargeVsAsymmetry",
0132 hcaldqm::hashfunctions::fSubdetPM,
0133 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDualAnodeAsymmetry),
0134 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000),
0135 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0136 0);
0137 _cDAAsymmetryMean_cut_depth.initialize(_name,
0138 "AsymmetryMean",
0139 hcaldqm::hashfunctions::fdepth,
0140 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0141 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0142 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDualAnodeAsymmetry),
0143 0);
0144 _cDAAsymmetry_cut_SubdetPM.initialize(_name,
0145 "Asymmetry",
0146 hcaldqm::hashfunctions::fSubdetPM,
0147 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDualAnodeAsymmetry),
0148 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0149 0);
0150 }
0151
0152
0153 if (_ptype == fOnline) {
0154 _cEnergyvsieta_Subdet.initialize(_name,
0155 "Energyvsieta",
0156 hcaldqm::hashfunctions::fSubdet,
0157 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0158 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV),
0159 0);
0160 _cEnergyvsiphi_SubdetPM.initialize(_name,
0161 "Energyvsiphi",
0162 hcaldqm::hashfunctions::fSubdetPM,
0163 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0164 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV),
0165 0);
0166 _cEnergyvsLS_SubdetPM.initialize(_name,
0167 "EnergyvsLS",
0168 hcaldqm::hashfunctions::fSubdetPM,
0169 new hcaldqm::quantity::LumiSection(_maxLS),
0170 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV),
0171 0);
0172 _cEnergyvsBX_SubdetPM.initialize(_name,
0173 "EnergyvsBX",
0174 hcaldqm::hashfunctions::fSubdetPM,
0175 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0176 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV),
0177 0);
0178 _cTimingCutvsieta_Subdet.initialize(_name,
0179 "TimingCutvsieta",
0180 hcaldqm::hashfunctions::fSubdet,
0181 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0182 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0183 0);
0184 _cTimingCutvsiphi_SubdetPM.initialize(_name,
0185 "TimingCutvsiphi",
0186 hcaldqm::hashfunctions::fSubdetPM,
0187 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0188 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0189 0);
0190 _cTimingCutvsBX_SubdetPM.initialize(_name,
0191 "TimingCutvsBX",
0192 hcaldqm::hashfunctions::fSubdetPM,
0193 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0194 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0195 0);
0196 _cOccupancyvsiphi_SubdetPM.initialize(_name,
0197 "Occupancyvsiphi",
0198 hcaldqm::hashfunctions::fSubdetPM,
0199 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0200 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0201 0);
0202 _cOccupancyvsieta_Subdet.initialize(_name,
0203 "Occupancyvsieta",
0204 hcaldqm::hashfunctions::fSubdet,
0205 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0206 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0207 0);
0208 _cOccupancyCutvsiphi_SubdetPM.initialize(_name,
0209 "OccupancyCutvsiphi",
0210 hcaldqm::hashfunctions::fSubdetPM,
0211 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0212 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0213 0);
0214 _cOccupancyCutvsieta_Subdet.initialize(_name,
0215 "OccupancyCutvsieta",
0216 hcaldqm::hashfunctions::fSubdet,
0217 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0218 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0219 0);
0220 _cOccupancyCutvsBX_Subdet.initialize(_name,
0221 "OccupancyCutvsBX",
0222 hcaldqm::hashfunctions::fSubdet,
0223 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0224 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0225 0);
0226 _cOccupancyCutvsiphivsLS_SubdetPM.initialize(_name,
0227 "OccupancyCutvsiphivsLS",
0228 hcaldqm::hashfunctions::fSubdetPM,
0229 new hcaldqm::quantity::LumiSection(_maxLS),
0230 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0231 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0232 0);
0233 _cOccupancyCutvsLS_Subdet.initialize(_name,
0234 "OccupancyCutvsLS",
0235 hcaldqm::hashfunctions::fSubdet,
0236 new hcaldqm::quantity::LumiSection(_maxLS),
0237 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),
0238 0);
0239 }
0240
0241
0242 if (_ptype != fOffline) {
0243 std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
0244 std::vector<int> vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap);
0245 std::vector<int> vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap);
0246
0247
0248 for (std::vector<int>::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it)
0249 _vhashFEDs.push_back(HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, (*it) - FED_VME_MIN).rawId());
0250 for (std::vector<int>::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) {
0251 std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
0252 _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0253 }
0254
0255 _cTimingCut_FEDuTCA.initialize(_name,
0256 "TimingCut",
0257 hcaldqm::hashfunctions::fFED,
0258 new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0259 new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh),
0260 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0261 0);
0262 _cTimingCutvsLS_FED.initialize(_name,
0263 "TimingCutvsLS",
0264 hcaldqm::hashfunctions::fFED,
0265 new hcaldqm::quantity::LumiSection(_maxLS),
0266 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0267 0);
0268 _cTimingCut_ElectronicsuTCA.initialize(_name,
0269 "TimingCut",
0270 hcaldqm::hashfunctions::fElectronics,
0271 new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0272 new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0273 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),
0274 0);
0275
0276 _cOccupancy_FEDuTCA.initialize(_name,
0277 "Occupancy",
0278 hcaldqm::hashfunctions::fFED,
0279 new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0280 new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh),
0281 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0282 0);
0283 _cOccupancy_ElectronicsuTCA.initialize(_name,
0284 "Occupancy",
0285 hcaldqm::hashfunctions::fElectronics,
0286 new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0287 new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0288 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0289 0);
0290
0291 _cOccupancyCut_FEDuTCA.initialize(_name,
0292 "OccupancyCut",
0293 hcaldqm::hashfunctions::fFED,
0294 new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0295 new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh),
0296 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0297 0);
0298 _cOccupancyCut_ElectronicsuTCA.initialize(_name,
0299 "OccupancyCut",
0300 hcaldqm::hashfunctions::fElectronics,
0301 new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0302 new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0303 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0304 0);
0305 if (_ptype == fOnline) {
0306 _cSummaryvsLS_FED.initialize(_name,
0307 "SummaryvsLS",
0308 hcaldqm::hashfunctions::fFED,
0309 new hcaldqm::quantity::LumiSection(_maxLS),
0310 new hcaldqm::quantity::FlagQuantity(_vflags),
0311 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),
0312 0);
0313 _cSummaryvsLS.initialize(_name,
0314 "SummaryvsLS",
0315 new hcaldqm::quantity::LumiSection(_maxLS),
0316 new hcaldqm::quantity::FEDQuantity(vFEDs),
0317 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),
0318 0);
0319
0320 _xUniHF.initialize(hcaldqm::hashfunctions::fFEDSlot);
0321 _xUni.initialize(hcaldqm::hashfunctions::fFED);
0322 }
0323 }
0324
0325
0326 char cutstr[200];
0327 sprintf(cutstr, "_EHBHE%dHO%dHF%d", int(_cutE_HBHE), int(_cutE_HO), int(_cutE_HF));
0328 char cutstr2[200];
0329 sprintf(cutstr2, "_EHF%d", int(_cutE_HF));
0330
0331
0332 _cEnergy_Subdet.book(ib, _emap, _subsystem);
0333 _cEnergy_depth.book(ib, _emap, _subsystem);
0334
0335
0336 _cTimingCut_SubdetPM.book(ib, _emap, _subsystem);
0337 _cTimingvsEnergy_SubdetPM.book(ib, _emap, _subsystem);
0338 if (_ptype != fOffline) {
0339 _cTimingCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem);
0340 _cTimingCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0341 }
0342 _cTimingCut_HBHEPartition.book(ib, _emap, _subsystem);
0343 _cTimingCut_depth.book(ib, _emap, _subsystem);
0344 _cTimingCutvsLS_SubdetPM.book(ib, _emap, _subsystem);
0345 if (_ptype != fOffline) {
0346 _cTimingCutvsLS_FED.book(ib, _emap, _subsystem);
0347 }
0348
0349
0350 _cOccupancy_depth.book(ib, _emap, _subsystem);
0351 if (_ptype != fOffline) {
0352 _cOccupancy_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem);
0353 _cOccupancy_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0354 }
0355 _cOccupancyvsLS_Subdet.book(ib, _emap, _subsystem);
0356 _cOccupancyCut_depth.book(ib, _emap, _subsystem);
0357 if (_ptype != fOffline) {
0358 _cOccupancyCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem);
0359 _cOccupancyCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0360 }
0361
0362 if (_hfPreRecHitsAvailable) {
0363 _cDAAsymmetryVsCharge_SubdetPM.book(ib, _emap, _filter_HF, _subsystem);
0364 _cDAAsymmetryMean_cut_depth.book(ib, _emap, _filter_HF, _subsystem);
0365 _cDAAsymmetry_cut_SubdetPM.book(ib, _emap, _filter_HF, _subsystem);
0366 }
0367
0368
0369 if (_ptype == fOnline) {
0370 _cEnergyvsLS_SubdetPM.book(ib, _emap, _subsystem);
0371 _cEnergyvsieta_Subdet.book(ib, _emap, _subsystem);
0372 _cEnergyvsiphi_SubdetPM.book(ib, _emap, _subsystem);
0373 _cEnergyvsBX_SubdetPM.book(ib, _emap, _subsystem);
0374 _cTimingCutvsieta_Subdet.book(ib, _emap, _subsystem);
0375 _cTimingCutvsiphi_SubdetPM.book(ib, _emap, _subsystem);
0376 _cTimingCutvsBX_SubdetPM.book(ib, _emap, _subsystem);
0377 _cOccupancyvsiphi_SubdetPM.book(ib, _emap, _subsystem);
0378 _cOccupancyvsieta_Subdet.book(ib, _emap, _subsystem);
0379 _cOccupancyCutvsiphi_SubdetPM.book(ib, _emap, _subsystem);
0380 _cOccupancyCutvsieta_Subdet.book(ib, _emap, _subsystem);
0381 _cOccupancyCutvsBX_Subdet.book(ib, _emap, _subsystem);
0382 _cOccupancyCutvsiphivsLS_SubdetPM.book(ib, _emap, _subsystem);
0383 _cOccupancyCutvsLS_Subdet.book(ib, _emap, _subsystem);
0384 _cSummaryvsLS_FED.book(ib, _emap, _subsystem);
0385 _cSummaryvsLS.book(ib, _subsystem);
0386
0387 std::vector<uint32_t> vhashFEDHF;
0388 vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0389 vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0390 vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0391 vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0392 vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0393 vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0394 HashFilter filter_FEDHF;
0395 filter_FEDHF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fFED, vhashFEDHF);
0396
0397 _gids = _emap->allPrecisionId();
0398 if (_ptype != fOffline) {
0399 _xUniHF.book(_emap, filter_FEDHF);
0400 _xUni.book(_emap);
0401 }
0402 }
0403
0404
0405 _ehashmap.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap);
0406
0407
0408 ib.setCurrentFolder(_subsystem + "/" + _name);
0409 auto scope = DQMStore::IBooker::UseLumiScope(ib);
0410 meUnknownIds1LS = ib.book1DD("UnknownIds", "UnknownIds", 1, 0, 1);
0411 _unknownIdsPresent = false;
0412 }
0413
0414 void RecHitTask::_resetMonitors(hcaldqm::UpdateFreq uf) {
0415 switch (uf) {
0416 case hcaldqm::f1LS:
0417 _unknownIdsPresent = false;
0418 break;
0419 default:
0420 break;
0421 }
0422
0423 DQTask::_resetMonitors(uf);
0424 }
0425
0426 void RecHitTask::_process(edm::Event const& e, edm::EventSetup const&) {
0427 edm::Handle<HBHERecHitCollection> chbhe;
0428 edm::Handle<HORecHitCollection> cho;
0429 edm::Handle<HFRecHitCollection> chf;
0430
0431 if (!(e.getByToken(_tokHBHE, chbhe)))
0432 _logger.dqmthrow("Collection HBHERecHitCollection not available " + _tagHBHE.label() + " " + _tagHBHE.instance());
0433 if (!(e.getByToken(_tokHO, cho)))
0434 _logger.dqmthrow("Collection HORecHitCollection not available " + _tagHO.label() + " " + _tagHO.instance());
0435 if (!(e.getByToken(_tokHF, chf)))
0436 _logger.dqmthrow("Collection HFRecHitCollection not available " + _tagHF.label() + " " + _tagHF.instance());
0437
0438 edm::Handle<HFPreRecHitCollection> cprehf;
0439 if (_hfPreRecHitsAvailable) {
0440 if (!(e.getByToken(_tokPreHF, cprehf)))
0441 _logger.dqmthrow("Collection HFPreRecHitCollection not available " + _tagPreHF.label() + " " +
0442 _tagPreHF.instance());
0443 }
0444
0445
0446 int bx = e.bunchCrossing();
0447
0448 auto lumiCache = luminosityBlockCache(e.getLuminosityBlock().index());
0449 _currentLS = lumiCache->currentLS;
0450
0451
0452
0453 uint32_t rawidHBValid = 0;
0454 uint32_t rawidHEValid = 0;
0455
0456 double ehbm = 0;
0457 double ehbp = 0;
0458 double ehem = 0;
0459 double ehep = 0;
0460 int nChsHB = 0;
0461 int nChsHE = 0;
0462 int nChsHBCut = 0;
0463 int nChsHECut = 0;
0464 for (HBHERecHitCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) {
0465 double energy = it->energy();
0466 double timing = it->time();
0467
0468
0469 HcalDetId did = it->id();
0470 uint32_t rawid = _ehashmap.lookup(did);
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480 HcalElectronicsId const& eid(rawid);
0481 if (did.subdet() == HcalBarrel)
0482 rawidHBValid = did.rawId();
0483 else if (did.subdet() == HcalEndcap)
0484 rawidHEValid = did.rawId();
0485
0486 _cEnergy_Subdet.fill(did, energy);
0487 _cTimingvsEnergy_SubdetPM.fill(did, energy, timing);
0488 _cOccupancy_depth.fill(did);
0489 did.subdet() == HcalBarrel ? did.ieta() > 0 ? ehbp += energy : ehbm += energy
0490 : did.ieta() > 0 ? ehep += energy
0491 : ehem += energy;
0492
0493
0494 if (_ptype == fOnline) {
0495 _cOccupancyvsiphi_SubdetPM.fill(did);
0496 _cOccupancyvsieta_Subdet.fill(did);
0497 }
0498
0499
0500 if (_ptype != fOffline) {
0501
0502 if (rawid != 0) {
0503 if (!eid.isVMEid()) {
0504 _cOccupancy_FEDuTCA.fill(eid);
0505 _cOccupancy_ElectronicsuTCA.fill(eid);
0506 }
0507 }
0508 }
0509
0510 if (energy > _cutE_HBHE) {
0511
0512 if (_ptype == fOnline) {
0513 _cEnergyvsLS_SubdetPM.fill(did, _currentLS, energy);
0514 _cEnergyvsBX_SubdetPM.fill(did, bx, energy);
0515 _cEnergyvsieta_Subdet.fill(did, energy);
0516 _cEnergyvsiphi_SubdetPM.fill(did, energy);
0517 _cTimingCutvsieta_Subdet.fill(did, timing);
0518 _cTimingCutvsiphi_SubdetPM.fill(did, timing);
0519 _cTimingCutvsBX_SubdetPM.fill(did, bx, timing);
0520 _cOccupancyCutvsiphi_SubdetPM.fill(did);
0521 _cOccupancyCutvsieta_Subdet.fill(did);
0522 _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS);
0523 }
0524
0525 _cEnergy_depth.fill(did, energy);
0526 _cTimingCut_SubdetPM.fill(did, timing);
0527 _cTimingCut_HBHEPartition.fill(did, timing);
0528 _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing);
0529
0530
0531 if (_ptype == fOnline) {
0532 if (rawid != 0) {
0533 _cTimingCutvsLS_FED.fill(eid, _currentLS, timing);
0534 }
0535 _cTimingCut_depth.fill(did, timing);
0536
0537 } else {
0538 if (_ptype != fOffline) {
0539 if (rawid != 0) {
0540 _cTimingCutvsLS_FED.fill(eid, _currentLS, timing);
0541 }
0542 }
0543 _cTimingCut_depth.fill(did, timing);
0544 }
0545 _cOccupancyCut_depth.fill(did);
0546 if (_ptype != fOffline) {
0547 if (rawid != 0) {
0548 if (eid.isUTCAid()) {
0549 if (_ptype == fOnline) {
0550
0551 _cTimingCut_FEDuTCA.fill(eid, timing);
0552 _cTimingCut_ElectronicsuTCA.fill(eid, timing);
0553 } else {
0554 _cTimingCut_FEDuTCA.fill(eid, timing);
0555 _cTimingCut_ElectronicsuTCA.fill(eid, timing);
0556 }
0557 _cOccupancyCut_FEDuTCA.fill(eid);
0558 _cOccupancyCut_ElectronicsuTCA.fill(eid);
0559 }
0560 }
0561 }
0562 did.subdet() == HcalBarrel ? nChsHBCut++ : nChsHECut++;
0563 }
0564 did.subdet() == HcalBarrel ? nChsHB++ : nChsHE++;
0565 }
0566
0567 if (rawidHBValid != 0 && rawidHEValid != 0) {
0568 _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, nChsHB);
0569 _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, nChsHE);
0570
0571
0572 if (_ptype == fOnline) {
0573 _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHBValid), bx, nChsHBCut);
0574 _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHEValid), bx, nChsHECut);
0575 _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, nChsHBCut);
0576 _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, nChsHECut);
0577 }
0578
0579 }
0580
0581
0582
0583 uint32_t rawidValid = 0;
0584
0585 int nChsHO = 0;
0586 int nChsHOCut = 0;
0587 double ehop = 0;
0588 double ehom = 0;
0589 for (HORecHitCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) {
0590 double energy = it->energy();
0591 double timing = it->time();
0592
0593
0594 HcalDetId did = it->id();
0595 uint32_t rawid = _ehashmap.lookup(did);
0596 if (rawid == 0) {
0597 meUnknownIds1LS->Fill(1);
0598 _unknownIdsPresent = true;
0599 continue;
0600 }
0601 HcalElectronicsId const& eid(rawid);
0602 if (did.subdet() == HcalOuter)
0603 rawidValid = did.rawId();
0604
0605 _cEnergy_Subdet.fill(did, energy);
0606 _cTimingvsEnergy_SubdetPM.fill(did, energy, timing);
0607 _cOccupancy_depth.fill(did);
0608 did.ieta() > 0 ? ehop += energy : ehom += energy;
0609
0610
0611 if (_ptype == fOnline) {
0612 _cOccupancyvsiphi_SubdetPM.fill(did);
0613 _cOccupancyvsieta_Subdet.fill(did);
0614 }
0615
0616
0617 if (_ptype != fOffline) {
0618 if (!eid.isVMEid()) {
0619 _cOccupancy_FEDuTCA.fill(eid);
0620 _cOccupancy_ElectronicsuTCA.fill(eid);
0621 }
0622 }
0623
0624 if (energy > _cutE_HO) {
0625
0626 if (_ptype == fOnline) {
0627 _cEnergyvsLS_SubdetPM.fill(did, _currentLS, energy);
0628 _cEnergyvsBX_SubdetPM.fill(did, bx, energy);
0629 _cEnergyvsieta_Subdet.fill(did, energy);
0630 _cEnergyvsiphi_SubdetPM.fill(did, energy);
0631 _cTimingCutvsieta_Subdet.fill(did, timing);
0632 _cTimingCutvsiphi_SubdetPM.fill(did, timing);
0633 _cTimingCutvsBX_SubdetPM.fill(did, bx, timing);
0634 _cOccupancyCutvsiphi_SubdetPM.fill(did);
0635 _cOccupancyCutvsieta_Subdet.fill(did);
0636 _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS);
0637 }
0638
0639
0640 _cEnergy_depth.fill(did, energy);
0641 _cTimingCut_SubdetPM.fill(did, timing);
0642 _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing);
0643 if (_ptype != fOffline) {
0644 _cTimingCutvsLS_FED.fill(eid, _currentLS, timing);
0645 }
0646 _cOccupancyCut_depth.fill(did);
0647 _cTimingCut_depth.fill(did, timing);
0648 if (_ptype != fOffline) {
0649 if (!eid.isVMEid()) {
0650 _cTimingCut_FEDuTCA.fill(eid, timing);
0651 _cTimingCut_ElectronicsuTCA.fill(eid, timing);
0652 _cOccupancyCut_FEDuTCA.fill(eid);
0653 _cOccupancyCut_ElectronicsuTCA.fill(eid);
0654 }
0655 }
0656 nChsHOCut++;
0657 }
0658 nChsHO++;
0659 }
0660
0661 if (rawidValid != 0) {
0662 _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, nChsHO);
0663
0664 if (_ptype == fOnline) {
0665 _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx, nChsHOCut);
0666 _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, nChsHOCut);
0667 }
0668
0669 }
0670
0671
0672 rawidValid = 0;
0673
0674 int nChsHF = 0;
0675 int nChsHFCut = 0;
0676 double ehfp = 0;
0677 double ehfm = 0;
0678 for (HFRecHitCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) {
0679 double energy = it->energy();
0680 double timing = it->time();
0681
0682
0683 HcalDetId did = it->id();
0684 uint32_t rawid = _ehashmap.lookup(did);
0685 if (rawid == 0) {
0686 meUnknownIds1LS->Fill(1);
0687 _unknownIdsPresent = true;
0688 continue;
0689 }
0690 HcalElectronicsId const& eid(rawid);
0691 if (did.subdet() == HcalForward)
0692 rawidValid = did.rawId();
0693
0694 _cEnergy_Subdet.fill(did, energy);
0695 _cTimingvsEnergy_SubdetPM.fill(did, energy, timing);
0696 _cOccupancy_depth.fill(did);
0697 did.ieta() > 0 ? ehfp += energy : ehfm += energy;
0698
0699
0700
0701
0702 if (_ptype == fOnline) {
0703 _cOccupancyvsiphi_SubdetPM.fill(did);
0704 _cOccupancyvsieta_Subdet.fill(did);
0705 }
0706
0707
0708 if (_ptype != fOffline) {
0709 if (!eid.isVMEid()) {
0710 _cOccupancy_FEDuTCA.fill(eid);
0711 _cOccupancy_ElectronicsuTCA.fill(eid);
0712 }
0713 }
0714
0715 if (energy > _cutE_HF) {
0716
0717 if (_ptype == fOnline) {
0718 _cEnergyvsLS_SubdetPM.fill(did, _currentLS, energy);
0719 _cEnergyvsBX_SubdetPM.fill(did, bx, energy);
0720 _cEnergyvsieta_Subdet.fill(did, energy);
0721 _cEnergyvsiphi_SubdetPM.fill(did, energy);
0722 _cTimingCutvsieta_Subdet.fill(did, timing);
0723 _cTimingCutvsiphi_SubdetPM.fill(did, timing);
0724 _cTimingCutvsBX_SubdetPM.fill(did, bx, timing);
0725 _cOccupancyCutvsiphi_SubdetPM.fill(did);
0726 _cOccupancyCutvsieta_Subdet.fill(did);
0727 _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS);
0728 if (_ptype != fOffline) {
0729 _xUniHF.get(eid)++;
0730 }
0731 }
0732
0733 _cEnergy_depth.fill(did, energy);
0734 _cTimingCut_SubdetPM.fill(did, timing);
0735 _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing);
0736 if (_ptype != fOffline) {
0737 _cTimingCutvsLS_FED.fill(eid, _currentLS, timing);
0738 }
0739 _cOccupancyCut_depth.fill(did);
0740 _cTimingCut_depth.fill(did, timing);
0741 if (_ptype != fOffline) {
0742 if (!eid.isVMEid()) {
0743 _cTimingCut_FEDuTCA.fill(eid, timing);
0744 _cTimingCut_ElectronicsuTCA.fill(eid, timing);
0745 _cOccupancyCut_FEDuTCA.fill(eid);
0746 _cOccupancyCut_ElectronicsuTCA.fill(eid);
0747 }
0748 }
0749 nChsHFCut++;
0750 }
0751 nChsHF++;
0752 }
0753
0754 if (rawidValid != 0) {
0755 _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, nChsHF);
0756
0757 if (_ptype == fOnline) {
0758 _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx, nChsHFCut);
0759 _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, nChsHFCut);
0760 }
0761
0762 }
0763
0764
0765 if (_hfPreRecHitsAvailable) {
0766 for (HFPreRecHitCollection::const_iterator it = cprehf->begin(); it != cprehf->end(); ++it) {
0767 HcalDetId did = it->id();
0768 if (_filter_HF.filter(did)) {
0769 continue;
0770 }
0771 std::pair<float, bool> chargeAsymmetry = it->chargeAsymmetry(0.);
0772 std::pair<float, bool> chargeAsymmetryCut = it->chargeAsymmetry(20.);
0773
0774 if (chargeAsymmetry.second) {
0775 _cDAAsymmetryVsCharge_SubdetPM.fill(did, chargeAsymmetry.first, it->charge());
0776 }
0777 if (chargeAsymmetryCut.second) {
0778 _cDAAsymmetryMean_cut_depth.fill(did, chargeAsymmetryCut.first);
0779 _cDAAsymmetry_cut_SubdetPM.fill(did, chargeAsymmetryCut.first);
0780 }
0781 }
0782 }
0783 }
0784
0785 std::shared_ptr<hcaldqm::Cache> RecHitTask::globalBeginLuminosityBlock(edm::LuminosityBlock const& lb,
0786 edm::EventSetup const& es) const {
0787 return DQTask::globalBeginLuminosityBlock(lb, es);
0788 }
0789
0790 void RecHitTask::globalEndLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) {
0791 if (_ptype != fOnline)
0792 return;
0793
0794 auto lumiCache = luminosityBlockCache(lb.index());
0795 _currentLS = lumiCache->currentLS;
0796
0797
0798
0799
0800
0801
0802
0803
0804 for (uintCompactMap::const_iterator it = _xUniHF.begin(); it != _xUniHF.end(); ++it) {
0805 uint32_t hash1 = it->first;
0806 HcalElectronicsId eid1(hash1);
0807 double x1 = it->second;
0808
0809 for (uintCompactMap::const_iterator jt = _xUniHF.begin(); jt != _xUniHF.end(); ++jt) {
0810 if (jt == it)
0811 continue;
0812 double x2 = jt->second;
0813 if (x2 == 0)
0814 continue;
0815 if (x1 / x2 < _thresh_unihf)
0816 _xUni.get(eid1)++;
0817 }
0818 }
0819
0820 if (_ptype != fOffline) {
0821 for (std::vector<uint32_t>::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) {
0822 flag::Flag fSum("RECO");
0823 HcalElectronicsId eid = HcalElectronicsId(*it);
0824
0825 std::vector<uint32_t>::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it);
0826 if (cit == _vcdaqEids.end()) {
0827
0828 for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++)
0829 _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(flag::fNCDAQ));
0830 _cSummaryvsLS.setBinContent(eid, _currentLS, int(flag::fNCDAQ));
0831 continue;
0832 }
0833
0834
0835 if (hcaldqm::utilities::isFEDHF(eid) && (_runkeyVal == 0 || _runkeyVal == 4)) {
0836 if (_xUni.get(eid) > 0)
0837 _vflags[fUni]._state = flag::fPROBLEMATIC;
0838 else
0839 _vflags[fUni]._state = flag::fGOOD;
0840 }
0841
0842 if (_unknownIdsPresent)
0843 _vflags[fUnknownIds]._state = flag::fBAD;
0844 else
0845 _vflags[fUnknownIds]._state = flag::fGOOD;
0846
0847 int iflag = 0;
0848 for (std::vector<flag::Flag>::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) {
0849 _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(ft->_state));
0850 fSum += (*ft);
0851 iflag++;
0852
0853
0854 ft->reset();
0855 }
0856 _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state);
0857 }
0858 _xUniHF.reset();
0859 _xUni.reset();
0860 }
0861
0862
0863 DQTask::globalEndLuminosityBlock(lb, es);
0864 }
0865
0866 DEFINE_FWK_MODULE(RecHitTask);