CMS 3D CMS Logo

QIE11Task.cc
Go to the documentation of this file.
3 
4 using namespace hcaldqm;
5 using namespace hcaldqm::constants;
7  : DQTask(ps), hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
8  // tags
9  _tagQIE11 = ps.getUntrackedParameter<edm::InputTag>("tagQIE11", edm::InputTag("hcalDigis"));
10  _tokQIE11 = consumes<QIE11DigiCollection>(_tagQIE11);
11 
12  _taguMN = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));
13  _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
14 
15  // cuts
16  _cut = ps.getUntrackedParameter<double>("cut", 50.0);
17  _ped = ps.getUntrackedParameter<int>("ped", 4);
18  _laserType = ps.getUntrackedParameter<int32_t>("laserType", -1);
19  _eventType = ps.getUntrackedParameter<int32_t>("eventType", -1);
20 }
21 //statis
24 
25  //from class inheritance
27 
28  desc.addUntracked<std::string>("name", "QIE11Task");
29  desc.addUntracked<int>("debug", 0);
30  desc.addUntracked<int>("runkeyVal", 0);
31  desc.addUntracked<std::string>("runkeyName", "pp_run");
32  desc.addUntracked<edm::InputTag>("tagQIE11", edm::InputTag("hcalDigis"));
33  desc.addUntracked<double>("cut", 20);
34  desc.addUntracked<int>("ped", 4);
35  desc.addUntracked<int>("laserType", -1);
36  desc.addUntracked<int>("eventType", -1);
37 
38  _desc.addDefault(desc);
39 }
40 
41 /* virtual */ void QIE11Task::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
42  if (_ptype == fLocal)
43  if (r.runAuxiliary().run() == 1)
44  return;
45 
47 
48  // GET WHAT YOU NEED
50  _emap = dbs->getHcalMapping();
51  std::vector<uint32_t> vhashC34;
52  vhashC34.push_back(HcalElectronicsId(34, 11, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
53  vhashC34.push_back(HcalElectronicsId(34, 12, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
55 
56  std::vector<std::pair<int, int> > timingChannels;
57  timingChannels.push_back(std::pair<int, int>(28, 63));
58  timingChannels.push_back(std::pair<int, int>(28, 65));
59  timingChannels.push_back(std::pair<int, int>(20, 63));
60  timingChannels.push_back(std::pair<int, int>(20, 65));
61  for (int iChan = 0; iChan < 4; ++iChan) {
62  std::vector<uint32_t> vhashTimingChannel;
63  for (int depth = 1; depth <= 7; ++depth) {
64  vhashTimingChannel.push_back(
65  HcalDetId(HcalEndcap, timingChannels[iChan].first, timingChannels[iChan].second, depth));
66  }
68  }
69 
70  // INITIALIZE what you need
71 
72  // EChannel plots, online+local only
73  if (_ptype != fOffline) {
74  unsigned int itr = 0;
75  for (unsigned int crate = 34; crate <= 34; ++crate) {
76  for (unsigned int slot = 11; slot <= 12; ++slot) {
77  std::vector<uint32_t> vhashSlot;
78  vhashSlot.push_back(HcalElectronicsId(crate, slot, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
81  "ShapeCut",
86  "LETDCvsTS",
91  0);
93  "LETDCTime",
97  0);
98  for (unsigned int j = 0; j < 10; j++) {
100  _name,
101  "LETDCvsADC",
106  0);
108  "ADC",
112  0);
114  "LETDC",
118  0);
119  }
120  ++itr;
121  }
122  }
123  }
125  "ShapeCut",
129  "LETDCvsADC",
133  0);
135  "LETDCTimevsADC",
139  0);
141  "LETDC",
144  0);
146  "ADC",
149  0);
150 
151  if (_ptype != fOffline) {
152  unsigned int itr = 0;
153  std::map<std::pair<unsigned int, unsigned int>, unsigned int> itr_map;
154  for (unsigned int crate = 34; crate <= 34; ++crate) {
155  for (unsigned int slot = 11; slot <= 12; ++slot) {
156  char aux[100];
157  sprintf(aux, "/Crate%d_Slot%d", crate, slot);
161  for (unsigned int j = 0; j < 10; j++) {
162  char aux2[100];
163  sprintf(aux2, "/Crate%d_Slot%d/TS%d", crate, slot, j);
165  _cLETDC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2);
166  _cADC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2);
167  }
168  itr_map[std::make_pair(crate, slot)] = itr;
169  ++itr;
170  }
171  }
172  }
178 
180 }
181 
183  // finish
184  DQTask::globalEndLuminosityBlock(lb, es);
185 }
186 
187 /* virtual */ void QIE11Task::_process(edm::Event const& e, edm::EventSetup const&) {
189  if (!e.getByToken(_tokQIE11, cqie11))
190  return;
191 
192  for (uint32_t i = 0; i < cqie11->size(); i++) {
193  QIE11DataFrame frame = static_cast<QIE11DataFrame>((*cqie11)[i]);
194  DetId did = frame.detid();
195  if (HcalDetId(frame.detid()).subdet() != HcalEndcap) {
196  continue;
197  }
198 
200  if (!eid.rawId()) {
201  continue;
202  }
203  int fakecrate = -1;
204  if (eid.crateId() == 34)
205  fakecrate = 0;
206  int index = fakecrate * 12 + (eid.slot() - 10) - 1;
207 
208  // compute the signal, ped subracted
209  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE11DataFrame>(_dbService, did, frame);
210  // double q = hcaldqm::utilities::aveTS_v10<QIE11DataFrame>(frame,
211  // constants::adc2fC[_ped], 0, frame.samples()-1);
212 
213  // iterate thru all TS and fill
214  for (int j = 0; j < frame.samples(); j++) {
215  double q_pedsub = hcaldqm::utilities::adc2fCDBMinusPedestal<QIE11DataFrame>(_dbService, digi_fC, did, frame, j);
216  if (_ptype != fOffline) {
217  if (index == 0 || index == 1) {
218  // shapes are after the cut
219  _cShapeCut_EChannel[index].fill(eid, j, q_pedsub);
221 
222  // w/o a cut
224  _cLETDC_EChannel[j][index].fill(eid, frame[j].tdc());
225  if (frame[j].tdc() < 50) {
226  // Each TDC count is 0.5 ns.
227  // tdc == 62 or 63 means value was below or above threshold for whole time slice.
228  _cLETDCTime_EChannel[index].fill(eid, j * 25. + (frame[j].tdc() / 2.));
229  }
231  }
232  }
233  _cShapeCut.fill(eid, j, q_pedsub);
234 
235  _cLETDCvsADC.fill(frame[j].adc(), frame[j].tdc());
236  if (frame[j].tdc() < 50) {
237  _cLETDCTimevsADC.fill(frame[j].adc(), j * 25. + (frame[j].tdc() / 2.));
238  }
239  _cLETDC.fill(eid, frame[j].tdc());
240 
241  _cADC.fill(eid, frame[j].adc());
242  }
243  }
244 }
245 
246 /* virtual */ bool QIE11Task::_isApplicable(edm::Event const& e) {
247  if (_ptype != fOnline || (_laserType < 0 && _eventType < 0))
248  return true;
249  else {
250  // fOnline mode
252  if (!e.getByToken(_tokuMN, cumn))
253  return false;
254 
255  // event type check first
256  int eventType = cumn->eventType();
257  if (eventType == _eventType)
258  return true;
259 
260  // check if this analysis task is of the right laser type
261  int laserType = cumn->valueUserWord(0);
262  if (laserType == _laserType)
263  return true;
264  }
265 
266  return false;
267 }
268 
270 
void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, int debug=0) override
edm::EDGetTokenT< QIE11DigiCollection > _tokQIE11
Definition: QIE11Task.h:38
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::ESGetToken< HcalDbService, HcalDbRecord > hcalDbServiceToken_
Definition: QIE11Task.h:42
hcaldqm::Container1D _cADC_EChannel[10][2]
Definition: QIE11Task.h:64
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:69
hcaldqm::filter::HashFilter _filter_C34
Definition: QIE11Task.h:51
bool _isApplicable(edm::Event const &) override
Definition: QIE11Task.cc:246
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
hcaldqm::Container2D _cLETDCvsTS_EChannel[2]
Definition: QIE11Task.h:61
hcaldqm::ContainerProf1D _cShapeCut_EChannel[2]
Definition: QIE11Task.h:59
dbs
Find files in dataset.
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
int _eventType
Definition: QIE11Task.h:48
hcaldqm::Container1D _cLETDCTime_EChannel[2]
Definition: QIE11Task.h:63
UpdateFreq
Definition: DQTask.h:32
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: QIE11Task.cc:187
hcaldqm::ContainerSingleProf1D _cShapeCut
Definition: QIE11Task.h:68
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: QIE11Task.cc:182
int _ped
Definition: QIE11Task.h:46
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
hcaldqm::Container2D _cLETDCvsADC_EChannel[10][2]
Definition: QIE11Task.h:60
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: QIE11Task.cc:22
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:138
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
T getUntrackedParameter(std::string const &, T const &) const
U second(std::pair< T, U > const &p)
ProcessingType _ptype
Definition: DQModule.h:44
virtual void fill(uint32_t)
Definition: Container1D.cc:73
uint32_t valueUserWord(int iword) const
void addDefault(ParameterSetDescription const &psetDescription)
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:52
QIE11Task(edm::ParameterSet const &)
Definition: QIE11Task.cc:6
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: QIE11Task.h:56
int const FIBER_uTCA_MIN1
Definition: Constants.h:132
Transition
Definition: Transition.h:12
edm::InputTag _tagQIE11
Definition: QIE11Task.h:37
void _resetMonitors(hcaldqm::UpdateFreq) override
Definition: QIE11Task.cc:269
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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
uint8_t eventType() const
double _cut
Definition: QIE11Task.h:45
hcaldqm::ContainerSingle1D _cADC
Definition: QIE11Task.h:72
edm::EDGetTokenT< HcalUMNioDigi > _tokuMN
Definition: QIE11Task.h:41
Definition: DetId.h:17
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:47
edm::InputTag _taguMN
Definition: QIE11Task.h:40
HLT enums.
edm::ESHandle< HcalDbService > _dbService
Definition: DQTask.h:80
hcaldqm::ContainerSingle2D _cLETDCTimevsADC
Definition: QIE11Task.h:70
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
static void fillPSetDescription(edm::ParameterSetDescription &des)
Definition: DQTask.cc:26
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:17
std::string _subsystem
Definition: DQModule.h:49
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: QIE11Task.cc:41
virtual void fill(int, int)
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:567
hcaldqm::Container1D _cLETDC_EChannel[10][2]
Definition: QIE11Task.h:62
Readout chain identification for Hcal.
hcaldqm::ContainerSingle1D _cLETDC
Definition: QIE11Task.h:71
Definition: Run.h:45
uint16_t *__restrict__ uint16_t const *__restrict__ adc
ib
Definition: cuy.py:661
hcaldqm::filter::HashFilter _filter_timingChannels[4]
Definition: QIE11Task.h:53