CMS 3D CMS Logo

SiPixelDaqInfo.cc
Go to the documentation of this file.
8 
9 using namespace std;
10 using namespace edm;
12 
13  FEDRange_.first = ps.getUntrackedParameter<unsigned int>("MinimumPixelFEDId", 0);
14  FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumPixelFEDId", 39);
15  daqSource_ = ps.getUntrackedParameter<string>("daqSource", "source");
16 
17  NumberOfFeds_ =FEDRange_.second - FEDRange_.first +1;
18 
19  NEvents_ = 0;
20  for(int i=0; i!=40; i++) 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 
32  //Book somethings first time around
33  if (firstLumi){
34  iBooker.setCurrentFolder("Pixel/EventInfo");
35  Fraction_= iBooker.bookFloat("DAQSummary");
36  iBooker.setCurrentFolder("Pixel/EventInfo/DAQContents");
37  FractionBarrel_= iBooker.bookFloat("PixelBarrelFraction");
38  FractionEndcap_= iBooker.bookFloat("PixelEndcapFraction");
39 
40  firstLumi = false;
41  }
42 
43  if(auto runInfoRec = iSetup.tryToGet<RunInfoRcd>()) {
44  //get fed summary information
45  ESHandle<RunInfo> sumFED;
46  runInfoRec->get(sumFED);
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) ++FedCountBarrel;
60  else if(fedID>=32 && fedID<=39) ++FedCountEndcap;
61  }
62  }
63  //Fill active fed fraction ME
64  if(FedCountBarrel<=32){
65  MonitorElement * mefed = iGetter.get("Pixel/EventInfo/DAQContents/fedcounter");
66  FedCountBarrel = 0; FedCountEndcap = 0; FedCount = 0; NumberOfFeds_ = 40;
67  if(mefed){
68  for(int i=0; i!=40; i++){
69  if(i<=31 && mefed->getBinContent(i+1)>0) FedCountBarrel++;
70  if(i>=32 && mefed->getBinContent(i+1)>0) FedCountEndcap++;
71  if(mefed->getBinContent(i+1)>0) FedCount++;
72  }
73  }
74  }
75  if(NumberOfFeds_>0){
76  //all Pixel:
77  Fraction_->Fill( FedCount/NumberOfFeds_);
78  //Barrel:
79  FractionBarrel_->Fill( FedCountBarrel/32.);
80  //Endcap:
81  FractionEndcap_->Fill( FedCountEndcap/8.);
82  }else{
83  Fraction_->Fill(-1);
84  FractionBarrel_->Fill(-1);
85  FractionEndcap_->Fill(-1);
86  }
87  }else{
88  Fraction_->Fill(-1);
89  FractionBarrel_->Fill(-1);
90  FractionEndcap_->Fill(-1);
91  return;
92  }
93 }
94 
T getUntrackedParameter(std::string const &, T const &) const
std::optional< T > tryToGet() const
Definition: EventSetup.h:87
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void Fill(long long x)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::vector< int > m_fed_in
Definition: RunInfo.h:26
SiPixelDaqInfo(const edm::ParameterSet &)
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
~SiPixelDaqInfo() override
double getBinContent(int binx) const
get content of bin (1-D)
HLT enums.
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, const edm::LuminosityBlock &, const edm::EventSetup &) override
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:105