CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
NoCQTask.cc
Go to the documentation of this file.
2 
3 using namespace hcaldqm;
4 using namespace hcaldqm::constants;
5 
7  : DQTask(ps), hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
8  _tagHBHE = ps.getUntrackedParameter<edm::InputTag>("tagHBHE", edm::InputTag("hcalDigis"));
9  _tagHO = ps.getUntrackedParameter<edm::InputTag>("tagHO", edm::InputTag("hcalDigis"));
10  _tagHF = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
11  _tagReport = ps.getUntrackedParameter<edm::InputTag>("tagReport", edm::InputTag("hcalDigis"));
12 
13  _tokHBHE = consumes<HBHEDigiCollection>(_tagHBHE);
14  _tokHO = consumes<HODigiCollection>(_tagHO);
15  _tokHF = consumes<HFDigiCollection>(_tagHF);
16  _tokReport = consumes<HcalUnpackerReport>(_tagReport);
17 
18  _cutSumQ_HBHE = ps.getUntrackedParameter<double>("cutSumQ_HBHE", 20);
19  _cutSumQ_HO = ps.getUntrackedParameter<double>("cutSumQ_HO", 20);
20  _cutSumQ_HF = ps.getUntrackedParameter<double>("cutSumQ_HF", 20);
21 }
22 
23 /* virtual */ void NoCQTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
24  DQTask::bookHistograms(ib, r, es);
25 
27  _emap = dbs->getHcalMapping();
28 
30  "TimingCut",
35  0);
37  "Occupancy",
42  0);
44  "OccupancyCut",
49  0);
51  "BadQuality",
56  0);
57 
62 }
63 
64 /* virtual */ void NoCQTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); }
65 
66 /* virtual */ void NoCQTask::_process(edm::Event const& e, edm::EventSetup const&) {
71 
72  if (!e.getByToken(_tokHBHE, chbhe))
73  _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE.label() + " " + _tagHBHE.instance());
74  if (!e.getByToken(_tokHO, cho))
75  _logger.dqmthrow("Collection HODigiCollection isn't available" + _tagHO.label() + " " + _tagHO.instance());
76  if (!e.getByToken(_tokHF, chf))
77  _logger.dqmthrow("Collection HFDigiCollection isn't available" + _tagHF.label() + " " + _tagHF.instance());
78  if (!e.getByToken(_tokReport, creport))
79  _logger.dqmthrow("Collection HcalUnpackerReport isn't available" + _tagReport.label() + " " +
81 
82  // RAW Bad Quality
83  for (std::vector<DetId>::const_iterator it = creport->bad_quality_begin(); it != creport->bad_quality_end(); ++it) {
84  if (!HcalGenericDetId(*it).isHcalDetId())
85  continue;
86 
88  }
89 
90  // DIGI HBH, HO, HF
91  for (HBHEDigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) {
92  double sumQ = hcaldqm::utilities::sumQ<HBHEDataFrame>(*it, 2.5, 0, it->size() - 1);
93  HcalDetId const& did = it->id();
94 
96  if (sumQ > _cutSumQ_HBHE) {
97  double timing = hcaldqm::utilities::aveTS<HBHEDataFrame>(*it, 2.5, 0, it->size() - 1);
99  _cTimingCut_depth.fill(did, timing);
100  }
101  }
102 
103  for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) {
104  double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(*it, 8.5, 0, it->size() - 1);
105  HcalDetId const& did = it->id();
106 
107  _cOccupancy_depth.fill(did);
108  if (sumQ > _cutSumQ_HO) {
109  double timing = hcaldqm::utilities::aveTS<HODataFrame>(*it, 8.5, 0, it->size() - 1);
111  _cTimingCut_depth.fill(did, timing);
112  }
113  }
114 
115  for (HFDigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) {
116  double sumQ = hcaldqm::utilities::sumQ<HFDataFrame>(*it, 2.5, 0, it->size() - 1);
117  HcalDetId const& did = it->id();
118 
119  _cOccupancy_depth.fill(did);
120  if (sumQ > _cutSumQ_HF) {
121  double timing = hcaldqm::utilities::aveTS<HFDataFrame>(*it, 2.5, 0, it->size() - 1);
123  _cTimingCut_depth.fill(did, timing);
124  }
125  }
126 }
127 
128 std::shared_ptr<hcaldqm::Cache> NoCQTask::globalBeginLuminosityBlock(edm::LuminosityBlock const& lb,
129  edm::EventSetup const& es) const {
130  return DQTask::globalBeginLuminosityBlock(lb, es);
131 }
132 
134  DQTask::globalEndLuminosityBlock(lb, es);
135 }
136 
T getUntrackedParameter(std::string const &, T const &) const
int ib
Definition: cuy.py:661
hcaldqm::Container2D _cOccupancy_depth
Definition: NoCQTask.h:46
void fill(HcalDetId const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
UpdateFreq
Definition: DQTask.h:32
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: NoCQTask.cc:23
std::vector< T >::const_iterator const_iterator
edm::EDGetTokenT< HFDigiCollection > _tokHF
Definition: NoCQTask.h:37
edm::EDGetTokenT< HcalUnpackerReport > _tokReport
Definition: NoCQTask.h:38
void _resetMonitors(hcaldqm::UpdateFreq) override
Definition: NoCQTask.cc:64
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: NoCQTask.cc:66
hcaldqm::ContainerProf2D _cTimingCut_depth
Definition: NoCQTask.h:45
void dqmthrow(std::string const &msg) const
Definition: Logger.h:12
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: NoCQTask.h:36
edm::InputTag _tagHF
Definition: NoCQTask.h:33
Transition
Definition: Transition.h:12
Logger _logger
Definition: DQModule.h:55
edm::InputTag _tagHBHE
Definition: NoCQTask.h:31
edm::ESGetToken< HcalDbService, HcalDbRecord > hcalDbServiceToken_
Definition: NoCQTask.h:39
std::string _name
Definition: DQModule.h:42
HcalElectronicsMap const * _emap
Definition: DQTask.h:81
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: NoCQTask.cc:133
bool isHcalDetId() const
edm::InputTag _tagReport
Definition: NoCQTask.h:34
double _cutSumQ_HF
Definition: NoCQTask.h:41
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:25
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
std::shared_ptr< hcaldqm::Cache > globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override
Definition: NoCQTask.cc:128
void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fEnergy), int debug=0) override
hcaldqm::Container2D _cBadQuality_depth
Definition: NoCQTask.h:48
std::string const & label() const
Definition: InputTag.h:36
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
std::string _subsystem
Definition: DQModule.h:49
edm::InputTag _tagHO
Definition: NoCQTask.h:32
double _cutSumQ_HO
Definition: NoCQTask.h:41
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:567
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE
Definition: NoCQTask.h:35
std::string const & instance() const
Definition: InputTag.h:37
hcaldqm::Container2D _cOccupancyCut_depth
Definition: NoCQTask.h:47
NoCQTask(edm::ParameterSet const &)
Definition: NoCQTask.cc:6
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
double _cutSumQ_HBHE
Definition: NoCQTask.h:41
Definition: Run.h:45
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:127