37 setConfig(ps,
"DTTriggerEfficiency");
38 baseFolderTM =
"DT/03-LocalTrigger-TM/";
53 Bookings(ibooker, igetter);
56 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr) {
58 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw) {
61 if (globalEffDistr.find(
fullName(
"TrigEffPhi")) == globalEffDistr.end()) {
65 for (
int wh = -2; wh <= 2; ++wh) {
66 TH2F* TrigEffDenum = getHisto<TH2F>(igetter.
get(getMEName(
"TrigEffDenum",
"Task", wh)));
67 TH2F* TrigEffNum = getHisto<TH2F>(igetter.
get(getMEName(
"TrigEffNum",
"Task", wh)));
68 TH2F* TrigEffCorrNum = getHisto<TH2F>(igetter.
get(getMEName(
"TrigEffCorrNum",
"Task", wh)));
70 if (TrigEffDenum && TrigEffNum && TrigEffCorrNum && TrigEffDenum->GetEntries() > 1) {
71 if (whME[wh].
find(
fullName(
"TrigEffPhi")) == whME[wh].end()) {
72 bookWheelHistos(ibooker, wh,
"TrigEffPhi",
"");
73 bookWheelHistos(ibooker, wh,
"TrigEffCorrPhi",
"");
85 makeEfficiencyME(TrigEffNum, TrigEffDenum, Eff2DWh_TrigEffPhi, Eff1DWh_TrigEffPhi, Eff1DAll_TrigEffPhi);
87 TrigEffCorrNum, TrigEffDenum, Eff2DWh_TrigEffCorrPhi, Eff1DWh_TrigEffCorrPhi, Eff1DAll_TrigEffCorrPhi);
92 for (
int sect = 1; sect <= 12; ++sect) {
94 uint32_t indexCh = chId.
rawId();
98 TH2F* TrackPosvsAngle = getHisto<TH2F>(igetter.
get(getMEName(
"TrackPosvsAngle",
"Segment", chId)));
99 TH2F* TrackPosvsAngleAnyQual =
100 getHisto<TH2F>(igetter.
get(getMEName(
"TrackPosvsAngleAnyQual",
"Segment", chId)));
101 TH2F* TrackPosvsAngleCorr =
102 getHisto<TH2F>(igetter.
get(getMEName(
"TrackPosvsAngleCorr",
"Segment", chId)));
104 if (TrackPosvsAngle && TrackPosvsAngleAnyQual && TrackPosvsAngleCorr &&
105 TrackPosvsAngle->GetEntries() > 1) {
106 if (chambME[indexCh].
find(
fullName(
"TrigEffAnglePhi")) == chambME[indexCh].end()) {
107 bookChambHistos(ibooker, chId,
"TrigEffPosvsAnglePhi",
"Segment");
108 bookChambHistos(ibooker, chId,
"TrigEffPosvsAngleCorrPhi",
"Segment");
111 std::map<std::string, MonitorElement*>* innerME = &(chambME[indexCh]);
113 TrackPosvsAngleAnyQual, TrackPosvsAngle, innerME->find(
fullName(
"TrigEffPosvsAnglePhi"))->second);
115 TrackPosvsAngleCorr, TrackPosvsAngle, innerME->find(
fullName(
"TrigEffPosvsAngleCorrPhi"))->second);
131 efficiency->Divide(numerator, denominator, 1, 1,
"");
133 int nbinsx = efficiency->GetNbinsX();
134 int nbinsy = efficiency->GetNbinsY();
135 for (
int binx = 1; binx <= nbinsx; ++binx) {
136 for (
int biny = 1; biny <= nbinsy; ++biny) {
138 float bineff = efficiency->GetBinContent(binx, biny);
140 result1DWh->
Fill(bineff);
141 result1D->
Fill(bineff);
143 if (denominator->GetBinContent(binx, biny)) {
144 error =
sqrt(bineff * (1 - bineff) / denominator->GetBinContent(binx, biny));
147 efficiency->SetBinContent(binx, biny, 0.);
150 efficiency->SetBinError(binx, biny, error);
157 efficiency->Divide(numerator, denominator, 1, 1,
"");
159 int nbinsx = efficiency->GetNbinsX();
160 int nbinsy = efficiency->GetNbinsY();
161 for (
int binx = 1; binx <= nbinsx; ++binx) {
162 for (
int biny = 1; biny <= nbinsy; ++biny) {
164 float bineff = efficiency->GetBinContent(binx, biny);
166 if (denominator->GetBinContent(binx, biny)) {
167 error =
sqrt(bineff * (1 - bineff) / denominator->GetBinContent(binx, biny));
170 efficiency->SetBinContent(binx, biny, 0.);
173 efficiency->SetBinError(binx, biny, error);
182 string folderName = topFolder() + folder +
"/";
184 string histoname = sourceFolder + folderName +
fullName(histoTag) +
"_W" + wheel.str();
191 basedir = topFolder();
193 if (!folder.empty()) {
194 basedir += folder +
"/";
200 string hname = fullTag +
"_All";
202 globalEffDistr[fullTag] = ibooker.
book1D(hname.c_str(), hname.c_str(), 51, 0., 1.02);
210 if (hTag.find(
"Summary") != string::npos) {
211 basedir = topFolder();
213 basedir = topFolder() +
"Wheel" + wh.str() +
"/";
215 if (!folder.empty()) {
216 basedir += folder +
"/";
222 string hname = fullTag +
"_W" + wh.str();
224 string hnameAll = fullTag +
"_All_W" + wh.str();
226 LogTrace(
category()) <<
"[" << testName <<
"Test]: booking " << basedir << hname;
228 (EffDistrPerWh[wheel])[fullTag] = ibooker.
book1D(hnameAll.c_str(), hnameAll.c_str(), 51, 0., 1.02);
230 if (hTag.find(
"Phi") != string::npos || hTag.find(
"Summary") != string::npos) {
240 whME[wheel][fullTag] =
me;
244 if (hTag.find(
"Theta") != string::npos) {
253 whME[wheel][fullTag] =
me;
263 wheel << chambId.
wheel();
267 sector << chambId.
sector();
270 string HistoName = fullType +
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
272 ibooker.
setCurrentFolder(topFolder() +
"Wheel" + wheel.str() +
"/Sector" + sector.str() +
"/Station" + station.str() +
275 LogTrace(
category()) <<
"[" << testName <<
"Test]: booking " + topFolder() +
"Wheel" << wheel.str() <<
"/Sector"
276 << sector.str() <<
"/Station" << station.str() <<
"/" + folder +
"/" <<
HistoName;
278 uint32_t indexChId = chambId.
rawId();
281 trigGeomUtils->phiRange(chambId, min, max, nbins, 20);
282 if (htype.find(
"TrigEffPosvsAnglePhi") == 0) {
283 chambME[indexChId][fullType] = ibooker.
book2D(
284 HistoName.c_str(),
"Trigger efficiency (any qual.) position vs angle (Phi)", 12, -30., 30.,
nbins,
min,
max);
287 if (htype.find(
"TrigEffPosvsAngleCorrPhi") == 0) {
288 chambME[indexChId][fullType] = ibooker.
book2D(
289 HistoName.c_str(),
"Trigger efficiency (correlated) pos vs angle (Phi)", 12, -30., 30.,
nbins,
min,
max);
295 vector<string>::const_iterator iTr = trigSources.begin();
296 vector<string>::const_iterator trEnd = trigSources.end();
297 vector<string>::const_iterator iHw = hwSources.begin();
298 vector<string>::const_iterator hwEnd = hwSources.end();
301 if (
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)) {
302 for (; iTr != trEnd; ++iTr) {
304 for (; iHw != hwEnd; ++iHw) {
310 for (
int wh = -2; wh <= 2; ++wh) {
312 for (
int sect = 1; sect <= 12; ++sect) {
316 bookChambHistos(ibooker, chId,
"TrigEffPosvsAnglePhi",
"Segment");
317 bookChambHistos(ibooker, chId,
"TrigEffPosvsAngleCorrPhi",
"Segment");
322 bookWheelHistos(ibooker, wh,
"TrigEffPhi",
"");
323 bookWheelHistos(ibooker, wh,
"TrigEffCorrPhi",
"");
void makeEfficiencyME(TH2F *numerator, TH2F *denominator, MonitorElement *result2DWh, MonitorElement *result1DWh, MonitorElement *result1D)
Compute 1D/2D efficiency plots.
T getUntrackedParameter(std::string const &, T const &) const
virtual TH2F * getTH2F() const
const edm::EventSetup & c
virtual void setCurrentFolder(std::string const &fullpath)
static const char category[]
constexpr uint32_t rawId() const
get the raw id
DTTriggerEfficiencyTest(const edm::ParameterSet &ps)
Constructor.
void bookWheelHistos(DQMStore::IBooker &ibooker, int wheel, std::string hTag, std::string folder)
Book the new MEs (for each wheel)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
U second(std::pair< T, U > const &p)
virtual MonitorElement * get(std::string const &fullpath) const
void bookChambHistos(DQMStore::IBooker &ibooker, DTChamberId chambId, std::string htype, std::string folder="")
Book the new MEs (for each chamber)
std::string getMEName(std::string histoTag, std::string folder, int wh)
Get the ME name (by wheel)
void runClientDiagnostic(DQMStore::IBooker &, DQMStore::IGetter &) override
DQM Client Diagnostic.
EventID const & min(EventID const &lh, EventID const &rh)
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
BeginRun.
~DTTriggerEfficiencyTest() override
Destructor.
int station() const
Return the station number.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int wheel() const
Return the wheel number.
void Bookings(DQMStore::IBooker &, DQMStore::IGetter &)
void bookHistos(DQMStore::IBooker &ibooker, std::string hTag, std::string folder)
Book the new MEs (global)
EventID const & max(EventID const &lh, EventID const &rh)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)