CMS 3D CMS Logo

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