CMS 3D CMS Logo

UMNioTask.cc
Go to the documentation of this file.
1 
3 
4 using namespace hcaldqm;
5 using namespace hcaldqm::constants;
7  DQTask(ps)
8 {
10  edm::InputTag("hcalDigis"));
12  edm::InputTag("hcalDigis"));
14  edm::InputTag("hcalDigis"));
16  edm::InputTag("hcalDigis"));
17 
18  _tokHBHE = consumes<HBHEDigiCollection>(_tagHBHE);
19  _tokHO = consumes<HODigiCollection>(_tagHO);
20  _tokHF = consumes<HFDigiCollection>(_tagHF);
21  _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
22 
23  _lowHBHE = ps.getUntrackedParameter<double>("lowHBHE",
24  20);
25  _lowHO = ps.getUntrackedParameter<double>("lowHO",
26  20);
27  _lowHF = ps.getUntrackedParameter<double>("lowHF",
28  20);
29 
30  // push all the event types to monitor - whole range basically
31  // This corresponds to all enum values in hcaldqm::constants::OrbitGapType
33  _eventtypes.push_back(type);
34  }
35 }
36 
38  edm::Run const& r, edm::EventSetup const& es)
39 {
40  if (_ptype==fLocal)
41  if (r.runAuxiliary().run()==1)
42  return;
43 
44  DQTask::bookHistograms(ib, r, es);
45 
47  es.get<HcalDbRecord>().get(dbService);
48  _emap = dbService->getHcalMapping();
49 
50  _cEventType.initialize(_name, "EventType",
54  _cTotalCharge.initialize(_name, "TotalCharge",
58  _cTotalChargeProfile.initialize(_name, "TotalChargeProfile",
65 }
66 
67 int UMNioTask::getOrbitGapIndex(uint8_t eventType, uint32_t laserType) {
68  constants::OrbitGapType orbitGapType;
69  if (eventType == constants::EVENTTYPE_PEDESTAL) {
70  orbitGapType = tPedestal;
71  } else if (eventType == constants::EVENTTYPE_LED) {
72  orbitGapType = tLED;
73  } else if (eventType == constants::EVENTTYPE_LASER) {
74  switch (laserType)
75  {
76  //case tNull : return "Null";
77  //case tHFRaddam : return "HFRaddam";
78  case 3 : return tHBHEHPD;
79  case 4 : return tHO;
80  case 5 : return tHF;
81  //case tZDC : return "ZDC";
82  case 7 : return tHEPMega;
83  case 8 : return tHEMMega;
84  case 9 : return tHBPMega;
85  case 10 : return tHBMMega;
86  //case tCRF : return "CRF";
87  //case tCalib : return "Calib";
88  //case tSafe : return "Safe";
89  default : return tUnknown;
90  }
91  }
92  return (int)(std::find(_eventtypes.begin(), _eventtypes.end(), orbitGapType) - _eventtypes.begin());
93 }
94 
95 
96 /* virtual */ void UMNioTask::_process(edm::Event const& e,
97  edm::EventSetup const& es)
98 {
100  if (!e.getByToken(_tokuMN, cumn))
101  return;
102 
103  uint8_t eventType = cumn->eventType();
104  uint32_t laserType = cumn->valueUserWord(0);
105  _cEventType.fill(_currentLS, getOrbitGapIndex(eventType, laserType));
106 
107  // Compute the Total Charge in the Detector...
111 
112  if (!e.getByToken(_tokHBHE, chbhe))
113  _logger.dqmthrow("Collection HBHEDigiCollection isn't available "
114  + _tagHBHE.label() + " " + _tagHBHE.instance());
115  if (!e.getByToken(_tokHO, cho))
116  _logger.dqmthrow("Collection HODigiCollection isn't available "
117  + _tagHO.label() + " " + _tagHO.instance());
118  if (!e.getByToken(_tokHF, chf))
119  _logger.dqmthrow("Collection HFDigiCollection isn't available "
120  + _tagHF.label() + " " + _tagHF.instance());
121 
122  for (HBHEDigiCollection::const_iterator it=chbhe->begin();
123  it!=chbhe->end(); ++it)
124  {
125  double sumQ = hcaldqm::utilities::sumQ<HBHEDataFrame>(*it, 2.5, 0, it->size()-1);
126  _cTotalCharge.fill(it->id(), _currentLS, sumQ);
128  }
130  it!=cho->end(); ++it)
131  {
132  double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(*it, 8.5, 0, it->size()-1);
133  _cTotalCharge.fill(it->id(), _currentLS, sumQ);
135  }
137  it!=chf->end(); ++it)
138  {
139  double sumQ = hcaldqm::utilities::sumQ<HFDataFrame>(*it, 2.5, 0, it->size()-1);
140  _cTotalCharge.fill(it->id(), _currentLS, sumQ);
142  }
143 }
145  edm::EventSetup const& es)
146 {
147  DQTask::endLuminosityBlock(lb, es);
148 }
149 
edm::InputTag _tagHBHE
Definition: UMNioTask.h:54
edm::EDGetTokenT< HFDigiCollection > _tokHF
Definition: UMNioTask.h:59
type
Definition: HCALResponse.h:21
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: UMNioTask.cc:144
T getUntrackedParameter(std::string const &, T const &) const
std::vector< uint32_t > _eventtypes
Definition: UMNioTask.h:50
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: UMNioTask.h:58
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< HcalUMNioDigi > _tokuMN
Definition: UMNioTask.h:60
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< HBHEDataFrame >::const_iterator const_iterator
edm::InputTag _tagHF
Definition: UMNioTask.h:56
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
hcaldqm::ContainerSingleProf2D _cTotalChargeProfile
Definition: UMNioTask.h:73
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
double _lowHO
Definition: UMNioTask.h:63
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
UMNioTask(edm::ParameterSet const &)
Definition: UMNioTask.cc:6
ProcessingType _ptype
Definition: DQModule.h:59
uint8_t const EVENTTYPE_LED
Definition: Constants.h:325
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
uint32_t valueUserWord(int iword) const
virtual example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
uint8_t eventType() const
edm::InputTag _taguMN
Definition: UMNioTask.h:53
Logger _logger
Definition: DQModule.h:70
RunAuxiliary const & runAuxiliary() const override
Definition: Run.h:63
int getOrbitGapIndex(uint8_t eventType, uint32_t laserType)
Definition: UMNioTask.cc:67
std::string _name
Definition: DQModule.h:57
HcalElectronicsMap const * _emap
Definition: DQTask.h:73
edm::InputTag _tagHO
Definition: UMNioTask.h:55
void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0) override
const_iterator end() const
uint8_t const EVENTTYPE_LASER
Definition: Constants.h:324
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: UMNioTask.cc:37
double _lowHBHE
Definition: UMNioTask.h:63
std::string const & label() const
Definition: InputTag.h:36
uint8_t const EVENTTYPE_PEDESTAL
Definition: Constants.h:323
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE
Definition: UMNioTask.h:57
T get() const
Definition: EventSetup.h:63
const HcalElectronicsMap * getHcalMapping() const
std::string _subsystem
Definition: DQModule.h:64
hcaldqm::ContainerSingle2D _cTotalCharge
Definition: UMNioTask.h:72
double _lowHF
Definition: UMNioTask.h:63
virtual void fill(int, int)
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: UMNioTask.cc:96
void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="") override
hcaldqm::ContainerSingle2D _cEventType
Definition: UMNioTask.h:71
std::string const & instance() const
Definition: InputTag.h:37
RunNumber_t run() const
Definition: RunAuxiliary.h:41
const_iterator begin() const
Definition: Run.h:44
ib
Definition: cuy.py:661
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:121