6 #define BOOK1D(name,title,nbinsx,lowx,highx) \
7 h##name = dbe_ ? dbe_->book1D(#name,title,nbinsx,lowx,highx)->getTH1F() \
8 : new TH1F(#name,title,nbinsx,lowx,highx)
11 #define BOOK2D(name,title,nbinsx,lowx,highx,nbinsy,lowy,highy) \
12 h##name = dbe_ ? dbe_->book2D(#name,title,nbinsx,lowx,highx,nbinsy,lowy,highy)->getTH2F() \
13 : new TH2F(#name,title,nbinsx,lowx,highx,nbinsy,lowy,highy)
17 #define SETAXES(name,xtitle,ytitle) \
18 h##name->GetXaxis()->SetTitle(xtitle); h##name->GetYaxis()->SetTitle(ytitle)
25 #define PT (plotAgainstReco_)?"reconstructed P_{T}" :"generated P_{T}"
44 cout <<
"Benchmark output written to file " <<
outputFile_.c_str() << endl;
49 cout <<
"No output file specified ("<<
outputFile_<<
"). Results will not be saved!" << endl;
66 cout <<
"Filename to write histograms " << Filename<<endl;
67 cout <<
"PFMETBenchmark debug " <<
debug_<< endl;
69 cout <<
"benchmarkLabel " << benchmarkLabel_ << endl;
74 string path =
"PFTask/Benchmarks/"+ benchmarkLabel_ +
"/";
75 if (plotAgainstReco) path +=
"Reco";
else path +=
"Gen";
77 dbe_->setCurrentFolder(path.c_str());
83 cout <<
"Info: DQM is not available to provide data storage service. Using TFile to save histograms. "<<endl;
87 BOOK1D(MEX,
"Particle Flow",400,-200,200);
88 BOOK1D(DeltaMEX,
"Particle Flow",400,-200,200);
89 BOOK1D(DeltaMET,
"Particle Flow",400,-200,200);
91 BOOK1D(DeltaSET,
"Particle Flow",400,-200,200);
92 BOOK2D(SETvsDeltaMET,
"Particle Flow",200, 0.0, 1000.0, 400, -200.0, 200.0);
93 BOOK2D(SETvsDeltaSET,
"Particle Flow",200, 0.0, 1000.0, 400, -200.0, 200.0);
94 profileSETvsSETresp =
new TProfile(
"#DeltaPFSET / trueSET vs trueSET",
"", 200, 0.0, 1000.0, -1.0, 1.0);
95 profileMETvsMETresp =
new TProfile(
"#DeltaPFMET / trueMET vs trueMET",
"", 50, 0.0, 200.0, -1.0, 1.0);
97 BOOK1D(CaloMEX,
"Calorimeter",400,-200,200);
98 BOOK1D(DeltaCaloMEX,
"Calorimeter",400,-200,200);
99 BOOK1D(DeltaCaloMET,
"Calorimeter",400,-200,200);
100 BOOK1D(DeltaCaloPhi,
"Calorimeter", 1000, -3.2, 3.2);
101 BOOK1D(DeltaCaloSET,
"Calorimeter",400,-200,200);
102 BOOK2D(CaloSETvsDeltaCaloMET,
"Calorimeter",200, 0.0, 1000.0, 400, -200.0, 200.0);
103 BOOK2D(CaloSETvsDeltaCaloSET,
"Calorimeter",200, 0.0, 1000.0, 400, -200.0, 200.0);
107 BOOK2D(DeltaPFMETvstrueMET,
"Particle Flow", 500, 0.0, 1000.0, 400, -200.0, 200.0);
108 BOOK2D(DeltaCaloMETvstrueMET,
"Calorimeter", 500, 0.0, 1000.0, 400, -200.0, 200.0);
109 BOOK2D(DeltaPFPhivstrueMET,
"Particle Flow", 500, 0.0, 1000.0, 400, -3.2, 3.2);
110 BOOK2D(DeltaCaloPhivstrueMET,
"Calorimeter", 500, 0.0, 1000.0, 400, -3.2, 3.2);
111 BOOK2D(CaloMETvstrueMET,
"Calorimeter", 500, 0.0, 1000.0, 500, 0.0, 1000.0);
112 BOOK2D(PFMETvstrueMET,
"Particle Flow", 500, 0.0, 1000.0, 500, 0.0, 1000.0);
114 BOOK2D(DeltaCaloMEXvstrueSET,
"Calorimeter",200, 0.0, 1000.0, 400, -200.0, 200.0);
115 BOOK2D(DeltaPFMEXvstrueSET,
"Particle Flow",200, 0.0, 1000.0, 400, -200.0, 200.0);
117 BOOK1D(TrueMET,
"MC truth", 500, 0.0, 1000.0);
121 BOOK1D(TCMEX,
"Track Corrected",400,-200,200);
122 BOOK1D(DeltaTCMEX,
"Track Corrected",400,-200,200);
123 BOOK1D(DeltaTCMET,
"Track Corrected",400,-200,200);
124 BOOK1D(DeltaTCPhi,
"Track Corrected", 1000, -3.2, 3.2);
125 BOOK1D(DeltaTCSET,
"Track Corrected",400,-200,200);
126 BOOK2D(TCSETvsDeltaTCMET,
"Track Corrected",200, 0.0, 1000.0, 400, -200.0, 200.0);
127 BOOK2D(TCSETvsDeltaTCSET,
"Track Corrected",200, 0.0, 1000.0, 400, -200.0, 200.0);
131 BOOK1D(TCMET,
"Track Corrected",500,0,1000);
132 BOOK2D(DeltaTCMETvstrueMET,
"Track Corrected", 500, 0.0, 1000.0, 400, -200.0, 200.0);
133 BOOK2D(DeltaTCPhivstrueMET,
"Track Corrected", 500, 0.0, 1000.0, 400, -3.2, 3.2);
135 BOOK2D(DeltaTCMEXvstrueSET,
"Track Corrected", 200, 0.0, 1000.0, 400, -200.0, 200.0);
136 BOOK2D(TCMETvstrueMET,
"Track Corrected", 200, 0.0, 1000.0, 500, 0.0, 1000.0);
148 SETAXES(DeltaMEX,
"#DeltaMEX",
"Events");
149 SETAXES(DeltaMET,
"#DeltaMET",
"Events");
151 SETAXES(DeltaSET,
"#DeltaSET",
"Events");
152 SETAXES(SETvsDeltaMET,
"SET",
"#DeltaMET");
153 SETAXES(SETvsDeltaSET,
"SET",
"#DeltaSET");
155 SETAXES(DeltaPFMETvstrueMET,
"trueMET",
"#DeltaMET");
156 SETAXES(DeltaCaloMETvstrueMET,
"trueMET",
"#DeltaCaloMET");
157 SETAXES(DeltaPFPhivstrueMET,
"trueMET",
"#DeltaPFPhi");
158 SETAXES(DeltaCaloPhivstrueMET,
"trueMET",
"#DeltaCaloPhi");
159 SETAXES(CaloMETvstrueMET,
"trueMET",
"CaloMET");
160 SETAXES(PFMETvstrueMET,
"trueMET",
"PFMET");
161 SETAXES(DeltaCaloMEXvstrueSET,
"trueSET",
"#DeltaCaloMEX");
162 SETAXES(DeltaPFMEXvstrueSET,
"trueSET",
"#DeltaPFMEX");
163 SETAXES(TrueMET,
"trueMET",
"Events");
166 SETAXES(TCMET,
"TCMET",
"Events");
168 SETAXES(CaloMEX,
"MEX",
"Events");
169 SETAXES(DeltaCaloMEX,
"#DeltaMEX",
"Events");
170 SETAXES(DeltaCaloMET,
"#DeltaMET",
"Events");
171 SETAXES(DeltaCaloPhi,
"#Delta#phi",
"Events");
172 SETAXES(DeltaCaloSET,
"#DeltaSET",
"Events");
173 SETAXES(CaloSETvsDeltaCaloMET,
"SET",
"#DeltaMET");
174 SETAXES(CaloSETvsDeltaCaloSET,
"SET",
"#DeltaSET");
176 SETAXES(TCMEX,
"MEX",
"Events");
177 SETAXES(DeltaTCMEX,
"#DeltaMEX",
"Events");
178 SETAXES(DeltaTCMET,
"#DeltaMET",
"Events");
179 SETAXES(DeltaTCPhi,
"#Delta#phi",
"Events");
180 SETAXES(DeltaTCSET,
"#DeltaSET",
"Events");
181 SETAXES(TCSETvsDeltaTCMET,
"SET",
"#DeltaMET");
182 SETAXES(TCSETvsDeltaTCSET,
"SET",
"#DeltaSET");
184 SETAXES(DeltaTCMETvstrueMET,
"trueMET",
"#DeltaTCMET");
185 SETAXES(DeltaTCPhivstrueMET,
"trueMET",
"#DeltaTCPhi");
187 SETAXES(DeltaTCMEXvstrueSET,
"trueSET",
"#DeltaTCMEX");
188 SETAXES(TCMETvstrueMET,
"trueMET",
"TCMET");
283 double trueMEY = 0.0;
284 double trueMEX = 0.0;;
288 for(
unsigned i = 0;
i < genParticleList.size();
i++ ) {
289 if( genParticleList[
i].
status() == 1 && fabs(genParticleList[
i].
eta()) < 5.0 ) {
295 trueMEX += genParticleList[
i].px();
296 trueMEY += genParticleList[
i].py();
334 const std::vector<reco::CaloJet>& caloJets,
335 const std::vector<reco::CaloJet>& corr_caloJets)
341 double trueMEY = 0.0;
342 double trueMEX = 0.0;;
346 for(
unsigned i = 0;
i < genParticleList.size();
i++ ) {
347 if( genParticleList[
i].
status() == 1 && fabs(genParticleList[
i].
eta()) < 5.0 ) {
353 trueMEX += genParticleList[
i].px();
354 trueMEY += genParticleList[
i].py();
371 double caloJetCorPX = 0.0;
372 double caloJetCorPY = 0.0;
374 for(
unsigned int caloJetc=0;caloJetc<caloJets.size();++caloJetc)
380 for(
unsigned int corr_caloJetc=0;corr_caloJetc<corr_caloJets.size();++corr_caloJetc)
386 Float_t
DeltaPhi = corr_caloJets[corr_caloJetc].phi() - caloJets[caloJetc].phi();
387 Float_t DeltaEta = corr_caloJets[corr_caloJetc].eta() - caloJets[caloJetc].eta();
388 Float_t DeltaR2 = DeltaPhi*DeltaPhi + DeltaEta*DeltaEta;
389 if( DeltaR2 < 0.0001 && caloJets[caloJetc].
pt() > 20.0 )
391 caloJetCorPX += (corr_caloJets[corr_caloJetc].px() - caloJets[caloJetc].px());
392 caloJetCorPY += (corr_caloJets[corr_caloJetc].py() - caloJets[caloJetc].py());
396 double corr_calomet=
sqrt((cm.
px()-caloJetCorPX)*(cm.
px()-caloJetCorPX)+(cm.
py()-caloJetCorPY)*(cm.
py()-caloJetCorPY));
400 calo_phi = atan2((cm.
py()-caloJetCorPY),(cm.
px()-caloJetCorPX));
625 const double pi = 3.14159265358979323;
626 const double pi2 = pi*2.;
627 while(angle>pi) angle -=
pi2;
628 while(angle<-pi) angle +=
pi2;
TProfile * profileTCSETvsTCSETresp
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
TProfile * profileTCMETvsTCMETresp
TH2F * hCaloSETvsDeltaCaloSET
TH2F * hDeltaPFPhivstrueMET
TH2F * hDeltaTCPhivstrueMET
TH2F * hDeltaTCMETvstrueMET
TProfile * profileMETvsMETresp
TH2F * hDeltaCaloMETvstrueMET
virtual ~PFMETBenchmark()
#define BOOK1D(name, title, nbinsx, lowx, highx)
void calculateQuantities(const reco::PFMETCollection &, const reco::GenParticleCollection &, const reco::CaloMETCollection &, const reco::METCollection &)
TH2F * hDeltaCaloPhivstrueMET
TProfile * profileSETvsSETresp
#define SETAXES(name, xtitle, ytitle)
TH2F * hCaloSETvsDeltaCaloMET
std::vector< reco::MET > METCollection
collection of MET objects
#define BOOK2D(name, title, nbinsx, lowx, highx, nbinsy, lowy, highy)
virtual double pt() const
transverse momentum
double mpi_pi(double angle)
void process(const reco::PFMETCollection &, const reco::GenParticleCollection &, const reco::CaloMETCollection &, const reco::METCollection &)
tuple path
else: Piece not in the list, fine.
TH2F * hDeltaPFMETvstrueMET
Abs< T >::type abs(const T &t)
TH2F * hDeltaTCMEXvstrueSET
TH2F * hDeltaCaloMEXvstrueSET
TH2F * hDeltaPFMEXvstrueSET
TProfile * profileCaloSETvsCaloSETresp
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
virtual double px() const
x coordinate of momentum vector
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
void setup(std::string Filename, bool debug, bool plotAgainstReco=0, std::string benchmarkLabel_="ParticleFlow", DQMStore *dbe_store=NULL)
TH2F * hTCSETvsDeltaTCSET
TProfile * profileCaloMETvsCaloMETresp
TH2F * hTCSETvsDeltaTCMET
virtual double phi() const
momentum azimuthal angle
virtual double py() const
y coordinate of momentum vector
T angle(T x1, T y1, T z1, T x2, T y2, T z2)