CMS 3D CMS Logo

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