11 #define BOOK1D(name, title, nbinsx, lowx, highx) \
13 DQM ? DQM->book1D(#name, title, nbinsx, lowx, highx)->getTH1F() : new TH1F(#name, title, nbinsx, lowx, highx)
16 #define BOOK2D(name, title, nbinsx, lowx, highx, nbinsy, lowy, highy) \
17 h##name = DQM ? DQM->book2D(#name, title, nbinsx, lowx, highx, nbinsy, lowy, highy)->getTH2F() \
18 : new TH2F(#name, title, nbinsx, lowx, highx, nbinsy, lowy, highy)
23 #define SETAXES(name, xtitle, ytitle) \
24 h##name->GetXaxis()->SetTitle(xtitle); \
25 h##name->GetYaxis()->SetTitle(ytitle)
27 #define ET (PlotAgainstReco_) ? "reconstructed E_{T} [GeV]" : "generated E_{T} [GeV]"
28 #define ETA (PlotAgainstReco_) ? "reconstructed #eta" : "generated #eta"
29 #define PHI (PlotAgainstReco_) ? "reconstructed #phi (rad)" : "generated #phi (rad)"
38 bool PlotAgainstReco_,
70 int nbinsDeltaEta = 1000;
74 int nbinsDeltaPhi = 1000;
79 BOOK1D(DeltaEt,
"#DeltaE_{T}", nbinsEt, minDeltaEt, maxDeltaEt);
80 BOOK1D(DeltaEx,
"#DeltaE_{X}", nbinsEt, minDeltaEt, maxDeltaEt);
81 BOOK1D(DeltaEy,
"#DeltaE_{Y}", nbinsEt, minDeltaEt, maxDeltaEt);
82 BOOK2D(DeltaEtvsEt,
"#DeltaE_{T} vs E_{T}", nbinsEt, minEt, maxEt, nbinsEt, minDeltaEt, maxDeltaEt);
83 BOOK2D(DeltaEtOverEtvsEt,
"#DeltaE_{T}/E_{T} vsE_{T}", nbinsEt, minEt, maxEt, nbinsEt, -1, 1);
84 BOOK2D(DeltaEtvsEta,
"#DeltaE_{T} vs #eta", nbinsEta, minEta, maxEta, nbinsEt, minDeltaEt, maxDeltaEt);
85 BOOK2D(DeltaEtOverEtvsEta,
"#DeltaE_{T}/E_{T} vs #eta", nbinsEta, minEta, maxEta, 100, -1, 1);
86 BOOK2D(DeltaEtvsPhi,
"#DeltaE_{T} vs #phi", 200, -
M_PI,
M_PI, nbinsEt, minDeltaEt, maxDeltaEt);
87 BOOK2D(DeltaEtOverEtvsPhi,
"#DeltaE_{T}/E_{T} vs #Phi", 200, -
M_PI,
M_PI, 100, -1, 1);
88 BOOK2D(DeltaEtvsDeltaR,
"#DeltaE_{T} vs #DeltaR", 100, 0, 1, nbinsEt, minDeltaEt, maxDeltaEt);
89 BOOK2D(DeltaEtOverEtvsDeltaR,
"#DeltaE_{T}/E_{T} vs #DeltaR", 100, 0, 1, 100, -1, 1);
92 BOOK1D(
DeltaEta,
"#Delta#eta", nbinsDeltaEta, minDeltaEta, maxDeltaEta);
93 BOOK2D(DeltaEtavsEt,
"#Delta#eta vs E_{T}", nbinsEt, minEt, maxEt, nbinsDeltaEta, minDeltaEta, maxDeltaEta);
94 BOOK2D(DeltaEtavsEta,
"#Delta#eta vs #eta", nbinsEta, minEta, maxEta, nbinsDeltaEta, minDeltaEta, maxDeltaEta);
97 BOOK1D(
DeltaPhi,
"#Delta#phi", nbinsDeltaPhi, minDeltaPhi, maxDeltaPhi);
98 BOOK2D(DeltaPhivsEt,
"#Delta#phi vs E_{T}", nbinsEt, minEt, maxEt, nbinsDeltaPhi, minDeltaPhi, maxDeltaPhi);
99 BOOK2D(DeltaPhivsEta,
"#Delta#phi vs #eta", nbinsEta, minEta, maxEta, nbinsDeltaPhi, minDeltaPhi, maxDeltaPhi);
103 BOOK2D(DeltaRvsEt,
"#DeltaR vs E_{T}", nbinsEt, minEt, maxEt, 100, 0, 1);
104 BOOK2D(DeltaRvsEta,
"#DeltaR vs #eta", nbinsEta, minEta, maxEta, 100, 0, 1);
106 BOOK1D(NRec,
"Number of reconstructed objects", 20, 0, 20);
109 BOOK1D(EtaSeen,
"seen #eta", 100, -5, 5);
110 BOOK1D(PhiSeen,
"seen #phi", 100, -3.5, 3.5);
111 BOOK1D(EtSeen,
"seen E_{T}", nbinsEt, minEt, maxEt);
112 BOOK2D(EtvsEtaSeen,
"seen E_{T} vs eta", 100, -5, 5, 200, 0, 200);
113 BOOK2D(EtvsPhiSeen,
"seen E_{T} vs seen #phi", 100, -3.5, 3.5, 200, 0, 200);
115 BOOK1D(PhiRec,
"Rec #phi", 100, -3.5, 3.5);
116 BOOK1D(EtRec,
"Rec E_{T}", nbinsEt, minEt, maxEt);
117 BOOK1D(ExRec,
"Rec E_{X}", nbinsEt, -maxEt, maxEt);
118 BOOK1D(EyRec,
"Rec E_{Y}", nbinsEt, -maxEt, maxEt);
120 BOOK2D(EtRecvsEt,
"Rec E_{T} vs E_{T}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
121 BOOK2D(EtRecOverTrueEtvsTrueEt,
"Rec E_{T} / E_{T} vs E_{T}", nbinsEt, minEt, maxEt, 1000, 0., 100.);
123 BOOK1D(EtaGen,
"generated #eta", 100, -5, 5);
124 BOOK1D(PhiGen,
"generated #phi", 100, -3.5, 3.5);
125 BOOK1D(EtGen,
"generated E_{T}", nbinsEt, minEt, maxEt);
126 BOOK2D(EtvsEtaGen,
"generated E_{T} vs generated #eta", 100, -5, 5, 200, 0, 200);
127 BOOK2D(EtvsPhiGen,
"generated E_{T} vs generated #phi", 100, -3.5, 3.5, 200, 0, 200);
129 BOOK1D(NGen,
"Number of generated objects", 20, 0, 20);
132 BOOK1D(SumEt,
"SumEt", 1000, 0., 3000.);
133 BOOK1D(TrueSumEt,
"TrueSumEt", 1000, 0., 3000.);
134 BOOK2D(DeltaSetvsSet,
"#DeltaSEt vs trueSEt", 3000, 0., 3000., 1000, -1000., 1000.);
135 BOOK2D(DeltaMexvsSet,
"#DeltaMEX vs trueSEt", 3000, 0., 3000., 1000, -400., 400.);
136 BOOK2D(DeltaSetOverSetvsSet,
"#DeltaSetOverSet vs trueSet", 3000, 0., 3000., 1000, -1., 1.);
137 BOOK2D(RecSetvsTrueSet,
"Set vs trueSet", 3000, 0., 3000., 3000, 0., 3000.);
138 BOOK2D(RecSetOverTrueSetvsTrueSet,
"Set/trueSet vs trueSet", 3000, 0., 3000., 500, 0., 2.);
139 BOOK2D(TrueMexvsTrueSet,
"trueMex vs trueSet", 3000, 0., 3000., nbinsEt, -maxEt, maxEt);
147 SETAXES(DeltaEt,
"#DeltaE_{T} [GeV]",
"");
148 SETAXES(DeltaEx,
"#DeltaE_{X} [GeV]",
"");
149 SETAXES(DeltaEy,
"#DeltaE_{Y} [GeV]",
"");
150 SETAXES(DeltaEtvsEt,
ET,
"#DeltaE_{T} [GeV]");
151 SETAXES(DeltaEtOverEtvsEt,
ET,
"#DeltaE_{T}/E_{T}");
152 SETAXES(DeltaEtvsEta,
ETA,
"#DeltaE_{T} [GeV]");
153 SETAXES(DeltaEtOverEtvsEta,
ETA,
"#DeltaE_{T}/E_{T}");
154 SETAXES(DeltaEtvsPhi,
PHI,
"#DeltaE_{T} [GeV]");
155 SETAXES(DeltaEtOverEtvsPhi,
PHI,
"#DeltaE_{T}/E_{T}");
156 SETAXES(DeltaEtvsDeltaR,
"#DeltaR",
"#DeltaE_{T} [GeV]");
157 SETAXES(DeltaEtOverEtvsDeltaR,
"#DeltaR",
"#DeltaE_{T}/E_{T}");
166 SETAXES(DeltaPhivsEt,
ET,
"#Delta#phi [rad]");
167 SETAXES(DeltaPhivsEta,
ETA,
"#Delta#phi [rad]");
174 SETAXES(NRec,
"Number of Rec Objects",
"");
176 SETAXES(EtaSeen,
"seen #eta",
"");
177 SETAXES(PhiSeen,
"seen #phi [rad]",
"");
178 SETAXES(EtSeen,
"seen E_{T} [GeV]",
"");
179 SETAXES(EtvsEtaSeen,
"seen #eta",
"seen E_{T}");
180 SETAXES(EtvsPhiSeen,
"seen #phi [rad]",
"seen E_{T}");
182 SETAXES(PhiRec,
"#phi [rad]",
"");
183 SETAXES(EtRec,
"E_{T} [GeV]",
"");
184 SETAXES(ExRec,
"E_{X} [GeV]",
"");
185 SETAXES(EyRec,
"E_{Y} [GeV]",
"");
186 SETAXES(EtRecvsEt,
ET,
"Rec E_{T} [GeV]");
187 SETAXES(EtRecOverTrueEtvsTrueEt,
ET,
"Rec E_{T} / E_{T} [GeV]");
189 SETAXES(EtaGen,
"generated #eta",
"");
190 SETAXES(PhiGen,
"generated #phi [rad]",
"");
191 SETAXES(EtGen,
"generated E_{T} [GeV]",
"");
192 SETAXES(EtvsPhiGen,
"generated #phi [rad]",
"generated E_{T} [GeV]");
193 SETAXES(EtvsEtaGen,
"generated #eta",
"generated E_{T} [GeV]");
195 SETAXES(NGen,
"Number of Gen Objects",
"");
198 SETAXES(SumEt,
"SumEt [GeV]",
"");
199 SETAXES(TrueSumEt,
"TrueSumEt [GeV]",
"");
200 SETAXES(DeltaSetvsSet,
"TrueSumEt",
"#DeltaSumEt [GeV]");
201 SETAXES(DeltaMexvsSet,
"TrueSumEt",
"#DeltaMEX [GeV]");
202 SETAXES(DeltaSetOverSetvsSet,
"TrueSumEt",
"#DeltaSumEt/trueSumEt");
203 SETAXES(RecSetvsTrueSet,
"TrueSumEt",
"SumEt");
204 SETAXES(RecSetOverTrueSetvsTrueSet,
"TrueSumEt",
"SumEt/trueSumEt");
205 SETAXES(TrueMexvsTrueSet,
"TrueSumEt",
"TrueMEX");
208 TDirectory* oldpwd = gDirectory;
210 TIter
next(gROOT->GetListOfFiles());
212 const bool debug =
false;
214 while (TFile*
file = (TFile*)
next()) {
216 cout <<
"file " <<
file->GetName() << endl;
219 cout <<
"DQM subdir" << endl;
220 cout << DQM->
pwd().c_str() << endl;
226 cout <<
"current dir" << endl;
233 doMetPlots_ = doMetPlots;
241 double maxEtaCut)
const {
243 if (particle->
pt() < ptCut and ptCut != -1.)
246 if (fabs(particle->
eta()) > maxEtaCut and maxEtaCut > 0)
248 if (fabs(particle->
eta()) < minEtaCut and minEtaCut > 0)
260 double et = genParticle->
et();
261 double eta = genParticle->
eta();
262 double phi = genParticle->
phi();
270 if (plotAgainstReco) {
271 et = recParticle->
et();
272 eta = recParticle->
eta();
273 phi = recParticle->
phi();
277 double deltaEt =
algo_->deltaEt(recParticle, genParticle);
278 double deltaR =
algo_->deltaR(recParticle, genParticle);
285 if (deltaR > deltaR_cut && deltaR_cut != -1.)
288 hDeltaEt->Fill(deltaEt);
289 hDeltaEx->Fill(recParticle->
px() - genParticle->
px());
290 hDeltaEy->Fill(recParticle->
py() - genParticle->
py());
291 hDeltaEtvsEt->Fill(et, deltaEt);
292 hDeltaEtOverEtvsEt->Fill(et, deltaEt / et);
293 hDeltaEtvsEta->Fill(eta, deltaEt);
294 hDeltaEtOverEtvsEta->Fill(eta, deltaEt / et);
295 hDeltaEtvsPhi->Fill(phi, deltaEt);
296 hDeltaEtOverEtvsPhi->Fill(phi, deltaEt / et);
297 hDeltaEtvsDeltaR->Fill(deltaR, deltaEt);
298 hDeltaEtOverEtvsDeltaR->Fill(deltaR, deltaEt / et);
300 hDeltaEta->Fill(deltaEta);
301 hDeltaEtavsEt->Fill(et, deltaEta);
302 hDeltaEtavsEta->Fill(eta, deltaEta);
304 hDeltaPhi->Fill(deltaPhi);
305 hDeltaPhivsEt->Fill(et, deltaPhi);
306 hDeltaPhivsEta->Fill(eta, deltaPhi);
309 hDeltaRvsEt->Fill(et, deltaR);
310 hDeltaRvsEta->Fill(eta, deltaR);
321 if (met1 !=
nullptr && met2 !=
nullptr) {
323 hTrueSumEt->Fill((*met1).sumEt());
324 hSumEt->Fill((*met2).sumEt());
325 hDeltaSetvsSet->Fill((*met1).sumEt(), (*met2).sumEt() - (*met1).sumEt());
326 hDeltaMexvsSet->Fill((*met1).sumEt(), recParticle->
px() - genParticle->
px());
327 hDeltaMexvsSet->Fill((*met1).sumEt(), recParticle->
py() - genParticle->
py());
328 if ((*met1).sumEt() > 0.01)
329 hDeltaSetOverSetvsSet->Fill((*met1).sumEt(), ((*met2).sumEt() - (*met1).sumEt()) / (*met1).sumEt());
330 hRecSetvsTrueSet->Fill((*met1).sumEt(), (*met2).sumEt());
331 hRecSetOverTrueSetvsTrueSet->Fill((*met1).sumEt(), (*met2).sumEt() / ((*met1).sumEt()));
332 hTrueMexvsTrueSet->Fill((*met1).sumEt(), (*met1).px());
333 hTrueMexvsTrueSet->Fill((*met1).sumEt(), (*met1).py());
335 std::cout <<
"Warning : reco::MET* == NULL" << std::endl;
343 if (!Filename.empty() && file_)
344 file_->Write(Filename.c_str());
void fillHistos(const reco::Candidate *genParticle, const reco::Candidate *recParticle, double deltaR_cut, bool plotAgainstReco)
void Fill(double xEntry, double yEntry, double zEntry, double path, double path_x, double SM, double pAbs, double En, int type)
virtual double et() const =0
transverse energy
virtual double pt() const =0
transverse momentum
#define BOOK1D(name, title, nbinsx, lowx, highx)
void setfile(TFile *file)
std::string pwd() override
bool accepted(const reco::Candidate *particle, double ptCut, double minEtaCut, double maxEtaCut) const
static const double deltaEta
virtual ~GenericBenchmark() noexcept(false)
#define BOOK2D(name, title, nbinsx, lowx, highx, nbinsy, lowy, highy)
virtual double py() const =0
y coordinate of momentum vector
virtual double px() const =0
x coordinate of momentum vector
void write(std::string Filename)
#define SETAXES(name, xtitle, ytitle)
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity
void setup(DQMStore *DQM=nullptr, bool PlotAgainstReco_=true, float minDeltaEt=-100., float maxDeltaEt=50., float minDeltaPhi=-0.5, float maxDeltaPhi=0.5, bool doMetPlots=false)