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