CMS 3D CMS Logo

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