#include <JetMETCorrections/MCJet/plugins/SimJetResponseAnalysis.h>
Public Member Functions | |
void | analyze (const reco::GenJetCollection &genjets, const reco::CaloJetCollection &recjets, const reco::GenMETCollection &genmet, const reco::CaloMETCollection &recmet) |
virtual void | analyze (edm::Event const &e, edm::EventSetup const &iSetup) |
void | bookGeneralHistograms () |
void | bookHistograms () |
void | bookJetHistograms (const TString &prefix) |
void | bookMetHists (const TString &prefix) |
void | bookSimJetResponse () |
void | done () |
virtual void | endJob () |
void | fillHist1D (const TString &histName, const Double_t &x, const Double_t &wt=1.0) |
void | fillHist2D (const TString &histName, const Double_t &x, const Double_t &y, const Double_t &wt=1.0) |
template<typename T> | |
void | fillJetHists (const T &jets, const TString &prefx) |
template<typename T> | |
void | fillMetHists (const T &mets, const TString &prefx) |
int | GetEtaBin (double eta) |
int | GetPtBin (double GenPtJet) |
void | GetSimJetResponse () |
SimJetResponseAnalysis () | |
SimJetResponseAnalysis (edm::ParameterSet const &cfg) | |
void | SimulatedJetResponse (const reco::GenJetCollection &genjets, const reco::CaloJetCollection &calojets) |
int | TowerNumber (double eta) |
Private Attributes | |
TString | calopfx |
std::vector< double > | GenJetPtBins_ |
std::string | genjets_ |
std::string | genmet_ |
TString | gjetpfx |
TString | gmetpfx |
TFile * | hist_file_ |
std::string | histogramFile_ |
std::map< TString, TH1 * > | m_HistNames1D |
std::map< TString, TH2 * > | m_HistNames2D |
std::map< TString, TGraph * > | m_HistNamesGraph |
std::map< TString, TProfile * > | m_HistNamesProf |
double | MatchRadius_ |
int | NEtaBins |
int | NJetMax_ |
int | NPtBins |
std::vector< double > | RecJetEtaBins_ |
double | RecJetPtMin_ |
std::string | recjets_ |
std::string | recmet_ |
TString | rjetpfx |
TString | rmetpfx |
Definition at line 32 of file SimJetResponseAnalysis.h.
SimJetResponseAnalysis::SimJetResponseAnalysis | ( | edm::ParameterSet const & | cfg | ) | [explicit] |
Definition at line 40 of file SimJetResponseAnalysis.cc.
References bookHistograms(), GenJetPtBins_, genjets_, genmet_, edm::ParameterSet::getParameter(), hist_file_, histogramFile_, i, MatchRadius_, NEtaBins, NJetMax_, NPtBins, RecJetEtaBins_, RecJetPtMin_, recjets_, and recmet_.
00040 { 00041 00042 // std::cout << " Beginning SimJetResponse Analysis " << std::endl; 00043 00044 MatchRadius_ = 0.2; 00045 RecJetPtMin_ = 5.; 00046 NJetMax_ = 2; 00047 00048 genjets_ = cfg.getParameter<std::string> ("genjets"); 00049 recjets_ = cfg.getParameter<std::string> ("recjets"); 00050 genmet_ = cfg.getParameter<std::string> ("genmet"); 00051 recmet_ = cfg.getParameter<std::string> ("recmet"); 00052 00053 NJetMax_ = cfg.getParameter<int> ("NJetMax"); 00054 MatchRadius_ =cfg.getParameter<double> ("MatchRadius"); 00055 RecJetPtMin_ =cfg.getParameter<double> ("RecJetPtMin"); 00056 GenJetPtBins_ =cfg.getParameter< std::vector<double> >("GenJetPtBins"); 00057 std::vector<double> EtaBins =cfg.getParameter< std::vector<double> >("RecJetEtaBins"); 00058 00059 int nb=EtaBins.size(); 00060 for(int i=nb;i>1;i--){RecJetEtaBins_.push_back(-1.0*EtaBins[i-1]);} 00061 for(int i=0;i<nb;i++){RecJetEtaBins_.push_back(EtaBins[i]);} 00062 00063 histogramFile_= cfg.getParameter<std::string> ("HistogramFile"), 00064 00065 hist_file_=new TFile(histogramFile_.c_str(),"RECREATE"); 00066 00067 NPtBins = GenJetPtBins_.size()-1; 00068 NEtaBins = RecJetEtaBins_.size()-1; 00069 00070 bookHistograms(); 00071 00072 }
SimJetResponseAnalysis::SimJetResponseAnalysis | ( | ) |
Definition at line 103 of file SimJetResponseAnalysis.cc.
References hist_file_.
00103 { 00104 hist_file_=0; // set to null 00105 }
void SimJetResponseAnalysis::analyze | ( | const reco::GenJetCollection & | genjets, | |
const reco::CaloJetCollection & | recjets, | |||
const reco::GenMETCollection & | genmet, | |||
const reco::CaloMETCollection & | recmet | |||
) |
void SimJetResponseAnalysis::analyze | ( | edm::Event const & | e, | |
edm::EventSetup const & | iSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 77 of file SimJetResponseAnalysis.cc.
References genjets_, genmet_, recjets_, and recmet_.
00077 { 00078 00079 // To get information from the event setup, you must request the "Record" 00080 // which contains it and then extract the object you need 00081 // edm::ESHandle<CaloGeometry> geometry; 00082 // iSetup.get<IdealGeometryRecord>().get(geometry); 00083 00084 // These declarations create handles to the types of records that you want 00085 // to retrieve from event "event". 00086 00087 // We assume that GenJet are sorted in Pt 00088 00089 edm::Handle<GenJetCollection> genjets; 00090 edm::Handle<CaloJetCollection> recjets; 00091 edm::Handle<GenMETCollection> genmet; 00092 edm::Handle<CaloMETCollection> recmet; 00093 00094 event.getByLabel (genjets_,genjets); 00095 event.getByLabel (recjets_,recjets); 00096 event.getByLabel (genmet_,genmet); 00097 event.getByLabel (recmet_,recmet); 00098 00099 analyze(*genjets,*recjets,*genmet,*recmet); 00100 }
void SimJetResponseAnalysis::bookGeneralHistograms | ( | ) |
Definition at line 157 of file SimJetResponseAnalysis.cc.
References m_HistNames1D.
Referenced by bookHistograms().
00157 { 00158 00159 TString hname; 00160 TString htitle; 00161 00162 hname= "nevents"; 00163 00164 m_HistNames1D[hname] = new TH1F(hname,hname,20,0.0,20.0); 00165 m_HistNames1D[hname]->GetXaxis()->SetBinLabel(1,"Total"); 00166 m_HistNames1D[hname]->GetXaxis()->SetBinLabel(2,"TwoJets"); 00167 m_HistNames1D[hname]->GetXaxis()->SetBinLabel(3,"Central"); 00168 m_HistNames1D[hname]->GetXaxis()->SetBinLabel(4,"AvePt"); 00169 m_HistNames1D[hname]->GetXaxis()->SetBinLabel(5,"DeltaPhi"); 00170 m_HistNames1D[hname]->GetXaxis()->SetBinLabel(6,"ThirdJet"); 00171 00172 m_HistNames1D[hname]->GetXaxis()->SetBinLabel(7,"CentralTrig0"); 00173 m_HistNames1D[hname]->GetXaxis()->SetBinLabel(8,"CentralTrig1"); 00174 00175 00176 }
void SimJetResponseAnalysis::bookHistograms | ( | ) |
Definition at line 132 of file SimJetResponseAnalysis.cc.
References bookGeneralHistograms(), bookJetHistograms(), bookMetHists(), and bookSimJetResponse().
Referenced by SimJetResponseAnalysis().
00132 { 00133 00134 bookGeneralHistograms(); 00135 bookJetHistograms("Gen"); 00136 bookJetHistograms("Calo"); 00137 bookMetHists("Gen"); 00138 bookMetHists("Calo"); 00139 bookSimJetResponse(); 00140 00141 00142 00143 }
void SimJetResponseAnalysis::bookJetHistograms | ( | const TString & | prefix | ) |
Definition at line 180 of file SimJetResponseAnalysis.cc.
References i, and m_HistNames1D.
Referenced by bookHistograms().
00180 { 00181 00182 TString hname; 00183 TString htitle; 00184 00185 hname=prefix + "NumberOfJet"; 00186 htitle=hname; 00187 m_HistNames1D[hname] = new TH1F(hname,htitle,100,-.0,100.0); 00188 00189 for(int i=0; i<5; i++) { 00190 std::ostringstream oi; oi << i; 00191 hname=prefix + "PhiJet"+oi.str(); 00192 htitle=hname; 00193 m_HistNames1D[hname] = new TH1F(hname,htitle,72,-M_PI,M_PI); 00194 00195 hname=prefix + "EtJet"+oi.str(); 00196 m_HistNames1D[hname]= new TH1F(hname,hname,500,0.0,5000.); 00197 hname=prefix + "PtJet"+oi.str(); 00198 m_HistNames1D[hname]= new TH1F(hname,hname,500,0.0,5000.); 00199 00200 hname=prefix + "RapidityJet"+oi.str(); 00201 m_HistNames1D[hname] = new TH1F(hname,hname,100,-5.0,5.0); 00202 } 00203 }
void SimJetResponseAnalysis::bookMetHists | ( | const TString & | prefix | ) |
Definition at line 245 of file SimJetResponseAnalysis.cc.
References m_HistNames1D.
Referenced by bookHistograms().
00245 { 00246 00247 TString hname; 00248 TString htitle; 00249 00250 hname =prefix+"NumberOfMetObjects"; 00251 htitle =prefix+"Number of MET objects"; 00252 m_HistNames1D[hname] = new TH1I(hname,htitle,10,0.,10.); 00253 00254 hname=prefix+"etMiss"; 00255 htitle=prefix+" Missing Et"; 00256 m_HistNames1D[hname] = new TH1F(hname,htitle,100,0.0,100.); 00257 00258 hname=prefix+"etMissX"; 00259 htitle=prefix+" Missing Et-X"; 00260 m_HistNames1D[hname] = new TH1F(hname,htitle,200,-100.0,100.); 00261 00262 hname=prefix+"etMissPhi"; 00263 htitle=prefix+" Phi of Missing Et"; 00264 m_HistNames1D[hname] = new TH1F(hname,htitle,100,-M_PI,M_PI); 00265 00266 hname=prefix+"sumEt"; 00267 htitle=prefix+" Sum Et"; 00268 m_HistNames1D[hname] = new TH1F(hname,htitle,1400,0.0,14000.); 00269 }
void SimJetResponseAnalysis::bookSimJetResponse | ( | ) |
Definition at line 305 of file SimJetResponseAnalysis.cc.
References CaloTowerEtaBoundries, GenJetPtBins_, it, m_HistNames1D, NETA, NEtaBins, and NPtBins.
Referenced by bookHistograms().
00305 { 00306 00307 TString hname; 00308 TString htitle; 00309 00310 for(int ip=0;ip<NPtBins;ip++){ 00311 std::ostringstream oip; oip << GenJetPtBins_[ip]; 00312 00313 int nBinPt(100); 00314 double PtMinBin=0.0; 00315 double PtMaxBin=7000.0; 00316 00317 if(GenJetPtBins_[ip+1]<200){ 00318 nBinPt=400; 00319 PtMaxBin=400.; 00320 } 00321 else if(GenJetPtBins_[ip+1]<1000){ 00322 nBinPt=400; 00323 PtMaxBin=2000.; 00324 } 00325 else { 00326 nBinPt=500; 00327 PtMaxBin=10000.; 00328 } 00329 00330 for(int ie=0;ie<NEtaBins;ie++){ 00331 // std::ostringstream oie; oie << RecJetEtaBins_[ie]; 00332 00333 std::ostringstream oie; oie << ie; 00334 hname="JetResponsePt"+oip.str()+"Eta"+oie.str(); 00335 htitle="JetResponsePt"+oip.str()+"Eta"+oie.str(); 00336 m_HistNames1D[hname] = new TH1F(hname,htitle,100,0.,2.0); 00337 00338 hname="RminPt"+oip.str()+"Eta"+oie.str(); 00339 htitle="Rmin"+oip.str()+"_"+oie.str(); 00340 00341 m_HistNames1D[hname] = new TH1F(hname,htitle,100,0.,2.0); 00342 00343 hname="PtGenJetPt"+oip.str()+"Eta"+oie.str(); 00344 htitle="PtGenJetPt"+oip.str()+"Eta"+oie.str(); 00345 m_HistNames1D[hname] = new TH1F(hname,htitle,nBinPt,PtMinBin,PtMaxBin); 00346 00347 hname="PtCaloJetPt"+oip.str()+"Eta"+oie.str(); 00348 htitle="PtCaloJetPt"+oip.str()+"Eta"+oie.str(); 00349 m_HistNames1D[hname] = new TH1F(hname,htitle,nBinPt,PtMinBin,PtMaxBin); 00350 00351 hname="EtaGenJetPt"+oip.str()+"Eta"+oie.str(); 00352 htitle="EtaGenJetPt"+oip.str()+"Eta"+oie.str(); 00353 m_HistNames1D[hname] = new TH1F(hname,htitle,82,CaloTowerEtaBoundries); 00354 00355 hname="EtaCaloJetPt"+oip.str()+"Eta"+oie.str(); 00356 htitle="EtaCaloJetPt"+oip.str()+"Eta"+oie.str(); 00357 m_HistNames1D[hname] = new TH1F(hname,htitle,82,CaloTowerEtaBoundries); 00358 00359 //---------------------------- 00360 00361 00362 // std::ostringstream oie; oie << ie; 00363 hname="JetResponseEt"+oip.str()+"Eta"+oie.str(); 00364 htitle="JetResponseEt"+oip.str()+"Eta"+oie.str(); 00365 m_HistNames1D[hname] = new TH1F(hname,htitle,100,0.,2.0); 00366 00367 hname="RminEt"+oip.str()+"Eta"+oie.str(); 00368 htitle="Rmin"+oip.str()+"_"+oie.str(); 00369 00370 m_HistNames1D[hname] = new TH1F(hname,htitle,100,0.,2.0); 00371 00372 hname="EtGenJetEt"+oip.str()+"Eta"+oie.str(); 00373 htitle="EtGenJetEt"+oip.str()+"Eta"+oie.str(); 00374 m_HistNames1D[hname] = new TH1F(hname,htitle,nBinPt,PtMinBin,PtMaxBin); 00375 00376 hname="EtCaloJetEt"+oip.str()+"Eta"+oie.str(); 00377 htitle="EtCaloJetEt"+oip.str()+"Eta"+oie.str(); 00378 m_HistNames1D[hname] = new TH1F(hname,htitle,nBinPt,PtMinBin,PtMaxBin); 00379 00380 hname="EtaGenJetEt"+oip.str()+"Eta"+oie.str(); 00381 htitle="EtaGenJetEt"+oip.str()+"Eta"+oie.str(); 00382 m_HistNames1D[hname] = new TH1F(hname,htitle,82,CaloTowerEtaBoundries); 00383 00384 hname="EtaCaloJetEt"+oip.str()+"Eta"+oie.str(); 00385 htitle="EtaCaloJetEt"+oip.str()+"Eta"+oie.str(); 00386 m_HistNames1D[hname] = new TH1F(hname,htitle,82,CaloTowerEtaBoundries); 00387 00388 } 00389 // } 00390 00391 // for(int ip=0;ip<NPtBins;ip++){ 00392 // std::ostringstream oip; oip << GenJetPtBins_[ip]; 00393 for(int it=0; it<NETA; it++){ 00394 std::ostringstream oit; oit << it; 00395 hname="JetResponsePt"+oip.str()+"Tower"+oit.str(); 00396 htitle="JetResponsePt"+oip.str()+"Tower"+oit.str(); 00397 m_HistNames1D[hname] = new TH1F(hname,htitle,100,0.,2.0); 00398 00399 hname="EtaCaloJetPt"+oip.str()+"Tower"+oit.str(); 00400 htitle="EtaCaloJetPt"+oip.str()+"Tower"+oit.str(); 00401 m_HistNames1D[hname] = new TH1F(hname,htitle,82,CaloTowerEtaBoundries); 00402 00403 00404 hname="EtaGenJetPt"+oip.str()+"Tower"+oit.str(); 00405 htitle="EtaGenJetPt"+oip.str()+"Tower"+oit.str(); 00406 m_HistNames1D[hname] = new TH1F(hname,htitle,82,CaloTowerEtaBoundries); 00407 00408 hname="PtGenJetPt"+oip.str()+"Tower"+oit.str(); 00409 htitle="PtGenJetPt"+oip.str()+"Tower"+oit.str(); 00410 m_HistNames1D[hname] = new TH1F(hname,htitle,nBinPt,PtMinBin,PtMaxBin); 00411 00412 hname="PtCaloJetPt"+oip.str()+"Tower"+oit.str(); 00413 htitle="PtCaloJetPt"+oip.str()+"Tower"+oit.str(); 00414 m_HistNames1D[hname] = new TH1F(hname,htitle,nBinPt,PtMinBin,PtMaxBin); 00415 00416 } 00417 } 00418 00419 for(int ip=0;ip<NPtBins;ip++){ 00420 std::ostringstream oip; oip << GenJetPtBins_[ip]; 00421 hname="ResponseVsEtaMean"+oip.str(); 00422 htitle="ResponseVsEtaMean"+oip.str(); 00423 m_HistNames1D[hname] = new TH1F(hname,htitle,82,CaloTowerEtaBoundries); 00424 00425 hname="ResponseVsEtaMPV"+oip.str(); 00426 htitle="ResponseVsEtaMPV"+oip.str(); 00427 m_HistNames1D[hname] = new TH1F(hname,htitle,82,CaloTowerEtaBoundries); 00428 } 00429 }
Definition at line 294 of file SimJetResponseAnalysis.cc.
References GetSimJetResponse(), and hist_file_.
Referenced by endJob().
00294 { 00295 00296 if (hist_file_!=0) { 00297 GetSimJetResponse(); 00298 hist_file_->Write(); 00299 // std::cout << "Output histograms written to: " << histogramFile_ << std::endl; 00300 delete hist_file_; 00301 hist_file_=0; 00302 } 00303 }
Reimplemented from edm::EDAnalyzer.
Definition at line 73 of file SimJetResponseAnalysis.cc.
References done().
00073 { 00074 done(); 00075 }
void SimJetResponseAnalysis::fillHist1D | ( | const TString & | histName, | |
const Double_t & | x, | |||
const Double_t & | wt = 1.0 | |||
) |
Definition at line 108 of file SimJetResponseAnalysis.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and m_HistNames1D.
Referenced by fillJetHists(), fillMetHists(), and SimulatedJetResponse().
00108 { 00109 00110 std::map<TString, TH1*>::iterator hid=m_HistNames1D.find(histName); 00111 if (hid==m_HistNames1D.end()){ 00112 std::cout << "%fillHist -- Could not find histogram with name: " << histName << std::endl; 00113 } 00114 else{ 00115 hid->second->Fill(value,wt); 00116 } 00117 }
void SimJetResponseAnalysis::fillHist2D | ( | const TString & | histName, | |
const Double_t & | x, | |||
const Double_t & | y, | |||
const Double_t & | wt = 1.0 | |||
) |
Definition at line 120 of file SimJetResponseAnalysis.cc.
References m_HistNames2D.
00120 { 00121 00122 std::map<TString, TH2*>::iterator hid=m_HistNames2D.find(histName); 00123 if (hid==m_HistNames2D.end()){ 00124 // std::cout << "%fillHist -- Could not find histogram with name: " << histName << std::endl; 00125 } 00126 else { 00127 hid->second->Fill(x,y,wt); 00128 } 00129 }
void SimJetResponseAnalysis::fillJetHists | ( | const T & | jets, | |
const TString & | prefx | |||
) | [inline] |
Definition at line 207 of file SimJetResponseAnalysis.cc.
References fillHist1D(), i, iter, reco::btau::jetPhi, and reco::btau::jetPt.
00207 { 00208 00209 typedef typename T::const_iterator iter; 00210 TString hname; 00211 00212 int NumOfJets=jets.size(); 00213 00214 hname=prefix + "NumberOfJet"; 00215 fillHist1D(hname,NumOfJets); 00216 00217 int ijet(0); 00218 00219 for ( iter i=jets.begin(); i!=jets.end(); i++) { 00220 00221 // First 5 jets only 00222 if(ijet>4) break; 00223 00224 Double_t jetRapidity = i->y(); 00225 Double_t jetPt = i->pt(); 00226 Double_t jetEt = i->et(); 00227 Double_t jetPhi = i->phi(); 00228 00229 std::ostringstream oi; oi << ijet; 00230 00231 hname=prefix + "PhiJet"+oi.str(); 00232 fillHist1D(hname,jetPhi); 00233 hname=prefix + "RapidityJet"+oi.str(); 00234 fillHist1D(hname,jetRapidity); 00235 hname=prefix + "PtJet"+oi.str(); 00236 fillHist1D(hname,jetPt); 00237 00238 hname=prefix + "EtJet"+oi.str(); 00239 fillHist1D(hname,jetEt); 00240 00241 ijet++; 00242 } 00243 }
void SimJetResponseAnalysis::fillMetHists | ( | const T & | mets, | |
const TString & | prefx | |||
) | [inline] |
Definition at line 272 of file SimJetResponseAnalysis.cc.
References fillHist1D(), iter, and CaloMET_cfi::met.
00272 { 00273 00274 Int_t NumMet=mets.size(); 00275 TString hname; 00276 hname=prefix + "NumberOfMetObjects"; 00277 fillHist1D(hname,NumMet); 00278 00279 typedef typename T::const_iterator iter; 00280 for ( iter met=mets.begin(); met!=mets.end(); met++) { 00281 Double_t mEt=met->et(); 00282 Double_t sumEt=met->sumEt(); 00283 Double_t mEtPhi=met->phi(); 00284 Double_t mEtX=met->px(); 00285 00286 fillHist1D(prefix+"etMiss",mEt); 00287 fillHist1D(prefix + "sumEt",sumEt); 00288 fillHist1D(prefix + "etMissX",mEtX); 00289 fillHist1D(prefix + "etMissPhi",mEtPhi); 00290 } 00291 }
int SimJetResponseAnalysis::GetEtaBin | ( | double | eta | ) |
Definition at line 446 of file SimJetResponseAnalysis.cc.
References NEtaBins, and RecJetEtaBins_.
Referenced by SimulatedJetResponse().
00446 { 00447 for(int ie=0;ie<NEtaBins;ie++){ 00448 if(eta>= RecJetEtaBins_[ie] && eta< RecJetEtaBins_[ie+1]){ 00449 return ie; 00450 } 00451 } 00452 return 0; 00453 }
int SimJetResponseAnalysis::GetPtBin | ( | double | GenPtJet | ) |
Definition at line 430 of file SimJetResponseAnalysis.cc.
References GenJetPtBins_, and NPtBins.
Referenced by SimulatedJetResponse().
00430 { 00431 for(int ip=0;ip<NPtBins;ip++){ 00432 if(GenJetPtBins_[ip] <GenJetPt && GenJetPt < GenJetPtBins_[ip+1] ){ 00433 return ip; 00434 } 00435 } 00436 return 0; 00437 }
void SimJetResponseAnalysis::GetSimJetResponse | ( | ) |
Definition at line 611 of file SimJetResponseAnalysis.cc.
References CaloTowerEtaBoundries, e, GenJetPtBins_, GetMPV(), i, int, it, m, m_HistNames1D, n, NETA, nevents, np, NPtBins, funct::sqrt(), x, and y.
Referenced by done().
00611 { 00612 00613 TString hname; 00614 00615 std::map<TString, TH1*>::iterator h1D; 00616 00617 const int MinimumEvents=25; 00618 00619 for(int ip=0;ip<NPtBins;ip++){ 00620 std::ostringstream oip; oip << GenJetPtBins_[ip]; 00621 00622 00623 std::vector<double> x(NETA); 00624 std::vector<double> y(NETA); 00625 std::vector<double> n(NETA); 00626 std::vector<double> m(NETA); 00627 std::vector<double> e(NETA); 00628 00629 std::vector<double> fittedMean(NETA); 00630 std::vector<double> fittedWidth(NETA); 00631 std::vector<double> fittedError(NETA); 00632 00633 std::vector<double> neve(NETA); 00634 std::vector<double> ex(NETA); 00635 std::vector<double> ey(NETA); 00636 00637 int np=0; 00638 for(int it=0; it<NETA; it++){ 00639 x[np] = (CaloTowerEtaBoundries[it]+CaloTowerEtaBoundries[it+1])/2.0; 00640 std::ostringstream oit; oit << it; 00641 hname="JetResponsePt"+oip.str()+"Tower"+oit.str(); 00642 h1D=m_HistNames1D.find(hname); 00643 00644 if(h1D!=m_HistNames1D.end()){ 00645 int nevents = int(h1D->second->GetEntries()); 00646 n[it] = nevents; 00647 // std::cout << " Number of events " <<" itower "<< it << " nevents " << nevents << std::endl; 00648 if(nevents>MinimumEvents){ 00649 m[it] = h1D->second->GetMean(); 00650 e[it] = h1D->second->GetRMS()/sqrt(n[it]); 00651 GetMPV(h1D->second,fittedMean[it],fittedWidth[it],fittedError[it]); 00652 // cout << "itower " << it <<" Nevents " << nevents<< " Mean " << m[it]<< " Fitted Mean " << fittedMean[it] <<endl; 00653 } 00654 else{ 00655 m[it] =0.0; 00656 e[it] = 0.0; 00657 fittedMean[it] =0.0; 00658 fittedWidth[it] =0.0; 00659 fittedError[it] =0.0; 00660 } 00661 } 00662 else { 00663 // cout << hname << " does not exist " <<endl; 00664 } 00665 00666 } 00667 00668 hname="ResponseVsEtaMean"+oip.str(); 00669 h1D=m_HistNames1D.find(hname); 00670 00671 for(int i=0;i<NETA;i++){ 00672 h1D->second->SetBinContent(i,m[i]); 00673 h1D->second->SetBinError(i,e[i]); 00674 } 00675 00676 hname="ResponseVsEtaMPV"+oip.str(); 00677 h1D=m_HistNames1D.find(hname); 00678 00679 for(int i=0;i<NETA;i++){ 00680 h1D->second->SetBinContent(i,fittedMean[i]); 00681 h1D->second->SetBinError(i,fittedError[i]); 00682 } 00683 } 00684 }
void SimJetResponseAnalysis::SimulatedJetResponse | ( | const reco::GenJetCollection & | genjets, | |
const reco::CaloJetCollection & | calojets | |||
) |
Definition at line 455 of file SimJetResponseAnalysis.cc.
References fillHist1D(), GenJetPtBins_, GetEtaBin(), GetPtBin(), i, it, j, MatchRadius_, njet, NJetMax_, radius(), RecJetPtMin_, and TowerNumber().
00455 { 00456 00457 if(genjets.size()==0) return; 00458 if(calojets.size()==0) return; 00459 00460 const double GenJetEtaMax=5.5; 00461 00462 double GenJetPtMin=GenJetPtBins_[0]; 00463 00464 TString hname; 00465 00466 int njet(0); 00467 00468 for(GenJetIter i=genjets.begin();i!=genjets.end(); i++) { 00469 njet++; 00470 if(njet>NJetMax_) return; // only two leading jets 00471 Double_t GenJetPt = i->pt(); 00472 Double_t GenJetEt = i->et(); 00473 Double_t GenJetEta = i->eta(); 00474 if(GenJetPt>GenJetPtMin) { 00475 if(fabs(GenJetEta)<GenJetEtaMax){ 00476 float rmin(99); 00477 CalJetIter caljet; 00478 for(CalJetIter j=calojets.begin();j!=calojets.end();j++){ 00479 float rr=radius(i,j); 00480 if(rr<rmin){rmin=rr;caljet=j;} 00481 } 00482 00483 double CaloJetPt=caljet->pt(); 00484 double CaloJetEt=caljet->et(); 00485 double CaloJetEta=caljet->eta(); 00486 double ResponsePt=CaloJetPt/GenJetPt; 00487 double ResponseEt=CaloJetEt/GenJetEt; 00488 00489 if(CaloJetPt<RecJetPtMin_) continue; 00490 00491 int ipt = GetPtBin(GenJetPt); 00492 int iet = GetPtBin(GenJetEt); 00493 int ie = GetEtaBin(CaloJetEta); 00494 int it = TowerNumber(CaloJetEta); 00495 std::ostringstream oipt; oipt << GenJetPtBins_[ipt]; 00496 std::ostringstream oiet; oiet << GenJetPtBins_[iet]; 00497 // std::ostringstream oie; oie << RecJetEtaBins_[ie]; 00498 std::ostringstream oie; oie <<ie; 00499 std::ostringstream oit; oit << it; 00500 00501 hname="RminPt"+oipt.str()+"Eta"+oie.str(); 00502 fillHist1D(hname,rmin); 00503 if(rmin<MatchRadius_){ 00504 // cout << " radius " << rmin << " GenPt " << GenJetPt << " CalPt " << caljet->pt() <<" rr " << calpt/GenJetPt <<endl; 00505 hname="JetResponsePt"+oipt.str()+"Eta"+oie.str(); 00506 fillHist1D(hname,ResponsePt); 00507 00508 hname="EtaGenJetPt"+oipt.str()+"Eta"+oie.str(); 00509 fillHist1D(hname,GenJetEta); 00510 00511 hname="PtGenJetPt"+oipt.str()+"Eta"+oie.str(); 00512 fillHist1D(hname,GenJetPt); 00513 00514 hname="PtCaloJetPt"+oipt.str()+"Eta"+oie.str(); 00515 fillHist1D(hname,CaloJetPt); 00516 00517 hname="EtaCaloJetPt"+oipt.str()+"Eta"+oie.str(); 00518 fillHist1D(hname,CaloJetEta); 00519 00520 // Et plots================================== 00521 00522 hname="JetResponseEt"+oiet.str()+"Eta"+oie.str(); 00523 fillHist1D(hname,ResponseEt); 00524 00525 hname="EtaGenJetEt"+oiet.str()+"Eta"+oie.str(); 00526 fillHist1D(hname,GenJetEta); 00527 00528 hname="EtGenJetEt"+oiet.str()+"Eta"+oie.str(); 00529 fillHist1D(hname,GenJetEt); 00530 00531 hname="EtCaloJetEt"+oiet.str()+"Eta"+oie.str(); 00532 fillHist1D(hname,CaloJetEt); 00533 00534 hname="EtaCaloJetEt"+oiet.str()+"Eta"+oie.str(); 00535 fillHist1D(hname,CaloJetEta); 00536 00537 // Tower plots===================================== 00538 00539 hname="JetResponsePt"+oipt.str()+"Tower"+oit.str(); 00540 fillHist1D(hname,ResponsePt); 00541 00542 hname="EtaCaloJetPt"+oipt.str()+"Tower"+oit.str(); 00543 fillHist1D(hname,CaloJetEta); 00544 00545 hname="EtaGenJetPt"+oipt.str()+"Tower"+oit.str(); 00546 fillHist1D(hname,GenJetEta); 00547 00548 hname="PtGenJetPt"+oipt.str()+"Tower"+oit.str(); 00549 fillHist1D(hname,GenJetPt); 00550 00551 hname="PtCaloJetPt"+oipt.str()+"Tower"+oit.str(); 00552 fillHist1D(hname,CaloJetPt); 00553 } 00554 } 00555 } 00556 } 00557 }
int SimJetResponseAnalysis::TowerNumber | ( | double | eta | ) |
Definition at line 438 of file SimJetResponseAnalysis.cc.
References CaloTowerEtaBoundries, i, and NETA.
Referenced by SimulatedJetResponse().
00438 { 00439 for(int i=0;i<NETA;i++){ 00440 if(CaloTowerEtaBoundries[i]<eta && eta<=CaloTowerEtaBoundries[i+1]){ 00441 return i; 00442 } 00443 } 00444 return 0; 00445 }
TString SimJetResponseAnalysis::calopfx [private] |
Definition at line 91 of file SimJetResponseAnalysis.h.
std::vector<double> SimJetResponseAnalysis::GenJetPtBins_ [private] |
Definition at line 76 of file SimJetResponseAnalysis.h.
Referenced by bookSimJetResponse(), GetPtBin(), GetSimJetResponse(), SimJetResponseAnalysis(), and SimulatedJetResponse().
std::string SimJetResponseAnalysis::genjets_ [private] |
Definition at line 90 of file SimJetResponseAnalysis.h.
Referenced by analyze(), and SimJetResponseAnalysis().
std::string SimJetResponseAnalysis::genmet_ [private] |
Definition at line 90 of file SimJetResponseAnalysis.h.
Referenced by analyze(), and SimJetResponseAnalysis().
TString SimJetResponseAnalysis::gjetpfx [private] |
Definition at line 91 of file SimJetResponseAnalysis.h.
TString SimJetResponseAnalysis::gmetpfx [private] |
Definition at line 91 of file SimJetResponseAnalysis.h.
TFile* SimJetResponseAnalysis::hist_file_ [private] |
Definition at line 81 of file SimJetResponseAnalysis.h.
Referenced by done(), and SimJetResponseAnalysis().
std::string SimJetResponseAnalysis::histogramFile_ [private] |
std::map<TString, TH1*> SimJetResponseAnalysis::m_HistNames1D [private] |
Definition at line 85 of file SimJetResponseAnalysis.h.
Referenced by bookGeneralHistograms(), bookJetHistograms(), bookMetHists(), bookSimJetResponse(), fillHist1D(), and GetSimJetResponse().
std::map<TString, TH2*> SimJetResponseAnalysis::m_HistNames2D [private] |
std::map<TString, TGraph*> SimJetResponseAnalysis::m_HistNamesGraph [private] |
Definition at line 88 of file SimJetResponseAnalysis.h.
std::map<TString, TProfile*> SimJetResponseAnalysis::m_HistNamesProf [private] |
Definition at line 87 of file SimJetResponseAnalysis.h.
double SimJetResponseAnalysis::MatchRadius_ [private] |
Definition at line 74 of file SimJetResponseAnalysis.h.
Referenced by SimJetResponseAnalysis(), and SimulatedJetResponse().
int SimJetResponseAnalysis::NEtaBins [private] |
Definition at line 79 of file SimJetResponseAnalysis.h.
Referenced by bookSimJetResponse(), GetEtaBin(), and SimJetResponseAnalysis().
int SimJetResponseAnalysis::NJetMax_ [private] |
Definition at line 73 of file SimJetResponseAnalysis.h.
Referenced by SimJetResponseAnalysis(), and SimulatedJetResponse().
int SimJetResponseAnalysis::NPtBins [private] |
Definition at line 78 of file SimJetResponseAnalysis.h.
Referenced by bookSimJetResponse(), GetPtBin(), GetSimJetResponse(), and SimJetResponseAnalysis().
std::vector<double> SimJetResponseAnalysis::RecJetEtaBins_ [private] |
Definition at line 77 of file SimJetResponseAnalysis.h.
Referenced by GetEtaBin(), and SimJetResponseAnalysis().
double SimJetResponseAnalysis::RecJetPtMin_ [private] |
Definition at line 75 of file SimJetResponseAnalysis.h.
Referenced by SimJetResponseAnalysis(), and SimulatedJetResponse().
std::string SimJetResponseAnalysis::recjets_ [private] |
Definition at line 90 of file SimJetResponseAnalysis.h.
Referenced by analyze(), and SimJetResponseAnalysis().
std::string SimJetResponseAnalysis::recmet_ [private] |
Definition at line 90 of file SimJetResponseAnalysis.h.
Referenced by analyze(), and SimJetResponseAnalysis().
TString SimJetResponseAnalysis::rjetpfx [private] |
Definition at line 91 of file SimJetResponseAnalysis.h.
TString SimJetResponseAnalysis::rmetpfx [private] |
Definition at line 91 of file SimJetResponseAnalysis.h.