CMS 3D CMS Logo

SiPixelDaqInfo.cc
Go to the documentation of this file.
1 
6 
7 using namespace std;
8 using namespace edm;
10  FEDRange_.first = ps.getUntrackedParameter<unsigned int>("MinimumPixelFEDId", 0);
11  FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumPixelFEDId", 39);
12  daqSource_ = ps.getUntrackedParameter<string>("daqSource", "source");
13 
14  NumberOfFeds_ = FEDRange_.second - FEDRange_.first + 1;
15 
16  NEvents_ = 0;
17  for (int i = 0; i != 40; i++)
18  FEDs_[i] = 0;
19 
20  firstLumi = true;
21 
22  // set Token(-s)
23  daqSourceToken_ = consumes<FEDRawDataCollection>(ps.getUntrackedParameter<string>("daqSource", "source"));
24  runInfoToken_ = esConsumes<RunInfo, RunInfoRcd, edm::Transition::EndLuminosityBlock>();
25 }
26 
28 
30  DQMStore::IGetter &iGetter,
31  const edm::LuminosityBlock &lumiBlock,
32  const edm::EventSetup &iSetup) {
33  // Book somethings first time around
34  if (firstLumi) {
35  iBooker.setCurrentFolder("Pixel/EventInfo");
36  Fraction_ = iBooker.bookFloat("DAQSummary");
37  iBooker.setCurrentFolder("Pixel/EventInfo/DAQContents");
38  FractionBarrel_ = iBooker.bookFloat("PixelBarrelFraction");
39  FractionEndcap_ = iBooker.bookFloat("PixelEndcapFraction");
40 
41  firstLumi = false;
42  }
43 
44  if (auto runInfoRec = iSetup.tryToGet<RunInfoRcd>()) {
45  // get fed summary information
46  const RunInfo &sumFED = runInfoRec->get(runInfoToken_);
47  vector<int> FedsInIds = sumFED.m_fed_in;
48 
49  int FedCount = 0;
50  int FedCountBarrel = 0;
51  int FedCountEndcap = 0;
52 
53  // loop on all active feds
54  for (unsigned int fedItr = 0; fedItr < FedsInIds.size(); ++fedItr) {
55  int fedID = FedsInIds[fedItr];
56  // make sure fed id is in allowed range
57  if (fedID >= FEDRange_.first && fedID <= FEDRange_.second) {
58  ++FedCount;
59  if (fedID >= 0 && fedID <= 31)
60  ++FedCountBarrel;
61  else if (fedID >= 32 && fedID <= 39)
62  ++FedCountEndcap;
63  }
64  }
65  // Fill active fed fraction ME
66  if (FedCountBarrel <= 32) {
67  MonitorElement *mefed = iGetter.get("Pixel/EventInfo/DAQContents/fedcounter");
68  FedCountBarrel = 0;
69  FedCountEndcap = 0;
70  FedCount = 0;
71  NumberOfFeds_ = 40;
72  if (mefed) {
73  for (int i = 0; i != 40; i++) {
74  if (i <= 31 && mefed->getBinContent(i + 1) > 0)
75  FedCountBarrel++;
76  if (i >= 32 && mefed->getBinContent(i + 1) > 0)
77  FedCountEndcap++;
78  if (mefed->getBinContent(i + 1) > 0)
79  FedCount++;
80  }
81  }
82  }
83  if (NumberOfFeds_ > 0) {
84  // all Pixel:
85  Fraction_->Fill(FedCount / NumberOfFeds_);
86  // Barrel:
87  FractionBarrel_->Fill(FedCountBarrel / 32.);
88  // Endcap:
89  FractionEndcap_->Fill(FedCountEndcap / 8.);
90  } else {
91  Fraction_->Fill(-1);
92  FractionBarrel_->Fill(-1);
93  FractionEndcap_->Fill(-1);
94  }
95  } else {
96  Fraction_->Fill(-1);
97  FractionBarrel_->Fill(-1);
98  FractionEndcap_->Fill(-1);
99  return;
100  }
101 }
102 
FEDNumbering.h
mps_fire.i
i
Definition: mps_fire.py:428
dqm::implementation::IBooker::bookFloat
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm
HLT enums.
Definition: AlignableModifier.h:19
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
RunInfo::m_fed_in
std::vector< int > m_fed_in
Definition: RunInfo.h:25
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
FEDRawData.h
RunInfo
Definition: RunInfo.h:18
edm::EventSetup::tryToGet
std::optional< T > tryToGet() const
Definition: EventSetup.h:108
SiPixelDaqInfo::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, const edm::LuminosityBlock &, const edm::EventSetup &) override
Definition: SiPixelDaqInfo.cc:29
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
RunInfoRcd
Definition: RunSummaryRcd.h:26
SiPixelDaqInfo::SiPixelDaqInfo
SiPixelDaqInfo(const edm::ParameterSet &)
Definition: SiPixelDaqInfo.cc:9
edm::ParameterSet
Definition: ParameterSet.h:47
FEDRawDataCollection.h
edm::EventSetup
Definition: EventSetup.h:58
std
Definition: JetResolutionObject.h:76
dqm::implementation::IGetter
Definition: DQMStore.h:484
SiPixelDaqInfo::~SiPixelDaqInfo
~SiPixelDaqInfo() override
Definition: SiPixelDaqInfo.cc:27
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
dqm::implementation::IBooker
Definition: DQMStore.h:43
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:592
SiPixelDaqInfo::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: SiPixelDaqInfo.cc:103
SiPixelDaqInfo.h