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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
#include <utility>
#include "DQMOffline/Trigger/interface/EgHLTPhoHLTFilterMon.h"
#include "DQMOffline/Trigger/interface/EgHLTDQMCut.h"
#include "DQMOffline/Trigger/interface/EgHLTMonElemFuncs.h"
#include "DQMOffline/Trigger/interface/EgHLTBinData.h"
#include "DQMOffline/Trigger/interface/EgHLTCutMasks.h"
#include "DataFormats/HLTReco/interface/TriggerObject.h"
#include "DataFormats/Math/interface/deltaR.h"
using namespace egHLT;
PhoHLTFilterMon::PhoHLTFilterMon(MonElemFuncs& monElemFuncs,
std::string filterName,
TrigCodes::TrigBitSet filterBit,
const BinData& bins,
const CutMasks& masks,
bool doHEP)
: filterName_(std::move(filterName)), filterBit_(filterBit), doHEP_(doHEP) {
bool monHLTFailedPho = false;
bool doN1andSingleEffsPho = false;
std::string histname = "egamma";
phoMonElems_.push_back(new MonElemContainer<OffPho>());
//phoMonElems_.push_back(new MonElemContainer<OffPho>("_cut"," cut, debug hists ",new EgHLTDQMVarCut<OffPho>(~0x0,&OffPho::cutCode)));
for (auto& phoMonElem : phoMonElems_) {
if (doHEP_) {
monElemFuncs.initStdPhoHistsHEP(
phoMonElem->monElems(), filterName_, histname + "_passFilter" + phoMonElem->name(), bins);
} else {
monElemFuncs.initStdPhoHists(
phoMonElem->monElems(), filterName_, filterName_ + "_pho_passFilter" + phoMonElem->name(), bins);
}
}
if (monHLTFailedPho)
phoFailMonElems_.push_back(new MonElemContainer<OffPho>());
for (size_t i = 0; i < phoFailMonElems_.size(); i++) {
if (doHEP_) {
monElemFuncs.initStdPhoHistsHEP(
phoFailMonElems_[i]->monElems(), filterName_, histname + "_failFilter" + phoMonElems_[i]->name(), bins);
} else {
monElemFuncs.initStdPhoHists(phoFailMonElems_[i]->monElems(),
filterName_,
filterName_ + "_pho_failFilter" + phoMonElems_[i]->name(),
bins);
}
}
phoEffHists_.push_back(new MonElemContainer<OffPho>());
// phoEffHists_.push_back(new MonElemContainer<OffPho>("_jetTag"," Tag and Probe ",new EgJetB2BCut<OffPho>(-M_PI/12,M_PI/12,0.3)));
if (doN1andSingleEffsPho) {
for (auto& phoEffHist : phoEffHists_) {
monElemFuncs.initStdEffHists(phoEffHist->cutMonElems(),
filterName_,
filterName_ + "_pho_effVsEt" + phoEffHist->name(),
bins.et,
&OffPho::et,
masks);
monElemFuncs.initStdEffHists(phoEffHist->cutMonElems(),
filterName_,
filterName_ + "_pho_effVsEta" + phoEffHist->name(),
bins.eta,
&OffPho::eta,
masks);
/* monElemFuncs.initStdEffHists(phoEffHists_[i]->cutMonElems(),filterName_,
filterName_+"_pho_effVsPhi"+phoEffHists_[i]->name(),bins.phi,&OffPho::phi,masks);*/
}
}
if (!doHEP_) {
typedef MonElemManager<ParticlePair<OffPho>, float> DiPhoMon;
diPhoMassBothME_ = new DiPhoMon(monElemFuncs.getIB(),
filterName_ + "_diPho_bothPassFilter_mass",
filterName_ + "_diPho_bothPassFilter Mass;M_{#gamma#gamma} (GeV/c^{2})",
bins.mass.nr,
bins.mass.min,
bins.mass.max,
&ParticlePair<OffPho>::mass);
diPhoMassOnlyOneME_ = new DiPhoMon(monElemFuncs.getIB(),
filterName_ + "_diPho_onlyOnePassFilter_mass",
filterName_ + "_diPho_onlyOnePassFilter Mass;M_{#gamma#gamma} (GeV/c^{2})",
bins.mass.nr,
bins.mass.min,
bins.mass.max,
&ParticlePair<OffPho>::mass);
diPhoMassBothHighME_ = new DiPhoMon(monElemFuncs.getIB(),
filterName_ + "_diPho_bothPassFilter_massHigh",
filterName_ + "_diPho_bothPassFilter Mass;M_{#gamma#gamma} (GeV/c^{2})",
bins.massHigh.nr,
bins.massHigh.min,
bins.massHigh.max,
&ParticlePair<OffPho>::mass);
diPhoMassOnlyOneHighME_ = new DiPhoMon(monElemFuncs.getIB(),
filterName_ + "_diPho_onlyOnePassFilter_massHigh",
filterName_ + "_diPho_onlyOnePassFilter Mass;M_{#gamma#gamma} (GeV/c^{2})",
bins.massHigh.nr,
bins.massHigh.min,
bins.massHigh.max,
&ParticlePair<OffPho>::mass);
}
}
PhoHLTFilterMon::~PhoHLTFilterMon() {
for (auto& phoMonElem : phoMonElems_)
delete phoMonElem;
for (auto& phoFailMonElem : phoFailMonElems_)
delete phoFailMonElem;
for (auto& phoEffHist : phoEffHists_)
delete phoEffHist;
if (!doHEP_) {
delete diPhoMassBothME_;
delete diPhoMassOnlyOneME_;
delete diPhoMassBothHighME_;
delete diPhoMassOnlyOneHighME_;
}
}
void PhoHLTFilterMon::fill(const OffEvt& evt, float weight) {
for (size_t phoNr = 0; phoNr < evt.phos().size(); phoNr++) {
const OffPho& pho = evt.phos()[phoNr];
if ((pho.trigBits() & filterBit_) != 0) { //pho passes
for (auto& phoMonElem : phoMonElems_)
phoMonElem->fill(pho, evt, weight);
for (auto& phoEffHist : phoEffHists_)
phoEffHist->fill(pho, evt, weight);
} else { //pho didnt pass trigger
for (auto& phoFailMonElem : phoFailMonElems_)
phoFailMonElem->fill(pho, evt, weight);
}
} //end loop over photons
if ((evt.evtTrigBits() & filterBit_) != 0) {
for (size_t pho1Nr = 0; pho1Nr < evt.phos().size(); pho1Nr++) {
for (size_t pho2Nr = pho1Nr + 1; pho2Nr < evt.phos().size(); pho2Nr++) {
const OffPho& pho1 = evt.phos()[pho1Nr];
const OffPho& pho2 = evt.phos()[pho2Nr];
if (!doHEP_) {
if ((pho1.trigBits() & pho2.trigBits() & filterBit_) == filterBit_)
diPhoMassBothME_->fill(ParticlePair<OffPho>(pho1, pho2), weight);
else if ((pho1.trigBits() & filterBit_) == filterBit_ || (pho2.trigBits() & filterBit_) == filterBit_) {
diPhoMassOnlyOneME_->fill(ParticlePair<OffPho>(pho1, pho2), weight);
}
}
} //end inner pho loop
} //end outer pho loop
} //end check if filter is present
}
|