CMS 3D CMS Logo

HFRaddamTask.cc
Go to the documentation of this file.
1 
3 
4 using namespace hcaldqm;
5 using namespace hcaldqm::constants;
6 using namespace hcaldqm::filter;
7 
9  // List all the DetIds
10  _vDetIds.push_back(HcalDetId(HcalForward, -30, 35, 1));
11  _vDetIds.push_back(HcalDetId(HcalForward, -30, 71, 1));
12  _vDetIds.push_back(HcalDetId(HcalForward, -32, 15, 1));
13  _vDetIds.push_back(HcalDetId(HcalForward, -32, 51, 1));
14  _vDetIds.push_back(HcalDetId(HcalForward, -34, 35, 1));
15  _vDetIds.push_back(HcalDetId(HcalForward, -34, 71, 1));
16  _vDetIds.push_back(HcalDetId(HcalForward, -36, 15, 1));
17  _vDetIds.push_back(HcalDetId(HcalForward, -36, 51, 1));
18  _vDetIds.push_back(HcalDetId(HcalForward, -38, 35, 1));
19  _vDetIds.push_back(HcalDetId(HcalForward, -38, 71, 1));
20  _vDetIds.push_back(HcalDetId(HcalForward, -40, 15, 1));
21  _vDetIds.push_back(HcalDetId(HcalForward, -40, 51, 1));
22  _vDetIds.push_back(HcalDetId(HcalForward, -41, 35, 1));
23  _vDetIds.push_back(HcalDetId(HcalForward, -41, 71, 1));
24  _vDetIds.push_back(HcalDetId(HcalForward, -30, 15, 2));
25  _vDetIds.push_back(HcalDetId(HcalForward, -30, 51, 2));
26  _vDetIds.push_back(HcalDetId(HcalForward, -32, 35, 2));
27  _vDetIds.push_back(HcalDetId(HcalForward, -32, 71, 2));
28  _vDetIds.push_back(HcalDetId(HcalForward, -34, 15, 2));
29  _vDetIds.push_back(HcalDetId(HcalForward, -34, 51, 2));
30  _vDetIds.push_back(HcalDetId(HcalForward, -36, 35, 2));
31  _vDetIds.push_back(HcalDetId(HcalForward, -36, 71, 2));
32  _vDetIds.push_back(HcalDetId(HcalForward, -38, 15, 2));
33  _vDetIds.push_back(HcalDetId(HcalForward, -38, 51, 2));
34  _vDetIds.push_back(HcalDetId(HcalForward, -40, 35, 2));
35  _vDetIds.push_back(HcalDetId(HcalForward, -40, 71, 2));
36  _vDetIds.push_back(HcalDetId(HcalForward, -41, 15, 2));
37  _vDetIds.push_back(HcalDetId(HcalForward, -41, 51, 2));
38 
39  _vDetIds.push_back(HcalDetId(HcalForward, 30, 21, 1));
40  _vDetIds.push_back(HcalDetId(HcalForward, 30, 57, 1));
41  _vDetIds.push_back(HcalDetId(HcalForward, 32, 1, 1));
42  _vDetIds.push_back(HcalDetId(HcalForward, 32, 37, 1));
43  _vDetIds.push_back(HcalDetId(HcalForward, 34, 21, 1));
44  _vDetIds.push_back(HcalDetId(HcalForward, 34, 57, 1));
45  _vDetIds.push_back(HcalDetId(HcalForward, 36, 1, 1));
46  _vDetIds.push_back(HcalDetId(HcalForward, 36, 37, 1));
47  _vDetIds.push_back(HcalDetId(HcalForward, 38, 21, 1));
48  _vDetIds.push_back(HcalDetId(HcalForward, 38, 57, 1));
49  _vDetIds.push_back(HcalDetId(HcalForward, 40, 35, 1));
50  _vDetIds.push_back(HcalDetId(HcalForward, 40, 71, 1));
51  _vDetIds.push_back(HcalDetId(HcalForward, 41, 19, 1));
52  _vDetIds.push_back(HcalDetId(HcalForward, 41, 55, 1));
53  _vDetIds.push_back(HcalDetId(HcalForward, 30, 1, 2));
54  _vDetIds.push_back(HcalDetId(HcalForward, 30, 37, 2));
55  _vDetIds.push_back(HcalDetId(HcalForward, 32, 21, 2));
56  _vDetIds.push_back(HcalDetId(HcalForward, 32, 57, 2));
57  _vDetIds.push_back(HcalDetId(HcalForward, 34, 1, 2));
58  _vDetIds.push_back(HcalDetId(HcalForward, 34, 37, 2));
59  _vDetIds.push_back(HcalDetId(HcalForward, 36, 21, 2));
60  _vDetIds.push_back(HcalDetId(HcalForward, 36, 57, 2));
61  _vDetIds.push_back(HcalDetId(HcalForward, 38, 1, 2));
62  _vDetIds.push_back(HcalDetId(HcalForward, 38, 37, 2));
63  _vDetIds.push_back(HcalDetId(HcalForward, 40, 19, 2));
64  _vDetIds.push_back(HcalDetId(HcalForward, 40, 55, 2));
65  _vDetIds.push_back(HcalDetId(HcalForward, 41, 35, 2));
66  _vDetIds.push_back(HcalDetId(HcalForward, 41, 71, 2));
67 
68  // tags
69  _tagHF = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
70  _taguMN = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));
71  _tokHF = consumes<QIE10DigiCollection>(_tagHF);
72  _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
73 }
74 
76  // Initialize all the Single Containers
77  for (std::vector<HcalDetId>::const_iterator it = _vDetIds.begin(); it != _vDetIds.end(); ++it) {
79  "Shape",
82  }
83 
84  DQTask::bookHistograms(ib, r, es);
85  char aux[200];
86  for (unsigned int i = 0; i < _vDetIds.size(); i++) {
87  sprintf(aux, "ieta%diphi%dd%d", _vDetIds[i].ieta(), _vDetIds[i].iphi(), _vDetIds[i].depth());
88  _vcShape[i].book(ib, _subsystem, aux);
89  }
90 }
91 
92 /* virtual */ void HFRaddamTask::_process(edm::Event const& e, edm::EventSetup const& es) {
93  auto const chf = e.getHandle(_tokHF);
94  if (not(chf.isValid())) {
95  edm::LogWarning("HFRaddamTask") << "QIE10 collection not valid for HF";
96  return;
97  }
98 
99  for (QIE10DigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) {
100  const QIE10DataFrame digi = static_cast<const QIE10DataFrame>(*it);
101  HcalDetId const& did = digi.detid();
102  if (did.subdet() != HcalForward)
103  continue;
104 
105  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE10DataFrame>(_dbService, did, digi);
106 
107  for (unsigned int i = 0; i < _vDetIds.size(); i++)
108  if (did == _vDetIds[i]) {
109  for (int j = 0; j < digi.samples(); j++) {
110  double q = hcaldqm::utilities::adc2fCDBMinusPedestal<QIE10DataFrame>(_dbService, digi_fC, did, digi, j);
111  _vcShape[i].fill(j, q);
112  }
113  }
114  }
115 }
116 
117 /* virtual */ bool HFRaddamTask::_isApplicable(edm::Event const& e) {
118  if (_ptype == fOnline) {
120  if (!e.getByToken(_tokuMN, cumn))
121  return false;
122 
123  // event type check
124  uint8_t eventType = cumn->eventType();
126  return true;
127  } else if (_ptype == fLocal) {
128  // local, just return true as all the settings will be done in cfg
129  return true;
130  }
131 
132  return false;
133 }
134 
constexpr DetId detid() const
Get the detector id.
edm::EDGetTokenT< QIE10DigiCollection > _tokHF
Definition: HFRaddamTask.h:33
uint8_t const EVENTTYPE_HFRADDAM
Definition: Constants.h:298
std::vector< hcaldqm::ContainerSingle1D > _vcShape
Definition: HFRaddamTask.h:44
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::InputTag _taguMN
Definition: HFRaddamTask.h:32
T getUntrackedParameter(std::string const &, T const &) const
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
ProcessingType _ptype
Definition: DQModule.h:44
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: HFRaddamTask.cc:92
edm::EDGetTokenT< HcalUMNioDigi > _tokuMN
Definition: HFRaddamTask.h:34
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::string _name
Definition: DQModule.h:42
uint8_t eventType() const
edm::InputTag _tagHF
Definition: HFRaddamTask.h:31
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: HFRaddamTask.cc:75
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
edm::ESHandle< HcalDbService > _dbService
Definition: DQTask.h:80
HFRaddamTask(edm::ParameterSet const &)
Definition: HFRaddamTask.cc:8
bool _isApplicable(edm::Event const &) override
std::string _subsystem
Definition: DQModule.h:49
Log< level::Warning, false > LogWarning
constexpr int samples() const
total number of samples in the digi
std::vector< HcalDetId > _vDetIds
Definition: HFRaddamTask.h:37
Definition: Run.h:45
ib
Definition: cuy.py:661