Skip to content

Commit f046f45

Browse files
authored
Merge pull request #8 from silviodonato/fixDQMscouting
Code-format
2 parents cbcad39 + 7187aa8 commit f046f45

12 files changed

+1114
-1355
lines changed

HLTriggerOffline/Scouting/plugins/ElectronEfficiencyPlotter.cc

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ using namespace edm;
1919
using namespace std;
2020

2121
// Constructor
22-
ElectronEfficiencyPlotter::ElectronEfficiencyPlotter(
23-
const edm::ParameterSet &ps) {
22+
ElectronEfficiencyPlotter::ElectronEfficiencyPlotter(const edm::ParameterSet &ps) {
2423
ptBin_ = ps.getParameter<int>("ptBin");
2524
ptMin_ = ps.getParameter<double>("ptMin");
2625
ptMax_ = ps.getParameter<double>("ptMax");
@@ -30,22 +29,17 @@ ElectronEfficiencyPlotter::ElectronEfficiencyPlotter(
3029
sourceFolder_ = ps.getParameter<string>("srcFolder");
3130
}
3231

33-
void ElectronEfficiencyPlotter::dqmEndJob(DQMStore::IBooker &ibooker,
34-
DQMStore::IGetter &igetter) {
32+
void ElectronEfficiencyPlotter::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) {
3533
ibooker.setCurrentFolder(theFolder_);
3634

3735
h_eff_pt_EB_doubleEG_HLT =
38-
ibooker.book1D("Eff_pt_barrel_DSTdoubleEG",
39-
"DSTdoubleEG Eff. vs Pt (barrel)", ptBin_, ptMin_, ptMax_);
36+
ibooker.book1D("Eff_pt_barrel_DSTdoubleEG", "DSTdoubleEG Eff. vs Pt (barrel)", ptBin_, ptMin_, ptMax_);
4037
h_eff_pt_EE_doubleEG_HLT =
41-
ibooker.book1D("Eff_pt_endcap_DSTdoubleEG",
42-
"DSTdoubleEG Eff. vs Pt (endcap)", ptBin_, ptMin_, ptMax_);
43-
h_eff_pt_EB_singlePhoton_HLT = ibooker.book1D(
44-
"Eff_pt_barrel_DSTsinglePhoton", "DSTsinglePhoton Eff. vs Pt (barrel)",
45-
ptBin_, ptMin_, ptMax_);
46-
h_eff_pt_EE_singlePhoton_HLT = ibooker.book1D(
47-
"Eff_pt_endcap_DSTsinglePhoton", "DSTsinglePhoton Eff. vs Pt (endcap)",
48-
ptBin_, ptMin_, ptMax_);
38+
ibooker.book1D("Eff_pt_endcap_DSTdoubleEG", "DSTdoubleEG Eff. vs Pt (endcap)", ptBin_, ptMin_, ptMax_);
39+
h_eff_pt_EB_singlePhoton_HLT =
40+
ibooker.book1D("Eff_pt_barrel_DSTsinglePhoton", "DSTsinglePhoton Eff. vs Pt (barrel)", ptBin_, ptMin_, ptMax_);
41+
h_eff_pt_EE_singlePhoton_HLT =
42+
ibooker.book1D("Eff_pt_endcap_DSTsinglePhoton", "DSTsinglePhoton Eff. vs Pt (endcap)", ptBin_, ptMin_, ptMax_);
4943

5044
// Axis title
5145
h_eff_pt_EB_singlePhoton_HLT->setAxisTitle("p_{T} (GeV)", 1);
@@ -69,42 +63,38 @@ void ElectronEfficiencyPlotter::dqmEndJob(DQMStore::IBooker &ibooker,
6963
igetter.get(sourceFolder_ +
7064
"/resonanceZ_Tag_pat_Probe_sctElectron_passSinglePhoton_DST_"
7165
"fireTrigObj_Pt_Endcap");
72-
MonitorElement *Denominator_pt_barrel = igetter.get(
73-
sourceFolder_ + "/resonanceZ_Tag_pat_Probe_sctElectron_Pt_Barrel");
74-
MonitorElement *Denominator_pt_endcap = igetter.get(
75-
sourceFolder_ + "/resonanceZ_Tag_pat_Probe_sctElectron_Pt_Endcap");
66+
MonitorElement *Denominator_pt_barrel =
67+
igetter.get(sourceFolder_ + "/resonanceZ_Tag_pat_Probe_sctElectron_Pt_Barrel");
68+
MonitorElement *Denominator_pt_endcap =
69+
igetter.get(sourceFolder_ + "/resonanceZ_Tag_pat_Probe_sctElectron_Pt_Endcap");
7670

7771
if (Numerator_pt_barrel_doubleEG_hlt && Denominator_pt_barrel)
78-
calculateEfficiency(Numerator_pt_barrel_doubleEG_hlt, Denominator_pt_barrel,
79-
h_eff_pt_EB_doubleEG_HLT);
72+
calculateEfficiency(Numerator_pt_barrel_doubleEG_hlt, Denominator_pt_barrel, h_eff_pt_EB_doubleEG_HLT);
8073
if (Numerator_pt_endcap_doubleEG_hlt && Denominator_pt_endcap)
81-
calculateEfficiency(Numerator_pt_endcap_doubleEG_hlt, Denominator_pt_endcap,
82-
h_eff_pt_EE_doubleEG_HLT);
74+
calculateEfficiency(Numerator_pt_endcap_doubleEG_hlt, Denominator_pt_endcap, h_eff_pt_EE_doubleEG_HLT);
8375
if (Numerator_pt_barrel_singlePhoton_hlt && Denominator_pt_barrel)
84-
calculateEfficiency(Numerator_pt_barrel_singlePhoton_hlt,
85-
Denominator_pt_barrel, h_eff_pt_EB_singlePhoton_HLT);
76+
calculateEfficiency(Numerator_pt_barrel_singlePhoton_hlt, Denominator_pt_barrel, h_eff_pt_EB_singlePhoton_HLT);
8677
if (Numerator_pt_endcap_singlePhoton_hlt && Denominator_pt_endcap)
87-
calculateEfficiency(Numerator_pt_endcap_singlePhoton_hlt,
88-
Denominator_pt_endcap, h_eff_pt_EE_singlePhoton_HLT);
78+
calculateEfficiency(Numerator_pt_endcap_singlePhoton_hlt, Denominator_pt_endcap, h_eff_pt_EE_singlePhoton_HLT);
8979
}
9080

91-
void ElectronEfficiencyPlotter::calculateEfficiency(
92-
MonitorElement *Numerator, MonitorElement *Denominator,
93-
MonitorElement *Efficiency) {
81+
void ElectronEfficiencyPlotter::calculateEfficiency(MonitorElement *Numerator,
82+
MonitorElement *Denominator,
83+
MonitorElement *Efficiency) {
9484
TH1F *h_numerator_pt = Numerator->getTH1F();
9585
TH1F *h_denominator_pt = Denominator->getTH1F();
9686
TH1F *h_eff_pt = Efficiency->getTH1F();
97-
if (h_eff_pt->GetSumw2N() == 0) h_eff_pt->Sumw2();
87+
if (h_eff_pt->GetSumw2N() == 0)
88+
h_eff_pt->Sumw2();
9889

9990
// ReBin
10091
int nBins = h_eff_pt->GetNbinsX();
10192
double *binEdges = new double[nBins + 1];
102-
for (int i = 0; i <= nBins; i++) binEdges[i] = h_eff_pt->GetBinLowEdge(i + 1);
93+
for (int i = 0; i <= nBins; i++)
94+
binEdges[i] = h_eff_pt->GetBinLowEdge(i + 1);
10395

104-
TH1F *h_numerator_pt_rebin =
105-
(TH1F *)h_numerator_pt->Rebin(nBins, "num_pt_rebinned", binEdges);
106-
TH1F *h_denominator_pt_rebin =
107-
(TH1F *)h_denominator_pt->Rebin(nBins, "num_pt_rebinned", binEdges);
96+
TH1F *h_numerator_pt_rebin = (TH1F *)h_numerator_pt->Rebin(nBins, "num_pt_rebinned", binEdges);
97+
TH1F *h_denominator_pt_rebin = (TH1F *)h_denominator_pt->Rebin(nBins, "num_pt_rebinned", binEdges);
10898
h_eff_pt->Divide(h_numerator_pt_rebin, h_denominator_pt_rebin, 1., 1., "B");
10999
}
110100

HLTriggerOffline/Scouting/plugins/ElectronEfficiencyPlotter.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
#include "FWCore/ServiceRegistry/interface/Service.h"
1414

1515
class ElectronEfficiencyPlotter : public DQMEDHarvester {
16-
public:
16+
public:
1717
// Constructor
1818
ElectronEfficiencyPlotter(const edm::ParameterSet& ps);
1919
// Destructor
2020
~ElectronEfficiencyPlotter() override = default;
2121

22-
protected:
22+
protected:
2323
// DQM Client Diagnostic
2424
void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override;
2525

26-
private:
26+
private:
2727
// counters
2828

2929
int ptBin_;
@@ -39,9 +39,7 @@ class ElectronEfficiencyPlotter : public DQMEDHarvester {
3939

4040
std::string theFolder_;
4141
std::string sourceFolder_;
42-
void calculateEfficiency(MonitorElement* Numerator,
43-
MonitorElement* Denominator,
44-
MonitorElement* Efficiency);
42+
void calculateEfficiency(MonitorElement* Numerator, MonitorElement* Denominator, MonitorElement* Efficiency);
4543
};
4644

4745
#endif

0 commit comments

Comments
 (0)