CMS 3D CMS Logo

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