CMS 3D CMS Logo

QIE10Task.cc
Go to the documentation of this file.
1 
3 #include <map>
4 
5 using namespace hcaldqm;
6 using namespace hcaldqm::constants;
8  DQTask(ps)
9 {
10 
11  // tags
13  edm::InputTag("hcalDigis"));
15  edm::InputTag("hcalDigis"));
16  _tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
17  _tokHF = consumes<HFDigiCollection>(_tagHF);
18 
19  // cuts
20  _cut = ps.getUntrackedParameter<double>("cut", 50.0);
21  _ped = ps.getUntrackedParameter<int>("ped", 4);
22 }
24  edm::Run const& r, edm::EventSetup const& es)
25 {
26  if (_ptype==fLocal)
27  if (r.runAuxiliary().run()==1)
28  return;
29 
30  DQTask::bookHistograms(ib, r, es);
31 
32  // GET WHAT YOU NEED
34  es.get<HcalDbRecord>().get(dbs);
35  _emap = dbs->getHcalMapping();
36 
37  unsigned int nTS = _ptype==fLocal ? 10 : 6;
38 
39  // create a slot filter and initialize what you need
40  unsigned int itr=0;
41  for (auto& crate : constants::crateListHF) {
42  for(unsigned int slot=SLOT_uTCA_MIN; slot<=SLOT_uTCA_MAX; ++slot) {
43  std::vector<uint32_t> vhashSlot;
44  vhashSlot.push_back(HcalElectronicsId(crate, slot, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
46 
60 
61  for (unsigned int j=0; j<nTS; j++) {
75 
76  }
77  ++itr;
78  }
79  }
80 
82  "ShapeCut",
85  _cLETDCvsADC.initialize(_name, "LETDCvsADC",
89  _cLETDCTimevsADC.initialize(_name, "LETDCTimevsADC",
93  _cLETDC.initialize(_name, "LETDC",
96  _cADC.initialize(_name, "ADC",
99 
100 
101 
102  //OCCUPANCY PER CRATE/SLOT
104  "Occupancy", hashfunctions::fCrate,
109  "Occupancy", hashfunctions::fCrateSlot,
113 
114  // OCCUPANCY IN DETECTOR COORDINATES
115  _cOccupancy_depth.initialize(_name, "Occupancy",
120 
121 
122  itr = 0;
123  for(auto& crate : constants::crateListHF) {
124  for(unsigned int slot=SLOT_uTCA_MIN; slot<=SLOT_uTCA_MAX; ++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  _cLETDCTime_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
129  _cLETDCvsTS_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
130  for (unsigned int i=0; i<nTS; i++) {
131  char aux2[100];
132  sprintf(aux2, "/Crate%d_Slot%d/TS%d", crate, slot, i);
133  _cLETDCvsADC_EChannel[i][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
134  _cLETDC_EChannel[i][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
135  _cADC_EChannel[i][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux);
136  }
137  ++itr;
138  }
139  }
140 
144  _cLETDC.book(ib, _subsystem);
145  _cADC.book(ib, _subsystem);
146 
150 
152 }
153 
155  edm::EventSetup const& es)
156 {
157 
158  // finish
159  DQTask::endLuminosityBlock(lb, es);
160 }
161 
162 /* virtual */ void QIE10Task::_process(edm::Event const& e,
163  edm::EventSetup const&)
164 {
167  if (!e.getByToken(_tokQIE10, cqie10))
168  return;
169  if (!e.getByToken(_tokHF, chf))
170  _logger.dqmthrow("Collection HFDigiCollection isn't available"
171  + _tagHF.label() + " " + _tagHF.instance());
172 
173  std::map<uint32_t, QIE10DataFrame> mqie10;
174  for (uint32_t i=0; i<cqie10->size(); i++)
175  {
176  QIE10DataFrame frame = static_cast<QIE10DataFrame>((*cqie10)[i]);
177  HcalDetId did = frame.detid();
179  if (did.subdet() != HcalForward) {
180  continue;
181  }
182 
183  // Compute index for EChannel plots
184  int fakecrate =-1;
185  if (eid.crateId() == 22) {
186  fakecrate = 0;
187  } else if (eid.crateId() == 29) {
188  fakecrate = 1;
189  } else if (eid.crateId() == 32) {
190  fakecrate = 2;
191  } else {
192  // Unknown crate, skip digi
193  continue;
194  }
195  int index = fakecrate*12+eid.slot()-1;
196 
197  // compute the signal, ped subracted
198  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE10DataFrame>(_dbService, did, frame);
199  double sumQ = hcaldqm::utilities::sumQDB<QIE10DataFrame>(_dbService, digi_fC, did, frame, 0, frame.samples()-1);
200  // double sumQ = hcaldqm::utilities::sumQ_v10<QIE10DataFrame>(frame, constants::adc2fC[_ped], 0, frame.samples()-1);
201 
202  _cOccupancy_Crate.fill(eid);
204  _cOccupancy_depth.fill(did);
205 
206  // iterate thru all TS and fill
207  for (int j=0; j<frame.samples(); j++)
208  {
209  // shapes are after the cut
210  if (sumQ>_cut)
211  {
212  double q = hcaldqm::utilities::adc2fCDBMinusPedestal<QIE10DataFrame>(_dbService, digi_fC, did, frame, j);
213  _cShapeCut_EChannel[index].fill(eid, j, q);
214  _cShapeCut.fill(j, q);
215  }
216  // w/o a cut
217  _cLETDCvsADC_EChannel[j][index].fill(eid, frame[j].adc(),
218  frame[j].le_tdc());
219  _cLETDCvsADC.fill(frame[j].adc(), frame[j].le_tdc());
220  _cLETDC_EChannel[j][index].fill(eid, frame[j].le_tdc());
221  _cLETDC.fill(frame[j].le_tdc());
222  _cADC_EChannel[j][index].fill(eid, frame[j].adc());
223  _cADC.fill(frame[j].adc());
224  _cLETDCvsTS_EChannel[index].fill(eid, j, frame[j].le_tdc());
225 
226  // TDC conversion to time
227  if (frame[j].le_tdc() < 50) {
228  // Each TDC count is 0.5 ns.
229  // tdc == 62 or 63 means value was below or above threshold for whole time slice.
230  double time = j*25. + (frame[j].le_tdc() / 2.);
231  _cLETDCTime_EChannel[index].fill(eid, time);
232  _cLETDCTimevsADC.fill(frame[j].adc(), time);
233  }
234  }
235 
236  mqie10[did.rawId()] = frame;
237  }
238 }
239 
241 {
242 }
243 
int adc(sample_type sample)
get the ADC sample (12 bits)
int samples() const
total number of samples in the digi
edm::InputTag _tagHF
Definition: QIE10Task.h:39
T getUntrackedParameter(std::string const &, T const &) const
hcaldqm::filter::HashFilter _filter_slot[36]
Definition: QIE10Task.h:48
edm::EDGetTokenT< QIE10DigiCollection > _tokQIE10
Definition: QIE10Task.h:40
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *qy=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:40
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: QIE10Task.h:52
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
hcaldqm::ContainerSingleProf1D _cShapeCut
Definition: QIE10Task.h:63
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
virtual void initialize(std::string const &folder, Quantity *, Quantity *qy=new ValueQuantity(quantity::fN), int debug=0)
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
hcaldqm::ContainerSingle1D _cLETDC
Definition: QIE10Task.h:66
void initialize(std::string const &folder, Quantity *, Quantity *qy=new ValueQuantity(quantity::fN), int debug=0) override
UpdateFreq
Definition: DQTask.h:17
edm::EDGetTokenT< HFDigiCollection > _tokHF
Definition: QIE10Task.h:41
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
hcaldqm::Container2D _cOccupancy_CrateSlot
Definition: QIE10Task.h:71
hcaldqm::ContainerProf1D _cShapeCut_EChannel[36]
Definition: QIE10Task.h:55
hcaldqm::ContainerSingle2D _cLETDCvsADC
Definition: QIE10Task.h:65
edm::InputTag _tagQIE10
Definition: QIE10Task.h:38
hcaldqm::Container1D _cADC_EChannel[10][36]
Definition: QIE10Task.h:59
hcaldqm::Container1D _cLETDC_EChannel[10][36]
Definition: QIE10Task.h:58
int crateId() const
get the readout VME crate number
void bookHistograms(fwlite::EventContainer &eventCont)
int _ped
Definition: QIE10Task.h:45
int const FIBERCH_MIN
Definition: Constants.h:151
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
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: QIE10Task.cc:162
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
DetId detid() const
Get the detector id.
Logger _logger
Definition: DQModule.h:70
hcaldqm::Container2D _cOccupancy_depth
Definition: QIE10Task.h:74
RunAuxiliary const & runAuxiliary() const override
Definition: Run.h:62
std::string _name
Definition: DQModule.h:57
HcalElectronicsMap const * _emap
Definition: DQTask.h:73
hcaldqm::Container2D _cLETDCvsADC_EChannel[10][36]
Definition: QIE10Task.h:56
hcaldqm::Container2D _cOccupancy_Crate
Definition: QIE10Task.h:70
std::vector< unsigned int > const crateListHF
Definition: Constants.h:93
hcaldqm::Container1D _cLETDCTime_EChannel[36]
Definition: QIE10Task.h:60
virtual void initialize(std::string const &folder, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: QIE10Task.cc:23
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
hcaldqm::Container2D _cLETDCvsTS_EChannel[36]
Definition: QIE10Task.h:57
const T & get() const
Definition: EventSetup.h:55
void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, int debug=0) override
int slot() const
get the htr or uHTR slot
QIE10Task(edm::ParameterSet const &)
Definition: QIE10Task.cc:7
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: QIE10Task.cc:154
int const SLOT_uTCA_MAX
Definition: Constants.h:124
hcaldqm::ContainerSingle2D _cLETDCTimevsADC
Definition: QIE10Task.h:64
std::string const & label() const
Definition: InputTag.h:36
edm::ESHandle< HcalDbService > _dbService
Definition: DQTask.h:72
void _resetMonitors(hcaldqm::UpdateFreq) override
Definition: QIE10Task.cc:240
double _cut
Definition: QIE10Task.h:44
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
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:895
hcaldqm::ContainerSingle1D _cADC
Definition: QIE10Task.h:67
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
RunNumber_t run() const
Definition: RunAuxiliary.h:41
int const SLOT_uTCA_MIN
Definition: Constants.h:123
Definition: Run.h:43
ib
Definition: cuy.py:660
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:122