CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/DQMOffline/PFTau/src/MatchMETBenchmark.cc

Go to the documentation of this file.
00001 #include "DQMOffline/PFTau/interface/MatchMETBenchmark.h"
00002 #include "DataFormats/METReco/interface/MET.h"
00003 #include "DataFormats/Candidate/interface/Candidate.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 // #include "DQMServices/Core/interface/MonitorElement.h"
00006 // #include "DQMServices/Core/interface/DQMStore.h"
00007 
00008 #include <TROOT.h>
00009 #include <TFile.h>
00010 #include <TH1.h>
00011 #include <TH2.h>
00012 
00013 using namespace std;
00014 
00015 MatchMETBenchmark::~MatchMETBenchmark() {}
00016 
00017 void MatchMETBenchmark::setup() {
00018 
00019   //std::cout << "FL: MatchMETBenchmark.cc: start setup()" << std::endl;
00020   PhaseSpace ptPS;
00021   PhaseSpace dptOvptPS;
00022   PhaseSpace dptPS;
00023   PhaseSpace dphiPS;
00024   PhaseSpace setPS;
00025   PhaseSpace dsetPS;
00026   PhaseSpace setOvsetPS;
00027 
00028   switch(mode_) {
00029   case VALIDATION:
00030     ptPS = PhaseSpace(100,0,1000);
00031     dptOvptPS = PhaseSpace( 200, -1, 1);
00032     dphiPS = PhaseSpace( 100, -3.2, 3.2);
00033     dptPS = PhaseSpace( 200, -500, 500);
00034     setPS = PhaseSpace( 300, 0.0, 3000);
00035     dsetPS = PhaseSpace( 200, 0.-1000, 1000);
00036     setOvsetPS = PhaseSpace( 500,0., 2.);
00037     break;
00038   case DQMOFFLINE:
00039   default:
00040     ptPS = PhaseSpace(50,0,200);
00041     dptOvptPS = PhaseSpace( 50, -1, 1);
00042     dphiPS = PhaseSpace( 50, -3.2, 3.2);
00043     dptPS = PhaseSpace( 50, -500, 500);
00044     setPS = PhaseSpace( 50, 0.0, 3000);
00045     dsetPS = PhaseSpace( 50, -1000.0, 1000);
00046     setOvsetPS = PhaseSpace( 100,0., 2.);
00047     break;
00048   }
00049 
00050   // variable bins to be done here, as they will save a lot of memory. 
00051 
00052   //float ptBins[11] = {0, 1, 2, 5, 10, 20, 50, 100, 200, 400, 1000};
00053 
00054   delta_et_Over_et_VS_et_ = book2D("delta_et_Over_et_VS_et_", 
00055                                    ";ME_{T, true} (GeV);#DeltaME_{T}/ME_{T}",
00056                                    ptPS.n, ptPS.m, ptPS.M,
00057                                    dptOvptPS.n, dptOvptPS.m, dptOvptPS.M );
00058 
00059   delta_et_VS_et_ = book2D("delta_et_VS_et_", 
00060                            ";ME_{T, true} (GeV);#DeltaME_{T}",
00061                            ptPS.n, ptPS.m, ptPS.M,
00062                            dptPS.n, dptPS.m, dptPS.M );
00063 
00064   delta_phi_VS_et_ = book2D("delta_phi_VS_et_", 
00065                             ";ME_{T, true} (GeV);#Delta#phi",
00066                             ptPS.n, ptPS.m, ptPS.M,
00067                             dphiPS.n, dphiPS.m, dphiPS.M );
00068 
00069   delta_ex_ = book1D("delta_ex_", 
00070                            "#DeltaME_{X}",
00071                            dptPS.n, dptPS.m, dptPS.M );
00072 
00073   RecEt_VS_TrueEt_ = book2D("RecEt_VS_TrueEt_", 
00074                            ";ME_{T, true} (GeV);ME_{T}",
00075                            ptPS.n, ptPS.m, ptPS.M,
00076                            ptPS.n, ptPS.m, ptPS.M );
00077 
00078   delta_set_VS_set_ = book2D("delta_set_VS_set_", 
00079                            ";SE_{T, true} (GeV);#DeltaSE_{T}",
00080                            setPS.n, setPS.m, setPS.M,
00081                            dsetPS.n, dsetPS.m, dsetPS.M );
00082 
00083   delta_set_Over_set_VS_set_ = book2D("delta_set_Over_set_VS_set_", 
00084                            ";SE_{T, true} (GeV);#DeltaSE_{T}/SE_{T}",
00085                            setPS.n, setPS.m, setPS.M,
00086                            dptOvptPS.n, dptOvptPS.m, dptOvptPS.M );
00087 
00088   delta_ex_VS_set_ = book2D("delta_ex_VS_set_", 
00089                            ";SE_{T, true} (GeV);#DeltaE_{X}",
00090                            setPS.n, setPS.m, setPS.M,
00091                            ptPS.n, -ptPS.M, ptPS.M );
00092 
00093   RecSet_Over_TrueSet_VS_TrueSet_ = book2D("RecSet_Over_TrueSet_VS_TrueSet_", 
00094                            ";SE_{T, true} (GeV);SE_{T}/SE_{T}",
00095                            setPS.n, setPS.m, setPS.M,
00096                            setOvsetPS.n, setOvsetPS.m, setOvsetPS.M );
00097 }
00098 
00099 void MatchMETBenchmark::fillOne(const reco::MET& cand,
00100                                       const reco::MET& matchedCand) {
00101   
00102   if( !isInRange(cand.pt(), cand.eta(), cand.phi() ) ) return;
00103   
00104   if ( matchedCand.pt()>0.001 ) delta_et_Over_et_VS_et_->Fill( matchedCand.pt(), (cand.pt() - matchedCand.pt())/matchedCand.pt() );
00105   else edm::LogWarning("MatchMETBenchmark") << " matchedCand.pt()<0.001";
00106   delta_et_VS_et_->Fill( matchedCand.pt(), cand.pt() - matchedCand.pt() );
00107   delta_phi_VS_et_->Fill( matchedCand.pt(), cand.phi() - matchedCand.phi() );
00108   delta_ex_->Fill(cand.px()-matchedCand.px());
00109   delta_ex_->Fill(cand.py()-matchedCand.py());
00110   RecEt_VS_TrueEt_->Fill(matchedCand.pt(),cand.pt());
00111   delta_set_VS_set_->Fill(matchedCand.sumEt(),cand.sumEt()-matchedCand.sumEt());
00112   if ( matchedCand.sumEt()>0.001 ) delta_set_Over_set_VS_set_->Fill(matchedCand.sumEt(),(cand.sumEt()-matchedCand.sumEt())/matchedCand.sumEt());
00113   else edm::LogWarning("MatchMETBenchmark") << " matchedCand.sumEt()<0.001";
00114   delta_ex_VS_set_->Fill(matchedCand.sumEt(),cand.px()-matchedCand.px());
00115   delta_ex_VS_set_->Fill(matchedCand.sumEt(),cand.py()-matchedCand.py());
00116   if ( matchedCand.sumEt()>0.001 ) RecSet_Over_TrueSet_VS_TrueSet_->Fill(matchedCand.sumEt(),cand.sumEt()/matchedCand.sumEt());
00117 
00118 }