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), 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<QIE11DigiCollection>(tagHBHE_);
14  tokHO_ = consumes<HODigiCollection>(tagHO_);
15  tokHF_ = consumes<QIE10DigiCollection>(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 
35 
37  _emap = dbService->getHcalMapping();
38 
40  "EventType",
44  0);
46  "TotalCharge",
50  0);
52  "TotalChargeProfile",
56  0);
60 }
61 
63  constants::OrbitGapType orbitGapType = tNull;
65  orbitGapType = tPhysics;
67  orbitGapType = tPedestal;
68  } else if (eventType == constants::EVENTTYPE_LED) {
69  orbitGapType = tLED;
71  orbitGapType = tHFRaddam;
72  } else if (eventType == constants::EVENTTYPE_LASER) {
73  switch (laserType) {
74  //case tNull : return "Null";
75  //case tHFRaddam : return "HFRaddam";
76  case 3:
77  return tHBHEHPD;
78  case 4:
79  return tHO;
80  case 5:
81  return tHF;
82  //case tZDC : return "ZDC";
83  case 7:
84  return tHEPMega;
85  case 8:
86  return tHEMMega;
87  case 9:
88  return tHBPMega;
89  case 10:
90  return tHBMMega;
91  //case tCRF : return "CRF";
92  //case tCalib : return "Calib";
93  case 14:
94  return tSafe;
95  case 23:
96  return tSiPMPMT;
97  case 24:
98  return tMegatile;
99  default:
100  return tUnknown;
101  }
102  }
103  return (int)(std::find(_eventtypes.begin(), _eventtypes.end(), orbitGapType) - _eventtypes.begin());
104 }
105 
106 /* virtual */ void UMNioTask::_process(edm::Event const& e, edm::EventSetup const& es) {
107  auto lumiCache = luminosityBlockCache(e.getLuminosityBlock().index());
108  _currentLS = lumiCache->currentLS;
109  _xQuality.reset();
110  _xQuality = lumiCache->xQuality;
111 
112  auto const cumn = e.getHandle(tokuMN_);
113  if (not(cumn.isValid())) {
114  edm::LogWarning("UMNioTask") << "HcalUMNioDigi isn't available, calling return";
115  return;
116  }
117 
118  uint8_t eventType = cumn->eventType();
119  uint32_t laserType = cumn->valueUserWord(0);
121 
122  // Compute the Total Charge in the Detector...
123  auto const chbhe = e.getHandle(tokHBHE_);
124  if (chbhe.isValid()) {
125  for (QIE11DigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) {
126  const QIE11DataFrame digi = static_cast<const QIE11DataFrame>(*it);
127  HcalDetId const& did = digi.detid();
128  if ((did.subdet() != HcalBarrel) && (did.subdet() != HcalEndcap))
129  continue;
130  if (_xQuality.exists(did)) {
131  HcalChannelStatus cs(did.rawId(), _xQuality.get(did));
133  continue;
134  }
135  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE11DataFrame>(_dbService, did, digi);
136  double sumQ = hcaldqm::utilities::sumQDB<QIE11DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
139  }
140  }
141  auto const cho = e.getHandle(tokHO_);
142  if (cho.isValid()) {
143  for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) {
144  const HODataFrame digi = (const HODataFrame)(*it);
145  HcalDetId did = digi.id();
146  if (did.subdet() != HcalOuter)
147  continue;
148  if (_xQuality.exists(did)) {
149  HcalChannelStatus cs(did.rawId(), _xQuality.get(did));
151  continue;
152  }
153  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<HODataFrame>(_dbService, did, digi);
154  double sumQ = hcaldqm::utilities::sumQDB<HODataFrame>(_dbService, digi_fC, did, digi, 0, digi.size() - 1);
157  }
158  }
159  auto const chf = e.getHandle(tokHF_);
160  if (chf.isValid()) {
161  for (QIE10DigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) {
162  const QIE10DataFrame digi = static_cast<const QIE10DataFrame>(*it);
163  HcalDetId did = digi.detid();
164  if (did.subdet() != HcalForward)
165  continue;
166  if (_xQuality.exists(did)) {
167  HcalChannelStatus cs(did.rawId(), _xQuality.get(did));
169  continue;
170  }
171  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE10DataFrame>(_dbService, did, digi);
172  double sumQ = hcaldqm::utilities::sumQDB<QIE10DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
175  }
176  }
177 }
178 
179 std::shared_ptr<hcaldqm::Cache> UMNioTask::globalBeginLuminosityBlock(edm::LuminosityBlock const& lb,
180  edm::EventSetup const& es) const {
181  return DQTask::globalBeginLuminosityBlock(lb, es);
182 }
183 
185  DQTask::globalEndLuminosityBlock(lb, es);
186 }
187 
constexpr DetId detid() const
Get the detector id.
std::vector< uint32_t > _eventtypes
Definition: UMNioTask.h:46
uint8_t const EVENTTYPE_PHYSICS
Definition: Constants.h:296
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
virtual bool exists(HcalDetId const &)
Definition: ContainerXXX.h:213
edm::EDGetTokenT< HODigiCollection > tokHO_
Definition: UMNioTask.h:54
uint8_t const EVENTTYPE_HFRADDAM
Definition: Constants.h:298
edm::EDGetTokenT< HcalUMNioDigi > tokuMN_
Definition: UMNioTask.h:56
edm::InputTag tagHBHE_
Definition: UMNioTask.h:50
std::vector< T >::const_iterator const_iterator
double lowHO_
Definition: UMNioTask.h:60
double lowHF_
Definition: UMNioTask.h:60
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
const HcalElectronicsMap * getHcalMapping() const
hcaldqm::ContainerSingleProf2D _cTotalChargeProfile
Definition: UMNioTask.h:70
virtual void reset()
Definition: ContainerXXX.h:293
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
constexpr DetId detid() const
Get the detector id.
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
edm::InputTag taguMN_
Definition: UMNioTask.h:49
T getUntrackedParameter(std::string const &, T const &) const
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
UMNioTask(edm::ParameterSet const &)
Definition: UMNioTask.cc:6
double lowHBHE_
Definition: UMNioTask.h:60
ProcessingType _ptype
Definition: DQModule.h:44
uint8_t const EVENTTYPE_LED
Definition: Constants.h:300
ContainerXXX< uint32_t > _xQuality
Definition: DQTask.h:66
Transition
Definition: Transition.h:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ESGetToken< HcalDbService, HcalDbRecord > hcalDbServiceToken_
Definition: UMNioTask.h:57
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
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0) override
constexpr int samples() const
total number of samples in the digi
uint8_t const EVENTTYPE_LASER
Definition: Constants.h:299
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: UMNioTask.cc:29
edm::EDGetTokenT< QIE10DigiCollection > tokHF_
Definition: UMNioTask.h:55
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
uint8_t const EVENTTYPE_PEDESTAL
Definition: Constants.h:297
constexpr int size() const
total number of samples in the digi
Definition: HODataFrame.h:27
edm::EDGetTokenT< QIE11DigiCollection > tokHBHE_
Definition: UMNioTask.h:53
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:198
HLT enums.
edm::ESHandle< HcalDbService > _dbService
Definition: DQTask.h:80
std::string _subsystem
Definition: DQModule.h:49
hcaldqm::ContainerSingle2D _cTotalCharge
Definition: UMNioTask.h:69
std::shared_ptr< hcaldqm::Cache > globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override
Definition: UMNioTask.cc:179
virtual void fill(int, int)
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: UMNioTask.cc:106
Log< level::Warning, false > LogWarning
void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="") override
hcaldqm::ContainerSingle2D _cEventType
Definition: UMNioTask.h:68
edm::InputTag tagHF_
Definition: UMNioTask.h:52
constexpr int samples() const
total number of samples in the digi
Definition: Run.h:45
constexpr HcalDetId const & id() const
Definition: HODataFrame.h:23
edm::InputTag tagHO_
Definition: UMNioTask.h:51
ib
Definition: cuy.py:661
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: UMNioTask.cc:184
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:127