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