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  : DQTask(ps), hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
10  // tags
11  _tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagQIE10", edm::InputTag("hcalDigis"));
12  _tagHF = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
13  _tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
14  _tokHF = consumes<HFDigiCollection>(_tagHF);
15 
16  // cuts
17  _cut = ps.getUntrackedParameter<double>("cut", 50.0);
18  _ped = ps.getUntrackedParameter<int>("ped", 4);
19 }
20 /* virtual */ void QIE10Task::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
21  if (_ptype == fLocal)
22  if (r.runAuxiliary().run() == 1)
23  return;
24 
26 
27  // GET WHAT YOU NEED
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);
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);
139  }
140  ++itr;
141  }
142  }
143 
149 
153 
155 }
156 
158  // finish
159  DQTask::globalEndLuminosityBlock(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 
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);
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());
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.);
226  }
227  }
228 
229  mqie10[did.rawId()] = frame;
230  }
231 }
232 
234 
void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, int debug=0) override
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: QIE10Task.cc:157
edm::InputTag _tagHF
Definition: QIE10Task.h:36
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
hcaldqm::filter::HashFilter _filter_slot[36]
Definition: QIE10Task.h:46
edm::EDGetTokenT< QIE10DigiCollection > _tokQIE10
Definition: QIE10Task.h:37
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: QIE10Task.h:49
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
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
hcaldqm::ContainerSingleProf1D _cShapeCut
Definition: QIE10Task.h:60
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
std::string const & instance() const
Definition: InputTag.h:37
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void dqmthrow(std::string const &msg) const
Definition: Logger.h:12
hcaldqm::ContainerSingle1D _cLETDC
Definition: QIE10Task.h:63
UpdateFreq
Definition: DQTask.h:32
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:68
hcaldqm::ContainerProf1D _cShapeCut_EChannel[36]
Definition: QIE10Task.h:52
const HcalElectronicsMap * getHcalMapping() const
hcaldqm::ContainerSingle2D _cLETDCvsADC
Definition: QIE10Task.h:62
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag _tagQIE10
Definition: QIE10Task.h:35
hcaldqm::Container1D _cADC_EChannel[10][36]
Definition: QIE10Task.h:56
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:55
int _ped
Definition: QIE10Task.h:43
int const FIBERCH_MIN
Definition: Constants.h:134
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
T getUntrackedParameter(std::string const &, T const &) const
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
ProcessingType _ptype
Definition: DQModule.h:44
virtual void fill(uint32_t)
Definition: Container1D.cc:73
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: QIE10Task.cc:162
int const FIBER_uTCA_MIN1
Definition: Constants.h:128
Transition
Definition: Transition.h:12
edm::ESGetToken< HcalDbService, HcalDbRecord > hcalDbServiceToken_
Definition: QIE10Task.h:39
Logger _logger
Definition: DQModule.h:55
hcaldqm::Container2D _cOccupancy_depth
Definition: QIE10Task.h:71
std::string _name
Definition: DQModule.h:42
HcalElectronicsMap const * _emap
Definition: DQTask.h:81
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
hcaldqm::Container2D _cLETDCvsADC_EChannel[10][36]
Definition: QIE10Task.h:53
hcaldqm::Container2D _cOccupancy_Crate
Definition: QIE10Task.h:67
std::vector< unsigned int > const crateListHF
Definition: Constants.h:76
hcaldqm::Container1D _cLETDCTime_EChannel[36]
Definition: QIE10Task.h:57
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: QIE10Task.cc:20
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:54
QIE10Task(edm::ParameterSet const &)
Definition: QIE10Task.cc:8
int const SLOT_uTCA_MAX
Definition: Constants.h:108
hcaldqm::ContainerSingle2D _cLETDCTimevsADC
Definition: QIE10Task.h:61
HLT enums.
edm::ESHandle< HcalDbService > _dbService
Definition: DQTask.h:80
void _resetMonitors(hcaldqm::UpdateFreq) override
Definition: QIE10Task.cc:233
double _cut
Definition: QIE10Task.h:42
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:17
std::string _subsystem
Definition: DQModule.h:49
virtual void fill(int, int)
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:567
hcaldqm::ContainerSingle1D _cADC
Definition: QIE10Task.h:64
Readout chain identification for Hcal.
int const SLOT_uTCA_MIN
Definition: Constants.h:107
Definition: Run.h:45
uint16_t *__restrict__ uint16_t const *__restrict__ adc
ib
Definition: cuy.py:661
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:127