CMS 3D CMS Logo

QIE11Task.cc
Go to the documentation of this file.
3 
4 using namespace hcaldqm;
5 using namespace hcaldqm::constants;
7  // tags
8  _tagQIE11 = ps.getUntrackedParameter<edm::InputTag>("tagQIE11", edm::InputTag("hcalDigis"));
9  _tokQIE11 = consumes<QIE11DigiCollection>(_tagQIE11);
10 
11  _taguMN = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));
12  _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
13 
14  // cuts
15  _cut = ps.getUntrackedParameter<double>("cut", 50.0);
16  _ped = ps.getUntrackedParameter<int>("ped", 4);
17  _laserType = ps.getUntrackedParameter<int32_t>("laserType", -1);
18  _eventType = ps.getUntrackedParameter<int32_t>("eventType", -1);
19 }
20 /* virtual */ void QIE11Task::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
21  if (_ptype == fLocal)
22  if (r.runAuxiliary().run() == 1)
23  return;
24 
25  DQTask::bookHistograms(ib, r, es);
26 
27  // GET WHAT YOU NEED
29  es.get<HcalDbRecord>().get(dbs);
30  _emap = dbs->getHcalMapping();
31  std::vector<uint32_t> vhashC34;
32  vhashC34.push_back(HcalElectronicsId(34, 11, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
33  vhashC34.push_back(HcalElectronicsId(34, 12, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
35 
36  std::vector<std::pair<int, int> > timingChannels;
37  timingChannels.push_back(std::pair<int, int>(28, 63));
38  timingChannels.push_back(std::pair<int, int>(28, 65));
39  timingChannels.push_back(std::pair<int, int>(20, 63));
40  timingChannels.push_back(std::pair<int, int>(20, 65));
41  for (int iChan = 0; iChan < 4; ++iChan) {
42  std::vector<uint32_t> vhashTimingChannel;
43  for (int depth = 1; depth <= 7; ++depth) {
44  vhashTimingChannel.push_back(
45  HcalDetId(HcalEndcap, timingChannels[iChan].first, timingChannels[iChan].second, depth));
46  }
48  }
49 
50  // INITIALIZE what you need
51 
52  // EChannel plots, online+local only
53  if (_ptype != fOffline) {
54  unsigned int itr = 0;
55  for (unsigned int crate = 34; crate <= 34; ++crate) {
56  for (unsigned int slot = 11; slot <= 12; ++slot) {
57  std::vector<uint32_t> vhashSlot;
58  vhashSlot.push_back(HcalElectronicsId(crate, slot, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
61  "ShapeCut",
66  "LETDCvsTS",
71  0);
73  "LETDCTime",
77  0);
78  for (unsigned int j = 0; j < 10; j++) {
80  _name,
81  "LETDCvsADC",
86  0);
88  "ADC",
92  0);
94  "LETDC",
98  0);
99  }
100  ++itr;
101  }
102  }
103  }
105  "ShapeCut",
109  "LETDCvsADC",
113  0);
115  "LETDCTimevsADC",
119  0);
121  "LETDC",
124  0);
126  "ADC",
129  0);
130 
131  if (_ptype != fOffline) {
132  unsigned int itr = 0;
133  std::map<std::pair<unsigned int, unsigned int>, unsigned int> itr_map;
134  for (unsigned int crate = 34; crate <= 34; ++crate) {
135  for (unsigned int slot = 11; slot <= 12; ++slot) {
136  char aux[100];
137  sprintf(aux, "/Crate%d_Slot%d", crate, slot);
138  _cShapeCut_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
139  _cLETDCvsTS_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
140  _cLETDCTime_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
141  for (unsigned int j = 0; j < 10; j++) {
142  char aux2[100];
143  sprintf(aux2, "/Crate%d_Slot%d/TS%d", crate, slot, j);
144  _cLETDCvsADC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2);
145  _cLETDC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2);
146  _cADC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2);
147  }
148  itr_map[std::make_pair(crate, slot)] = itr;
149  ++itr;
150  }
151  }
152  }
156  _cLETDC.book(ib, _subsystem);
157  _cADC.book(ib, _subsystem);
158 
160 }
161 
162 /* virtual */ void QIE11Task::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) {
163  // finish
164  DQTask::endLuminosityBlock(lb, es);
165 }
166 
167 /* virtual */ void QIE11Task::_process(edm::Event const& e, edm::EventSetup const&) {
169  if (!e.getByToken(_tokQIE11, cqie11))
170  return;
171 
172  for (uint32_t i = 0; i < cqie11->size(); i++) {
173  QIE11DataFrame frame = static_cast<QIE11DataFrame>((*cqie11)[i]);
174  DetId did = frame.detid();
175  if (HcalDetId(frame.detid()).subdet() != HcalEndcap) {
176  continue;
177  }
178 
180  if (!eid.rawId()) {
181  continue;
182  }
183  int fakecrate = -1;
184  if (eid.crateId() == 34)
185  fakecrate = 0;
186  int index = fakecrate * 12 + (eid.slot() - 10) - 1;
187 
188  // compute the signal, ped subracted
189  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE11DataFrame>(_dbService, did, frame);
190  // double q = hcaldqm::utilities::aveTS_v10<QIE11DataFrame>(frame,
191  // constants::adc2fC[_ped], 0, frame.samples()-1);
192 
193  // iterate thru all TS and fill
194  for (int j = 0; j < frame.samples(); j++) {
195  double q_pedsub = hcaldqm::utilities::adc2fCDBMinusPedestal<QIE11DataFrame>(_dbService, digi_fC, did, frame, j);
196  if (_ptype != fOffline) {
197  if (index == 0 || index == 1) {
198  // shapes are after the cut
199  _cShapeCut_EChannel[index].fill(eid, j, q_pedsub);
200  _cLETDCvsTS_EChannel[index].fill(eid, j, frame[j].tdc());
201 
202  // w/o a cut
203  _cLETDCvsADC_EChannel[j][index].fill(eid, frame[j].adc(), frame[j].tdc());
204  _cLETDC_EChannel[j][index].fill(eid, frame[j].tdc());
205  if (frame[j].tdc() < 50) {
206  // Each TDC count is 0.5 ns.
207  // tdc == 62 or 63 means value was below or above threshold for whole time slice.
208  _cLETDCTime_EChannel[index].fill(eid, j * 25. + (frame[j].tdc() / 2.));
209  }
210  _cADC_EChannel[j][index].fill(eid, frame[j].adc());
211  }
212  }
213  _cShapeCut.fill(eid, j, q_pedsub);
214 
215  _cLETDCvsADC.fill(frame[j].adc(), frame[j].tdc());
216  if (frame[j].tdc() < 50) {
217  _cLETDCTimevsADC.fill(frame[j].adc(), j * 25. + (frame[j].tdc() / 2.));
218  }
219  _cLETDC.fill(eid, frame[j].tdc());
220 
221  _cADC.fill(eid, frame[j].adc());
222  }
223  }
224 }
225 
226 /* virtual */ bool QIE11Task::_isApplicable(edm::Event const& e) {
227  if (_ptype != fOnline || (_laserType < 0 && _eventType < 0))
228  return true;
229  else {
230  // fOnline mode
232  if (!e.getByToken(_tokuMN, cumn))
233  return false;
234 
235  // event type check first
236  int eventType = cumn->eventType();
237  if (eventType == _eventType)
238  return true;
239 
240  // check if this analysis task is of the right laser type
241  int laserType = cumn->valueUserWord(0);
242  if (laserType == _laserType)
243  return true;
244  }
245 
246  return false;
247 }
248 
250 
void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, int debug=0) override
DetId detid() const
Get the detector id.
edm::EDGetTokenT< QIE11DigiCollection > _tokQIE11
Definition: QIE11Task.h:37
constexpr uint32_t rawId() const
T getUntrackedParameter(std::string const &, T const &) const
hcaldqm::Container1D _cADC_EChannel[10][2]
Definition: QIE11Task.h:62
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:33
hcaldqm::ContainerSingle2D _cLETDCvsADC
Definition: QIE11Task.h:67
hcaldqm::filter::HashFilter _filter_C34
Definition: QIE11Task.h:49
bool _isApplicable(edm::Event const &) override
Definition: QIE11Task.cc:226
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
hcaldqm::Container2D _cLETDCvsTS_EChannel[2]
Definition: QIE11Task.h:59
hcaldqm::ContainerProf1D _cShapeCut_EChannel[2]
Definition: QIE11Task.h:57
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
int _eventType
Definition: QIE11Task.h:46
hcaldqm::Container1D _cLETDCTime_EChannel[2]
Definition: QIE11Task.h:61
UpdateFreq
Definition: DQTask.h:16
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: QIE11Task.cc:167
hcaldqm::ContainerSingleProf1D _cShapeCut
Definition: QIE11Task.h:66
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
int _ped
Definition: QIE11Task.h:44
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
hcaldqm::Container2D _cLETDCvsADC_EChannel[10][2]
Definition: QIE11Task.h:58
void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0) override
int const FIBERCH_MIN
Definition: Constants.h:122
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
U second(std::pair< T, U > const &p)
ProcessingType _ptype
Definition: DQModule.h:43
virtual void fill(uint32_t)
Definition: Container1D.cc:73
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
hcaldqm::filter::HashFilter _filter_slot[2]
Definition: QIE11Task.h:50
uint32_t valueUserWord(int iword) const
QIE11Task(edm::ParameterSet const &)
Definition: QIE11Task.cc:6
uint8_t eventType() const
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: QIE11Task.h:54
int const FIBER_uTCA_MIN1
Definition: Constants.h:116
edm::InputTag _tagQIE11
Definition: QIE11Task.h:36
void _resetMonitors(hcaldqm::UpdateFreq) override
Definition: QIE11Task.cc:249
constexpr int crateId() const
get the readout VME crate number
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
RunAuxiliary const & runAuxiliary() const override
Definition: Run.h:61
std::string _name
Definition: DQModule.h:41
HcalElectronicsMap const * _emap
Definition: DQTask.h:59
double _cut
Definition: QIE11Task.h:43
hcaldqm::ContainerSingle1D _cADC
Definition: QIE11Task.h:70
edm::EDGetTokenT< HcalUMNioDigi > _tokuMN
Definition: QIE11Task.h:40
Definition: DetId.h:18
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:592
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 &, std::string subsystem="Hcal", std::string aux="") override
int _laserType
Definition: QIE11Task.h:45
example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
edm::InputTag _taguMN
Definition: QIE11Task.h:39
constexpr int slot() const
get the htr or uHTR slot
edm::ESHandle< HcalDbService > _dbService
Definition: DQTask.h:58
hcaldqm::ContainerSingle2D _cLETDCTimevsADC
Definition: QIE11Task.h:68
T get() const
Definition: EventSetup.h:71
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
const HcalElectronicsMap * getHcalMapping() const
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:17
std::string _subsystem
Definition: DQModule.h:48
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: QIE11Task.cc:20
virtual void fill(int, int)
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:558
int samples() const
total number of samples in the digi
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: QIE11Task.cc:162
hcaldqm::Container1D _cLETDC_EChannel[10][2]
Definition: QIE11Task.h:60
Readout chain identification for Hcal.
hcaldqm::ContainerSingle1D _cLETDC
Definition: QIE11Task.h:69
RunNumber_t run() const
Definition: RunAuxiliary.h:41
Definition: Run.h:45
ib
Definition: cuy.py:662
hcaldqm::filter::HashFilter _filter_timingChannels[4]
Definition: QIE11Task.h:51