CMS 3D CMS Logo

FCDTask.cc
Go to the documentation of this file.
1 
3 
4 bool operator==(const FCDTask::FCDChannel& lhs, const FCDTask::FCDChannel& rhs) {
5  return ((lhs.crate == rhs.crate) && (lhs.slot == rhs.slot) && (lhs.fiber == rhs.fiber) &&
6  (lhs.fiberChannel == rhs.fiberChannel));
7 }
8 
10  : hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
11  // tags
12  _tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagQIE10", edm::InputTag("hcalDigis", "ZDC"));
13  _tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
14 
15  // channels
16  edm::ParameterSet channelPSet = ps.getParameter<edm::ParameterSet>("fcdChannels");
17  std::vector<int32_t> crates = channelPSet.getUntrackedParameter<std::vector<int32_t> >("crate");
18  std::vector<int32_t> slots = channelPSet.getUntrackedParameter<std::vector<int32_t> >("slot");
19  std::vector<int32_t> fibers = channelPSet.getUntrackedParameter<std::vector<int32_t> >("fiber");
20  std::vector<int32_t> fiberChannels = channelPSet.getUntrackedParameter<std::vector<int32_t> >("fiber_channel");
21  for (unsigned int i = 0; i < crates.size(); ++i) {
22  _channels.push_back({crates[i], slots[i], fibers[i], fiberChannels[i]});
23  }
24 }
25 
26 /* virtual */ void FCDTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
28  _emap = dbService->getHcalMapping();
30 
31  ib.cd();
32 
33  //book histos per channel
34  std::string histoname;
35  std::vector<HcalGenericDetId> gids = _emap->allPrecisionId();
36  for (auto& it_gid : gids) {
37  if (it_gid.genericSubdet() != HcalGenericDetId::HcalGenZDC) {
38  continue;
39  }
41  for (auto& it_channel : _channels) {
42  if ((eid.crateId() == it_channel.crate) && (eid.slot() == it_channel.slot) &&
43  (eid.fiberIndex() == it_channel.fiber) && (eid.fiberChanId() == it_channel.fiberChannel)) {
44  _fcd_eids.push_back(eid);
45  }
46  }
47  }
48  for (auto& it_eid : _fcd_eids) {
49  // EM Pos
50  histoname = std::to_string(it_eid.crateId()) + "-" + std::to_string(it_eid.slot()) + "-" +
51  std::to_string(it_eid.fiberIndex()) + "-" + std::to_string(it_eid.fiberChanId());
52  ib.setCurrentFolder("Hcal/FCDTask/ADC");
53  _cADC[it_eid] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
54  _cADC[it_eid]->setAxisTitle("ADC", 1);
55  _cADC[it_eid]->setAxisTitle("N", 2);
56 
57  ib.setCurrentFolder("Hcal/FCDTask/ADC_vs_TS"),
58  _cADC_vs_TS[it_eid] = ib.book2D(histoname.c_str(), histoname.c_str(), 10, 0, 10, 64, 0, 256);
59  _cADC_vs_TS[it_eid]->setAxisTitle("TS", 1);
60  _cADC_vs_TS[it_eid]->setAxisTitle("ADC", 2);
61 
62  ib.setCurrentFolder("Hcal/FCDTask/TDCTime");
63  _cTDCTime[it_eid] = ib.book1DD(histoname.c_str(), histoname.c_str(), 500, 0., 250.);
64  _cTDCTime[it_eid]->setAxisTitle("TDC time [ns]", 1);
65 
66  ib.setCurrentFolder("Hcal/FCDTask/TDC");
67  _cTDC[it_eid] = ib.book1DD(histoname.c_str(), histoname.c_str(), 64, -0.5, 63.5);
68  _cTDC[it_eid]->setAxisTitle("TDC", 1);
69  }
70 }
71 
72 /* virtual */ void FCDTask::analyze(edm::Event const& e, edm::EventSetup const&) {
74  if (!e.getByToken(_tokQIE10, digis))
75  edm::LogError("Collection QIE10DigiCollection for ZDC isn't available" + _tagQIE10.label() + " " +
77 
78  for (auto it = digis->begin(); it != digis->end(); it++) {
79  const QIE10DataFrame digi = static_cast<const QIE10DataFrame>(*it);
80  HcalGenericDetId const& gdid = digi.detid();
82  if (std::find(_fcd_eids.begin(), _fcd_eids.end(), eid) == _fcd_eids.end()) {
83  continue;
84  }
85 
86  for (int i = 0; i < digi.samples(); i++) {
87  // iter over all samples
88  _cADC[eid]->Fill(digi[i].adc());
89  _cADC_vs_TS[eid]->Fill(i, digi[i].adc());
90  _cTDC[eid]->Fill(digi[i].le_tdc());
91  if (digi[i].le_tdc() <= 50.) {
92  double tdctime = 25. * i + 0.5 * digi[i].le_tdc();
93  _cTDCTime[eid]->Fill(tdctime);
94  }
95  }
96  }
97 }
98 
std::map< HcalElectronicsId, MonitorElement * > _cADC
Definition: FCDTask.h:37
constexpr DetId detid() const
Get the detector id.
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
FCDTask(edm::ParameterSet const &)
Definition: FCDTask.cc:9
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
std::string const & instance() const
Definition: InputTag.h:37
edm::ESGetToken< HcalDbService, HcalDbRecord > hcalDbServiceToken_
Definition: FCDTask.h:34
std::string to_string(const V &value)
Definition: OMSAccess.h:71
const HcalElectronicsMap * getHcalMapping() const
std::string const & label() const
Definition: InputTag.h:36
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
T getUntrackedParameter(std::string const &, T const &) const
std::vector< HcalElectronicsId > _fcd_eids
Definition: FCDTask.h:42
std::map< HcalElectronicsId, MonitorElement * > _cTDCTime
Definition: FCDTask.h:40
Transition
Definition: Transition.h:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::InputTag _tagQIE10
Definition: FCDTask.h:32
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const_iterator end() const
bool operator==(const FCDTask::FCDChannel &lhs, const FCDTask::FCDChannel &rhs)
Definition: FCDTask.cc:4
std::vector< FCDChannel > _channels
Definition: FCDTask.h:43
const_iterator begin() const
The iterator returned can not safely be used across threads.
std::map< HcalElectronicsId, MonitorElement * > _cADC_vs_TS
Definition: FCDTask.h:38
edm::EDGetTokenT< QIE10DigiCollection > _tokQIE10
Definition: FCDTask.h:33
HLT enums.
std::vector< HcalGenericDetId > allPrecisionId() const
HcalElectronicsMap const * _emap
Definition: FCDTask.h:44
std::map< HcalElectronicsId, MonitorElement * > _cTDC
Definition: FCDTask.h:39
Readout chain identification for Hcal.
constexpr int samples() const
total number of samples in the digi
Definition: Run.h:45
uint16_t *__restrict__ uint16_t const *__restrict__ adc
ib
Definition: cuy.py:661
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: FCDTask.h:45
void analyze(edm::Event const &, edm::EventSetup const &) override
Definition: FCDTask.cc:72
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: FCDTask.cc:26