CMS 3D CMS Logo

QIE11Task.cc
Go to the documentation of this file.
1 
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  // INITIALIZE what you need
47  unsigned int itr = 0;
48  for (unsigned int crate = 34; crate <= 34; ++crate) {
49  for (unsigned int slot = 11; slot <= 12; ++slot) {
50  std::vector<uint32_t> vhashSlot;
51  vhashSlot.push_back(HcalElectronicsId(crate, slot, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
66  for (unsigned int j=0; j<10; j++) {
80  }
81  ++itr;
82  }
83  }
85  "ShapeCut",
88  _cTDCvsADC.initialize(_name, "TDCvsADC",
92  _cTDC.initialize(_name, "TDC",
95  _cADC.initialize(_name, "ADC",
98 
99  itr = 0;
100  std::map<std::pair<unsigned int, unsigned int>, unsigned int> itr_map;
101  for(unsigned int crate = 34; crate <= 34; ++crate) {
102  for(unsigned int slot=11; slot<=12; ++slot) {
103  char aux[100];
104  sprintf(aux, "/Crate%d_Slot%d", crate, slot);
105  _cShapeCut_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
106  _cTDCvsTS_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
107  _cTDCTime_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
108  for (unsigned int j=0; j<10; j++) {
109  char aux2[100];
110  sprintf(aux2, "/Crate%d_Slot%d/TS%d", crate, slot, j);
111  _cTDCvsADC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2);
112  _cTDC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2);
113  _cADC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2);
114  }
115  itr_map[std::make_pair(crate, slot)] = itr;
116  ++itr;
117  }
118  }
121  _cTDC.book(ib, _subsystem);
122  _cADC.book(ib, _subsystem);
123 
125 }
126 
128  edm::EventSetup const& es)
129 {
130 
131  // finish
132  DQTask::endLuminosityBlock(lb, es);
133 }
134 
135 /* virtual */ void QIE11Task::_process(edm::Event const& e,
136  edm::EventSetup const&)
137 {
139  if (!e.getByToken(_tokQIE11, cqie11))
140  return;
141 
142  for (uint32_t i=0; i<cqie11->size(); i++)
143  {
144  QIE11DataFrame frame = static_cast<QIE11DataFrame>((*cqie11)[i]);
145  DetId did = frame.detid();
147  int fakecrate = -1;
148  if (eid.crateId() == 34) fakecrate = 0;
149  int index = fakecrate * 12 + (eid.slot() - 10) - 1;
150 
151  // compute the signal, ped subracted
152 // double q = hcaldqm::utilities::aveTS_v10<QIE11DataFrame>(frame,
153 // constants::adc2fC[_ped], 0, frame.samples()-1);
154 
155  // iterate thru all TS and fill
156  for (int j=0; j<frame.samples(); j++)
157  {
158  if (index == 0 || index == 1) {
159  // shapes are after the cut
160  _cShapeCut_EChannel[index].fill(eid, j, adc2fC[frame[j].adc()]);
161  _cTDCvsTS_EChannel[index].fill(eid, j, frame[j].tdc());
162 
163  // w/o a cut
164  _cTDCvsADC_EChannel[j][index].fill(eid, frame[j].adc(),
165  frame[j].tdc());
166  _cTDC_EChannel[j][index].fill(eid, frame[j].tdc());
167  if (frame[j].tdc() < 50) {
168  // Each TDC count is 0.5 ns.
169  // tdc == 62 or 63 means value was below or above threshold for whole time slice.
170  _cTDCTime_EChannel[index].fill(eid, j*25. + (frame[j].tdc() / 2.));
171  }
172  _cADC_EChannel[j][index].fill(eid, frame[j].adc());
173  }
174  _cShapeCut.fill(eid, j, adc2fC[frame[j].adc()]);
175 
176  _cTDCvsADC.fill(frame[j].adc(), frame[j].tdc());
177 
178  _cTDC.fill(eid, frame[j].tdc());
179 
180  _cADC.fill(eid, frame[j].adc());
181 
182  }
183  }
184 }
185 
186 
187 /* virtual */ bool QIE11Task::_isApplicable(edm::Event const& e)
188 {
189  if (_ptype!=fOnline || (_laserType < 0 && _eventType < 0))
190  return true;
191  else
192  {
193  // fOnline mode
195  if (!e.getByToken(_tokuMN, cumn))
196  return false;
197 
198  // event type check first
199  int eventType = cumn->eventType();
200  if (eventType==_eventType)
201  return true;
202 
203  // check if this analysis task is of the right laser type
204  int laserType = cumn->valueUserWord(0);
205  if (laserType==_laserType)
206  return true;
207  }
208 
209  return false;
210 }
211 
212 
214 {
215 }
216 
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::filter::HashFilter _filter_C34
Definition: QIE11Task.h:56
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
hcaldqm::ContainerProf1D _cShapeCut_EChannel[2]
Definition: QIE11Task.h:64
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Definition: QIE11Task.cc:25
UpdateFreq
Definition: DQTask.h:17
hcaldqm::ContainerSingleProf1D _cShapeCut
Definition: QIE11Task.h:73
int _ped
Definition: QIE11Task.h:50
hcaldqm::Container1D _cTDC_EChannel[10][2]
Definition: QIE11Task.h:67
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: QIE11Task.cc:127
int crateId() const
get the readout VME crate number
void bookHistograms(fwlite::EventContainer &eventCont)
int const FIBERCH_MIN
Definition: Constants.h:108
hcaldqm::ContainerSingle2D _cTDCvsADC
Definition: QIE11Task.h:74
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
ProcessingType _ptype
Definition: DQModule.h:59
virtual void fill(uint32_t)
Definition: Container1D.cc:82
HcalElectronicsMap const * _emap
Definition: QIE11Task.h:60
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, int debug=0)
hcaldqm::Container2D _cTDCvsADC_EChannel[10][2]
Definition: QIE11Task.h:65
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 void _resetMonitors(hcaldqm::UpdateFreq)
Definition: QIE11Task.cc:213
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:101
edm::InputTag _tagQIE11
Definition: QIE11Task.h:40
std::string _name
Definition: DQModule.h:57
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:76
double const adc2fC[256]
Definition: Constants.h:229
edm::EDGetTokenT< HcalUMNioDigi > _tokuMN
Definition: QIE11Task.h:44
Definition: DetId.h:18
hcaldqm::ContainerSingle1D _cTDC
Definition: QIE11Task.h:75
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:56
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:135
RunAuxiliary const & runAuxiliary() const
Definition: Run.h:59
virtual bool _isApplicable(edm::Event const &)
Definition: QIE11Task.cc:187
edm::InputTag _taguMN
Definition: QIE11Task.h:43
virtual void fill(HcalDetId const &) override
Definition: Container2D.cc:59
const HcalElectronicsMap * getHcalMapping() const
std::string _subsystem
Definition: DQModule.h:64
hcaldqm::Container2D _cTDCvsTS_EChannel[2]
Definition: QIE11Task.h:66
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
Readout chain identification for Hcal.
RunNumber_t run() const
Definition: RunAuxiliary.h:41
hcaldqm::Container1D _cTDCTime_EChannel[2]
Definition: QIE11Task.h:68
Definition: Run.h:42
ib
Definition: cuy.py:660