Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:33:47

0001 
0002 #include <iostream>
0003 #include <string>
0004 #include "TFile.h"
0005 #include "THashList.h"
0006 #include "TH1.h"
0007 #include "TKey.h"
0008 #include "TClass.h"
0009 #include "TSystem.h"
0010 
0011 int makeCompositeEff( TString fname, TString assocName )
0012 {
0013   int a = makeValidTrackEff(fname,assocName);
0014   return a;
0015 }
0016 
0017 int makeValidTrackEff( TString fname, TString assocName)
0018 {
0019   
0020   TFile* source = TFile::Open( fname , "UPDATE");
0021   if( source==0 ){
0022     return 1;
0023   }
0024 
0025   bool glbDir = source->cd("DQMData/Track/cutsGLB_"+assocName);
0026   if(!glbDir) return -1;
0027   
0028   TH1F *glbSimRec_eta, *glbSimRec_pt, *glbreco2sim_eta, *glbreco_eta;
0029   TH1F *glbeffic, *glbeffic_pt, *glbfakerate;
0030   gDirectory->GetObject("num_assoc(simToReco)_eta",glbSimRec_eta);
0031   gDirectory->GetObject("num_assoc(simToReco)_pT",glbSimRec_pt);
0032   //gDirectory->GetObject("num_assoc(recoToSim)_eta",glbreco2sim_eta);
0033   //gDirectory->GetObject("num_reco_eta",glbreco_eta);
0034   //glbeffic = (TH1*)gDirectory->Get("effic")->Clone(); glbeffic->Reset();
0035   //glbeffic_pt = (TH1*)gDirectory->Get("efficPt")->Clone(); glbeffic_pt->Reset();
0036   //glbfakerate = (TH1*)gDirectory->Get("fakerate")->Clone(); glbfakerate->Reset();  
0037 
0038   bool staDir = source->cd("DQMData/Track/cutsSTA_"+assocName);
0039   if(!staDir) return -1;
0040 
0041 
0042   TH1F *staSimRec_eta, *staSimRec_pt, *stareco2sim_eta, *stareco_eta;
0043   TH1F *staeffic, *staeffic_pt, *stafakerate;
0044   gDirectory->GetObject("num_assoc(simToReco)_eta",staSimRec_eta);
0045   gDirectory->GetObject("num_assoc(simToReco)_pT",staSimRec_pt);
0046   //gDirectory->GetObject("num_assoc(recoToSim)_eta",stareco2sim_eta);
0047   //gDirectory->GetObject("num_reco_eta",stareco_eta);
0048   //staeffic = (TH1*)gDirectory->Get("effic")->Clone(); staeffic->Reset();
0049   //staeffic_pt = (TH1*)gDirectory->Get("efficPt")->Clone(); staeffic_pt->Reset();
0050   //stafakerate = (TH1*)gDirectory->Get("fakerate")->Clone(); stafakerate->Reset();  
0051 
0052   bool seedDir = source->cd("DQMData/Track/muonSeedTrack_"+assocName);
0053   if(!seedDir) return -1;
0054 
0055   TH1F *seedSimRec_eta, *seedSimRec_pt, *seedreco2sim_eta, *seedreco_eta;
0056   TH1F *seedeffic, *seedeffic_pt, *seedfakerate;
0057   gDirectory->GetObject("num_assoc(simToReco)_eta",seedSimRec_eta);
0058   gDirectory->GetObject("num_assoc(simToReco)_pT",seedSimRec_pt);
0059   //gDirectory->GetObject("num_assoc(recoToSim)_eta",seedreco2sim_eta);
0060   //gDirectory->GetObject("num_reco_eta",seedreco_eta);
0061   //seedeffic = (TH1*)gDirectory->Get("effic")->Clone(); seedeffic->Reset();
0062   //seedeffic_pt = (TH1*)gDirectory->Get("efficPt")->Clone(); seedeffic_pt->Reset();
0063   //seedfakerate = (TH1*)gDirectory->Get("fakerate")->Clone(); seedfakerate->Reset();  
0064 
0065   source->cd("DQMData/Track");
0066 
0067   TString effPath("eff_"+assocName);
0068 
0069   TDirectory* effDir = gDirectory->mkdir(effPath.Data());
0070 
0071   effDir->cd();
0072 
0073   TGraphAsymmErrors * glbStaEff = new TGraphAsymmErrors(glbSimRec_eta,staSimRec_eta);
0074   TGraphAsymmErrors * glbSeedEff = new TGraphAsymmErrors(glbSimRec_eta,seedSimRec_eta);
0075   TGraphAsymmErrors * staSeedEff = new TGraphAsymmErrors(staSimRec_eta,seedSimRec_eta);
0076 
0077   TGraphAsymmErrors * glbStaEff_pt = new TGraphAsymmErrors(glbSimRec_pt,staSimRec_pt);
0078   TGraphAsymmErrors * glbSeedEff_pt = new TGraphAsymmErrors(glbSimRec_pt,seedSimRec_pt);
0079   TGraphAsymmErrors * staSeedEff_pt = new TGraphAsymmErrors(staSimRec_pt,seedSimRec_pt);
0080 
0081   glbStaEff->SetNameTitle("glbStaEff_eta","Global-Standalone Efficiency vs #eta");
0082   glbSeedEff->SetNameTitle("glbSeedEff_eta","Global-Seed Efficiency vs #eta");
0083   staSeedEff->SetNameTitle("staSeedEff_eta","Standalone-Seed Efficiency vs #eta");
0084   glbStaEff_pt->SetNameTitle("glbStaEff_pt","Global-Standalone Efficiency vs #eta");
0085   glbSeedEff_pt->SetNameTitle("glbSeedEff_pt","Global-Seed Efficiency vs #eta");
0086   staSeedEff_pt->SetNameTitle("staSeedEff_pt","Standalone-Seed Efficiency vs #eta");
0087 
0088   glbStaEff->Write("",TObject::kOverwrite);
0089   glbSeedEff->Write("",TObject::kOverwrite);
0090   staSeedEff->Write("",TObject::kOverwrite);
0091   glbStaEff_pt->Write("",TObject::kOverwrite);
0092   glbSeedEff_pt->Write("",TObject::kOverwrite);
0093   staSeedEff_pt->Write("",TObject::kOverwrite);
0094 
0095   //TGraphAsymmErrors * glbStaFake = new TGraphAsymmErrors(glbSimRec_eta,staSimRec_eta);
0096   //TGraphAsymmErrors * glbSeedFake = new TGraphAsymmErrors(glbSimRec_eta,seedSimRec_eta);
0097   //TGraphAsymmErrors * staSeedFake = new TGraphAsymmErrors(staSimRec_eta,seedSimRec_eta);
0098 
0099   return 0;
0100 }