8 #define BOOK1D(name,title,nbinsx,lowx,highx) \
9 h##name = dbe_ ? dbe_->book1D(#name,title,nbinsx,lowx,highx)->getTH1F() \
10 : new TH1F(#name,title,nbinsx,lowx,highx)
13 #define BOOK2D(name,title,nbinsx,lowx,highx,nbinsy,lowy,highy) \
14 h##name = dbe_ ? dbe_->book2D(#name,title,nbinsx,lowx,highx,nbinsy,lowy,highy)->getTH2F() \
15 : new TH2F(#name,title,nbinsx,lowx,highx,nbinsy,lowy,highy)
19 #define SETAXES(name,xtitle,ytitle) \
20 h##name->GetXaxis()->SetTitle(xtitle); h##name->GetYaxis()->SetTitle(ytitle)
27 #define PT (plotAgainstReco_)?"reconstructed P_{T}" :"generated P_{T}"
48 cout <<
"Benchmark output written to file " <<
outputFile_.c_str() << endl;
53 cout <<
"No output file specified ("<<
outputFile_<<
"). Results will not be saved!" << endl;
70 cout <<
"Filename to write histograms " << Filename<<endl;
71 cout <<
"PFMETBenchmark debug " <<
debug_<< endl;
73 cout <<
"benchmarkLabel " << benchmarkLabel_ << endl;
78 string path =
"PFTask/Benchmarks/"+ benchmarkLabel_ +
"/";
79 if (plotAgainstReco) path +=
"Reco";
else path +=
"Gen";
87 cout <<
"Info: DQM is not available to provide data storage service. Using TFile to save histograms. "<<endl;
91 BOOK1D(MEX,
"Particle Flow",400,-200,200);
92 BOOK1D(DeltaMEX,
"Particle Flow",400,-200,200);
93 BOOK1D(DeltaMET,
"Particle Flow",400,-200,200);
95 BOOK1D(DeltaSET,
"Particle Flow",400,-200,200);
96 BOOK2D(SETvsDeltaMET,
"Particle Flow",200, 0.0, 1000.0, 400, -200.0, 200.0);
97 BOOK2D(SETvsDeltaSET,
"Particle Flow",200, 0.0, 1000.0, 400, -200.0, 200.0);
98 profileSETvsSETresp =
new TProfile(
"#DeltaPFSET / trueSET vs trueSET",
"", 200, 0.0, 1000.0, -1.0, 1.0);
99 profileMETvsMETresp =
new TProfile(
"#DeltaPFMET / trueMET vs trueMET",
"", 50, 0.0, 200.0, -1.0, 1.0);
101 BOOK1D(CaloMEX,
"Calorimeter",400,-200,200);
102 BOOK1D(DeltaCaloMEX,
"Calorimeter",400,-200,200);
103 BOOK1D(DeltaCaloMET,
"Calorimeter",400,-200,200);
104 BOOK1D(DeltaCaloPhi,
"Calorimeter", 1000, -3.2, 3.2);
105 BOOK1D(DeltaCaloSET,
"Calorimeter",400,-200,200);
106 BOOK2D(CaloSETvsDeltaCaloMET,
"Calorimeter",200, 0.0, 1000.0, 400, -200.0, 200.0);
107 BOOK2D(CaloSETvsDeltaCaloSET,
"Calorimeter",200, 0.0, 1000.0, 400, -200.0, 200.0);
111 BOOK2D(DeltaPFMETvstrueMET,
"Particle Flow", 500, 0.0, 1000.0, 400, -200.0, 200.0);
112 BOOK2D(DeltaCaloMETvstrueMET,
"Calorimeter", 500, 0.0, 1000.0, 400, -200.0, 200.0);
113 BOOK2D(DeltaPFPhivstrueMET,
"Particle Flow", 500, 0.0, 1000.0, 400, -3.2, 3.2);
114 BOOK2D(DeltaCaloPhivstrueMET,
"Calorimeter", 500, 0.0, 1000.0, 400, -3.2, 3.2);
115 BOOK2D(CaloMETvstrueMET,
"Calorimeter", 500, 0.0, 1000.0, 500, 0.0, 1000.0);
116 BOOK2D(PFMETvstrueMET,
"Particle Flow", 500, 0.0, 1000.0, 500, 0.0, 1000.0);
118 BOOK2D(DeltaCaloMEXvstrueSET,
"Calorimeter",200, 0.0, 1000.0, 400, -200.0, 200.0);
119 BOOK2D(DeltaPFMEXvstrueSET,
"Particle Flow",200, 0.0, 1000.0, 400, -200.0, 200.0);
121 BOOK1D(TrueMET,
"MC truth", 500, 0.0, 1000.0);
125 BOOK1D(TCMEX,
"Track Corrected",400,-200,200);
126 BOOK1D(DeltaTCMEX,
"Track Corrected",400,-200,200);
127 BOOK1D(DeltaTCMET,
"Track Corrected",400,-200,200);
128 BOOK1D(DeltaTCPhi,
"Track Corrected", 1000, -3.2, 3.2);
129 BOOK1D(DeltaTCSET,
"Track Corrected",400,-200,200);
130 BOOK2D(TCSETvsDeltaTCMET,
"Track Corrected",200, 0.0, 1000.0, 400, -200.0, 200.0);
131 BOOK2D(TCSETvsDeltaTCSET,
"Track Corrected",200, 0.0, 1000.0, 400, -200.0, 200.0);
135 BOOK1D(TCMET,
"Track Corrected",500,0,1000);
136 BOOK2D(DeltaTCMETvstrueMET,
"Track Corrected", 500, 0.0, 1000.0, 400, -200.0, 200.0);
137 BOOK2D(DeltaTCPhivstrueMET,
"Track Corrected", 500, 0.0, 1000.0, 400, -3.2, 3.2);
139 BOOK2D(DeltaTCMEXvstrueSET,
"Track Corrected", 200, 0.0, 1000.0, 400, -200.0, 200.0);
140 BOOK2D(TCMETvstrueMET,
"Track Corrected", 200, 0.0, 1000.0, 500, 0.0, 1000.0);
152 SETAXES(DeltaMEX,
"#DeltaMEX",
"Events");
153 SETAXES(DeltaMET,
"#DeltaMET",
"Events");
155 SETAXES(DeltaSET,
"#DeltaSET",
"Events");
156 SETAXES(SETvsDeltaMET,
"SET",
"#DeltaMET");
157 SETAXES(SETvsDeltaSET,
"SET",
"#DeltaSET");
159 SETAXES(DeltaPFMETvstrueMET,
"trueMET",
"#DeltaMET");
160 SETAXES(DeltaCaloMETvstrueMET,
"trueMET",
"#DeltaCaloMET");
161 SETAXES(DeltaPFPhivstrueMET,
"trueMET",
"#DeltaPFPhi");
162 SETAXES(DeltaCaloPhivstrueMET,
"trueMET",
"#DeltaCaloPhi");
163 SETAXES(CaloMETvstrueMET,
"trueMET",
"CaloMET");
164 SETAXES(PFMETvstrueMET,
"trueMET",
"PFMET");
165 SETAXES(DeltaCaloMEXvstrueSET,
"trueSET",
"#DeltaCaloMEX");
166 SETAXES(DeltaPFMEXvstrueSET,
"trueSET",
"#DeltaPFMEX");
167 SETAXES(TrueMET,
"trueMET",
"Events");
170 SETAXES(TCMET,
"TCMET",
"Events");
172 SETAXES(CaloMEX,
"MEX",
"Events");
173 SETAXES(DeltaCaloMEX,
"#DeltaMEX",
"Events");
174 SETAXES(DeltaCaloMET,
"#DeltaMET",
"Events");
175 SETAXES(DeltaCaloPhi,
"#Delta#phi",
"Events");
176 SETAXES(DeltaCaloSET,
"#DeltaSET",
"Events");
177 SETAXES(CaloSETvsDeltaCaloMET,
"SET",
"#DeltaMET");
178 SETAXES(CaloSETvsDeltaCaloSET,
"SET",
"#DeltaSET");
180 SETAXES(TCMEX,
"MEX",
"Events");
181 SETAXES(DeltaTCMEX,
"#DeltaMEX",
"Events");
182 SETAXES(DeltaTCMET,
"#DeltaMET",
"Events");
183 SETAXES(DeltaTCPhi,
"#Delta#phi",
"Events");
184 SETAXES(DeltaTCSET,
"#DeltaSET",
"Events");
185 SETAXES(TCSETvsDeltaTCMET,
"SET",
"#DeltaMET");
186 SETAXES(TCSETvsDeltaTCSET,
"SET",
"#DeltaSET");
188 SETAXES(DeltaTCMETvstrueMET,
"trueMET",
"#DeltaTCMET");
189 SETAXES(DeltaTCPhivstrueMET,
"trueMET",
"#DeltaTCPhi");
191 SETAXES(DeltaTCMEXvstrueSET,
"trueSET",
"#DeltaTCMEX");
192 SETAXES(TCMETvstrueMET,
"trueMET",
"TCMET");
287 double trueMEY = 0.0;
288 double trueMEX = 0.0;;
292 for(
unsigned i = 0;
i < genParticleList.size();
i++ ) {
293 if( genParticleList[
i].
status() == 1 && fabs(genParticleList[
i].
eta()) < 5.0 ) {
299 trueMEX += genParticleList[
i].px();
300 trueMEY += genParticleList[
i].py();
338 const std::vector<reco::CaloJet>&
caloJets,
339 const std::vector<reco::CaloJet>& corr_caloJets)
345 double trueMEY = 0.0;
346 double trueMEX = 0.0;;
350 for(
unsigned i = 0;
i < genParticleList.size();
i++ ) {
351 if( genParticleList[
i].
status() == 1 && fabs(genParticleList[
i].
eta()) < 5.0 ) {
357 trueMEX += genParticleList[
i].px();
358 trueMEY += genParticleList[
i].py();
375 double caloJetCorPX = 0.0;
376 double caloJetCorPY = 0.0;
378 for(
unsigned int caloJetc=0;caloJetc<caloJets.size();++caloJetc)
384 for(
unsigned int corr_caloJetc=0;corr_caloJetc<corr_caloJets.size();++corr_caloJetc)
390 Float_t
DeltaPhi = corr_caloJets[corr_caloJetc].phi() - caloJets[caloJetc].phi();
391 Float_t DeltaEta = corr_caloJets[corr_caloJetc].eta() - caloJets[caloJetc].eta();
392 Float_t DeltaR2 = DeltaPhi*DeltaPhi + DeltaEta*DeltaEta;
393 if( DeltaR2 < 0.0001 && caloJets[caloJetc].pt() > 20.0 )
395 caloJetCorPX += (corr_caloJets[corr_caloJetc].px() - caloJets[caloJetc].px());
396 caloJetCorPY += (corr_caloJets[corr_caloJetc].py() - caloJets[caloJetc].py());
400 double corr_calomet=
sqrt((cm.
px()-caloJetCorPX)*(cm.
px()-caloJetCorPX)+(cm.
py()-caloJetCorPY)*(cm.
py()-caloJetCorPY));
404 calo_phi = atan2((cm.
py()-caloJetCorPY),(cm.
px()-caloJetCorPX));
629 const double pi = 3.14159265358979323;
630 const double pi2 = pi*2.;
631 while(angle>pi) angle -=
pi2;
632 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
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
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 py() const GCC11_FINAL
y coordinate of momentum vector
double mpi_pi(double angle)
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
void process(const reco::PFMETCollection &, const reco::GenParticleCollection &, const reco::CaloMETCollection &, const reco::METCollection &)
TH2F * hDeltaPFMETvstrueMET
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
TH2F * hDeltaTCMEXvstrueSET
TH2F * hDeltaCaloMEXvstrueSET
TH2F * hDeltaPFMEXvstrueSET
TProfile * profileCaloSETvsCaloSETresp
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
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
virtual float pt() const GCC11_FINAL
transverse momentum
TH2F * hTCSETvsDeltaTCMET
void setCurrentFolder(const std::string &fullpath)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)