Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-25 06:38:19

0001 #include "DQM/HcalTasks/interface/NoCQTask.h"
0002 
0003 using namespace hcaldqm;
0004 using namespace hcaldqm::constants;
0005 
0006 NoCQTask::NoCQTask(edm::ParameterSet const& ps)
0007     : DQTask(ps), hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
0008   _tagHBHE = ps.getUntrackedParameter<edm::InputTag>("tagHBHE", edm::InputTag("hcalDigis"));
0009   _tagHO = ps.getUntrackedParameter<edm::InputTag>("tagHO", edm::InputTag("hcalDigis"));
0010   _tagHF = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
0011   _tagReport = ps.getUntrackedParameter<edm::InputTag>("tagReport", edm::InputTag("hcalDigis"));
0012 
0013   _tokHBHE = consumes<HBHEDigiCollection>(_tagHBHE);
0014   _tokHO = consumes<HODigiCollection>(_tagHO);
0015   _tokHF = consumes<HFDigiCollection>(_tagHF);
0016   _tokReport = consumes<HcalUnpackerReport>(_tagReport);
0017 
0018   _cutSumQ_HBHE = ps.getUntrackedParameter<double>("cutSumQ_HBHE", 20);
0019   _cutSumQ_HO = ps.getUntrackedParameter<double>("cutSumQ_HO", 20);
0020   _cutSumQ_HF = ps.getUntrackedParameter<double>("cutSumQ_HF", 20);
0021 }
0022 
0023 /* virtual */ void NoCQTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
0024   DQTask::bookHistograms(ib, r, es);
0025 
0026   edm::ESHandle<HcalDbService> dbs = es.getHandle(hcalDbServiceToken_);
0027   _emap = dbs->getHcalMapping();
0028 
0029   _cTimingCut_depth.initialize(_name,
0030                                "TimingCut",
0031                                hcaldqm::hashfunctions::fdepth,
0032                                new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0033                                new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0034                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0035                                0);
0036   _cOccupancy_depth.initialize(_name,
0037                                "Occupancy",
0038                                hcaldqm::hashfunctions::fdepth,
0039                                new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0040                                new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0041                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0042                                0);
0043   _cOccupancyCut_depth.initialize(_name,
0044                                   "OccupancyCut",
0045                                   hcaldqm::hashfunctions::fdepth,
0046                                   new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0047                                   new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0048                                   new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0049                                   0);
0050   _cBadQuality_depth.initialize(_name,
0051                                 "BadQuality",
0052                                 hcaldqm::hashfunctions::fdepth,
0053                                 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0054                                 new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0055                                 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0056                                 0);
0057 
0058   _cTimingCut_depth.book(ib, _emap, _subsystem);
0059   _cOccupancy_depth.book(ib, _emap, _subsystem);
0060   _cOccupancyCut_depth.book(ib, _emap, _subsystem);
0061   _cBadQuality_depth.book(ib, _emap, _subsystem);
0062 }
0063 
0064 /* virtual */ void NoCQTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); }
0065 
0066 /* virtual */ void NoCQTask::_process(edm::Event const& e, edm::EventSetup const&) {
0067   edm::Handle<HBHEDigiCollection> chbhe;
0068   edm::Handle<HODigiCollection> cho;
0069   edm::Handle<HFDigiCollection> chf;
0070   edm::Handle<HcalUnpackerReport> creport;
0071 
0072   if (!e.getByToken(_tokHBHE, chbhe))
0073     _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE.label() + " " + _tagHBHE.instance());
0074   if (!e.getByToken(_tokHO, cho))
0075     _logger.dqmthrow("Collection HODigiCollection isn't available" + _tagHO.label() + " " + _tagHO.instance());
0076   if (!e.getByToken(_tokHF, chf))
0077     _logger.dqmthrow("Collection HFDigiCollection isn't available" + _tagHF.label() + " " + _tagHF.instance());
0078   if (!e.getByToken(_tokReport, creport))
0079     _logger.dqmthrow("Collection HcalUnpackerReport isn't available" + _tagReport.label() + " " +
0080                      _tagReport.instance());
0081 
0082   //    RAW Bad Quality
0083   for (std::vector<DetId>::const_iterator it = creport->bad_quality_begin(); it != creport->bad_quality_end(); ++it) {
0084     if (!HcalGenericDetId(*it).isHcalDetId())
0085       continue;
0086 
0087     _cBadQuality_depth.fill(HcalDetId(*it));
0088   }
0089 
0090   //    DIGI HBH, HO, HF
0091   for (HBHEDigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) {
0092     double sumQ = hcaldqm::utilities::sumQ<HBHEDataFrame>(*it, 2.5, 0, it->size() - 1);
0093     HcalDetId const& did = it->id();
0094 
0095     _cOccupancy_depth.fill(did);
0096     if (sumQ > _cutSumQ_HBHE) {
0097       double timing = hcaldqm::utilities::aveTS<HBHEDataFrame>(*it, 2.5, 0, it->size() - 1);
0098       _cOccupancyCut_depth.fill(did);
0099       _cTimingCut_depth.fill(did, timing);
0100     }
0101   }
0102 
0103   for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) {
0104     double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(*it, 8.5, 0, it->size() - 1);
0105     HcalDetId const& did = it->id();
0106 
0107     _cOccupancy_depth.fill(did);
0108     if (sumQ > _cutSumQ_HO) {
0109       double timing = hcaldqm::utilities::aveTS<HODataFrame>(*it, 8.5, 0, it->size() - 1);
0110       _cOccupancyCut_depth.fill(did);
0111       _cTimingCut_depth.fill(did, timing);
0112     }
0113   }
0114 
0115   for (HFDigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) {
0116     double sumQ = hcaldqm::utilities::sumQ<HFDataFrame>(*it, 2.5, 0, it->size() - 1);
0117     HcalDetId const& did = it->id();
0118 
0119     _cOccupancy_depth.fill(did);
0120     if (sumQ > _cutSumQ_HF) {
0121       double timing = hcaldqm::utilities::aveTS<HFDataFrame>(*it, 2.5, 0, it->size() - 1);
0122       _cOccupancyCut_depth.fill(did);
0123       _cTimingCut_depth.fill(did, timing);
0124     }
0125   }
0126 }
0127 
0128 std::shared_ptr<hcaldqm::Cache> NoCQTask::globalBeginLuminosityBlock(edm::LuminosityBlock const& lb,
0129                                                                      edm::EventSetup const& es) const {
0130   return DQTask::globalBeginLuminosityBlock(lb, es);
0131 }
0132 
0133 /* virtual */ void NoCQTask::globalEndLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) {
0134   DQTask::globalEndLuminosityBlock(lb, es);
0135 }
0136 
0137 DEFINE_FWK_MODULE(NoCQTask);