diff --git a/GEMValidation/plugins/GEMDigiAnalyzer.cc b/GEMValidation/plugins/GEMDigiAnalyzer.cc index b030a0655c931..4d77ec3245326 100644 --- a/GEMValidation/plugins/GEMDigiAnalyzer.cc +++ b/GEMValidation/plugins/GEMDigiAnalyzer.cc @@ -211,9 +211,10 @@ void GEMDigiAnalyzer::beginRun(edm::Run const&, edm::EventSetup const& iSetup) iSetup.get().get(gem_geo_); gem_geometry_ = &*gem_geo_; + // FIXME - when a geometry with different partition numbers will be released, the code will brake! const auto top_chamber = static_cast(gem_geometry_->idToDetUnit(GEMDetId(1,1,1,1,1,1))); - // TODO: it's really bad to hardcode max partition number! - const auto bottom_chamber = static_cast(gem_geometry_->idToDetUnit(GEMDetId(1,1,1,1,1,6))); + const int nEtaPartitions(gem_geometry_->chamber(GEMDetId(1,1,1,1,1,1))->nEtaPartitions()); + const auto bottom_chamber = static_cast(gem_geometry_->idToDetUnit(GEMDetId(1,1,1,1,1,nEtaPartitions))); const float top_half_striplength = top_chamber->specs()->specificTopology().stripLength()/2.; const float bottom_half_striplength = bottom_chamber->specs()->specificTopology().stripLength()/2.; const LocalPoint lp_top(0., top_half_striplength, 0.); diff --git a/GEMValidation/plugins/GEMRecHitAnalyzer.cc b/GEMValidation/plugins/GEMRecHitAnalyzer.cc index 36dcdf03b70bb..b02ce4e9fb022 100644 --- a/GEMValidation/plugins/GEMRecHitAnalyzer.cc +++ b/GEMValidation/plugins/GEMRecHitAnalyzer.cc @@ -165,9 +165,10 @@ void GEMRecHitAnalyzer::beginRun(edm::Run const& iRun, edm::EventSetup const& iS iSetup.get().get(gem_geom_); gem_geometry_ = &*gem_geom_; + // FIXME - when a geometry with different partition numbers will be released, the code will brake! const auto top_chamber = static_cast(gem_geometry_->idToDetUnit(GEMDetId(1,1,1,1,1,1))); - // TODO: it's really bad to hardcode max partition number! - const auto bottom_chamber = static_cast(gem_geometry_->idToDetUnit(GEMDetId(1,1,1,1,1,6))); + const int nEtaPartitions(gem_geometry_->chamber(GEMDetId(1,1,1,1,1,1))->nEtaPartitions()); + const auto bottom_chamber = static_cast(gem_geometry_->idToDetUnit(GEMDetId(1,1,1,1,1,nEtaPartitions))); const float top_half_striplength = top_chamber->specs()->specificTopology().stripLength()/2.; const float bottom_half_striplength = bottom_chamber->specs()->specificTopology().stripLength()/2.; const LocalPoint lp_top(0., top_half_striplength, 0.); diff --git a/GEMValidation/plugins/GEMSimHitAnalyzer.cc b/GEMValidation/plugins/GEMSimHitAnalyzer.cc index 5b2ade2a1bf7d..1362c20326d08 100644 --- a/GEMValidation/plugins/GEMSimHitAnalyzer.cc +++ b/GEMValidation/plugins/GEMSimHitAnalyzer.cc @@ -138,9 +138,10 @@ void GEMSimHitAnalyzer::beginRun(const edm::Run &iRun, const edm::EventSetup &iS iSetup.get().get(gem_geom); gem_geometry_ = &*gem_geom; + // FIXME - when a geometry with different partition numbers will be released, the code will brake! const auto top_chamber = static_cast(gem_geometry_->idToDetUnit(GEMDetId(1,1,1,1,1,1))); - // TODO: it's really bad to hardcode max partition number! - const auto bottom_chamber = static_cast(gem_geometry_->idToDetUnit(GEMDetId(1,1,1,1,1,6))); + const int nEtaPartitions(gem_geometry_->chamber(GEMDetId(1,1,1,1,1,1))->nEtaPartitions()); + const auto bottom_chamber = static_cast(gem_geometry_->idToDetUnit(GEMDetId(1,1,1,1,1,nEtaPartitions))); const float top_half_striplength = top_chamber->specs()->specificTopology().stripLength()/2.; const float bottom_half_striplength = bottom_chamber->specs()->specificTopology().stripLength()/2.; const LocalPoint lp_top(0., top_half_striplength, 0.); @@ -433,8 +434,6 @@ void GEMSimHitAnalyzer::buildLUT() std::vector neg_ids; neg_ids.push_back(GEMDetId(-1,1,1,1,36,1).rawId()); - // VK: I would really suggest getting phis from GEMGeometry - std::vector phis; phis.push_back(0.); for(int i=1; i<37; ++i) diff --git a/GEMValidation/scripts/extractPlots.C b/GEMValidation/scripts/extractPlots.C new file mode 100644 index 0000000000000..e487c81786250 --- /dev/null +++ b/GEMValidation/scripts/extractPlots.C @@ -0,0 +1,422 @@ +#include +#include +#include +#include "TTree.h" +#include "TFile.h" +#include "TMath.h" +#include "TH1F.h" +#include "TF1.h" +#include "TCanvas.h" +#include "TLegend.h" +#include "TGraphAsymmErrors.h" +#include "TPaveStats.h" +#include "TStyle.h" +#include "TEfficiency.h" + +#include "TStyle.h" + +void makePlots(string name1, string name2, string name3){ + + TFile * f1 = TFile::Open(name1.c_str()); + f1->cd(); + + TH1F * pTRec_NoGEM = (TH1F*)gDirectory->Get("pTRec"); + TH1F * pTSim_NoGEM = (TH1F*)gDirectory->Get("pTSim"); + TH1F * pTRes_NoGEM = (TH1F*)gDirectory->Get("pTRes"); + TH1F * invPTRes_NoGEM = (TH1F*)gDirectory->Get("invPTRes"); + TH1F * pTDiff_NoGEM = (TH1F*)gDirectory->Get("pTDiff"); + TH1F * PSimEta_NoGEM = (TH1F*)gDirectory->Get("PSimEta"); + TH1F * PRecEta_NoGEM = (TH1F*)gDirectory->Get("PRecEta"); + TH1F * PDeltaEta_NoGEM = (TH1F*)gDirectory->Get("PDeltaEta"); + TH1F * PSimPhi_NoGEM = (TH1F*)gDirectory->Get("PSimPhi"); + TH1F * PRecPhi_NoGEM = (TH1F*)gDirectory->Get("PRecPhi"); + TH1F * NumSimTracks_NoGEM = (TH1F*)gDirectory->Get("NumSimTracks"); + TH1F * NumMuonSimTracks_NoGEM = (TH1F*)gDirectory->Get("NumMuonSimTracks"); + TH1F * NumRecTracks_NoGEM = (TH1F*)gDirectory->Get("NumRecTracks"); + TH2F * PtResVsPt_NoGEM = (TH2F*)gDirectory->Get("PtResVsPt"); + TH2F * InvPtResVsPt_NoGEM = (TH2F*)gDirectory->Get("InvPtResVsPt"); + TH2F * PtResVsEta_NoGEM = (TH2F*)gDirectory->Get("PtResVsEta"); + TH2F * InvPtResVsEta_NoGEM = (TH2F*)gDirectory->Get("InvPtResVsEta"); + TH2F * DPhiVsPt_NoGEM = (TH2F*)gDirectory->Get("DPhiVsPt"); + TH1F * DenPt_NoGEM = (TH1F*)gDirectory->Get("DenPt"); + TH1F * DenEta_NoGEM = (TH1F*)gDirectory->Get("DenEta"); + TH1F * NumPt_NoGEM = (TH1F*)gDirectory->Get("NumPt"); + TH1F * NumEta_NoGEM = (TH1F*)gDirectory->Get("NumEta"); + TH1F * PullGEM_NoGEM = (TH1F*)gDirectory->Get("PullGEMx"); + TH1F * PullCSC_NoGEM = (TH1F*)gDirectory->Get("PullCSC"); + TH1F * GEMRecHitEta_NoGEM = (TH1F*)gDirectory->Get("GEMRecHitEta"); + TH2F * DeltaCharge_NoGEM = (TH2F*)gDirectory->Get("DeltaCharge"); + TH2F * RecoPtVsSimPt_NoGEM = (TH2F*)gDirectory->Get("RecoPtVsSimPt"); + + TH1F * NumPt_NoGEM2 = (TH1F*)NumPt_NoGEM->Clone(); + TH1F * NumEta_NoGEM2 = (TH1F*)NumEta_NoGEM->Clone(); + + TH2F * PtResVsPt_NoGEM2 = (TH2F*)PtResVsPt_NoGEM->Clone(); + TH2F * InvPtResVsPt_NoGEM2 = (TH2F*)InvPtResVsPt_NoGEM->Clone(); + TH2F * PtResVsEta_NoGEM2 = (TH2F*)PtResVsEta_NoGEM->Clone(); + TH2F * InvPtResVsEta_NoGEM2 = (TH2F*)InvPtResVsEta_NoGEM->Clone(); + TH2F * DPhiVsPt_NoGEM2 = (TH2F*)DPhiVsPt_NoGEM->Clone(); + + NumPt_NoGEM2->Divide(DenPt_NoGEM); + NumEta_NoGEM2->Divide(DenEta_NoGEM); + + TProfile * prof1_NoGEM = PtResVsPt_NoGEM2->ProfileX(); + TProfile * prof2_NoGEM = InvPtResVsPt_NoGEM2->ProfileX(); + TProfile * prof1_2_NoGEM = PtResVsEta_NoGEM2->ProfileX(); + TProfile * prof2_2_NoGEM = InvPtResVsEta_NoGEM2->ProfileX(); + TProfile * prof2bis_NoGEM = InvPtResVsPt_NoGEM2->ProfileX("profile",-1,-1,"s"); + TProfile * prof3_NoGEM = DPhiVsPt_NoGEM2->ProfileX(); + + TProfile * prof4_NoGEM = RecoPtVsSimPt_NoGEM->ProfileX(); + + std::vector vecResNoGEM; + for(int i=1; i<=PtResVsPt_NoGEM->GetNbinsX(); i++){ + + TH1F * temp = (TH1F*)pTRes_NoGEM->Clone(); + int col = i; + if(i==10) col=41; + if(i==5) col=46; + temp->SetLineColor(col); + temp->SetLineWidth(2); + + for(int j=1; j<=PtResVsPt_NoGEM->GetNbinsY(); j++){ + + float bin = PtResVsPt_NoGEM->GetBinContent(i,j); + + temp->SetBinContent(bin,i); + //std::cout<Clone(); + TH1F * denNoGem = (TH1F*)DeltaChargePercentage_NoGEM->Clone(); + + for(int i=1; i<=DeltaCharge_NoGEM->GetNbinsX(); i++){ + + int num1 = DeltaCharge_NoGEM->GetBinContent(i,2); + int num2 = DeltaCharge_NoGEM->GetBinContent(i,4); //zero + int num3 = DeltaCharge_NoGEM->GetBinContent(i,6); + + numNoGem->SetBinContent(i,num1+num3); + denNoGem->SetBinContent(i,num1+num2+num3); + + //cout<Draw(); + } + + ///////////////////////////////////////////////////////////////////////////////////// + + TFile * f2 = TFile::Open(name2.c_str()); + f2->cd(); + TH1F * pTRec_GEM = (TH1F*)gDirectory->Get("pTRec"); + TH1F * pTSim_GEM = (TH1F*)gDirectory->Get("pTSim"); + TH1F * pTRes_GEM = (TH1F*)gDirectory->Get("pTRes"); + TH1F * invPTRes_GEM = (TH1F*)gDirectory->Get("invPTRes"); + TH1F * pTDiff_GEM = (TH1F*)gDirectory->Get("pTDiff"); + TH1F * PSimEta_GEM = (TH1F*)gDirectory->Get("PSimEta"); + TH1F * PRecEta_GEM = (TH1F*)gDirectory->Get("PRecEta"); + TH1F * PDeltaEta_GEM = (TH1F*)gDirectory->Get("PDeltaEta"); + TH1F * PSimPhi_GEM = (TH1F*)gDirectory->Get("PSimPhi"); + TH1F * PRecPhi_GEM = (TH1F*)gDirectory->Get("PRecPhi"); + TH1F * NumSimTracks_GEM = (TH1F*)gDirectory->Get("NumSimTracks"); + TH1F * NumMuonSimTracks_GEM = (TH1F*)gDirectory->Get("NumMuonSimTracks"); + TH1F * NumRecTracks_GEM = (TH1F*)gDirectory->Get("NumRecTracks"); + TH2F * PtResVsPt_GEM = (TH2F*)gDirectory->Get("PtResVsPt"); + TH2F * InvPtResVsPt_GEM = (TH2F*)gDirectory->Get("InvPtResVsPt"); + TH2F * PtResVsEta_GEM = (TH2F*)gDirectory->Get("PtResVsEta"); + TH2F * InvPtResVsEta_GEM = (TH2F*)gDirectory->Get("InvPtResVsEta"); + TH2F * DPhiVsPt_GEM = (TH2F*)gDirectory->Get("DPhiVsPt"); + TH1F * DenPt_GEM = (TH1F*)gDirectory->Get("DenPt"); + TH1F * DenEta_GEM = (TH1F*)gDirectory->Get("DenEta"); + TH1F * DenPhi_GEM = (TH1F*)gDirectory->Get("DenPhi"); + TH1F * DenPhiPlus_GEM = (TH1F*)gDirectory->Get("DenPhiPlus"); + TH1F * DenPhiMinus_GEM = (TH1F*)gDirectory->Get("DenPhiMinus"); + TH1F * NumPt_GEM = (TH1F*)gDirectory->Get("NumPt"); + TH1F * NumEta_GEM = (TH1F*)gDirectory->Get("NumEta"); + TH1F * NumPhi_GEM = (TH1F*)gDirectory->Get("NumPhi"); + TH1F * NumPhiPlus_GEM = (TH1F*)gDirectory->Get("NumPhiPlus"); + TH1F * NumPhiMinus_GEM = (TH1F*)gDirectory->Get("NumPhiMinus"); + + TH1F * DenSimPt_GEM = (TH1F*)gDirectory->Get("DenSimPt"); + TH1F * DenSimEta_GEM = (TH1F*)gDirectory->Get("DenSimEta"); + TH1F * DenSimPhiPlus_GEM = (TH1F*)gDirectory->Get("DenSimPhiPlus"); + TH1F * DenSimPhiMinus_GEM = (TH1F*)gDirectory->Get("DenSimPhiMinus"); + TH1F * NumSimPt_GEM = (TH1F*)gDirectory->Get("NumSimPt"); + TH1F * NumSimEta_GEM = (TH1F*)gDirectory->Get("NumSimEta"); + TH1F * NumSimPhiPlus_GEM = (TH1F*)gDirectory->Get("NumSimPhiPlus"); + TH1F * NumSimPhiMinus_GEM = (TH1F*)gDirectory->Get("NumSimPhiMinus"); + + TH1F * PullGEM_GEM = (TH1F*)gDirectory->Get("PullGEMx"); + TH1F * PullCSC_GEM = (TH1F*)gDirectory->Get("PullCSC"); + TH1F * GEMRecHitEta_GEM = (TH1F*)gDirectory->Get("GEMRecHitEta"); + TH1F * GEMRecHitPhi_GEM = (TH1F*)gDirectory->Get("GEMRecHitPhi"); + TH2F * DeltaCharge_GEM = (TH2F*)gDirectory->Get("DeltaCharge"); + TH2F * RecPhi2DPlusLayer1_GEM = (TH2F*)gDirectory->Get("RecHitPhi2DPlusLayer1"); + TH2F * RecPhi2DMinusLayer1_GEM = (TH2F*)gDirectory->Get("RecHitPhi2DMinusLayer1"); + TH2F * RecPhi2DPlusLayer2_GEM = (TH2F*)gDirectory->Get("RecHitPhi2DPlusLayer2"); + TH2F * RecPhi2DMinusLayer2_GEM = (TH2F*)gDirectory->Get("RecHitPhi2DMinusLayer2"); + + TH1F * NumPt_GEM2 = (TH1F*)NumPt_GEM->Clone(); + TH1F * NumEta_GEM2 = (TH1F*)NumEta_GEM->Clone(); + + TH2F * PtResVsPt_GEM2 = (TH2F*)PtResVsPt_GEM->Clone(); + TH2F * InvPtResVsPt_GEM2 = (TH2F*)InvPtResVsPt_GEM->Clone(); + TH2F * PtResVsEta_GEM2 = (TH2F*)PtResVsEta_GEM->Clone(); + TH2F * InvPtResVsEta_GEM2 = (TH2F*)InvPtResVsEta_GEM->Clone(); + TH2F * DPhiVsPt_GEM2 = (TH2F*)DPhiVsPt_GEM->Clone(); + TH2F * RecoPtVsSimPt_GEM = (TH2F*)gDirectory->Get("RecoPtVsSimPt"); + + NumPt_GEM2->Divide(DenPt_GEM); + NumEta_GEM2->Divide(DenEta_GEM); + + TProfile * prof1_GEM = PtResVsPt_GEM2->ProfileX(); + TProfile * prof2_GEM = InvPtResVsPt_GEM2->ProfileX(); + TProfile * prof1_2_GEM = PtResVsEta_GEM2->ProfileX(); + TProfile * prof2_2_GEM = InvPtResVsEta_GEM2->ProfileX(); + TProfile * prof2bis_GEM = InvPtResVsPt_GEM2->ProfileX("profile",-1,-1,"s"); + TProfile * prof3_GEM = DPhiVsPt_GEM2->ProfileX(); + + TProfile * prof4_GEM = RecoPtVsSimPt_GEM->ProfileX(); + + TEfficiency* pEffPt_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumPt_GEM,*DenPt_GEM)) + { + pEffPt_GEM = new TEfficiency(*NumPt_GEM,*DenPt_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffEta_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumEta_GEM,*DenEta_GEM)) + { + pEffEta_GEM = new TEfficiency(*NumEta_GEM,*DenEta_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffEta_GEM->Draw(); + } + + TEfficiency* pEffPhi_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumPhi_GEM,*DenPhi_GEM)) + { + pEffPhi_GEM = new TEfficiency(*NumPhi_GEM,*DenPhi_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffPhiPlus_GEM = 0; + + NumPhiPlus_GEM->Rebin(10); + DenPhiPlus_GEM->Rebin(10); + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumPhiPlus_GEM,*DenPhiPlus_GEM)) + { + pEffPhiPlus_GEM = new TEfficiency(*NumPhiPlus_GEM,*DenPhiPlus_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffPhiMinus_GEM = 0; + + NumPhiMinus_GEM->Rebin(10); + DenPhiMinus_GEM->Rebin(10); + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumPhiMinus_GEM,*DenPhiMinus_GEM)) + { + pEffPhiMinus_GEM = new TEfficiency(*NumPhiMinus_GEM,*DenPhiMinus_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffSimPt_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumSimPt_GEM,*DenSimPt_GEM)) + { + pEffSimPt_GEM = new TEfficiency(*NumSimPt_GEM,*DenSimPt_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffSimEta_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumSimEta_GEM,*DenSimEta_GEM)) + { + pEffSimEta_GEM = new TEfficiency(*NumSimEta_GEM,*DenSimEta_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffEta_GEM->Draw(); + } + + TEfficiency* pEffSimPhiPlus_GEM = 0; + + NumSimPhiPlus_GEM->Rebin(10); + DenSimPhiPlus_GEM->Rebin(10); + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumSimPhiPlus_GEM,*DenSimPhiPlus_GEM)) + { + pEffSimPhiPlus_GEM = new TEfficiency(*NumSimPhiPlus_GEM,*DenSimPhiPlus_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffSimPhiMinus_GEM = 0; + + NumSimPhiMinus_GEM->Rebin(10); + DenSimPhiMinus_GEM->Rebin(10); + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumSimPhiMinus_GEM,*DenSimPhiMinus_GEM)) + { + pEffSimPhiMinus_GEM = new TEfficiency(*NumSimPhiMinus_GEM,*DenSimPhiMinus_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + std::vector vecResGEM; + for(int i=1; i<=PtResVsPt_GEM->GetNbinsX(); i++){ + + TH1F * temp = (TH1F*)pTRes_GEM->Clone(); + int col = i; + if(i==10) col=41; + if(i==5) col=46; + temp->SetLineColor(col); + temp->SetLineWidth(2); + + for(int j=1; j<=PtResVsPt_GEM->GetNbinsY(); j++){ + + float bin = PtResVsPt_GEM->GetBinContent(i,j); + + temp->SetBinContent(bin,i); + + } + + vecResGEM.push_back(temp); + + } + + //std::cout<Clone(); + TH1F * denGem = (TH1F*)DeltaChargePercentage_GEM->Clone(); + for(int i=1; i<=DeltaCharge_GEM->GetNbinsX(); i++){ + + int num1 = DeltaCharge_GEM->GetBinContent(i,2); + int num2 = DeltaCharge_GEM->GetBinContent(i,4); //zero + int num3 = DeltaCharge_GEM->GetBinContent(i,6); + + numGem->SetBinContent(i,num1+num3); + denGem->SetBinContent(i,num1+num2+num3); + + } + + TEfficiency* pEffCharge_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*numGem,*denGem)) + { + pEffCharge_GEM = new TEfficiency(*numGem,*denGem); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + + ///////////////////////////////////////////////////////////////////////////////////// + + TFile * fileOut = new TFile(name3.c_str(), "RECREATE"); + + pTRes_NoGEM->Write("pTRes_NoGEM"); + pTRes_GEM->Write("pTRes_GEM"); + + invPTRes_NoGEM->Write("invPTRes_NoGEM"); + invPTRes_GEM->Write("invPTRes_GEM"); + + pTDiff_GEM->Write("pTDiff_GEM"); + pTDiff_NoGEM->Write("pTDiff_NoGEM"); + + prof1_NoGEM->Write("prof1_NoGEM"); + prof1_GEM->Write("prof1_GEM"); + PtResVsPt_NoGEM->Write("PtResVsPt_NoGEM"); + PtResVsPt_GEM->Write("PtResVsPt_GEM"); + PtResVsEta_NoGEM->Write("PtResVsEta_NoGEM"); + PtResVsEta_GEM->Write("PtResVsEta_GEM"); + + prof2_NoGEM->Write("prof2_NoGEM"); + prof2_GEM->Write("prof2_GEM"); + InvPtResVsPt_NoGEM->Write("InvPtResVsPt_NoGEM"); + InvPtResVsPt_GEM->Write("InvPtResVsPt_GEM"); + InvPtResVsEta_NoGEM->Write("InvPtResVsEta_NoGEM"); + InvPtResVsEta_GEM->Write("InvPtResVsEta_GEM"); + + prof1_2_NoGEM->Write("prof1_2_NoGEM"); + prof1_2_GEM->Write("prof1_2_GEM"); + + prof2_2_NoGEM->Write("prof2_2_NoGEM"); + prof2_2_GEM->Write("prof2_2_GEM"); + + pEffPt_GEM->Write("pEffPt_GEM"); + + pEffEta_GEM->Write("pEffEta_GEM"); + + pEffSimPt_GEM->Write("pEffSimPt_GEM"); + + pEffSimEta_GEM->Write("pEffSimEta_GEM"); + + pEffCharge_NoGEM->Write("pEffCharge_NoGEM"); + pEffCharge_GEM->Write("pEffCharge_GEM"); + + pEffPhiPlus_GEM->Write("pEffPhiPlus_GEM"); + pEffPhiMinus_GEM->Write("pEffPhiMinus_GEM"); + pEffSimPhiPlus_GEM->Write("pEffSimPhiPlus_GEM"); + pEffSimPhiMinus_GEM->Write("pEffSimPhiMinus_GEM"); + + prof4_NoGEM->Write("prof4_NoGEM"); + prof4_GEM->Write("prof4_GEM"); + + fileOut->Write(); + +} + +void makeAll(){ + + makePlots("GLBMuonAnalyzer_5GeV.root","GLBMuonAnalyzerWithGEMs_5GeV.root","plots_5GeV.root"); + makePlots("GLBMuonAnalyzer_10GeV.root","GLBMuonAnalyzerWithGEMs_10GeV.root","plots_10GeV.root"); + makePlots("GLBMuonAnalyzer_50GeV.root","GLBMuonAnalyzerWithGEMs_50GeV.root","plots_50GeV.root"); + makePlots("GLBMuonAnalyzer_100GeV.root","GLBMuonAnalyzerWithGEMs_100GeV.root","plots_100GeV.root"); + makePlots("GLBMuonAnalyzer_200GeV.root","GLBMuonAnalyzerWithGEMs_200GeV.root","plots_200GeV.root"); + makePlots("GLBMuonAnalyzer_500GeV.root","GLBMuonAnalyzerWithGEMs_500GeV.root","plots_500GeV.root"); + makePlots("GLBMuonAnalyzer_1000GeV.root","GLBMuonAnalyzerWithGEMs_1000GeV.root","plots_1000GeV.root"); + +} + diff --git a/GEMValidation/scripts/produceRecoPlotsVersusEta.C b/GEMValidation/scripts/produceRecoPlotsVersusEta.C new file mode 100644 index 0000000000000..ba0efae2c2e74 --- /dev/null +++ b/GEMValidation/scripts/produceRecoPlotsVersusEta.C @@ -0,0 +1,754 @@ +#include +#include +#include +#include "TTree.h" +#include "TFile.h" +#include "TMath.h" +#include "TH1F.h" +#include "TH2F.h" +#include "TF1.h" +#include "TCanvas.h" +#include "TLegend.h" +#include "TGraphAsymmErrors.h" +#include "TPaveStats.h" +#include "TStyle.h" +#include "TEfficiency.h" +#include "TProfile.h" + +#include "TStyle.h" + +void setTDRStyle() { + TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR"); + +// For the canvas: + tdrStyle->SetCanvasBorderMode(0); + tdrStyle->SetCanvasColor(kWhite); + tdrStyle->SetCanvasDefH(600); //Height of canvas + tdrStyle->SetCanvasDefW(600); //Width of canvas + tdrStyle->SetCanvasDefX(0); //POsition on screen + tdrStyle->SetCanvasDefY(0); + +// For the Pad: + tdrStyle->SetPadBorderMode(0); + // tdrStyle->SetPadBorderSize(Width_t size = 1); + tdrStyle->SetPadColor(kWhite); + tdrStyle->SetPadGridX(false); + tdrStyle->SetPadGridY(false); + tdrStyle->SetGridColor(0); + tdrStyle->SetGridStyle(3); + tdrStyle->SetGridWidth(1); + +// For the frame: + tdrStyle->SetFrameBorderMode(0); + tdrStyle->SetFrameBorderSize(1); + tdrStyle->SetFrameFillColor(0); + tdrStyle->SetFrameFillStyle(0); + tdrStyle->SetFrameLineColor(1); + tdrStyle->SetFrameLineStyle(1); + tdrStyle->SetFrameLineWidth(1); + +// For the histo: + // tdrStyle->SetHistFillColor(1); + // tdrStyle->SetHistFillStyle(0); + tdrStyle->SetHistLineColor(1); + tdrStyle->SetHistLineStyle(0); + tdrStyle->SetHistLineWidth(1); + // tdrStyle->SetLegoInnerR(Float_t rad = 0.5); + // tdrStyle->SetNumberContours(Int_t number = 20); + + tdrStyle->SetEndErrorSize(2); +// tdrStyle->SetErrorMarker(20); + tdrStyle->SetErrorX(0.5); + + tdrStyle->SetMarkerStyle(20); + +//For the fit/function: + tdrStyle->SetOptFit(1); + tdrStyle->SetFitFormat("5.4g"); + tdrStyle->SetFuncColor(2); + tdrStyle->SetFuncStyle(1); + tdrStyle->SetFuncWidth(1); + +//For the date: + tdrStyle->SetOptDate(0); + // tdrStyle->SetDateX(Float_t x = 0.01); + // tdrStyle->SetDateY(Float_t y = 0.01); + +// For the statistics box: + tdrStyle->SetOptFile(0); + tdrStyle->SetOptStat(0); // To display the mean and RMS: SetOptStat("mr"); + tdrStyle->SetStatColor(kWhite); + tdrStyle->SetStatFont(42); + tdrStyle->SetStatFontSize(0.025); + tdrStyle->SetStatTextColor(1); + tdrStyle->SetStatFormat("6.4g"); + tdrStyle->SetStatBorderSize(1); + tdrStyle->SetStatH(0.1); + tdrStyle->SetStatW(0.15); + // tdrStyle->SetStatStyle(Style_t style = 1001); + // tdrStyle->SetStatX(Float_t x = 0); + // tdrStyle->SetStatY(Float_t y = 0); + +// Margins: + tdrStyle->SetPadTopMargin(0.05); + tdrStyle->SetPadBottomMargin(0.13); + tdrStyle->SetPadLeftMargin(0.16); + tdrStyle->SetPadRightMargin(0.02); + +// For the Global title: + + tdrStyle->SetOptTitle(0); + tdrStyle->SetTitleFont(42); + tdrStyle->SetTitleColor(1); + tdrStyle->SetTitleTextColor(1); + tdrStyle->SetTitleFillColor(10); + tdrStyle->SetTitleFontSize(0.05); + // tdrStyle->SetTitleH(0); // Set the height of the title box + // tdrStyle->SetTitleW(0); // Set the width of the title box + // tdrStyle->SetTitleX(0); // Set the position of the title box + // tdrStyle->SetTitleY(0.985); // Set the position of the title box + // tdrStyle->SetTitleStyle(Style_t style = 1001); + // tdrStyle->SetTitleBorderSize(2); + +// For the axis titles: + + tdrStyle->SetTitleColor(1, "XYZ"); + tdrStyle->SetTitleFont(42, "XYZ"); + tdrStyle->SetTitleSize(0.06, "XYZ"); + // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size? + // tdrStyle->SetTitleYSize(Float_t size = 0.02); + tdrStyle->SetTitleXOffset(0.9); + tdrStyle->SetTitleYOffset(1.25); + // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset + +// For the axis labels: + + tdrStyle->SetLabelColor(1, "XYZ"); + tdrStyle->SetLabelFont(42, "XYZ"); + tdrStyle->SetLabelOffset(0.007, "XYZ"); + tdrStyle->SetLabelSize(0.05, "XYZ"); + +// For the axis: + + tdrStyle->SetAxisColor(1, "XYZ"); + tdrStyle->SetStripDecimals(kTRUE); + tdrStyle->SetTickLength(0.03, "XYZ"); + tdrStyle->SetNdivisions(510, "XYZ"); + tdrStyle->SetPadTickX(1); // To get tick marks on the opposite side of the frame + tdrStyle->SetPadTickY(1); + +// Change for log plots: + tdrStyle->SetOptLogx(0); + tdrStyle->SetOptLogy(0); + tdrStyle->SetOptLogz(0); + +// Postscript options: + tdrStyle->SetPaperSize(20.,20.); + // tdrStyle->SetLineScalePS(Float_t scale = 3); + // tdrStyle->SetLineStyleString(Int_t i, const char* text); + // tdrStyle->SetHeaderPS(const char* header); + // tdrStyle->SetTitlePS(const char* pstitle); + + // tdrStyle->SetBarOffset(Float_t baroff = 0.5); + // tdrStyle->SetBarWidth(Float_t barwidth = 0.5); + // tdrStyle->SetPaintTextFormat(const char* format = "g"); + // tdrStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0); + // tdrStyle->SetTimeOffset(Double_t toffset); + // tdrStyle->SetHistMinimumZero(kTRUE); + + tdrStyle->cd(); + +} + +struct MyHisto{ + + TH2F * PtResVsEta_NoGEM; + TH2F * InvPtResVsEta_NoGEM; + TH2F * PtResVsEta_GEM; + TH2F * InvPtResVsEta_GEM; + + TProfile * prof_PtResVsEta_NoGEM; + TProfile * prof_InvPtResVsEta_NoGEM; + TProfile * prof_PtResVsEta_GEM; + TProfile * prof_InvPtResVsEta_GEM; + + TEfficiency * pEffEta_GEM; + TEfficiency * pEffSimEta_GEM; + TEfficiency * pEffPhiPlus_GEM; + TEfficiency * pEffPhiMinus_GEM; + TEfficiency * pEffSimPhiPlus_GEM; + TEfficiency * pEffSimPhiMinus_GEM; + +}; + +struct MyPar{ + + double mean; + double rms; + double sigma; + double sigmaErr; + double sigmaFR; + double sigmaErrFR; + double DeltaSigma; + TH1D * histo; + +}; + +MyPar extractSigma(TH1D * hist, std::string postFix = "none"){ + + gStyle->SetOptStat(000002210); + + std::string name = "fit_"; + + MyPar obj; + + obj.mean = hist->GetMean(); + obj.rms = hist->GetRMS(); + TCanvas * canvasTMP = new TCanvas("canvasTMP","canvas",700,700); + + std::string label; + if(postFix.find("InvRes") != std::string::npos) label = "(q^{Reco}/p_{T}^{Reco} - q^{Sim}/p_{T}^{Sim}) / q^{Sim}/p_{T}^{Sim}"; + else label = "(p_{T}^{Reco} - p_{T}^{Sim}) / p_{T}^{Sim}"; + + hist->GetXaxis()->SetTitle(label.c_str()); + hist->Draw(); + TF1 *myfitFR = new TF1("myfitFR","gaus", -1, +1); + hist->Fit("myfitFR"); + TF1 *myfit = new TF1("myfit","gaus", -(obj.mean+2*obj.rms), obj.mean+2*obj.rms); + hist->Fit("myfit", "R"); + + obj.sigma = myfit->GetParameter(2); + obj.sigmaErr = myfit->GetParError(2); + obj.sigmaFR = myfitFR->GetParameter(2); + obj.sigmaErrFR = myfitFR->GetParError(2); + double delta = abs(myfit->GetParameter(2) - myfitFR->GetParameter(2)); + obj.DeltaSigma = sqrt(delta*delta + obj.sigmaErr*obj.sigmaErr); + obj.histo = hist; + + //hist->GetXaxis()->SetRangeUser(-0.5, +0.5); + //hist->Draw(); + canvasTMP->SaveAs((name + postFix + ".png").c_str()); + return obj; + +} + +MyHisto extractHistos(std::string name){ + + TFile * f1 = TFile::Open(name.c_str()); + f1->cd(); + MyHisto temp; + + std::cout<<("aperto "+name).c_str()<Get("PtResVsEta_NoGEM"); + temp.InvPtResVsEta_NoGEM = (TH2F*)gDirectory->Get("InvPtResVsEta_NoGEM"); + temp.PtResVsEta_GEM = (TH2F*)gDirectory->Get("PtResVsEta_GEM"); + temp.InvPtResVsEta_GEM = (TH2F*)gDirectory->Get("InvPtResVsEta_GEM"); + + temp.prof_PtResVsEta_NoGEM = (TProfile*)gDirectory->Get("prof1_2_NoGEM"); + temp.prof_InvPtResVsEta_NoGEM = (TProfile*)gDirectory->Get("prof2_2_NoGEM"); + temp.prof_PtResVsEta_GEM = (TProfile*)gDirectory->Get("prof1_2_GEM"); + temp.prof_InvPtResVsEta_GEM = (TProfile*)gDirectory->Get("prof2_2_GEM"); + + temp.pEffEta_GEM = (TEfficiency*)gDirectory->Get("pEffEta_GEM"); + temp.pEffSimEta_GEM = (TEfficiency*)gDirectory->Get("pEffSimEta_GEM"); + temp.pEffPhiPlus_GEM = (TEfficiency*)gDirectory->Get("pEffPhiPlus_GEM"); + temp.pEffPhiMinus_GEM = (TEfficiency*)gDirectory->Get("pEffPhiMinus_GEM"); + temp.pEffSimPhiPlus_GEM = (TEfficiency*)gDirectory->Get("pEffSimPhiPlus_GEM"); + temp.pEffSimPhiMinus_GEM = (TEfficiency*)gDirectory->Get("pEffSimPhiMinus_GEM"); + + return temp; + +} + +std::string bin[] = {"5", "10", "50", "100", "200", "500", "1000"}; + +std::vector projectAndFit(TH2F * Histo2D, std::string postFix = "none"){ + + std::vector vec; + + TH1D * h1 = new TH1D((postFix + "RMS").c_str(),(postFix + "RMS").c_str(),100,-2.5,+2.5); + TH1D * h2 = new TH1D((postFix + "Sigma").c_str(),(postFix + "Sigma").c_str(),100,-2.5,+2.5); + + for(int i = 1; i <= Histo2D->GetNbinsX(); i++){ + + TH1D * proj1 = Histo2D->ProjectionY("proj1",i,i); + if(proj1->GetEntries() == 0) continue; + std::stringstream ss; + ss<SetBinContent(i,temp.rms); + h1->SetBinError(i,0); + + h2->SetBinContent(i,temp.sigma); + h2->SetBinError(i,temp.DeltaSigma); + + } + + vec.push_back(h1); + vec.push_back(h2); + return vec; + +} + +TH1F * makeRatio(TH1F * plot1, TH1F * plot2){ + + TH1F * plotTMP = (TH1F*)plot2->Clone(); + plotTMP->Divide(plot1); + return plotTMP; + +} + +TH1D * makeRatio2(TH1D * plot1, TH1D * plot2){ + + TH1D * plotTMP = (TH1D*)plot2->Clone(); + plotTMP->SetStats(kFALSE); + plotTMP->SetLineColor(1); + plotTMP->SetMaximum(1.1); + plotTMP->SetMinimum(0.6); + plotTMP->Divide(plot1); + return plotTMP; + +} + +TH1D * makeRatio3(TEfficiency * plot1, TEfficiency * plot2){ + + TH1D * plotTMP1 = new TH1D("plotTMP1","plotTMP1",221,-2.5,1102.5); + TH1D * plotTMP2 = new TH1D("plotTMP2","plotTMP2",221,-2.5,1102.5); + + for(int i = 1; i <= plotTMP1->GetSize(); i++){ + + double eff1 = plot1->GetEfficiency(i); + double eff2 = plot2->GetEfficiency(i); + + //std::cout<<"eff1: "<GetEfficiencyErrorLow(i) + plot1->GetEfficiencyErrorUp(i))/2; + double err2 = (plot2->GetEfficiencyErrorLow(i) + plot2->GetEfficiencyErrorUp(i))/2; + + plotTMP1->SetBinContent(i,eff1); + plotTMP1->SetBinError(i,err1); + plotTMP2->SetBinContent(i,eff2); + plotTMP2->SetBinError(i,err2); + + } + + plotTMP2->SetMaximum(4); + plotTMP2->SetMinimum(0.01); + plotTMP2->Divide(plotTMP1); + return plotTMP2; + +} +// 0 1 2 3 4 5 6 +// 5 10 50 100 200 500 1000 +int colorVec[] = {1, 3, 2, 4, 5, 7, 6}; + +void superimposeHistos(std::vector allHistos){ + + TCanvas * canvas = new TCanvas("canvas","canvas",700,700); + + TLegend *leg5 = new TLegend(0.50,0.40,0.70,0.80); + leg5->SetFillColor(kWhite); + leg5->SetLineColor(kWhite); + //leg5->SetHeader("Standard Reco"); + + allHistos[0].pEffSimEta_GEM->Draw("AP"); + gPad->Update(); + allHistos[0].pEffSimEta_GEM->GetPaintedGraph()->SetMaximum(1); + gPad->Update(); + allHistos[0].pEffSimEta_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#eta^{Sim}"); + gPad->Update(); + allHistos[0].pEffSimEta_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon"); + allHistos[0].pEffSimEta_GEM->SetMarkerStyle(20); + allHistos[0].pEffSimEta_GEM->Draw("AP"); + leg5->AddEntry(allHistos[0].pEffSimEta_GEM,"p_{T} = 5 GeV/c","lp"); + + for(int i=1; i<(int)allHistos.size(); i++){ + + if(!(i == 0 || i == 2 || i == 6)) continue; + allHistos[i].pEffSimEta_GEM->SetMarkerStyle(20); + std::cout<<"color "<SetLineColor(colorVec[i]); + allHistos[i].pEffSimEta_GEM->SetMarkerColor(colorVec[i]); + allHistos[i].pEffSimEta_GEM->Draw("SAME"); + leg5->AddEntry(allHistos[i].pEffSimEta_GEM,("p_{T} = " + bin[i] + " GeV/c").c_str(),"lp"); + + } + leg5->Draw(); + + canvas->SaveAs("plot1.png"); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + allHistos[0].pEffEta_GEM->Draw("AP"); + gPad->Update(); + allHistos[0].pEffEta_GEM->GetPaintedGraph()->SetMaximum(1); + gPad->Update(); + allHistos[0].pEffEta_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#eta^{Reco}"); + gPad->Update(); + allHistos[0].pEffEta_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon"); + allHistos[0].pEffEta_GEM->SetMarkerStyle(20); + allHistos[0].pEffEta_GEM->Draw("AP"); + + for(int i=1; i<(int)allHistos.size(); i++){ + + if(!(i == 0 || i == 2 || i == 6)) continue; + allHistos[i].pEffEta_GEM->SetMarkerStyle(20); + allHistos[i].pEffEta_GEM->SetLineColor(colorVec[i]); + allHistos[i].pEffEta_GEM->SetMarkerColor(colorVec[i]); + allHistos[i].pEffEta_GEM->Draw("SAME"); + + } + leg5->Draw(); + + canvas->SaveAs("plot2.png"); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + //TCanvas * canvas = new TCanvas("canvas","canvas",700,700); + + TLegend *leg6 = new TLegend(0.80,0.15,1.00,0.55); + leg6->SetFillColor(kWhite); + leg6->SetLineColor(kWhite); + //leg6->SetHeader("Standard Reco"); + + allHistos[0].pEffPhiPlus_GEM->Draw("AP"); + gPad->Update(); + allHistos[0].pEffPhiPlus_GEM->GetPaintedGraph()->SetMaximum(1); + gPad->Update(); + allHistos[0].pEffPhiPlus_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#phi^{Reco}"); + gPad->Update(); + allHistos[0].pEffPhiPlus_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon (#eta > 0)"); + allHistos[0].pEffPhiPlus_GEM->SetMarkerStyle(20); + allHistos[0].pEffPhiPlus_GEM->Draw("AP"); + leg6->AddEntry(allHistos[0].pEffPhiPlus_GEM,"p_{T} = 5 GeV/c","lp"); + + for(int i=1; i<(int)allHistos.size(); i++){ + + if(!(i == 0 || i == 2 || i == 6)) continue; + allHistos[i].pEffPhiPlus_GEM->SetMarkerStyle(20); + allHistos[i].pEffPhiPlus_GEM->SetLineColor(colorVec[i]); + allHistos[i].pEffPhiPlus_GEM->SetMarkerColor(colorVec[i]); + allHistos[i].pEffPhiPlus_GEM->Draw("SAME"); + leg6->AddEntry(allHistos[i].pEffPhiPlus_GEM,("p_{T} = " + bin[i] + " GeV/c").c_str(),"lp"); + + } + leg6->Draw(); + + canvas->SaveAs("plot3.png"); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + allHistos[0].pEffPhiMinus_GEM->Draw("AP"); + gPad->Update(); + allHistos[0].pEffPhiMinus_GEM->GetPaintedGraph()->SetMaximum(1); + gPad->Update(); + allHistos[0].pEffPhiMinus_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#phi^{Reco}"); + gPad->Update(); + allHistos[0].pEffPhiMinus_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon (#eta < 0)"); + allHistos[0].pEffPhiMinus_GEM->SetMarkerStyle(20); + allHistos[0].pEffPhiMinus_GEM->Draw("AP"); + + for(int i=1; i<(int)allHistos.size(); i++){ + + if(!(i == 0 || i == 2 || i == 6)) continue; + allHistos[i].pEffPhiMinus_GEM->SetMarkerStyle(20); + allHistos[i].pEffPhiMinus_GEM->SetLineColor(colorVec[i]); + allHistos[i].pEffPhiMinus_GEM->SetMarkerColor(colorVec[i]); + allHistos[i].pEffPhiMinus_GEM->Draw("SAME"); + + } + leg6->Draw(); + + canvas->SaveAs("plot4.png"); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + allHistos[0].pEffSimPhiPlus_GEM->Draw("AP"); + gPad->Update(); + allHistos[0].pEffSimPhiPlus_GEM->GetPaintedGraph()->SetMaximum(1); + gPad->Update(); + allHistos[0].pEffSimPhiPlus_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#phi^{Sim}"); + gPad->Update(); + allHistos[0].pEffSimPhiPlus_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon (#eta > 0)"); + allHistos[0].pEffSimPhiPlus_GEM->SetMarkerStyle(20); + allHistos[0].pEffSimPhiPlus_GEM->Draw("AP"); + + for(int i=1; i<(int)allHistos.size(); i++){ + + if(!(i == 0 || i == 2 || i == 6)) continue; + allHistos[i].pEffSimPhiPlus_GEM->SetMarkerStyle(20); + allHistos[i].pEffSimPhiPlus_GEM->SetLineColor(colorVec[i]); + allHistos[i].pEffSimPhiPlus_GEM->SetMarkerColor(colorVec[i]); + allHistos[i].pEffSimPhiPlus_GEM->Draw("SAME"); + + } + leg6->Draw(); + + canvas->SaveAs("plot6.png"); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + allHistos[0].pEffSimPhiMinus_GEM->Draw("AP"); + gPad->Update(); + allHistos[0].pEffSimPhiMinus_GEM->GetPaintedGraph()->SetMaximum(1); + gPad->Update(); + allHistos[0].pEffSimPhiMinus_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#phi^{Sim}"); + gPad->Update(); + allHistos[0].pEffSimPhiMinus_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon (#eta < 0)"); + allHistos[0].pEffSimPhiMinus_GEM->SetMarkerStyle(20); + allHistos[0].pEffSimPhiMinus_GEM->Draw("AP"); + + for(int i=1; i<(int)allHistos.size(); i++){ + + if(!(i == 0 || i == 2 || i == 6)) continue; + allHistos[i].pEffSimPhiMinus_GEM->SetMarkerStyle(20); + allHistos[i].pEffSimPhiMinus_GEM->SetLineColor(colorVec[i]); + allHistos[i].pEffSimPhiMinus_GEM->SetMarkerColor(colorVec[i]); + allHistos[i].pEffSimPhiMinus_GEM->Draw("SAME"); + + } + leg6->Draw(); + + canvas->SaveAs("plot7.png"); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /*for(int i=0; i<(int)allHistos.size(); i++){ + + TLegend *leg2 = new TLegend(0.40,0.50,0.70,0.70); + leg2->SetFillColor(0); + leg2->SetLineColor(1); + leg2->SetHeader(("p_{T} = " + bin[i] + " GeV/c").c_str()); + + allHistos[i].prof_PtResVsEta_NoGEM->SetStats(kFALSE); + allHistos[i].prof_PtResVsEta_NoGEM->SetMaximum(+0.025); + allHistos[i].prof_PtResVsEta_NoGEM->SetMinimum(-0.025); + allHistos[i].prof_PtResVsEta_NoGEM->SetLineColor(9); + allHistos[i].prof_PtResVsEta_NoGEM->GetXaxis()->SetTitle("#eta^{Sim}"); + allHistos[i].prof_PtResVsEta_NoGEM->GetYaxis()->SetTitle("< (p_{T}^{Reco} - p_{T}^{Sim}) / p_{T}^{Sim} >"); + allHistos[i].prof_PtResVsEta_NoGEM->Draw("E1P"); + allHistos[i].prof_PtResVsEta_GEM->SetLineColor(2); + allHistos[i].prof_PtResVsEta_GEM->Draw("E1PSAME"); + + leg2->AddEntry(allHistos[i].prof_PtResVsEta_NoGEM, "Standard Reco", "lp"); + leg2->AddEntry(allHistos[i].prof_PtResVsEta_GEM, "GEMsReco+GEMRecHit", "lp"); + leg2->Draw(); + canvas->SaveAs(("plot_Res_" + bin[i] + ".png").c_str()); + + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + for(int i=0; i<(int)allHistos.size(); i++){ + + TLegend *leg2 = new TLegend(0.40,0.50,0.70,0.70); + leg2->SetFillColor(0); + leg2->SetLineColor(1); + leg2->SetHeader(("p_{T} = " + bin[i] + " GeV/c").c_str()); + + allHistos[i].prof_InvPtResVsEta_NoGEM->SetStats(kFALSE); + allHistos[i].prof_InvPtResVsEta_NoGEM->SetMaximum(+0.03); + allHistos[i].prof_InvPtResVsEta_NoGEM->SetMinimum(-0.03); + allHistos[i].prof_InvPtResVsEta_NoGEM->SetLineColor(9); + allHistos[i].prof_InvPtResVsEta_NoGEM->GetXaxis()->SetTitle("#eta^{Sim}"); + allHistos[i].prof_InvPtResVsEta_NoGEM->GetYaxis()->SetTitle("< (p_{T}^{Reco} - p_{T}^{Sim}) / p_{T}^{Sim} >"); + allHistos[i].prof_InvPtResVsEta_NoGEM->Draw("E1P"); + allHistos[i].prof_InvPtResVsEta_GEM->SetLineColor(2); + allHistos[i].prof_InvPtResVsEta_GEM->Draw("E1PSAME"); + + leg2->AddEntry(allHistos[i].prof_InvPtResVsEta_NoGEM, "Standard Reco", "lp"); + leg2->AddEntry(allHistos[i].prof_InvPtResVsEta_GEM, "GEMsReco+GEMRecHit", "lp"); + leg2->Draw(); + canvas->SaveAs(("plot_InvRes_" + bin[i] + ".png").c_str()); + + }*/ + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + for(int i = 0; i < (int)allHistos.size(); i++){ + + std::vector resGEM = projectAndFit(allHistos[i].PtResVsEta_GEM,("Res_GEM_" + bin[i] + "GeV_").c_str()); + std::vector resNoGEM = projectAndFit(allHistos[i].PtResVsEta_NoGEM,("Res_NoGEM_" + bin[i] + "GeV_").c_str()); + + TLegend *leg2 = new TLegend(0.40,0.50,0.70,0.70); + leg2->SetFillColor(0); + leg2->SetLineColor(1); + leg2->SetHeader(("RMS: p_{T} = " + bin[i] + " GeV/c").c_str()); + + TCanvas * canvas2 = new TCanvas("canvas2","canvas",700,700); + canvas2->Divide(1,2); + canvas2->cd(1); + + TH1D * hRMSNoGEM = (TH1D*)resNoGEM[0]->Clone(); + TH1D * hRMSGEM = (TH1D*)resGEM[0]->Clone(); + + hRMSNoGEM->SetStats(kFALSE); + hRMSNoGEM->SetMarkerColor(9); + hRMSNoGEM->GetXaxis()->SetTitle("#eta^{Sim}"); + hRMSNoGEM->GetYaxis()->SetTitle("RMS_{Res}"); + hRMSNoGEM->SetMarkerStyle(20); + hRMSNoGEM->Draw("P"); + hRMSGEM->SetMarkerColor(2); + hRMSGEM->SetMarkerStyle(20); + hRMSGEM->Draw("PSAME"); + leg2->AddEntry(hRMSNoGEM, "Standard Reco", "p"); + leg2->AddEntry(hRMSGEM, "GEMsReco+GEMRecHit", "p"); + leg2->Draw(); + + canvas2->cd(2); + TH1D * ratioComp1 = makeRatio2(hRMSNoGEM, hRMSGEM); + ratioComp1->SetMarkerColor(1); + ratioComp1->GetXaxis()->SetTitle("#eta^{Sim}"); + ratioComp1->GetYaxis()->SetTitle("RMS_{Res}^{GEM} / RMS_{Res}^{NoGEM}"); + ratioComp1->Draw("E1P"); + + canvas2->SaveAs(("RMS_Res_" + bin[i] + "GeV.png").c_str()); + + canvas2->Clear(); + canvas2->Update(); + canvas2->Divide(1,2); + canvas2->cd(1); + + TH1D * hResNoGEM = (TH1D*)resNoGEM[1]->Clone(); + TH1D * hResGEM = (TH1D*)resGEM[1]->Clone(); + + TLegend *leg3 = new TLegend(0.40,0.50,0.70,0.70); + leg3->SetFillColor(0); + leg3->SetLineColor(1); + leg3->SetHeader(("#sigma: p_{T} = " + bin[i] + " GeV/c").c_str()); + + hResNoGEM->SetLineColor(9); + hResNoGEM->SetMarkerColor(9); + hResNoGEM->SetStats(kFALSE); + hResNoGEM->GetXaxis()->SetTitle("#eta^{Sim}"); + hResNoGEM->GetYaxis()->SetTitle("#sigma_{Res}"); + hResNoGEM->Draw("E1P"); + hResGEM->SetLineColor(2); + hResGEM->SetMarkerColor(2); + hResGEM->Draw("E1PSAME"); + leg3->AddEntry(hResNoGEM, "Standard Reco", "pl"); + leg3->AddEntry(hResGEM, "GEMsReco+GEMRecHit", "pl"); + leg3->Draw(); + + canvas2->cd(2); + TH1D * ratioComp2 = makeRatio2(hResNoGEM, hResGEM); + ratioComp2->SetMarkerColor(1); + ratioComp2->GetXaxis()->SetTitle("#eta^{Sim}"); + ratioComp2->GetYaxis()->SetTitle("#sigma_{Res}^{GEM} / #sigma_{Res}^{NoGEM}"); + ratioComp2->Draw("E1P"); + + canvas2->SaveAs(("Res_" + bin[i] + "GeV.png").c_str()); + + canvas2->Clear(); + canvas2->Update(); + + } + + for(int i = 0; i < (int)allHistos.size(); i++){ + + std::vector invResGEM = projectAndFit(allHistos[i].InvPtResVsEta_GEM,("InvRes_GEM_" + bin[i] + "GeV_").c_str()); + std::vector invResNoGEM = projectAndFit(allHistos[i].InvPtResVsEta_NoGEM,("InvRes_NoGEM_" + bin[i] + "GeV_").c_str()); + + TLegend *leg2 = new TLegend(0.40,0.50,0.70,0.70); + leg2->SetFillColor(0); + leg2->SetLineColor(1); + leg2->SetHeader(("RMS: p_{T} = " + bin[i] + " GeV/c").c_str()); + + TCanvas * canvas2 = new TCanvas("canvas2","canvas",700,700); + canvas2->Divide(1,2); + canvas2->cd(1); + + TH1D * hRMSNoGEM = (TH1D*)invResNoGEM[0]->Clone(); + TH1D * hRMSGEM = (TH1D*)invResGEM[0]->Clone(); + + hRMSNoGEM->SetStats(kFALSE); + hRMSNoGEM->SetMarkerColor(9); + hRMSNoGEM->GetXaxis()->SetTitle("#eta^{Sim}"); + hRMSNoGEM->GetYaxis()->SetTitle("RMS_{InvRes}"); + hRMSNoGEM->SetMarkerStyle(20); + hRMSNoGEM->Draw("P"); + //hRMSNoGEM->SetMaximum(hRMSGEM->GetMaximum()); + hRMSGEM->SetMarkerColor(2); + hRMSGEM->SetMarkerStyle(20); + hRMSGEM->Draw("PSAME"); + leg2->AddEntry(hRMSNoGEM, "Standard Reco", "p"); + leg2->AddEntry(hRMSGEM, "GEMsReco+GEMRecHit", "p"); + leg2->Draw(); + + canvas2->cd(2); + TH1D * ratioComp1 = makeRatio2(hRMSNoGEM, hRMSGEM); + ratioComp1->SetMarkerColor(1); + ratioComp1->GetXaxis()->SetTitle("#eta^{Sim}"); + ratioComp1->GetYaxis()->SetTitle("RMS_{InvRes}^{GEM} / RMS_{InvRes}^{NoGEM}"); + ratioComp1->Draw("E1P"); + + canvas2->SaveAs(("RMS_InvRes_" + bin[i] + "GeV.png").c_str()); + + canvas2->Clear(); + canvas2->Update(); + canvas2->Divide(1,2); + canvas2->cd(1); + + TH1D * hInvResNoGEM = (TH1D*)invResNoGEM[1]->Clone(); + TH1D * hInvResGEM = (TH1D*)invResGEM[1]->Clone(); + + TLegend *leg3 = new TLegend(0.40,0.50,0.70,0.70); + leg3->SetFillColor(0); + leg3->SetLineColor(1); + leg3->SetHeader(("#sigma: p_{T} = " + bin[i] + " GeV/c").c_str()); + + hInvResNoGEM->SetLineColor(9); + hInvResNoGEM->SetMarkerColor(9); + //hInvResNoGEM->SetMarkerSize(0); + hInvResNoGEM->SetStats(kFALSE); + hInvResNoGEM->GetXaxis()->SetTitle("#eta^{Sim}"); + hInvResNoGEM->GetYaxis()->SetTitle("#sigma_{InvRes}"); + hInvResNoGEM->Draw("E1P"); + hInvResGEM->SetLineColor(2); + hInvResGEM->SetMarkerColor(2); + //hInvResGEM->SetMarkerSize(0); + hInvResGEM->Draw("E1PSAME"); + leg3->AddEntry(hInvResNoGEM, "Standard Reco", "pl"); + leg3->AddEntry(hInvResGEM, "GEMsReco+GEMRecHit", "pl"); + leg3->Draw(); + + canvas2->cd(2); + TH1D * ratioComp2 = makeRatio2(hInvResNoGEM, hInvResGEM); + ratioComp2->SetMarkerColor(1); + ratioComp2->GetXaxis()->SetTitle("#eta^{Sim}"); + ratioComp2->GetYaxis()->SetTitle("#sigma_{InvRes}^{GEM} / #sigma_{InvRes}^{NoGEM}"); + ratioComp2->Draw("E1P"); + + canvas2->SaveAs(("InvRes_" + bin[i] + "GeV.png").c_str()); + + } + +} + +void makePlots(){ + + setTDRStyle(); + std::vector allHistos; + + MyHisto struct5 = extractHistos("plots_5GeV.root"); + MyHisto struct10 = extractHistos("plots_10GeV.root"); + MyHisto struct50 = extractHistos("plots_50GeV.root"); + MyHisto struct100 = extractHistos("plots_100GeV.root"); + MyHisto struct200 = extractHistos("plots_200GeV.root"); + MyHisto struct500 = extractHistos("plots_500GeV.root"); + MyHisto struct1000 = extractHistos("plots_1000GeV.root"); + + allHistos.push_back(struct5); + allHistos.push_back(struct10); + allHistos.push_back(struct50); + allHistos.push_back(struct100); + allHistos.push_back(struct200); + allHistos.push_back(struct500); + allHistos.push_back(struct1000); + + superimposeHistos(allHistos); + +} diff --git a/GEMValidation/scripts/produceRecoPlotsVersusPt.C b/GEMValidation/scripts/produceRecoPlotsVersusPt.C new file mode 100644 index 0000000000000..4880826426bb6 --- /dev/null +++ b/GEMValidation/scripts/produceRecoPlotsVersusPt.C @@ -0,0 +1,1800 @@ +#include +#include +#include +#include "TTree.h" +#include "TFile.h" +#include "TMath.h" +#include "TH1F.h" +#include "TF1.h" +#include "TCanvas.h" +#include "TLegend.h" +#include "TGraphAsymmErrors.h" +#include "TPaveStats.h" +#include "TStyle.h" +#include "TEfficiency.h" + +// tdrGrid: Turns the grid lines on (true) or off (false) + +void tdrGrid(bool gridOn) { + tdrStyle->SetPadGridX(gridOn); + tdrStyle->SetPadGridY(gridOn); +} + +// fixOverlay: Redraws the axis + +void fixOverlay() { + gPad->RedrawAxis(); +} + +void setTDRStyle() { + TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR"); + +// For the canvas: + tdrStyle->SetCanvasBorderMode(0); + tdrStyle->SetCanvasColor(kWhite); + tdrStyle->SetCanvasDefH(600); //Height of canvas + tdrStyle->SetCanvasDefW(600); //Width of canvas + tdrStyle->SetCanvasDefX(0); //POsition on screen + tdrStyle->SetCanvasDefY(0); + +// For the Pad: + tdrStyle->SetPadBorderMode(0); + // tdrStyle->SetPadBorderSize(Width_t size = 1); + tdrStyle->SetPadColor(kWhite); + tdrStyle->SetPadGridX(false); + tdrStyle->SetPadGridY(false); + tdrStyle->SetGridColor(0); + tdrStyle->SetGridStyle(3); + tdrStyle->SetGridWidth(1); + +// For the frame: + tdrStyle->SetFrameBorderMode(0); + tdrStyle->SetFrameBorderSize(1); + tdrStyle->SetFrameFillColor(0); + tdrStyle->SetFrameFillStyle(0); + tdrStyle->SetFrameLineColor(1); + tdrStyle->SetFrameLineStyle(1); + tdrStyle->SetFrameLineWidth(1); + +// For the histo: + // tdrStyle->SetHistFillColor(1); + // tdrStyle->SetHistFillStyle(0); + tdrStyle->SetHistLineColor(1); + tdrStyle->SetHistLineStyle(0); + tdrStyle->SetHistLineWidth(1); + // tdrStyle->SetLegoInnerR(Float_t rad = 0.5); + // tdrStyle->SetNumberContours(Int_t number = 20); + + tdrStyle->SetEndErrorSize(2); +// tdrStyle->SetErrorMarker(20); + tdrStyle->SetErrorX(0.5); + + tdrStyle->SetMarkerStyle(20); + +//For the fit/function: + tdrStyle->SetOptFit(1); + tdrStyle->SetFitFormat("5.4g"); + tdrStyle->SetFuncColor(2); + tdrStyle->SetFuncStyle(1); + tdrStyle->SetFuncWidth(1); + +//For the date: + tdrStyle->SetOptDate(0); + // tdrStyle->SetDateX(Float_t x = 0.01); + // tdrStyle->SetDateY(Float_t y = 0.01); + +// For the statistics box: + tdrStyle->SetOptFile(0); + tdrStyle->SetOptStat(0); // To display the mean and RMS: SetOptStat("mr"); + tdrStyle->SetStatColor(kWhite); + tdrStyle->SetStatFont(42); + tdrStyle->SetStatFontSize(0.025); + tdrStyle->SetStatTextColor(1); + tdrStyle->SetStatFormat("6.4g"); + tdrStyle->SetStatBorderSize(1); + tdrStyle->SetStatH(0.1); + tdrStyle->SetStatW(0.15); + // tdrStyle->SetStatStyle(Style_t style = 1001); + // tdrStyle->SetStatX(Float_t x = 0); + // tdrStyle->SetStatY(Float_t y = 0); + +// Margins: + tdrStyle->SetPadTopMargin(0.05); + tdrStyle->SetPadBottomMargin(0.13); + tdrStyle->SetPadLeftMargin(0.16); + tdrStyle->SetPadRightMargin(0.02); + +// For the Global title: + + tdrStyle->SetOptTitle(0); + tdrStyle->SetTitleFont(42); + tdrStyle->SetTitleColor(1); + tdrStyle->SetTitleTextColor(1); + tdrStyle->SetTitleFillColor(10); + tdrStyle->SetTitleFontSize(0.05); + // tdrStyle->SetTitleH(0); // Set the height of the title box + // tdrStyle->SetTitleW(0); // Set the width of the title box + // tdrStyle->SetTitleX(0); // Set the position of the title box + // tdrStyle->SetTitleY(0.985); // Set the position of the title box + // tdrStyle->SetTitleStyle(Style_t style = 1001); + // tdrStyle->SetTitleBorderSize(2); + +// For the axis titles: + + tdrStyle->SetTitleColor(1, "XYZ"); + tdrStyle->SetTitleFont(42, "XYZ"); + tdrStyle->SetTitleSize(0.06, "XYZ"); + // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size? + // tdrStyle->SetTitleYSize(Float_t size = 0.02); + tdrStyle->SetTitleXOffset(0.9); + tdrStyle->SetTitleYOffset(1.25); + // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset + +// For the axis labels: + + tdrStyle->SetLabelColor(1, "XYZ"); + tdrStyle->SetLabelFont(42, "XYZ"); + tdrStyle->SetLabelOffset(0.007, "XYZ"); + tdrStyle->SetLabelSize(0.05, "XYZ"); + +// For the axis: + + tdrStyle->SetAxisColor(1, "XYZ"); + tdrStyle->SetStripDecimals(kTRUE); + tdrStyle->SetTickLength(0.03, "XYZ"); + tdrStyle->SetNdivisions(510, "XYZ"); + tdrStyle->SetPadTickX(1); // To get tick marks on the opposite side of the frame + tdrStyle->SetPadTickY(1); + +// Change for log plots: + tdrStyle->SetOptLogx(0); + tdrStyle->SetOptLogy(0); + tdrStyle->SetOptLogz(0); + +// Postscript options: + tdrStyle->SetPaperSize(20.,20.); + // tdrStyle->SetLineScalePS(Float_t scale = 3); + // tdrStyle->SetLineStyleString(Int_t i, const char* text); + // tdrStyle->SetHeaderPS(const char* header); + // tdrStyle->SetTitlePS(const char* pstitle); + + // tdrStyle->SetBarOffset(Float_t baroff = 0.5); + // tdrStyle->SetBarWidth(Float_t barwidth = 0.5); + // tdrStyle->SetPaintTextFormat(const char* format = "g"); + // tdrStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0); + // tdrStyle->SetTimeOffset(Double_t toffset); + // tdrStyle->SetHistMinimumZero(kTRUE); + + tdrStyle->cd(); + +} + +struct MyPar{ + + double sigma; + double sigmaErr; + double sigmaFR; + double sigmaErrFR; + double DeltaSigma; + TH1D * histo; + +}; + +MyPar extractSigma(TH1D * hist, std::string postFix = "none"){ + + gStyle->SetOptStat(000002210); + //gStyle->SetOptFit(1111); + gStyle->SetStatW(0.2); + gStyle->SetStatH(0.5); + + std::string name = "fit_"; + + MyPar obj; + + double mean = hist->GetMean(); + double rms = hist->GetRMS(); + TCanvas * canvasTMP = new TCanvas("canvasTMP","canvas",700,700); + + hist->SetLineColor(1); + hist->SetLineWidth(2); + hist->Draw(); + gStyle->SetFuncWidth(2); + TF1 *myfitFR = new TF1("myfitFR","gaus", -1, +1); + hist->Fit("myfitFR"); + TF1 *myfit = new TF1("myfit","gaus", -(mean+2*rms), mean+2*rms); + hist->Fit("myfit", "R"); + + obj.sigma = myfit->GetParameter(2); + obj.sigmaErr = myfit->GetParError(2); + obj.sigmaFR = myfitFR->GetParameter(2); + obj.sigmaErrFR = myfitFR->GetParError(2); + double delta = abs(myfit->GetParameter(2) - myfitFR->GetParameter(2)); + obj.DeltaSigma = sqrt(delta*delta + obj.sigmaErr*obj.sigmaErr); + obj.histo = hist; + + //hist->GetXaxis()->SetRangeUser(-0.5, +0.5); + //hist->Draw(); + canvasTMP->SaveAs((name + postFix + ".png").c_str()); + return obj; + +} + +typedef std::vector vdouble; + +vdouble composeHistos(MyPar p1, MyPar p2, std::string pt){ + + gStyle->SetOptStat(000002210); + + vdouble temp; + + TH1D * h1 = p1.histo; + TH1D * h2 = p2.histo; + double mean1 = h1->GetMean(); + double rms1 = h1->GetRMS(); + double mean2 = h2->GetMean(); + double rms2 = h2->GetRMS(); + double range1 = mean1 + 2*rms1; + double range2 = mean2 + 2*rms2; + double minRange = (range1 > range2 ? range2 : range1); + + TCanvas * canvasTMP = new TCanvas("canvasTMP","canvas",700,700); + h1->Draw(); + TF1 *myfit1 = new TF1("myfit1","gaus", -minRange, +minRange); + h1->Fit("myfit1", "R"); + + temp.push_back(myfit1->GetParameter(2)); + temp.push_back(myfit1->GetParError(2)); + + h2->Draw("SAME"); + TF1 *myfit2 = new TF1("myfit2","gaus", -minRange, +minRange); + h2->Fit("myfit2", "R"); + + //canvasTMP->SaveAs(("fit_" + pt + ".png").c_str()); + + temp.push_back(myfit2->GetParameter(2)); + temp.push_back(myfit2->GetParError(2)); + return temp; + //Eventually uncertainties shoudl be calculated as deltaSigma also here + +} + +TH1F * makeRatio(TH1F * plot1, TH1F * plot2){ + + TH1F * plotTMP = (TH1F*)plot2->Clone(); + plotTMP->Divide(plot1); + return plotTMP; + +} + +TH1D * makeRatio2(TH1D * plot1, TH1D * plot2){ + + TH1D * plotTMP = (TH1D*)plot2->Clone(); + plotTMP->SetMaximum(1.1); + plotTMP->SetMinimum(0.9); + plotTMP->Divide(plot1); + return plotTMP; + +} + +TH1D * makeRatio3(TEfficiency * plot1, TEfficiency * plot2){ + + TH1D * plotTMP1 = new TH1D("plotTMP1","plotTMP1",221,-2.5,1102.5); + TH1D * plotTMP2 = new TH1D("plotTMP2","plotTMP2",221,-2.5,1102.5); + + for(int i = 1; i <= plotTMP1->GetSize(); i++){ + + double eff1 = plot1->GetEfficiency(i); + double eff2 = plot2->GetEfficiency(i); + + //std::cout<<"eff1: "<GetEfficiencyErrorLow(i) + plot1->GetEfficiencyErrorUp(i))/2; + double err2 = (plot2->GetEfficiencyErrorLow(i) + plot2->GetEfficiencyErrorUp(i))/2; + + plotTMP1->SetBinContent(i,eff1); + plotTMP1->SetBinError(i,err1); + plotTMP2->SetBinContent(i,eff2); + plotTMP2->SetBinError(i,err2); + + } + + plotTMP2->SetMaximum(4); + plotTMP2->SetMinimum(0.01); + plotTMP2->Divide(plotTMP1); + return plotTMP2; + +} + +void makePlots(){ + + setTDRStyle(); + + TFile * f1_ = TFile::Open("GLBMuonAnalyzer_tot.root"); + f1_->cd(); + + TH1F * pTRec_NoGEM = (TH1F*)gDirectory->Get("pTRec"); + TH1F * pTSim_NoGEM = (TH1F*)gDirectory->Get("pTSim"); + TH1F * pTRes_NoGEM = (TH1F*)gDirectory->Get("pTRes"); + TH1F * invPTRes_NoGEM = (TH1F*)gDirectory->Get("invPTRes"); + TH1F * pTDiff_NoGEM = (TH1F*)gDirectory->Get("pTDiff"); + TH1F * PSimEta_NoGEM = (TH1F*)gDirectory->Get("PSimEta"); + TH1F * PRecEta_NoGEM = (TH1F*)gDirectory->Get("PRecEta"); + TH1F * PDeltaEta_NoGEM = (TH1F*)gDirectory->Get("PDeltaEta"); + TH1F * PSimPhi_NoGEM = (TH1F*)gDirectory->Get("PSimPhi"); + TH1F * PRecPhi_NoGEM = (TH1F*)gDirectory->Get("PRecPhi"); + TH1F * NumSimTracks_NoGEM = (TH1F*)gDirectory->Get("NumSimTracks"); + TH1F * NumMuonSimTracks_NoGEM = (TH1F*)gDirectory->Get("NumMuonSimTracks"); + TH1F * NumRecTracks_NoGEM = (TH1F*)gDirectory->Get("NumRecTracks"); + TH2F * PtResVsPt_NoGEM = (TH2F*)gDirectory->Get("PtResVsPt"); + TH2F * InvPtResVsPt_NoGEM = (TH2F*)gDirectory->Get("InvPtResVsPt"); + + TH2F * PtResVsPtNoCharge_NoGEM = (TH2F*)gDirectory->Get("PtResVsPtNoCharge"); + TH2F * InvPtResVsPtNoCharge_NoGEM = (TH2F*)gDirectory->Get("InvPtResVsPtNoCharge"); + + TH2F * DPhiVsPt_NoGEM = (TH2F*)gDirectory->Get("DPhiVsPt"); + TH1F * DenPt_NoGEM = (TH1F*)gDirectory->Get("DenPt"); + TH1F * DenEta_NoGEM = (TH1F*)gDirectory->Get("DenEta"); + TH1F * NumPt_NoGEM = (TH1F*)gDirectory->Get("NumPt"); + TH1F * NumEta_NoGEM = (TH1F*)gDirectory->Get("NumEta"); + TH1F * PullGEM_NoGEM = (TH1F*)gDirectory->Get("PullGEMx"); + TH1F * PullCSC_NoGEM = (TH1F*)gDirectory->Get("PullCSC"); + TH1F * GEMRecHitEta_NoGEM = (TH1F*)gDirectory->Get("GEMRecHitEta"); + TH2F * DeltaCharge_NoGEM = (TH2F*)gDirectory->Get("DeltaCharge"); + TH2F * RecoPtVsSimPt_NoGEM = (TH2F*)gDirectory->Get("RecoPtVsSimPt"); + TH2F * DeltaPtVsSimPt_NoGEM = (TH2F*)gDirectory->Get("DeltaPtVsSimPt"); + + pTRec_NoGEM->GetXaxis()->SetTitle("p_{T}^{Reco} [GeV/c]"); + pTSim_NoGEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + pTRes_NoGEM->GetXaxis()->SetTitle("(p_{T}^{Reco} - p_{T}^{Sim}) / p_{T}^{Sim}"); + invPTRes_NoGEM->GetXaxis()->SetTitle("(q^{Reco}/p_{T}^{Reco} - q^{Sim}/p_{T}^{Sim}) / q^{Sim}/p_{T}^{Sim}"); + pTDiff_NoGEM->GetXaxis()->SetTitle("p_{T}^{Reco} - p_{T}^{Sim} [GeV/c]"); + PSimEta_NoGEM->GetXaxis()->SetTitle("#eta^{Sim}"); + PRecEta_NoGEM->GetXaxis()->SetTitle("#eta^{Rec0}"); + PDeltaEta_NoGEM->GetXaxis()->SetTitle("#Delta#eta"); + PSimPhi_NoGEM->GetXaxis()->SetTitle("#phi^{Sim}"); + PRecPhi_NoGEM->GetXaxis()->SetTitle("#phi^{Reco}"); + NumSimTracks_NoGEM->GetXaxis()->SetTitle("# SimTracks"); + NumMuonSimTracks_NoGEM->GetXaxis()->SetTitle("# SimMuonTracks"); + NumRecTracks_NoGEM->GetXaxis()->SetTitle("# RecoTracks"); + PtResVsPt_NoGEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + InvPtResVsPt_NoGEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + DPhiVsPt_NoGEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + PullGEM_NoGEM->GetXaxis()->SetTitle("#Delta x / #sigma (Sim-GEMRecHit)"); + PullCSC_NoGEM->GetXaxis()->SetTitle("#Delta x / #sigma (Sim-CSCRecHit)"); + + PtResVsPt_NoGEM->GetYaxis()->SetTitle("< p_{t} res. >"); + InvPtResVsPt_NoGEM->GetYaxis()->SetTitle("< 1/p_{t} res. >"); + DPhiVsPt_NoGEM->GetYaxis()->SetTitle("<#Delta#phi>"); + + //DeltaCharge_NoGEM->RebinX(5); + + TH1F * NumPt_NoGEM2 = (TH1F*)NumPt_NoGEM->Clone(); + TH1F * NumEta_NoGEM2 = (TH1F*)NumEta_NoGEM->Clone(); + + NumPt_NoGEM2->GetYaxis()->SetTitle("#varepsilon"); + NumEta_NoGEM2->GetYaxis()->SetTitle("#varepsilon"); + + TH2F * PtResVsPt_NoGEM2 = (TH2F*)PtResVsPt_NoGEM->Clone(); + TH2F * InvPtResVsPt_NoGEM2 = (TH2F*)InvPtResVsPt_NoGEM->Clone(); + TH2F * DPhiVsPt_NoGEM2 = (TH2F*)DPhiVsPt_NoGEM->Clone(); + + NumPt_NoGEM2->Divide(DenPt_NoGEM); + NumEta_NoGEM2->Divide(DenEta_NoGEM); + + TProfile * prof1_NoGEM = PtResVsPt_NoGEM2->ProfileX(); + TProfile * prof2_NoGEM = InvPtResVsPt_NoGEM2->ProfileX(); + + TProfile * prof1NoCharge_NoGEM = PtResVsPtNoCharge_NoGEM->ProfileX(); + TProfile * prof2NoCharge_NoGEM = InvPtResVsPtNoCharge_NoGEM->ProfileX(); + + TProfile * prof2bis_NoGEM = InvPtResVsPt_NoGEM2->ProfileX("profile",-1,-1,"s"); + TProfile * prof3_NoGEM = DPhiVsPt_NoGEM2->ProfileX(); + + TProfile * prof4_NoGEM = RecoPtVsSimPt_NoGEM->ProfileX(); + TProfile * prof5_NoGEM = DeltaPtVsSimPt_NoGEM->ProfileX(); + + std::vector vecResNoGEM; + for(int i=1; i<=PtResVsPt_NoGEM->GetNbinsX(); i++){ + + TH1F * temp = (TH1F*)pTRes_NoGEM->Clone(); + int col = i; + if(i==10) col=41; + if(i==5) col=46; + temp->SetLineColor(col); + temp->SetLineWidth(2); + + for(int j=1; j<=PtResVsPt_NoGEM->GetNbinsY(); j++){ + + float bin = PtResVsPt_NoGEM->GetBinContent(i,j); + + temp->SetBinContent(bin,i); + //std::cout<Clone(); + TH1F * denNoGem = (TH1F*)DeltaChargePercentage_NoGEM->Clone(); + + for(int i=1; i<=DeltaCharge_NoGEM->GetNbinsX(); i++){ + + int num1 = DeltaCharge_NoGEM->GetBinContent(i,2); + int num2 = DeltaCharge_NoGEM->GetBinContent(i,4); //zero + int num3 = DeltaCharge_NoGEM->GetBinContent(i,6); + + numNoGem->SetBinContent(i,num1+num3); + denNoGem->SetBinContent(i,num1+num2+num3); + + //double perc = (double) (num1 + num3)/(num1 + num2 + num3); + //cout<SetBinContent(i,perc); + + } + + TEfficiency* pEffCharge_NoGEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*numNoGem,*denNoGem)) + { + pEffCharge_NoGEM = new TEfficiency(*numNoGem,*denNoGem); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + ///////////////////////////////////////////////////////////////////////////////////// + + TFile * f2_ = TFile::Open("GLBMuonAnalyzerWithGEMs_tot.root"); + f2_->cd(); + TH1F * pTRec_GEM = (TH1F*)gDirectory->Get("pTRec"); + TH1F * pTSim_GEM = (TH1F*)gDirectory->Get("pTSim"); + TH1F * pTRes_GEM = (TH1F*)gDirectory->Get("pTRes"); + TH1F * invPTRes_GEM = (TH1F*)gDirectory->Get("invPTRes"); + TH1F * pTDiff_GEM = (TH1F*)gDirectory->Get("pTDiff"); + TH1F * PSimEta_GEM = (TH1F*)gDirectory->Get("PSimEta"); + TH1F * PRecEta_GEM = (TH1F*)gDirectory->Get("PRecEta"); + TH1F * PDeltaEta_GEM = (TH1F*)gDirectory->Get("PDeltaEta"); + TH1F * PSimPhi_GEM = (TH1F*)gDirectory->Get("PSimPhi"); + TH1F * PRecPhi_GEM = (TH1F*)gDirectory->Get("PRecPhi"); + TH1F * NumSimTracks_GEM = (TH1F*)gDirectory->Get("NumSimTracks"); + TH1F * NumMuonSimTracks_GEM = (TH1F*)gDirectory->Get("NumMuonSimTracks"); + TH1F * NumRecTracks_GEM = (TH1F*)gDirectory->Get("NumRecTracks"); + TH2F * PtResVsPt_GEM = (TH2F*)gDirectory->Get("PtResVsPt"); + TH2F * InvPtResVsPt_GEM = (TH2F*)gDirectory->Get("InvPtResVsPt"); + + TH2F * PtResVsPtNoCharge_GEM = (TH2F*)gDirectory->Get("PtResVsPtNoCharge"); + TH2F * InvPtResVsPtNoCharge_GEM = (TH2F*)gDirectory->Get("InvPtResVsPtNoCharge"); + + TH2F * DPhiVsPt_GEM = (TH2F*)gDirectory->Get("DPhiVsPt"); + TH1F * DenPt_GEM = (TH1F*)gDirectory->Get("DenPt"); + TH1F * DenEta_GEM = (TH1F*)gDirectory->Get("DenEta"); + TH1F * DenPhi_GEM = (TH1F*)gDirectory->Get("DenPhi"); + TH1F * DenPhiPlus_GEM = (TH1F*)gDirectory->Get("DenPhiPlus"); + TH1F * DenPhiMinus_GEM = (TH1F*)gDirectory->Get("DenPhiMinus"); + TH1F * NumPt_GEM = (TH1F*)gDirectory->Get("NumPt"); + TH1F * NumEta_GEM = (TH1F*)gDirectory->Get("NumEta"); + TH1F * NumPhi_GEM = (TH1F*)gDirectory->Get("NumPhi"); + TH1F * NumPhiPlus_GEM = (TH1F*)gDirectory->Get("NumPhiPlus"); + TH1F * NumPhiMinus_GEM = (TH1F*)gDirectory->Get("NumPhiMinus"); + + TH1F * DenSimPt_GEM = (TH1F*)gDirectory->Get("DenSimPt"); + TH1F * DenSimEta_GEM = (TH1F*)gDirectory->Get("DenSimEta"); + TH1F * DenSimPhiPlus_GEM = (TH1F*)gDirectory->Get("DenSimPhiPlus"); + TH1F * DenSimPhiMinus_GEM = (TH1F*)gDirectory->Get("DenSimPhiMinus"); + TH1F * NumSimPt_GEM = (TH1F*)gDirectory->Get("NumSimPt"); + TH1F * NumSimEta_GEM = (TH1F*)gDirectory->Get("NumSimEta"); + TH1F * NumSimPhiPlus_GEM = (TH1F*)gDirectory->Get("NumSimPhiPlus"); + TH1F * NumSimPhiMinus_GEM = (TH1F*)gDirectory->Get("NumSimPhiMinus"); + + TH1F * PullGEM_GEM = (TH1F*)gDirectory->Get("PullGEMx"); + TH1F * PullCSC_GEM = (TH1F*)gDirectory->Get("PullCSC"); + TH1F * GEMRecHitEta_GEM = (TH1F*)gDirectory->Get("GEMRecHitEta"); + TH1F * GEMRecHitPhi_GEM = (TH1F*)gDirectory->Get("GEMRecHitPhi"); + TH2F * DeltaCharge_GEM = (TH2F*)gDirectory->Get("DeltaCharge"); + TH2F * RecPhi2DPlusLayer1_GEM = (TH2F*)gDirectory->Get("RecHitPhi2DPlusLayer1"); + TH2F * RecPhi2DMinusLayer1_GEM = (TH2F*)gDirectory->Get("RecHitPhi2DMinusLayer1"); + TH2F * RecPhi2DPlusLayer2_GEM = (TH2F*)gDirectory->Get("RecHitPhi2DPlusLayer2"); + TH2F * RecPhi2DMinusLayer2_GEM = (TH2F*)gDirectory->Get("RecHitPhi2DMinusLayer2"); + TH2F * RecoPtVsSimPt_GEM = (TH2F*)gDirectory->Get("RecoPtVsSimPt"); + TH2F * DeltaPtVsSimPt_GEM = (TH2F*)gDirectory->Get("DeltaPtVsSimPt"); + + TH1F * NumPt_GEM2 = (TH1F*)NumPt_GEM->Clone(); + TH1F * NumEta_GEM2 = (TH1F*)NumEta_GEM->Clone(); + + NumPt_GEM2->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + NumEta_GEM2->GetXaxis()->SetTitle("#eta"); + NumPt_GEM2->GetYaxis()->SetTitle("#varepsilon"); + NumEta_GEM2->GetYaxis()->SetTitle("#varepsilon"); + + PtResVsPt_GEM->GetYaxis()->SetTitle("< p_{t} res. >"); + InvPtResVsPt_GEM->GetYaxis()->SetTitle("< 1/p_{t} res. >"); + DPhiVsPt_GEM->GetYaxis()->SetTitle("<#Delta#phi>"); + + //DeltaCharge_GEM->RebinX(5); + + TH2F * PtResVsPt_GEM2 = (TH2F*)PtResVsPt_GEM->Clone(); + TH2F * InvPtResVsPt_GEM2 = (TH2F*)InvPtResVsPt_GEM->Clone(); + TH2F * DPhiVsPt_GEM2 = (TH2F*)DPhiVsPt_GEM->Clone(); + + TProfile * prof1_GEM = PtResVsPt_GEM2->ProfileX(); + TProfile * prof2_GEM = InvPtResVsPt_GEM2->ProfileX(); + + TProfile * prof1NoCharge_GEM = PtResVsPtNoCharge_GEM->ProfileX(); + TProfile * prof2NoCharge_GEM = InvPtResVsPtNoCharge_GEM->ProfileX(); + + TProfile * prof2bis_GEM = InvPtResVsPt_GEM2->ProfileX("profile",-1,-1,"s"); + TProfile * prof3_GEM = DPhiVsPt_GEM2->ProfileX(); + + TProfile * prof4_GEM = RecoPtVsSimPt_GEM->ProfileX(); + TProfile * prof5_GEM = DeltaPtVsSimPt_GEM->ProfileX(); + + pTRec_GEM->SetLineColor(2); + pTSim_GEM->SetLineColor(2); + pTRes_GEM->SetLineColor(2); + invPTRes_GEM->SetLineColor(2); + pTDiff_GEM->SetLineColor(2); + PSimEta_GEM->SetLineColor(2); + PRecEta_GEM->SetLineColor(2); + PDeltaEta_GEM->SetLineColor(2); + PSimPhi_GEM->SetLineColor(2); + PRecPhi_GEM->SetLineColor(2); + NumSimTracks_GEM->SetLineColor(2); + NumMuonSimTracks_GEM->SetLineColor(2); + NumRecTracks_GEM->SetLineColor(2); + PullGEM_GEM->SetLineColor(2); + PullCSC_GEM->SetLineColor(2); + GEMRecHitEta_GEM->SetLineColor(2); + GEMRecHitPhi_GEM->SetLineColor(2); + prof1_GEM->SetLineColor(2); + prof2_GEM->SetLineColor(2); + prof3_GEM->SetLineColor(2); + + GEMRecHitEta_GEM->GetXaxis()->SetTitle("#eta_{GEMRecHit}"); + GEMRecHitEta_GEM->SetStats(kFALSE); + GEMRecHitPhi_GEM->GetXaxis()->SetTitle("#phi_{GEMRecHit}"); + GEMRecHitPhi_GEM->SetStats(kFALSE); + PullGEM_GEM->GetXaxis()->SetTitle("#Delta x / #sigma (Sim-GEMRecHit)"); + + TEfficiency* pEffPt_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumPt_GEM,*DenPt_GEM)) + { + pEffPt_GEM = new TEfficiency(*NumPt_GEM,*DenPt_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffEta_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumEta_GEM,*DenEta_GEM)) + { + pEffEta_GEM = new TEfficiency(*NumEta_GEM,*DenEta_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffEta_GEM->Draw(); + } + + TEfficiency* pEffPhi_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumPhi_GEM,*DenPhi_GEM)) + { + pEffPhi_GEM = new TEfficiency(*NumPhi_GEM,*DenPhi_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffPhiPlus_GEM = 0; + + NumPhiPlus_GEM->Rebin(); + DenPhiPlus_GEM->Rebin(); + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumPhiPlus_GEM,*DenPhiPlus_GEM)) + { + pEffPhiPlus_GEM = new TEfficiency(*NumPhiPlus_GEM,*DenPhiPlus_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffPhiMinus_GEM = 0; + + NumPhiMinus_GEM->Rebin(); + DenPhiMinus_GEM->Rebin(); + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumPhiMinus_GEM,*DenPhiMinus_GEM)) + { + pEffPhiMinus_GEM = new TEfficiency(*NumPhiMinus_GEM,*DenPhiMinus_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffSimPt_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumSimPt_GEM,*DenSimPt_GEM)) + { + pEffSimPt_GEM = new TEfficiency(*NumSimPt_GEM,*DenSimPt_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffSimEta_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumSimEta_GEM,*DenSimEta_GEM)) + { + pEffSimEta_GEM = new TEfficiency(*NumSimEta_GEM,*DenSimEta_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffEta_GEM->Draw(); + } + + TEfficiency* pEffSimPhiPlus_GEM = 0; + + NumSimPhiPlus_GEM->Rebin(); + DenSimPhiPlus_GEM->Rebin(); + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumSimPhiPlus_GEM,*DenSimPhiPlus_GEM)) + { + pEffSimPhiPlus_GEM = new TEfficiency(*NumSimPhiPlus_GEM,*DenSimPhiPlus_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + TEfficiency* pEffSimPhiMinus_GEM = 0; + + NumSimPhiMinus_GEM->Rebin(); + DenSimPhiMinus_GEM->Rebin(); + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*NumSimPhiMinus_GEM,*DenSimPhiMinus_GEM)) + { + pEffSimPhiMinus_GEM = new TEfficiency(*NumSimPhiMinus_GEM,*DenSimPhiMinus_GEM); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + std::vector vecResGEM; + for(int i=1; i<=PtResVsPt_GEM->GetNbinsX(); i++){ + + TH1F * temp = (TH1F*)pTRes_GEM->Clone(); + int col = i; + if(i==10) col=41; + if(i==5) col=46; + temp->SetLineColor(col); + temp->SetLineWidth(2); + + for(int j=1; j<=PtResVsPt_GEM->GetNbinsY(); j++){ + + float bin = PtResVsPt_GEM->GetBinContent(i,j); + + temp->SetBinContent(bin,i); + + } + + vecResGEM.push_back(temp); + + } + + //std::cout<Clone(); + TH1F * denGem = (TH1F*)DeltaChargePercentage_GEM->Clone(); + for(int i=1; i<=DeltaCharge_GEM->GetNbinsX(); i++){ + + int num1 = DeltaCharge_GEM->GetBinContent(i,2); + int num2 = DeltaCharge_GEM->GetBinContent(i,4); //zero + int num3 = DeltaCharge_GEM->GetBinContent(i,6); + + numGem->SetBinContent(i,num1+num3); + denGem->SetBinContent(i,num1+num2+num3); + + //double perc = (double) (num1 + num3)/(num1 + num2 + num3); + //DeltaChargePercentage_GEM->SetBinContent(i,perc); + + } + + TEfficiency* pEffCharge_GEM = 0; + + //h_pass and h_total are valid and consistent histograms + if(TEfficiency::CheckConsistency(*numGem,*denGem)) + { + pEffCharge_GEM = new TEfficiency(*numGem,*denGem); + // this will write the TEfficiency object to "myfile.root" + // AND pEff will be attached to the current directory + //pEffPt_GEM->Draw(); + } + + + ///////////////////////////////////////////////////////////////////////////////////// + + TLegend *leg2 = new TLegend(0.45,0.85,0.95,1.00); + leg2->SetFillColor(0); + leg2->SetLineColor(1); + leg2->AddEntry(pTRec_NoGEM, "Standard Reco", "l"); + leg2->AddEntry(pTRec_GEM, "GEMsReco+GEMRecHit", "l"); + + TCanvas * canvas = new TCanvas("canvas1","canvas",700,700); + canvas->SetLogy(); + //canvas1->SetLogx(); + pTRec_NoGEM->Draw(); + pTRec_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot1.png"); + + canvas->SetLogy(0); + + //TCanvas * canvas2 = new TCanvas("canvas2","canvas",700,700); + pTSim_NoGEM->Draw(); + pTSim_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot2.png"); + + //TCanvas * canvas3 = new TCanvas("canvas3","canvas",700,700); + pTRes_NoGEM->GetXaxis()->SetTitle("(p_{T}^{Reco} - p_{T}^{Sim}) / p_{T}^{Sim}"); + pTRes_NoGEM->Draw(); + pTRes_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot3.png"); + + //TCanvas * canvas4 = new TCanvas("canvas4","canvas",700,700); + invPTRes_NoGEM->GetXaxis()->SetTitle("(q^{Reco}/p_{T}^{Reco} - q^{Sim}/p_{T}^{Sim}) / q^{Sim}/p_{T}^{Sim}"); + invPTRes_NoGEM->Draw(); + invPTRes_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot4.png"); + + //TCanvas * canvas5 = new TCanvas("canvas5","canvas",700,700); + pTDiff_NoGEM->Draw(); + pTDiff_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot5.png"); + + //TCanvas * canvas7 = new TCanvas("canvas7","canvas",700,700); + PSimEta_NoGEM->Draw(); + PSimEta_GEM->Draw("SAME"); + canvas->SaveAs("plot7.png"); + + //TCanvas * canvas8 = new TCanvas("canvas8","canvas",700,700); + PRecEta_NoGEM->Draw(); + PRecEta_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot8.png"); + + //TCanvas * canvas9 = new TCanvas("canvas9","canvas",700,700); + PDeltaEta_NoGEM->Draw(); + PDeltaEta_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot9.png"); + + //TCanvas * canvas10 = new TCanvas("canvas10","canvas",700,700); + PSimPhi_NoGEM->SetMinimum(0); + PSimPhi_NoGEM->Draw(); + PSimPhi_GEM->Draw("SAME"); + canvas->SaveAs("plot10.png"); + + //TCanvas * canvas11 = new TCanvas("canvas11","canvas",700,700); + PRecPhi_NoGEM->SetMinimum(0); + PRecPhi_NoGEM->Draw(); + PRecPhi_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot11.png"); + + //TCanvas * canvas12 = new TCanvas("canvas12","canvas",700,700); + NumSimTracks_NoGEM->Draw(); + NumSimTracks_GEM->Draw("SAME"); + canvas->SaveAs("plot12.png"); + + //TCanvas * canvas13 = new TCanvas("canvas13","canvas",700,700); + NumMuonSimTracks_NoGEM->Draw(); + NumMuonSimTracks_GEM->Draw("SAME"); + canvas->SaveAs("plot13.png"); + + //TCanvas * canvas14 = new TCanvas("canvas14","canvas",700,700); + NumRecTracks_NoGEM->SetStats(kFALSE); + NumRecTracks_NoGEM->Draw(); + NumRecTracks_NoGEM->GetXaxis()->SetTitle("# RecoTracks"); + NumRecTracks_GEM->SetLineColor(2); + NumRecTracks_GEM->SetLineStyle(2); + NumRecTracks_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot14.png"); + + //TCanvas * canvas15 = new TCanvas("canvas15","canvas",700,700); + //PullGEM_NoGEM->Draw(); + PullGEM_GEM->Draw(); + + //TCanvas * canvas16 = new TCanvas("canvas16","canvas",700,700); + PullCSC_NoGEM->Draw(); + PullCSC_GEM->Draw("SAME"); + leg2->Draw(); + + //TCanvas * canvas17 = new TCanvas("canvas17","canvas",700,700); + GEMRecHitEta_GEM->Draw(); + + //TCanvas * canvas17bis = new TCanvas("canvas17bis","canvas",700,700); + GEMRecHitPhi_GEM->Draw(); + + //TCanvas * canvas18 = new TCanvas("canvas18","canvas",700,700); + //NumPt_NoGEM2->Draw(); + NumPt_GEM2->Draw(""); + NumPt_GEM2->Draw("EP"); + + //TCanvas * canvas19 = new TCanvas("canvas19","canvas",700,700); + //NumEta_NoGEM2->Draw(); + NumEta_GEM2->Draw("EP"); + + TLegend *leg22 = new TLegend(0.45,0.85,0.95,1.00); + leg22->SetFillColor(0); + leg22->SetLineColor(1); + leg22->AddEntry(prof1_NoGEM, "Standard Reco", "pl"); + leg22->AddEntry(prof1_GEM, "GEMsReco+GEMRecHit", "pl"); + + //TCanvas * canvas20 = new TCanvas("canvas20","canvas",700,700); + prof1_NoGEM->GetYaxis()->SetTitle("< (p_{T}^{Reco} - p_{T}^{Sim}) / p_{T}^{Sim} >"); + prof1_NoGEM->SetStats(kFALSE); + prof1_NoGEM->SetMinimum(-0.02); + prof1_NoGEM->SetMaximum(0.02); + prof1_NoGEM->SetMarkerStyle(20); + prof1_NoGEM->SetMarkerColor(9); + prof1_NoGEM->SetMarkerSize(1); + prof1_NoGEM->Draw("E1P"); + prof1_GEM->SetMarkerStyle(20); + prof1_GEM->SetMarkerColor(2); + prof1_GEM->SetMarkerSize(1); + prof1_GEM->Draw("E1PSAME"); + leg22->Draw(); + canvas->SaveAs("plot20.png"); + + //TCanvas * canvas20 = new TCanvas("canvas20","canvas",700,700); + prof1NoCharge_NoGEM->GetYaxis()->SetTitle("< (p_{T}^{Reco} - p_{T}^{Sim}) / p_{T}^{Sim} >"); + prof1NoCharge_NoGEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + prof1NoCharge_NoGEM->SetStats(kFALSE); + prof1NoCharge_NoGEM->SetMinimum(-0.02); + prof1NoCharge_NoGEM->SetMaximum(0.02); + prof1NoCharge_NoGEM->SetMarkerStyle(20); + prof1NoCharge_NoGEM->SetMarkerColor(9); + prof1NoCharge_NoGEM->SetLineColor(9); + prof1NoCharge_NoGEM->SetMarkerSize(1); + prof1NoCharge_NoGEM->Draw("E1P"); + prof1NoCharge_GEM->SetMarkerStyle(20); + prof1NoCharge_GEM->SetMarkerColor(2); + prof1NoCharge_GEM->SetLineColor(2); + prof1NoCharge_GEM->SetMarkerSize(1); + prof1NoCharge_GEM->Draw("E1PSAME"); + leg22->Draw(); + canvas->SaveAs("plot20NoCharge.png"); + + //TCanvas * canvas21 = new TCanvas("canvas21","canvas",700,700); + prof2_NoGEM->GetYaxis()->SetTitle("< (q^{Reco}/p_{T}^{Reco} - q^{Sim}/p_{T}^{Sim}) / q^{Sim}/p_{T}^{Sim} >"); + prof2_NoGEM->SetStats(kFALSE); + prof2_NoGEM->SetMinimum(-0.002); + prof2_NoGEM->SetMaximum(0.01); + prof2_NoGEM->SetMarkerStyle(20); + prof2_NoGEM->SetMarkerColor(9); + prof2_NoGEM->SetMarkerSize(1); + prof2_NoGEM->Draw("E1P"); + prof2_GEM->SetMarkerStyle(20); + prof2_GEM->SetMarkerColor(2); + prof2_GEM->SetMarkerSize(1); + prof2_GEM->Draw("E1PSAME"); + leg22->Draw(); + canvas->SaveAs("plot21.png"); + + //TCanvas * canvas21 = new TCanvas("canvas21","canvas",700,700); + prof2NoCharge_NoGEM->GetYaxis()->SetTitle("< (1/p_{T}^{Reco} - 1/p_{T}^{Sim}) / 1/p_{T}^{Sim} >"); + prof2NoCharge_NoGEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + prof2NoCharge_NoGEM->SetStats(kFALSE); + prof2NoCharge_NoGEM->SetMinimum(-0.002); + prof2NoCharge_NoGEM->SetMaximum(0.01); + prof2NoCharge_NoGEM->SetMarkerStyle(20); + prof2NoCharge_NoGEM->SetMarkerColor(9); + prof2NoCharge_NoGEM->SetLineColor(9); + prof2NoCharge_NoGEM->SetMarkerSize(1); + prof2NoCharge_NoGEM->Draw("E1P"); + prof2NoCharge_GEM->SetMarkerStyle(20); + prof2NoCharge_GEM->SetMarkerColor(2); + prof2NoCharge_GEM->SetLineColor(2); + prof2NoCharge_GEM->SetMarkerSize(1); + prof2NoCharge_GEM->Draw("E1PSAME"); + leg22->Draw(); + canvas->SaveAs("plot21NoCharge.png"); + + canvas->Clear(); + canvas->Update(); + + TLegend *leg4 = new TLegend(0.60,0.15,0.95,0.50); + leg4->SetFillColor(0); + leg4->SetLineColor(1); + + //TCanvas * canvas21bis = new TCanvas("canvas21bis","canvas",700,700); + TH1F * rmsNoGem = new TH1F("rmsNoGem","",261,-2.5,1302.5); + TH1F * rmsGem = new TH1F("rmsGem","",261,-2.5,1302.5); + for(int i=1; i<=prof2bis_NoGEM->GetNbinsX(); i++){ + + double rms1 = prof2bis_NoGEM->GetBinError(i); + double rms2 = prof2bis_GEM->GetBinError(i); + + //cout<SetBinContent(i,rms1); + rmsGem->SetBinContent(i,rms2); + + } + TH1F * ratio21Bis = makeRatio(rmsNoGem, rmsGem); + canvas->Divide(1,2); + canvas->cd(1); + rmsNoGem->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + rmsNoGem->GetYaxis()->SetTitle("RMS"); + rmsNoGem->SetMarkerSize(1); + rmsNoGem->SetMarkerColor(9); + rmsGem->SetMarkerSize(1); + rmsNoGem->SetMarkerStyle(20); + rmsGem->SetMarkerStyle(20); + rmsNoGem->SetStats(kFALSE); + rmsNoGem->SetMinimum(0.); + rmsNoGem->SetMaximum(0.3); + rmsNoGem->Draw("P"); + rmsGem->SetMarkerColor(2); + rmsGem->Draw("PSAME"); + leg4->AddEntry(rmsNoGem,"Standard Reco","P"); + leg4->AddEntry(rmsGem,"GEMsReco+GEMRecHit","P"); + leg4->Draw(); + canvas->cd(2); + ratio21Bis->SetMinimum(0.6); + ratio21Bis->Draw("P"); + ratio21Bis->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + ratio21Bis->GetYaxis()->SetTitle("RMS_{GEM} / RMS_{NoGEM}"); + canvas->SaveAs("plot21bis.png"); + + canvas->Clear(); + canvas->Update(); + + //TCanvas * canvas22 = new TCanvas("canvas22","canvas",700,700); + prof3_NoGEM->GetYaxis()->SetTitle("< #Delta#phi >"); + prof3_NoGEM->SetMinimum(-0.003); + prof3_NoGEM->SetMaximum(+0.003); + prof3_NoGEM->SetMarkerStyle(20); + prof3_NoGEM->SetMarkerSize(1); + prof3_NoGEM->Draw("E1P"); + prof3_GEM->SetMarkerStyle(20); + prof3_GEM->SetMarkerSize(1); + prof3_GEM->Draw("E1PSAME"); + leg2->Draw(); + canvas->SaveAs("plot22.png"); + + //TCanvas * canvas23 = new TCanvas("canvas23","canvas",700,700); + pEffPt_GEM->Draw("AP"); + gPad->Update(); + pEffPt_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("p_{T}^{Reco} [GeV/c]"); + gPad->Update(); + pEffPt_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon"); + gPad->Update(); + canvas->SaveAs("plot23.png"); + + //TCanvas * canvas24 = new TCanvas("canvas24","canvas",700,700); + //canvas24->SetLogy(); + pEffEta_GEM->Draw("AP"); + gPad->Update(); + pEffEta_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#eta^{Reco}"); + gPad->Update(); + pEffEta_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon"); + canvas->SaveAs("plot24.png"); + + //TCanvas * canvas23Sim = new TCanvas("canvas23Sim","canvas",700,700); + pEffSimPt_GEM->Draw("AP"); + gPad->Update(); + pEffSimPt_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + gPad->Update(); + pEffSimPt_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon"); + gPad->Update(); + canvas->SaveAs("plot23Sim.png"); + + //TCanvas * canvas24Sim = new TCanvas("canvas24Sim","canvas",700,700); + //canvas24->SetLogy(); + pEffSimEta_GEM->Draw("AP"); + gPad->Update(); + pEffSimEta_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#eta^{Sim}"); + gPad->Update(); + pEffSimEta_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon"); + canvas->SaveAs("plot24Sim.png"); + + //TCanvas * canvas26 = new TCanvas("canvas26","canvas",700,700); + PtResVsPt_NoGEM->SetStats(kFALSE); + PtResVsPt_NoGEM->SetTitle("p_{T} Res. (Standard Reco)"); + PtResVsPt_NoGEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + PtResVsPt_NoGEM->GetYaxis()->SetTitle("p_{T} Res."); + PtResVsPt_NoGEM->Draw("COLZ"); + + //TCanvas * canvas27 = new TCanvas("canvas27","canvas",700,700); + PtResVsPt_GEM->SetStats(kFALSE); + PtResVsPt_GEM->SetTitle("p_{T} Res. (GEMsReco+GEMRecHit)"); + PtResVsPt_GEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + PtResVsPt_GEM->GetYaxis()->SetTitle("p_{T} Res."); + PtResVsPt_GEM->Draw("COLZ"); + + //TCanvas * canvas28 = new TCanvas("canvas28","canvas",700,700); + DenPt_NoGEM->SetStats(kFALSE); + DenPt_NoGEM->SetMaximum(10000); + DenPt_NoGEM->Draw(); + DenPt_NoGEM->GetXaxis()->SetTitle("p_{T}^{Reco} [GeV/c]"); + DenPt_GEM->SetLineColor(2); + DenPt_GEM->SetLineStyle(2); + DenPt_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot28.png"); + + //TCanvas * canvas29 = new TCanvas("canvas29","canvas",700,700); + NumPt_NoGEM->SetStats(kFALSE); + NumPt_NoGEM->SetMaximum(10000); + NumPt_NoGEM->Draw(); + NumPt_NoGEM->GetXaxis()->SetTitle("p_{T}^{Reco} [GeV/c]"); + NumPt_GEM->SetLineColor(2); + NumPt_GEM->SetLineStyle(2); + NumPt_GEM->Draw("SAME"); + leg2->Draw(); + canvas->SaveAs("plot29.png"); + + canvas->Clear(); + canvas->Update(); + + TLegend *leg23 = new TLegend(0.35,0.85,0.85,1.00); + leg23->SetFillColor(0); + leg23->SetLineColor(1); + leg23->AddEntry(prof1_NoGEM, "Standard Reco", "pl"); + leg23->AddEntry(prof1_GEM, "GEMsReco+GEMRecHit", "pl"); + + //TCanvas * canvas30 = new TCanvas("canvas30","canvas",700,700); + /*DeltaChargePercentage_NoGEM->SetStats(kFALSE); + DeltaChargePercentage_NoGEM->Draw(); + DeltaChargePercentage_NoGEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + DeltaChargePercentage_NoGEM->GetYaxis()->SetTitle("Fraction Misidentified Charge"); + DeltaChargePercentage_GEM->SetLineColor(2); + DeltaChargePercentage_GEM->SetLineStyle(2); + DeltaChargePercentage_GEM->Draw("SAME");*/ + //gPad->SetLogy(); + //gPad->SetLogx(); + canvas->Divide(1,2); + TPad * p1 = canvas->cd(1); + //p1->SetLogy(); + pEffCharge_NoGEM->SetLineColor(9); + pEffCharge_NoGEM->SetMarkerColor(9); + gPad->Update(); + pEffCharge_NoGEM->Draw("AP"); + gPad->Update(); + pEffCharge_NoGEM->GetPaintedGraph()->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + gPad->Update(); + pEffCharge_NoGEM->GetPaintedGraph()->GetYaxis()->SetTitle("Charge misidentification rate"); + gPad->Update(); + pEffCharge_GEM->SetLineColor(2); + pEffCharge_GEM->SetMarkerColor(2); + gPad->Update(); + pEffCharge_GEM->Draw("SAME"); + gPad->Update(); + leg23->Draw(); + TPad * p2 = canvas->cd(2); + p2->SetLogy(); + TH1D * ratio30 = makeRatio3(pEffCharge_NoGEM, pEffCharge_GEM); + ratio30->Draw("E1P"); + ratio30->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + ratio30->GetYaxis()->SetTitle("Rate_{GEM} / Rate_{NoGEM}"); + canvas->SaveAs("plot30.png"); + + canvas->Clear(); + canvas->Update(); + + //exit(1); + + //TCanvas * canvas31 = new TCanvas("canvas31","canvas",1400,700); + RecPhi2DPlusLayer1_GEM->SetStats(kFALSE); + RecPhi2DPlusLayer1_GEM->GetXaxis()->SetTitle("#phi_{RecHit}"); + RecPhi2DPlusLayer1_GEM->GetYaxis()->SetTitle("Chamber"); + RecPhi2DPlusLayer1_GEM->Draw("COLZTEXT"); + + //TCanvas * canvas32 = new TCanvas("canvas32","canvas",1400,700); + RecPhi2DPlusLayer2_GEM->SetStats(kFALSE); + RecPhi2DPlusLayer2_GEM->GetXaxis()->SetTitle("#phi_{RecHit}"); + RecPhi2DPlusLayer2_GEM->GetYaxis()->SetTitle("Chamber"); + RecPhi2DPlusLayer2_GEM->Draw("COLZTEXT"); + + //TCanvas * canvas33 = new TCanvas("canvas33","canvas",1400,700); + RecPhi2DMinusLayer1_GEM->SetStats(kFALSE); + RecPhi2DMinusLayer1_GEM->GetXaxis()->SetTitle("#phi_{RecHit}"); + RecPhi2DMinusLayer1_GEM->GetYaxis()->SetTitle("Chamber"); + RecPhi2DMinusLayer1_GEM->Draw("COLZTEXT"); + + //TCanvas * canvas34 = new TCanvas("canvas34","canvas",1400,700); + RecPhi2DMinusLayer2_GEM->SetStats(kFALSE); + RecPhi2DMinusLayer2_GEM->GetXaxis()->SetTitle("#phi_{RecHit}"); + RecPhi2DMinusLayer2_GEM->GetYaxis()->SetTitle("Chamber"); + RecPhi2DMinusLayer2_GEM->Draw("COLZTEXT"); + + //TCanvas * canvas35 = new TCanvas("canvas35","canvas",1400,700); + //canvas24->SetLogy(); + pEffPhiPlus_GEM->Draw("AP"); + gPad->Update(); + pEffPhiPlus_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#phi^{Reco}"); + gPad->Update(); + pEffPhiPlus_GEM->SetTitle("GLB Muons Plus Region"); + gPad->Update(); + pEffPhiPlus_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon (#eta > 0)"); + canvas->SaveAs("plot35.png"); + + //TCanvas * canvas36 = new TCanvas("canvas36","canvas",1400,700); + //canvas24->SetLogy(); + pEffPhiMinus_GEM->Draw("AP"); + gPad->Update(); + pEffPhiMinus_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#phi^{Reco}"); + gPad->Update(); + pEffPhiMinus_GEM->SetTitle("GLB Muons Minus Region"); + gPad->Update(); + pEffPhiMinus_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon (#eta < 0)"); + canvas->SaveAs("plot36.png"); + + //TCanvas * canvas35Sim = new TCanvas("canvas35Sim","canvas",1400,700); + //canvas24->SetLogy(); + pEffSimPhiPlus_GEM->Draw("AP"); + gPad->Update(); + pEffSimPhiPlus_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#phi^{Sim}"); + gPad->Update(); + pEffSimPhiPlus_GEM->SetTitle("STA Muons Plus Region"); + gPad->Update(); + pEffSimPhiPlus_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon (#eta > 0)"); + canvas->SaveAs("plot35Sim.png"); + + //TCanvas * canvas36Sim = new TCanvas("canvas36Sim","canvas",1400,700); + //canvas24->SetLogy(); + pEffSimPhiMinus_GEM->Draw("AP"); + gPad->Update(); + pEffSimPhiMinus_GEM->GetPaintedGraph()->GetXaxis()->SetTitle("#phi^{Sim}"); + gPad->Update(); + pEffSimPhiMinus_GEM->SetTitle("STA Muons Minus Region"); + gPad->Update(); + pEffSimPhiMinus_GEM->GetPaintedGraph()->GetYaxis()->SetTitle("#varepsilon (#eta < 0)"); + canvas->SaveAs("plot36Sim.png"); + + //TCanvas * canvas39 = new TCanvas("canvas39","canvas",700,700); + //gPad->SetLogy(); + //gPad->SetLogx(); + gStyle->SetStatY(0.5); + // Set y-position (fraction of pad size) + gStyle->SetStatX(0.9); + prof4_NoGEM->GetYaxis()->SetTitle("< p_{T}^{Reco} > [GeV/c]"); + prof4_NoGEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + //prof4_NoGEM->SetMinimum(-0.005); + //prof4_NoGEM->SetMaximum(+0.005); + prof4_NoGEM->SetMarkerStyle(20); + prof4_NoGEM->SetMarkerSize(0.7); + prof4_NoGEM->Draw("E1P"); + TF1 *myfit1 = new TF1("myfit1","pol1", 0, 800); + prof4_NoGEM->Fit("myfit1", "R"); + canvas->SaveAs("plot39.png"); + + //TCanvas * canvas40 = new TCanvas("canvas40","canvas",700,700); + //gPad->SetLogy(); + //gPad->SetLogx(); + gStyle->SetStatY(0.5); + // Set y-position (fraction of pad size) + gStyle->SetStatX(0.9); + prof4_GEM->GetYaxis()->SetTitle("< p_{T}^{Reco} > [GeV/c]"); + prof4_GEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + //prof4_GEM->SetMinimum(-0.005); + //prof4_GEM->SetMaximum(+0.005); + prof4_GEM->SetLineColor(2); + prof4_GEM->SetMarkerStyle(20); + prof4_GEM->SetMarkerSize(0.7); + prof4_GEM->Draw("E1P"); + TF1 *myfit2 = new TF1("myfit2","pol1", 0, 800); + prof4_GEM->Fit("myfit2", "R"); + canvas->SaveAs("plot40.png"); + + //TCanvas * canvas41 = new TCanvas("canvas41","canvas",700,700); + //gPad->SetLogy(); + //gPad->SetLogx(); + gStyle->SetStatY(0.9); + gStyle->SetStatX(0.5); + prof5_NoGEM->GetYaxis()->SetTitle("< p_{T}^{Reco} - p_{T}^{Sim} > [GeV/c]"); + prof5_NoGEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + //prof4_NoGEM->SetMinimum(-0.005); + //prof4_NoGEM->SetMaximum(+0.005); + prof5_NoGEM->SetMarkerStyle(20); + prof5_NoGEM->SetMarkerSize(0.7); + prof5_NoGEM->Draw("E1P"); + TF1 *myfit3 = new TF1("myfit3","pol1", 0, 800); + prof5_NoGEM->Fit("myfit3", "R"); + canvas->SaveAs("plot41.png"); + + //TCanvas * canvas42 = new TCanvas("canvas42","canvas",700,700); + //gPad->SetLogy(); + //gPad->SetLogx(); + gStyle->SetStatY(0.9); + gStyle->SetStatX(0.5); + prof5_GEM->GetYaxis()->SetTitle("< p_{T}^{Reco} - p_{T}^{Sim} > [GeV/c]"); + prof5_GEM->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + //prof4_GEM->SetMinimum(-0.005); + //prof4_GEM->SetMaximum(+0.005); + prof5_GEM->SetLineColor(2); + prof5_GEM->SetMarkerStyle(20); + prof5_GEM->SetMarkerSize(0.7); + prof5_GEM->Draw("E1P"); + TF1 *myfit4 = new TF1("myfit4","pol1", 0, 800); + prof5_GEM->Fit("myfit4", "R"); + canvas->SaveAs("plot42.png"); + + /*TLegend *leg3 = new TLegend(0.60,0.50,0.80,0.90); + leg3->SetFillColor(kWhite); + leg3->SetLineColor(kWhite); + + TCanvas * canvas25 = new TCanvas("canvas25","canvas",700,700); + canvas25->Divide(1,2); + canvas25->cd(1); + vecResNoGEM[0]->SetMaximum(7000); + vecResNoGEM[0]->SetStats(kFALSE); + vecResNoGEM[0]->Draw(); + leg3->AddEntry(vecResNoGEM[0], "5-100 [GeV/c]", "l"); + for(int k=1; kDraw("SAME"); + std::stringstream ss; + ss<AddEntry(vecResNoGEM[k], name.c_str(), "l"); + + } + leg3->Draw(); + canvas25->cd(2); + vecResGEM[0]->SetMaximum(3000); + vecResGEM[0]->SetStats(kFALSE); + vecResGEM[0]->Draw(); + for(int k=1; kDraw("SAME"); + + } + leg3->Draw(); + canvas25->SaveAs("plot25.png");*/ + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + TCanvas * canvasFit = new TCanvas("canvasFit","canvas",700,700); + canvasFit->Divide(1,2); + + f1_->cd(); + canvasFit->cd(1); + TH2F * PtResVsPt_NoGEM_Clone = (TH2F*)PtResVsPt_NoGEM->Clone(); + PtResVsPt_NoGEM_Clone->GetYaxis()->SetTitle("(p_{T}^{Reco} - p_{T}^{Sim}) / p_{T}^{Sim}"); + PtResVsPt_NoGEM_Clone->Draw("COLZ"); + canvasFit->cd(2); + //f1->SetRange(xmin,xmax); + PtResVsPt_NoGEM_Clone->FitSlicesY(0, 0, -1, 0, "R"); + TH1D *PtResVsPt_NoGEM_Sigma = (TH1D*)gDirectory->Get("PtResVsPt_2"); + PtResVsPt_NoGEM_Sigma->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + PtResVsPt_NoGEM_Sigma->GetYaxis()->SetTitle("#sigma_{Res}"); + PtResVsPt_NoGEM_Sigma->Draw(); + + canvasFit->SaveAs("PtResVsPt_NoGEM.png"); + + canvasFit->cd(1); + TH2F * InvPtResVsPt_NoGEM_Clone = (TH2F*)InvPtResVsPt_NoGEM->Clone(); + InvPtResVsPt_NoGEM_Clone->GetYaxis()->SetTitle("(q^{Reco}/p_{T}^{Reco} - q^{Sim}/p_{T}^{Sim}) / q^{Sim}/p_{T}^{Sim}"); + InvPtResVsPt_NoGEM_Clone->Draw("COLZ"); + canvasFit->cd(2); + //f1->SetRange(xmin,xmax); + InvPtResVsPt_NoGEM_Clone->FitSlicesY(0, 0, -1, 0, "R"); + TH1D *InvPtResVsPt_NoGEM_Sigma = (TH1D*)gDirectory->Get("InvPtResVsPt_2"); + InvPtResVsPt_NoGEM_Sigma->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + InvPtResVsPt_NoGEM_Sigma->GetYaxis()->SetTitle("#sigma_{InvRes}"); + InvPtResVsPt_NoGEM_Sigma->Draw(); + + canvasFit->SaveAs("InvPtResVsPt_NoGEM.png"); + + f2_->cd(); + canvasFit->cd(1); + TH2F * PtResVsPt_GEM_Clone = (TH2F*)PtResVsPt_GEM->Clone(); + PtResVsPt_GEM_Clone->GetYaxis()->SetTitle("(p_{T}^{Reco} - p_{T}^{Sim}) / p_{T}^{Sim}"); + PtResVsPt_GEM_Clone->Draw("COLZ"); + canvasFit->cd(2); + //f1->SetRange(xmin,xmax); + PtResVsPt_GEM_Clone->FitSlicesY(0, 0, -1, 0, "R"); + TH1D *PtResVsPt_GEM_Sigma = (TH1D*)gDirectory->Get("PtResVsPt_2"); + PtResVsPt_GEM_Sigma->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + PtResVsPt_GEM_Sigma->GetYaxis()->SetTitle("#sigma_{Res}"); + PtResVsPt_GEM_Sigma->Draw(); + + canvasFit->SaveAs("PtResVsPt_GEM.png"); + + canvasFit->cd(1); + TH2F * InvPtResVsPt_GEM_Clone = (TH2F*)InvPtResVsPt_GEM->Clone(); + InvPtResVsPt_GEM_Clone->GetYaxis()->SetTitle("(q^{Reco}/p_{T}^{Reco} - q^{Sim}/p_{T}^{Sim}) / q^{Sim}/p_{T}^{Sim}"); + InvPtResVsPt_GEM_Clone->Draw("COLZ"); + canvasFit->cd(2); + //f1->SetRange(xmin,xmax); + InvPtResVsPt_GEM_Clone->FitSlicesY(0, 0, -1, 0, "R"); + TH1D *InvPtResVsPt_GEM_Sigma = (TH1D*)gDirectory->Get("InvPtResVsPt_2"); + InvPtResVsPt_GEM_Sigma->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + InvPtResVsPt_GEM_Sigma->GetYaxis()->SetTitle("#sigma_{InvRes}"); + InvPtResVsPt_GEM_Sigma->Draw(); + + canvasFit->SaveAs("InvPtResVsPt_GEM.png"); + + canvasFit->Clear(); + canvasFit->Update(); + + canvasFit->Divide(1,2); + canvasFit->cd(1); + PtResVsPt_NoGEM_Sigma->SetMaximum(0.15); + PtResVsPt_NoGEM_Sigma->SetMarkerColor(9); + PtResVsPt_NoGEM_Sigma->SetMarkerSize(0.7); + PtResVsPt_NoGEM_Sigma->Draw("E1P"); + PtResVsPt_GEM_Sigma->SetMarkerColor(2); + PtResVsPt_GEM_Sigma->SetMarkerSize(0.7); + PtResVsPt_GEM_Sigma->Draw("E1PSAME"); + leg4->Draw(); + canvasFit->cd(2); + TH1D * ratioComp1 = makeRatio2(PtResVsPt_NoGEM_Sigma, PtResVsPt_GEM_Sigma); + ratioComp1->SetMarkerColor(1); + ratioComp1->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + ratioComp1->GetYaxis()->SetTitle("#sigma_{Res}^{GEM} / #sigma_{Res}^{NoGEM}"); + ratioComp1->Draw("E1P"); + canvasFit->SaveAs("comparison_res.png"); + + canvasFit->Clear(); + canvasFit->Update(); + + canvasFit->Divide(1,2); + canvasFit->cd(1); + InvPtResVsPt_NoGEM_Sigma->SetMaximum(0.15); + InvPtResVsPt_NoGEM_Sigma->SetMarkerColor(9); + InvPtResVsPt_NoGEM_Sigma->SetMarkerSize(0.7); + InvPtResVsPt_NoGEM_Sigma->Draw("E1P"); + InvPtResVsPt_GEM_Sigma->SetMarkerColor(2); + InvPtResVsPt_GEM_Sigma->SetMarkerSize(0.7); + InvPtResVsPt_GEM_Sigma->Draw("E1PSAME"); + leg4->Draw(); + canvasFit->cd(2); + TH1D * ratioComp2 = makeRatio2(InvPtResVsPt_NoGEM_Sigma, InvPtResVsPt_GEM_Sigma); + ratioComp2->SetMarkerColor(1); + ratioComp2->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + ratioComp2->GetYaxis()->SetTitle("#sigma_{InvRes}^{GEM} / #sigma_{InvRes}^{NoGEM}"); + ratioComp2->Draw("E1P"); + + canvasFit->SaveAs("comparison_invres.png"); + + canvasFit->Clear(); + canvasFit->Update(); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + TLegend *leg5 = new TLegend(0.75,0.50,0.95,0.90); + leg5->SetFillColor(kWhite); + leg5->SetLineColor(kWhite); + leg5->SetHeader("Standard Reco"); + + canvasFit->Divide(1,2); + canvasFit->cd(1); + canvasFit_1->SetLogy(); + TH1D * proj1 = PtResVsPt_NoGEM_Clone->ProjectionY("proj1",1,2); + proj1->SetMaximum(12000); + proj1->SetLineColor(1); + leg5->AddEntry(proj1,"p_{T} = 5 GeV/c","l"); + TH1D * proj2 = PtResVsPt_NoGEM_Clone->ProjectionY("proj2",3,4); + proj2->SetLineColor(2); + leg5->AddEntry(proj2,"p_{T} = 10 GeV/c","l"); + TH1D * proj3 = PtResVsPt_NoGEM_Clone->ProjectionY("proj3",9,11); + proj3->SetLineColor(3); + leg5->AddEntry(proj3,"p_{T} = 50 GeV/c","l"); + TH1D * proj4 = PtResVsPt_NoGEM_Clone->ProjectionY("proj4",19,21); + proj4->SetLineColor(4); + leg5->AddEntry(proj4,"p_{T} = 100 GeV/c","l"); + TH1D * proj5 = PtResVsPt_NoGEM_Clone->ProjectionY("proj5",39,41); + proj5->SetLineColor(5); + leg5->AddEntry(proj5,"p_{T} = 200 GeV/c","l"); + TH1D * proj6 = PtResVsPt_NoGEM_Clone->ProjectionY("proj6",99,101); + proj6->SetLineColor(6); + leg5->AddEntry(proj6,"p_{T} = 500 GeV/c","l"); + TH1D * proj7 = PtResVsPt_NoGEM_Clone->ProjectionY("proj7",150,201); + proj7->SetLineColor(7); + leg5->AddEntry(proj7,"p_{T} = 1000 GeV/c","l"); + + proj1->Draw(); + proj2->Draw("SAME"); + proj3->Draw("SAME"); + proj4->Draw("SAME"); + proj5->Draw("SAME"); + proj6->Draw("SAME"); + proj7->Draw("SAME"); + + leg5->Draw(); + + canvasFit->cd(2); + canvasFit_2->SetLogy(); + TH1D * projI1 = InvPtResVsPt_NoGEM_Clone->ProjectionY("projI1",1,2); + projI1->SetLineColor(1); + projI1->SetMaximum(12000); + TH1D * projI2 = InvPtResVsPt_NoGEM_Clone->ProjectionY("projI2",3,4); + projI2->SetLineColor(2); + TH1D * projI3 = InvPtResVsPt_NoGEM_Clone->ProjectionY("projI3",9,11); + projI3->SetLineColor(3); + TH1D * projI4 = InvPtResVsPt_NoGEM_Clone->ProjectionY("projI4",19,21); + projI4->SetLineColor(4); + TH1D * projI5 = InvPtResVsPt_NoGEM_Clone->ProjectionY("projI5",39,41); + projI5->SetLineColor(5); + TH1D * projI6 = InvPtResVsPt_NoGEM_Clone->ProjectionY("projI6",99,101); + projI6->SetLineColor(6); + TH1D * projI7 = InvPtResVsPt_NoGEM_Clone->ProjectionY("projI7",150,201); + projI7->SetLineColor(7); + + projI1->Draw(); + projI2->Draw("SAME"); + projI3->Draw("SAME"); + projI4->Draw("SAME"); + projI5->Draw("SAME"); + projI6->Draw("SAME"); + projI7->Draw("SAME"); + + leg5->Draw(); + + canvasFit->SaveAs("resNoGEM.png"); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + leg5->SetHeader("GEMsReco+GEMRecHit"); + + canvasFit->cd(1); + canvasFit_1->SetLogy(); + TH1D * projGEM1 = PtResVsPt_GEM_Clone->ProjectionY("projGEM1",1,2); + projGEM1->SetMaximum(12000); + projGEM1->SetLineColor(1); + + TH1D * projGEM2 = PtResVsPt_GEM_Clone->ProjectionY("projGEM2",3,4); + projGEM2->SetLineColor(2); + + TH1D * projGEM3 = PtResVsPt_GEM_Clone->ProjectionY("projGEM3",9,11); + projGEM3->SetLineColor(3); + + TH1D * projGEM4 = PtResVsPt_GEM_Clone->ProjectionY("projGEM4",19,21); + projGEM4->SetLineColor(4); + + TH1D * projGEM5 = PtResVsPt_GEM_Clone->ProjectionY("projGEM5",39,41); + projGEM5->SetLineColor(5); + + TH1D * projGEM6 = PtResVsPt_GEM_Clone->ProjectionY("projGEM6",99,101); + projGEM6->SetLineColor(6); + + TH1D * projGEM7 = PtResVsPt_GEM_Clone->ProjectionY("projGEM7",150,201); + projGEM7->SetLineColor(7); + + projGEM1->Draw(); + projGEM2->Draw("SAME"); + projGEM3->Draw("SAME"); + projGEM4->Draw("SAME"); + projGEM5->Draw("SAME"); + projGEM6->Draw("SAME"); + projGEM7->Draw("SAME"); + + leg5->Draw(); + + canvasFit->cd(2); + canvasFit_1->SetLogy(); + TH1D * projGEMI1 = InvPtResVsPt_GEM_Clone->ProjectionY("projGEMI1",1,2); + projGEMI1->SetLineColor(1); + projGEMI1->SetMaximum(12000); + TH1D * projGEMI2 = InvPtResVsPt_GEM_Clone->ProjectionY("projGEMI2",3,4); + projGEMI2->SetLineColor(2); + TH1D * projGEMI3 = InvPtResVsPt_GEM_Clone->ProjectionY("projGEMI3",9,11); + projGEMI3->SetLineColor(3); + TH1D * projGEMI4 = InvPtResVsPt_GEM_Clone->ProjectionY("projGEMI4",19,21); + projGEMI4->SetLineColor(4); + TH1D * projGEMI5 = InvPtResVsPt_GEM_Clone->ProjectionY("projGEMI5",39,41); + projGEMI5->SetLineColor(5); + TH1D * projGEMI6 = InvPtResVsPt_GEM_Clone->ProjectionY("projGEMI6",99,101); + projGEMI6->SetLineColor(6); + TH1D * projGEMI7 = InvPtResVsPt_GEM_Clone->ProjectionY("projGEMI7",150,201); + projGEMI7->SetLineColor(7); + + projGEMI1->Draw(); + projGEMI2->Draw("SAME"); + projGEMI3->Draw("SAME"); + projGEMI4->Draw("SAME"); + projGEMI5->Draw("SAME"); + projGEMI6->Draw("SAME"); + projGEMI7->Draw("SAME"); + + leg5->Draw(); + + canvasFit->SaveAs("resGEM.png"); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + //TCanvas * canvasFit2 = new TCanvas("canvasFit2","canvas",1300,700); + //canvasFit2->Divide(4,2); + //canvasFit2->cd(1); + MyPar sigmaNoGEM1 = extractSigma(proj1,"sigmaNoGEM1"); + //canvasFit2->cd(2); + MyPar sigmaNoGEM2 = extractSigma(proj2,"sigmaNoGEM2"); + //canvasFit2->cd(3); + MyPar sigmaNoGEM3 = extractSigma(proj3,"sigmaNoGEM3"); + //canvasFit2->cd(4); + MyPar sigmaNoGEM4 = extractSigma(proj4,"sigmaNoGEM4"); + //canvasFit2->cd(5); + MyPar sigmaNoGEM5 = extractSigma(proj5,"sigmaNoGEM5"); + //canvasFit2->cd(6); + MyPar sigmaNoGEM6 = extractSigma(proj6,"sigmaNoGEM6"); + //canvasFit2->cd(7); + MyPar sigmaNoGEM7 = extractSigma(proj7,"sigmaNoGEM7"); + //canvasFit2->SaveAs("fitResNoGEM.png"); + + //canvasFit2->cd(1); + MyPar sigmaNoGEMI1 = extractSigma(projI1,"sigmaNoGEMI1"); + //canvasFit2->cd(2); + MyPar sigmaNoGEMI2 = extractSigma(projI2,"sigmaNoGEMI2"); + //canvasFit2->cd(3); + MyPar sigmaNoGEMI3 = extractSigma(projI3,"sigmaNoGEMI3"); + //canvasFit2->cd(4); + MyPar sigmaNoGEMI4 = extractSigma(projI4,"sigmaNoGEMI4"); + //canvasFit2->cd(5); + MyPar sigmaNoGEMI5 = extractSigma(projI5,"sigmaNoGEMI5"); + //canvasFit2->cd(6); + MyPar sigmaNoGEMI6 = extractSigma(projI6,"sigmaNoGEMI6"); + //canvasFit2->cd(7); + MyPar sigmaNoGEMI7 = extractSigma(projI7,"sigmaNoGEMI7"); + //canvasFit2->SaveAs("fitInvResNoGEM.png"); + + //canvasFit2->cd(1); + MyPar sigmaGEM1 = extractSigma(projGEM1,"sigmaGEM1"); + //canvasFit2->cd(2); + MyPar sigmaGEM2 = extractSigma(projGEM2,"sigmaGEM2"); + //canvasFit2->cd(3); + MyPar sigmaGEM3 = extractSigma(projGEM3,"sigmaGEM3"); + //canvasFit2->cd(4); + MyPar sigmaGEM4 = extractSigma(projGEM4,"sigmaGEM4"); + //canvasFit2->cd(5); + MyPar sigmaGEM5 = extractSigma(projGEM5,"sigmaGEM5"); + //canvasFit2->cd(6); + MyPar sigmaGEM6 = extractSigma(projGEM6,"sigmaGEM6"); + //canvasFit2->cd(7); + MyPar sigmaGEM7 = extractSigma(projGEM7,"sigmaGEM7"); + //canvasFit2->SaveAs("fitResGEM.png"); + + //canvasFit2->cd(1); + MyPar sigmaGEMI1 = extractSigma(projGEMI1,"sigmaGEMI1"); + //canvasFit2->cd(2); + MyPar sigmaGEMI2 = extractSigma(projGEMI2,"sigmaGEMI2"); + //canvasFit2->cd(3); + MyPar sigmaGEMI3 = extractSigma(projGEMI3,"sigmaGEMI3"); + //canvasFit2->cd(4); + MyPar sigmaGEMI4 = extractSigma(projGEMI4,"sigmaGEMI4"); + //canvasFit2->cd(5); + MyPar sigmaGEMI5 = extractSigma(projGEMI5,"sigmaGEMI5"); + //canvasFit2->cd(6); + MyPar sigmaGEMI6 = extractSigma(projGEMI6,"sigmaGEMI6"); + //canvasFit2->cd(7); + MyPar sigmaGEMI7 = extractSigma(projGEMI7,"sigmaGEMI7"); + //canvasFit2->SaveAs("fitInvResGEM.png"); + + TCanvas * canvasFit3 = new TCanvas("canvasFit3","canvas",700,700); + gStyle->SetOptStat(0); + canvasFit3->Divide(1,2); + canvasFit3->cd(1); + TH1D * PtResVsPt_NoGEM_Sigma2 = (TH1D*)PtResVsPt_NoGEM_Sigma->Clone(); + PtResVsPt_NoGEM_Sigma2->SetMaximum(0.15); + PtResVsPt_NoGEM_Sigma2->SetBinContent(2,sigmaNoGEM1.sigma); + PtResVsPt_NoGEM_Sigma2->SetBinError(2,sigmaNoGEM1.DeltaSigma); + PtResVsPt_NoGEM_Sigma2->SetBinContent(3,sigmaNoGEM2.sigma); + PtResVsPt_NoGEM_Sigma2->SetBinError(3,sigmaNoGEM2.DeltaSigma); + PtResVsPt_NoGEM_Sigma2->SetBinContent(11,sigmaNoGEM3.sigma); + PtResVsPt_NoGEM_Sigma2->SetBinError(11,sigmaNoGEM3.DeltaSigma); + PtResVsPt_NoGEM_Sigma2->SetBinContent(21,sigmaNoGEM4.sigma); + PtResVsPt_NoGEM_Sigma2->SetBinError(21,sigmaNoGEM4.DeltaSigma); + PtResVsPt_NoGEM_Sigma2->SetBinContent(41,sigmaNoGEM5.sigma); + PtResVsPt_NoGEM_Sigma2->SetBinError(41,sigmaNoGEM5.DeltaSigma); + PtResVsPt_NoGEM_Sigma2->SetBinContent(101,sigmaNoGEM6.sigma); + PtResVsPt_NoGEM_Sigma2->SetBinError(101,sigmaNoGEM6.DeltaSigma); + PtResVsPt_NoGEM_Sigma2->SetBinContent(201,sigmaNoGEM7.sigma); + PtResVsPt_NoGEM_Sigma2->SetBinError(201,sigmaNoGEM7.DeltaSigma); + PtResVsPt_NoGEM_Sigma2->Draw("E1P"); + TH1D * PtResVsPt_GEM_Sigma2 = (TH1D*)PtResVsPt_GEM_Sigma->Clone(); + PtResVsPt_GEM_Sigma2->SetBinContent(2,sigmaGEM1.sigma); + PtResVsPt_GEM_Sigma2->SetBinError(2,sigmaGEM1.DeltaSigma); + PtResVsPt_GEM_Sigma2->SetBinContent(3,sigmaGEM2.sigma); + PtResVsPt_GEM_Sigma2->SetBinError(3,sigmaGEM2.DeltaSigma); + PtResVsPt_GEM_Sigma2->SetBinContent(11,sigmaGEM3.sigma); + PtResVsPt_GEM_Sigma2->SetBinError(11,sigmaGEM3.DeltaSigma); + PtResVsPt_GEM_Sigma2->SetBinContent(21,sigmaGEM4.sigma); + PtResVsPt_GEM_Sigma2->SetBinError(21,sigmaGEM4.DeltaSigma); + PtResVsPt_GEM_Sigma2->SetBinContent(41,sigmaGEM5.sigma); + PtResVsPt_GEM_Sigma2->SetBinError(41,sigmaGEM5.DeltaSigma); + PtResVsPt_GEM_Sigma2->SetBinContent(101,sigmaGEM6.sigma); + PtResVsPt_GEM_Sigma2->SetBinError(101,sigmaGEM6.DeltaSigma); + PtResVsPt_GEM_Sigma2->SetBinContent(201,sigmaGEM7.sigma); + PtResVsPt_GEM_Sigma2->SetBinError(201,sigmaGEM7.DeltaSigma); + PtResVsPt_GEM_Sigma2->Draw("E1PSAME"); + leg4->Draw(); + canvasFit3->cd(2); + TH1D * ratioComp3 = makeRatio2(PtResVsPt_NoGEM_Sigma2, PtResVsPt_GEM_Sigma2); + ratioComp3->SetMarkerColor(1); + ratioComp3->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + ratioComp3->GetYaxis()->SetTitle("#sigma_{Res}^{GEM} / #sigma_{Res}^{NoGEM}"); + ratioComp3->Draw("E1P"); + + canvasFit3->SaveAs("comparisonRange_res.png"); + + canvasFit3->Clear(); + canvasFit3->Update(); + + canvasFit3->Divide(1,2); + canvasFit3->cd(1); + TH1D * InvPtResVsPt_NoGEM_Sigma2 = (TH1D*)InvPtResVsPt_NoGEM_Sigma->Clone(); + InvPtResVsPt_NoGEM_Sigma2->SetMaximum(0.15); + InvPtResVsPt_NoGEM_Sigma2->SetBinContent(2,sigmaNoGEMI1.sigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinError(2,sigmaNoGEMI1.DeltaSigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinContent(3,sigmaNoGEMI2.sigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinError(3,sigmaNoGEMI2.DeltaSigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinContent(11,sigmaNoGEMI3.sigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinError(11,sigmaNoGEMI3.DeltaSigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinContent(21,sigmaNoGEMI4.sigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinError(21,sigmaNoGEMI4.DeltaSigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinContent(41,sigmaNoGEMI5.sigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinError(41,sigmaNoGEMI5.DeltaSigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinContent(101,sigmaNoGEMI6.sigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinError(101,sigmaNoGEMI6.DeltaSigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinContent(201,sigmaNoGEMI7.sigma); + InvPtResVsPt_NoGEM_Sigma2->SetBinError(201,sigmaNoGEMI7.DeltaSigma); + InvPtResVsPt_NoGEM_Sigma2->Draw("E1P"); + TH1D * InvPtResVsPt_GEM_Sigma2 = (TH1D*)InvPtResVsPt_GEM_Sigma->Clone(); + InvPtResVsPt_GEM_Sigma2->SetBinContent(2,sigmaGEMI1.sigma); + InvPtResVsPt_GEM_Sigma2->SetBinError(2,sigmaGEMI1.DeltaSigma); + InvPtResVsPt_GEM_Sigma2->SetBinContent(3,sigmaGEMI2.sigma); + InvPtResVsPt_GEM_Sigma2->SetBinError(3,sigmaGEMI2.DeltaSigma); + InvPtResVsPt_GEM_Sigma2->SetBinContent(11,sigmaGEMI3.sigma); + InvPtResVsPt_GEM_Sigma2->SetBinError(11,sigmaGEMI3.DeltaSigma); + InvPtResVsPt_GEM_Sigma2->SetBinContent(21,sigmaGEMI4.sigma); + InvPtResVsPt_GEM_Sigma2->SetBinError(21,sigmaGEMI4.DeltaSigma); + InvPtResVsPt_GEM_Sigma2->SetBinContent(41,sigmaGEMI5.sigma); + InvPtResVsPt_GEM_Sigma2->SetBinError(41,sigmaGEMI5.DeltaSigma); + InvPtResVsPt_GEM_Sigma2->SetBinContent(101,sigmaGEMI6.sigma); + InvPtResVsPt_GEM_Sigma2->SetBinError(101,sigmaGEMI6.DeltaSigma); + InvPtResVsPt_GEM_Sigma2->SetBinContent(201,sigmaGEMI7.sigma); + InvPtResVsPt_GEM_Sigma2->SetBinError(201,sigmaGEMI7.DeltaSigma); + InvPtResVsPt_GEM_Sigma2->Draw("E1PSAME"); + leg4->Draw(); + canvasFit3->cd(2); + TH1D * ratioComp4 = makeRatio2(InvPtResVsPt_NoGEM_Sigma2, InvPtResVsPt_GEM_Sigma2); + ratioComp4->SetMarkerColor(1); + ratioComp4->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + ratioComp4->GetYaxis()->SetTitle("#sigma_{InvRes}^{GEM} / #sigma_{InvRes}^{NoGEM}"); + ratioComp4->Draw("E1P"); + + canvasFit3->SaveAs("comparisonRange_invres.png"); + + canvasFit3->Clear(); + canvasFit3->Update(); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + vdouble vecRes5GeV = composeHistos(sigmaNoGEM1, sigmaGEM1, "Res_5GeV"); + vdouble vecRes10GeV = composeHistos(sigmaNoGEM2, sigmaGEM2, "Res_10GeV"); + vdouble vecRes50GeV = composeHistos(sigmaNoGEM3, sigmaGEM3, "Res_50GeV"); + vdouble vecRes100GeV = composeHistos(sigmaNoGEM4, sigmaGEM4, "Res_100GeV"); + vdouble vecRes200GeV = composeHistos(sigmaNoGEM5, sigmaGEM5, "Res_200GeV"); + vdouble vecRes500GeV = composeHistos(sigmaNoGEM6, sigmaGEM6, "Res_500GeV"); + vdouble vecRes1000GeV = composeHistos(sigmaNoGEM7, sigmaGEM7, "Res_1000GeV"); + + vdouble vecInvRes5GeV = composeHistos(sigmaNoGEMI1, sigmaGEMI1, "InvRes_5GeV"); + vdouble vecInvRes10GeV = composeHistos(sigmaNoGEMI2, sigmaGEMI2, "InvRes_10GeV"); + vdouble vecInvRes50GeV = composeHistos(sigmaNoGEMI3, sigmaGEMI3, "InvRes_50GeV"); + vdouble vecInvRes100GeV = composeHistos(sigmaNoGEMI4, sigmaGEMI4, "InvRes_100GeV"); + vdouble vecInvRes200GeV = composeHistos(sigmaNoGEMI5, sigmaGEMI5, "InvRes_200GeV"); + vdouble vecInvRes500GeV = composeHistos(sigmaNoGEMI6, sigmaGEMI6, "InvRes_500GeV"); + vdouble vecInvRes1000GeV = composeHistos(sigmaNoGEMI7, sigmaGEMI7, "InvRes_1000GeV"); + + TCanvas * canvasFit4 = new TCanvas("canvasFit4","canvas",700,700); + gStyle->SetOptStat(0); + canvasFit4->Divide(1,2); + canvasFit4->cd(1); + TH1D * PtResVsPt_NoGEM_Sigma3 = (TH1D*)PtResVsPt_NoGEM_Sigma->Clone(); + PtResVsPt_NoGEM_Sigma3->SetMaximum(0.15); + PtResVsPt_NoGEM_Sigma3->SetBinContent(2,vecRes5GeV[0]); + PtResVsPt_NoGEM_Sigma3->SetBinError(2,vecRes5GeV[1]); + PtResVsPt_NoGEM_Sigma3->SetBinContent(3,vecRes10GeV[0]); + PtResVsPt_NoGEM_Sigma3->SetBinError(3,vecRes10GeV[1]); + PtResVsPt_NoGEM_Sigma3->SetBinContent(11,vecRes50GeV[0]); + PtResVsPt_NoGEM_Sigma3->SetBinError(11,vecRes50GeV[1]); + PtResVsPt_NoGEM_Sigma3->SetBinContent(21,vecRes100GeV[0]); + PtResVsPt_NoGEM_Sigma3->SetBinError(21,vecRes100GeV[1]); + PtResVsPt_NoGEM_Sigma3->SetBinContent(41,vecRes200GeV[0]); + PtResVsPt_NoGEM_Sigma3->SetBinError(41,vecRes200GeV[1]); + PtResVsPt_NoGEM_Sigma3->SetBinContent(101,vecRes500GeV[0]); + PtResVsPt_NoGEM_Sigma3->SetBinError(101,vecRes500GeV[1]); + PtResVsPt_NoGEM_Sigma3->SetBinContent(201,vecRes1000GeV[0]); + PtResVsPt_NoGEM_Sigma3->SetBinError(201,vecRes1000GeV[1]); + PtResVsPt_NoGEM_Sigma3->Draw("E1P"); + TH1D * PtResVsPt_GEM_Sigma3 = (TH1D*)PtResVsPt_GEM_Sigma->Clone(); + PtResVsPt_GEM_Sigma3->SetBinContent(2,vecRes5GeV[2]); + PtResVsPt_GEM_Sigma3->SetBinError(2,vecRes5GeV[3]); + PtResVsPt_GEM_Sigma3->SetBinContent(3,vecRes10GeV[2]); + PtResVsPt_GEM_Sigma3->SetBinError(3,vecRes10GeV[3]); + PtResVsPt_GEM_Sigma3->SetBinContent(11,vecRes50GeV[2]); + PtResVsPt_GEM_Sigma3->SetBinError(11,vecRes50GeV[3]); + PtResVsPt_GEM_Sigma3->SetBinContent(21,vecRes100GeV[2]); + PtResVsPt_GEM_Sigma3->SetBinError(21,vecRes100GeV[3]); + PtResVsPt_GEM_Sigma3->SetBinContent(41,vecRes200GeV[2]); + PtResVsPt_GEM_Sigma3->SetBinError(41,vecRes200GeV[3]); + PtResVsPt_GEM_Sigma3->SetBinContent(101,vecRes500GeV[2]); + PtResVsPt_GEM_Sigma3->SetBinError(101,vecRes500GeV[3]); + PtResVsPt_GEM_Sigma3->SetBinContent(201,vecRes1000GeV[2]); + PtResVsPt_GEM_Sigma3->SetBinError(201,vecRes1000GeV[3]); + PtResVsPt_GEM_Sigma3->Draw("E1PSAME"); + leg4->Draw(); + canvasFit4->cd(2); + TH1D * ratioComp5 = makeRatio2(PtResVsPt_NoGEM_Sigma3, PtResVsPt_GEM_Sigma3); + ratioComp5->SetMarkerColor(1); + ratioComp5->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + ratioComp5->GetYaxis()->SetTitle("#sigma_{Res}^{GEM} / #sigma_{Res}^{NoGEM}"); + ratioComp5->Draw("E1P"); + canvasFit4->SaveAs("comparisonMinRange_res.png"); + + canvasFit4->Clear(); + canvasFit4->Update(); + + canvasFit4->Divide(1,2); + canvasFit4->cd(1); + TH1D * InvPtResVsPt_NoGEM_Sigma3 = (TH1D*)InvPtResVsPt_NoGEM_Sigma->Clone(); + InvPtResVsPt_NoGEM_Sigma3->SetMaximum(0.15); + InvPtResVsPt_NoGEM_Sigma3->SetBinContent(2,vecInvRes5GeV[0]); + InvPtResVsPt_NoGEM_Sigma3->SetBinError(2,vecInvRes5GeV[1]); + InvPtResVsPt_NoGEM_Sigma3->SetBinContent(3,vecInvRes10GeV[0]); + InvPtResVsPt_NoGEM_Sigma3->SetBinError(3,vecInvRes10GeV[1]); + InvPtResVsPt_NoGEM_Sigma3->SetBinContent(11,vecInvRes50GeV[0]); + InvPtResVsPt_NoGEM_Sigma3->SetBinError(11,vecInvRes50GeV[1]); + InvPtResVsPt_NoGEM_Sigma3->SetBinContent(21,vecInvRes100GeV[0]); + InvPtResVsPt_NoGEM_Sigma3->SetBinError(21,vecInvRes100GeV[1]); + InvPtResVsPt_NoGEM_Sigma3->SetBinContent(41,vecInvRes200GeV[0]); + InvPtResVsPt_NoGEM_Sigma3->SetBinError(41,vecInvRes200GeV[1]); + InvPtResVsPt_NoGEM_Sigma3->SetBinContent(101,vecInvRes500GeV[0]); + InvPtResVsPt_NoGEM_Sigma3->SetBinError(101,vecInvRes500GeV[1]); + InvPtResVsPt_NoGEM_Sigma3->SetBinContent(201,vecInvRes1000GeV[0]); + InvPtResVsPt_NoGEM_Sigma3->SetBinError(201,vecInvRes1000GeV[1]); + InvPtResVsPt_NoGEM_Sigma3->Draw("E1P"); + TH1D * InvPtResVsPt_GEM_Sigma3 = (TH1D*)InvPtResVsPt_GEM_Sigma->Clone(); + InvPtResVsPt_GEM_Sigma3->SetBinContent(2,vecInvRes5GeV[2]); + InvPtResVsPt_GEM_Sigma3->SetBinError(2,vecInvRes5GeV[3]); + InvPtResVsPt_GEM_Sigma3->SetBinContent(3,vecInvRes10GeV[2]); + InvPtResVsPt_GEM_Sigma3->SetBinError(3,vecInvRes10GeV[3]); + InvPtResVsPt_GEM_Sigma3->SetBinContent(11,vecInvRes50GeV[2]); + InvPtResVsPt_GEM_Sigma3->SetBinError(11,vecInvRes50GeV[3]); + InvPtResVsPt_GEM_Sigma3->SetBinContent(21,vecInvRes100GeV[2]); + InvPtResVsPt_GEM_Sigma3->SetBinError(21,vecInvRes100GeV[3]); + InvPtResVsPt_GEM_Sigma3->SetBinContent(41,vecInvRes200GeV[2]); + InvPtResVsPt_GEM_Sigma3->SetBinError(41,vecInvRes200GeV[3]); + InvPtResVsPt_GEM_Sigma3->SetBinContent(101,vecInvRes500GeV[2]); + InvPtResVsPt_GEM_Sigma3->SetBinError(101,vecInvRes500GeV[3]); + InvPtResVsPt_GEM_Sigma3->SetBinContent(201,vecInvRes1000GeV[2]); + InvPtResVsPt_GEM_Sigma3->SetBinError(201,vecInvRes1000GeV[3]); + InvPtResVsPt_GEM_Sigma3->Draw("E1PSAME"); + leg4->Draw(); + canvasFit4->cd(2); + TH1D * ratioComp6 = makeRatio2(InvPtResVsPt_NoGEM_Sigma3, InvPtResVsPt_GEM_Sigma3); + ratioComp6->SetMarkerColor(1); + ratioComp6->GetXaxis()->SetTitle("p_{T}^{Sim} [GeV/c]"); + ratioComp6->GetYaxis()->SetTitle("#sigma_{InvRes}^{GEM} / #sigma_{InvRes}^{NoGEM}"); + ratioComp6->Draw("E1P"); + + canvasFit4->SaveAs("comparisonMinRange_invres.png"); + +} diff --git a/SimMuL1/scripts/drawplot_frankenstein_ptshiftX.C b/SimMuL1/scripts/drawplot_frankenstein_ptshiftX.C index 8482f3b27b8f2..733bee148991e 100644 --- a/SimMuL1/scripts/drawplot_frankenstein_ptshiftX.C +++ b/SimMuL1/scripts/drawplot_frankenstein_ptshiftX.C @@ -59,18 +59,25 @@ void produceRatePlot(TH1D* h, TH1D* i, TH1D* j, TH1D* m, Color_t col0, Color_t c h->GetYaxis()->SetRangeUser(miny, maxy); h->GetXaxis()->SetTitle(""); - TLegend *leg = new TLegend(0.45,0.65,.93,0.93,"","brNDC"); - leg->SetMargin(0.25); + TLegend *leg = new TLegend(0.15,0.88,.93,0.93,"","brNDC"); + leg->SetMargin(0.15); + leg->SetBorderSize(0); + leg->SetFillStyle(0); + leg->SetTextSize(0.04); + leg->SetFillStyle(1001); + leg->SetFillColor(kWhite); + leg->AddEntry(h, "L1 Single Mu (2012 configuration) + ME1/1a unganging","f"); + leg->Draw(); + + TLegend *leg = new TLegend(0.4,0.7,.93,0.88,"","brNDC"); + leg->SetMargin(0.2); leg->SetBorderSize(0); leg->SetFillStyle(0); leg->SetTextSize(0.04); leg->SetFillStyle(1001); leg->SetFillColor(kWhite); - leg->AddEntry(h, "L1 single muon trigger","f"); - leg->AddEntry((TObject*)0, "(final 2012 configuration)",""); - // leg->AddEntry((TObject*)0, "L1 selections (#geq " + k + " stations):",""); leg->AddEntry(i,"CSC #geq" + k + " stubs (anywhere)","f"); - leg->AddEntry(j,"CSC #geq" + k + " stubs (one in ME1/b)","f"); + leg->AddEntry(j,"CSC #geq" + k + " stubs (one in Station 1)","f"); leg->AddEntry(m,"GEM+CSC integrated trigger","f"); leg->AddEntry((TObject*)0,"with #geq" + k + " stubs",""); leg->Draw(); @@ -105,8 +112,8 @@ void produceRatePlot(TH1D* h, TH1D* i, TH1D* j, TH1D* m, Color_t col0, Color_t c leg->SetFillStyle(0); // leg->SetFillStyle(1001); // leg->SetFillColor(kWhite); - leg->AddEntry(hh_ratio_gmt, "(GEM+CSC)/L1 single muon trigger","p"); - leg->AddEntry(hh_ratio, "(GEM+CSC)/CSC #geq" + k + " stubs (one in ME1/b)","p"); + leg->AddEntry(hh_ratio_gmt, "(GEM+CSC)/L1 Single Mu","p"); + leg->AddEntry(hh_ratio, "(GEM+CSC)/CSC #geq" + k + " stubs (one in Station 1)","p"); leg->Draw("same"); c->SaveAs(plots + "rates_vs_pt__PU100__def_" + k + "s_" + k + "s1b_" + k + "s1bgem__" + l + ext); @@ -119,7 +126,7 @@ void drawplot_frankenstein_ptshiftX() gROOT->ProcessLine(".L drawplot_gmtrt.C"); gROOT->ProcessLine(".L getPTHistos.C"); - TString ext = ".pdf"; + TString ext = ".eps"; TString filesDir = "files/"; TString plotDir = "plots/rate_vs_pt_shiftX/"; @@ -221,7 +228,7 @@ void drawplot_frankenstein_ptshiftX() // TString the_ttl = " L1 Single Muon Trigger CMS Simulation Preliminary;L1 candidate muon p_{T}^{cut} [GeV/c];rate [kHz]"; - TString the_ttl = " CMS Simulation Preliminary;L1 muon candidate p_{T}^{cut} [GeV/c];Trigger rate [kHz]"; + TString the_ttl = " CMS Phase-2 Simulation Preliminary;L1 muon candidate p_{T}^{cut} [GeV/c];Trigger rate [kHz]"; hh = setPTHisto(hh, the_ttl, kGreen+3, 1, 1); hh_all = setPTHisto(hh_all, the_ttl, kGreen+3, 1, 1); diff --git a/SimMuL1/scripts/highEfficiencyPatterns.py b/SimMuL1/scripts/highEfficiencyPatterns.py index 017e4f4602b53..07159325ad94e 100644 --- a/SimMuL1/scripts/highEfficiencyPatterns.py +++ b/SimMuL1/scripts/highEfficiencyPatterns.py @@ -115,12 +115,13 @@ def highEfficiencyPatterns(filesDir, plotDir, eff, oddEven, ext): c.SetGridx(1) c.SetGridy(1) c.cd() - h = TH1F(""," GEM-CSC bending Angle CMS Simulation Preliminary;Generated muon p_{T} [GeV/c];",50,0.,50.) + h = TH1F(""," GEM-CSC bending Angle CMS Phase-2 Simulation Preliminary;Generated muon p_{T} [GeV/c];",50,0.,50.) superscript = "p_{T}>p_{T}^{min}" subscript = "0" ## h.GetYaxis().SetTitle(" |#Delta#phi_{{}^{(GEM,CSC)}}|<|#Delta#phi_{0}^{WP}| Cut Efficiency"); ## h.GetYaxis().SetTitle(" |#Delta#phi_{{}^{(GEM,CSC)}}|<|#Delta#phi_{%s}^{%s}| Cut Efficiency"%(subscript,superscript)); - h.GetYaxis().SetTitle(" |#Delta#phi_{{}^{(GEM,CSC)}}|<#Delta#phi_{%s} Cut Efficiency"%(subscript)); +# h.GetYaxis().SetTitle(" |#Delta#phi_{{}^{(GEM,CSC)}}|<#Delta#phi_{%s} Cut Efficiency"%(subscript)); + h.GetYaxis().SetTitle("#Delta#phi_{(GEM,CSC)} cut efficiency"); h.GetYaxis().SetTitleOffset(.9) h.SetStats(0) @@ -138,11 +139,11 @@ def highEfficiencyPatterns(filesDir, plotDir, eff, oddEven, ext): if oddEven=="even": ok_dphi = TCut("TMath::Abs(dphi_pad_even) < %f"%(dphi)) denom_cut = ok_pad2_lct2_eta - closeFar = "Close" + closeFar = 'Even ("close")' else: ok_dphi = TCut("TMath::Abs(dphi_pad_odd) < %f"%(dphi)) denom_cut = ok_pad1_lct1_eta - closeFar = "Far" + closeFar = 'Odd ("far")' h2 = draw_eff(t, "", "h2", "(50,0.,50.)", "pt", denom_cut, ok_dphi, marker_colors[i], marker_styles[i]) @@ -151,13 +152,13 @@ def highEfficiencyPatterns(filesDir, plotDir, eff, oddEven, ext): h2.Draw("same") ## add legend - leg = TLegend(0.52,0.17,.93,0.57, "High efficiency patterns:", "brNDC") + leg = TLegend(0.55,0.15,.93,0.57, "High efficiency patterns:", "brNDC") for n in range(len(pt)): superscript = "\"%s\""%(pt_labels[n]) superscript = "p_{T}>%s"%(pt_labels[n]) - subscript = "0" + subscript = "(GEM,CSC)" #leg.AddEntry(histoList[n], "#Delta#phi_{%s}^{%s} = %.1f mrad"%(subscript,superscript,dphis[n]*1000), "p") - leg.AddEntry(histoList[n], "#Delta#phi_{%s} = %.1f mrad"%(subscript,dphis[n]*1000), "p") + leg.AddEntry(histoList[n], "#Delta#phi_{%s} < %.1f mrad"%(subscript,dphis[n]*1000), "p") #leg.AddEntry(histoList[n], "WP = %s"%(pt_labels[n]), "p") @@ -184,15 +185,25 @@ def highEfficiencyPatterns(filesDir, plotDir, eff, oddEven, ext): ## hardcore nitpicking over here! if closeFar == "Close": - xpos = 0.57 + xpos = 0.735 else: - xpos = 0.611 +# xpos = 0.611 + xpos = 0.735 - tex = TLatex(xpos,.75,'"%s" chamber pairs'%(closeFar)) + xpos = .7 + + + tex = TLatex(xpos,.75,"%s"%(closeFar)) tex.Draw("same") tex.SetTextSize(0.05) tex.SetNDC() + tex2 = TLatex(xpos,.68,"Chamber pairs") + tex2.Draw("same") + tex2.SetTextSize(0.05) + tex2.SetNDC() + + ## save the file c.SaveAs("%sGEM_highEffPatterns_%s_%s%s"%(plotDir, eff,oddEven,ext)) diff --git a/SimMuL1/scripts/matchingEfficiency.C b/SimMuL1/scripts/matchingEfficiency.C deleted file mode 100644 index 4293359a13bbf..0000000000000 --- a/SimMuL1/scripts/matchingEfficiency.C +++ /dev/null @@ -1,568 +0,0 @@ -//gROOT->ProcessLine(".L effFunctions.C"); - - -gROOT->SetBatch(1); - - -TString filesDir = "files/"; -TString plotDir = "plots/efficiency/"; -TString ext = ".pdf"; - -TCut ok_sh1 = "(has_csc_sh&1) > 0"; -TCut ok_sh2 = "(has_csc_sh&2) > 0"; -TCut ok_st1 = "(has_csc_strips&1) > 0"; -TCut ok_st2 = "(has_csc_strips&2) > 0"; -TCut ok_w1 = "(has_csc_wires&1) > 0"; -TCut ok_w2 = "(has_csc_wires&2) > 0"; -TCut ok_digi1 = (ok_st1 && ok_w1); -TCut ok_digi2 = (ok_st2 && ok_w2); -TCut ok_lct1 = "(has_lct&1) > 0"; -TCut ok_lct2 = "(has_lct&2) > 0"; -TCut ok_lcths1 = ok_lct1 && "hs_lct_odd > 4 && hs_lct_odd < 125"; -TCut ok_lcths2 = ok_lct2 && "hs_lct_even > 4 && hs_lct_even < 125"; - -TCut ok_gsh1 = "(has_gem_sh&1) > 0"; -TCut ok_gsh2 = "(has_gem_sh&2) > 0"; -TCut ok_g2sh1 = "(has_gem_sh2&1) > 0"; -TCut ok_g2sh2 = "(has_gem_sh2&2) > 0"; -TCut ok_gdg1 = "(has_gem_dg&1) > 0"; -TCut ok_gdg2 = "(has_gem_dg&2) > 0"; -TCut ok_pad1 = "(has_gem_pad&1) > 0"; -TCut ok_pad2 = "(has_gem_pad&2) > 0"; -TCut ok_2pad1 = "(has_gem_pad2&1) > 0"; -TCut ok_2pad2 = "(has_gem_pad2&2) > 0"; -TCut ok_pad1_overlap = ok_pad1 || (ok_lct2 && ok_pad2); -TCut ok_pad2_overlap = ok_pad2 || (ok_lct1 && ok_pad1); -TCut ok_copad1 = "(has_gem_copad&1) > 0"; -TCut ok_copad2 = "(has_gem_copad&2) > 0"; - - -TCut Qp = "charge > 0"; -TCut Qn = "charge < 0"; - -TCut Ep = "endcap > 0"; -TCut En = "endcap < 0"; - -TCut ok_eta = "TMath::Abs(eta)>1.64 && TMath::Abs(eta)<2.14"; -TCut ok_pt = "pt > 20"; - - - -// TCut ok_dphi1 = "dphi_pad_odd < 10."; -// TCut ok_dphi2 = "dphi_pad_even < 10."; - -// enum {GEM_EFF95 = 0, GEM_EFF98, GEM_EFF99}; -// enum {DPHI_PT10 = 0, DPHI_PT15, DPHI_PT20, DPHI_PT30, DPHI_PT40}; - -double mymod(double x, double y) -{ - return fmod(x,y); -} - -// void setDPhi(int label_pt, int label_eff = GEM_EFF98) -// { -// float dphi_odd[3][20] = { -// {0.009887, 0.006685, 0.005194, 0.003849, 0.003133}, -// {0.01076 , 0.007313, 0.005713, 0.004263, 0.003513}, -// {0.011434, 0.007860, 0.006162, 0.004615, 0.003891} }; -// float dphi_even[3][20] = { -// {0.004418, 0.003274, 0.002751, 0.002259, 0.002008}, -// {0.004863, 0.003638, 0.003063, 0.002563, 0.002313}, -// {0.005238, 0.003931, 0.003354, 0.002809, 0.002574} }; -// ok_dphi1 = Form("TMath::Abs(dphi_pad_odd) < %f", dphi_odd[label_eff][label_pt]); -// ok_dphi2 = Form("TMath::Abs(dphi_pad_even) < %f", dphi_even[label_eff][label_pt]); -// } - - -TFile* gf = 0; -TTree* gt = 0; -TString gf_name = ""; - -TTree* getTree(TString f_name) -{ - if (gf_name == f_name && gt != 0) return gt; - cout<Get("GEMCSCAnalyzer/trk_eff"); - return gt; -} - -void eff_hs_dphi(TString f_name, TString p_name) -{ - // efficiency vs half-strip - separate odd-even - TCut ok_eta = "TMath::Abs(eta)>1.64 && TMath::Abs(eta)<2.12"; - //TCut ok_eta = "TMath::Abs(eta)>1.64 && TMath::Abs(eta)<1.74"; - //TCut ok_eta = "TMath::Abs(eta)>1.94 && TMath::Abs(eta)<2.12"; - - TTree *t = getTree(f_name); - setDPhi(DPHI_PT40, GEM_EFF98); - - // TH1F* ho = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(130,0.5,130.5)", "hs_lct_odd", ok_lct1 && ok_eta && ok_gsh1 , ok_pad1, "", kRed); - // TH1F* he = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_evn", "(130,0.5,130.5)", "hs_lct_even", ok_lct2 && ok_eta && ok_gsh2, ok_pad2, "same"); - - //TH1F* ho = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(130,0.5,130.5)", "hs_lct_odd", ok_lct1 && ok_eta, ok_gsh1, "", kRed); - //TH1F* he = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_evn", "(130,0.5,130.5)", "hs_lct_even", ok_lct2 && ok_eta, ok_gsh2, "same"); - - //TH1F* ho = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(130,0.5,130.5)", "hs_lct_odd", ok_lct1 && ok_eta && Qneg, ok_pad1 && ok_dphi1, "", kRed); - //TH1F* he = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_evn", "(130,0.5,130.5)", "hs_lct_even", ok_lct2 && ok_eta && Qneg, ok_pad2 && ok_dphi2, "same"); - //TH1F* ho = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(130,-0.2,0.2)", "mymod(phi+TMath::Pi()/36., TMath::Pi()/18.)", ok_eta, ok_lct1, "", kRed); - //TH1F* he = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_evn", "(130,-0.2,0.2)", "mymod(phi+TMath::Pi()/36., TMath::Pi()/18.)",ok_eta, ok_lct2, "same"); - //TH1F* ho = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(130,-0.2,0.2)", "mymod(phi+TMath::Pi()/36., TMath::Pi()/18.)", ok_eta, ok_lct1 || ok_lct2, "", kRed); - //TH1F* hg = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(130,-0.2,0.2)", "mymod(phi+TMath::Pi()/36., TMath::Pi()/18.)", ok_eta, ok_pad1 || ok_pad2, "same"); - //TH1F* hgp = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(130,-0.2,0.2)", "mymod(phi+TMath::Pi()/36., TMath::Pi()/18.)", ok_eta&&Qpos, ok_pad1 || ok_pad2, "same", kGreen); - - - //TH1F* ho = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(384,0.,384.)", "strip_gemsh_odd", ok_gsh1 && ok_eta, ok_pad1, "", kRed); - //TH1F* he = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_evn", "(384,0.,384.)", "strip_gemsh_even", ok_gsh2 && ok_eta, ok_pad2, "same"); - //TH1F* he = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_evn", "(384,0.,384.)", "strip_gemsh_even", ok_gsh2 && ok_eta, ok_pad2, ""); - - //TH1F* ho = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(384,0.,384.)", "strip_gemsh_odd", ok_gsh1 && ok_eta, ok_gdg1, "", kRed); - //TH1F* he = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_evn", "(384,0.,384.)", "strip_gemsh_even", ok_gsh2 && ok_eta, ok_gdg2, "same"); - - //TH1F* ho = draw_eff(t, "Eff. for track with GEM digi to have GEM pad in chamber;digi strip;Eff.", "h_odd", "(384,0.5,384.5)", "strip_gemdg_odd", ok_gdg1 && ok_eta, ok_pad1, "", kRed); - //TH1F* he = draw_eff(t, "Eff. for track with GEM digi to have GEM pad in chamber;digi strip;Eff.", "h_evn", "(384,0.5,384.5)", "strip_gemdg_even", ok_gdg2 && ok_eta, ok_pad2, "same"); - - //gPad->Print(p_name); -} - - -void efficiency_1(TString f_name, TString p_name, TString pt, bool overlap) -{ - - gStyle->SetTitleStyle(0); - gStyle->SetTitleAlign(13); // coord in top left - gStyle->SetTitleX(0.); - gStyle->SetTitleY(1.); - gStyle->SetTitleW(1); - gStyle->SetTitleH(0.058); - gStyle->SetTitleBorderSize(0); - - gStyle->SetPadLeftMargin(0.126); - gStyle->SetPadRightMargin(0.04); - gStyle->SetPadTopMargin(0.06); - gStyle->SetPadBottomMargin(0.13); - gStyle->SetOptStat(0); - gStyle->SetMarkerStyle(1); - - // efficiency vs half-strip - separate odd-even - TCut ok_eta = "TMath::Abs(eta)>1.64 && TMath::Abs(eta)<2.12"; - TCut cut1; - TCut cut2; - if (overlap) - { - cut1 = ok_pad1_overlap; - cut2 = ok_pad2_overlap; - } - else - { - cut1 = ok_pad1; - cut2 = ok_pad2; - } - - TTree *t = getTree(f_name); - TH1F* ho = draw_eff(t, " GEM reconstruction efficiency CMS Simulation Preliminary;LCT half-strip number;Efficiency", "h_odd", "(130,0.5,130.5)", "hs_lct_odd", ok_lct1 && ok_eta , cut1, "", kRed); - TH1F* he = draw_eff(t, " GEM reconstruction efficiency CMS Simulation Preliminary;LCT half-strip number;Efficiency", "h_evn", "(130,0.5,130.5)", "hs_lct_even", ok_lct2 && ok_eta , cut2, "same"); - ho->SetMinimum(0.9); - ho->GetXaxis()->SetLabelSize(0.06); - ho->GetYaxis()->SetLabelSize(0.06); - - - TLegend *leg = new TLegend(0.25,0.23,.75,0.5, NULL, "brNDC"); - leg->SetBorderSize(0); - leg->SetFillStyle(0); - leg->SetTextSize(0.06); - leg->AddEntry((TObject*)0,"muon p_{T} = " + pt + " GeV/c",""); - leg->AddEntry(he, "\"Close\" chamber pairs","l"); - leg->AddEntry(ho, "\"Far\" chamber pairs","l"); - leg->Draw(); - - // TLatex* tex2 = new TLatex(.67,.8," L1 Trigger"); - // tex2->SetTextSize(0.05); - // tex2->SetNDC(); - // tex2->Draw(); - - TLatex * tex = new TLatex(.66,.73,"1.64<|#eta|<2.12"); - tex->SetTextSize(0.05); - tex->SetNDC(); - tex->Draw(); - - gPad->Print(p_name); -} - - -void efficiency_2(TString f_name, TString p_name, TString pt, bool overlap) -{ - // efficiency vs half-strip - including overlaps in odd&even - TCut ok_eta = "TMath::Abs(eta)>1.64 && TMath::Abs(eta)<2.12"; - TCut cut1; - TCut cut2; - if (overlap) - { - cut1 = ok_pad1_overlap; - cut2 = ok_pad2_overlap; - } - else - { - cut1 = ok_pad1; - cut2 = ok_pad2; - } - - TTree *t = getTree(f_name); - - // latest instructions by Vadim: 21-08-2013 - TGraphAsymmErrors* hgn = draw_geff(t, " GEM pad matching CMS Simulation Preliminary;Generated muon #phi [deg];Efficiency", "h_odd", "(40,-10,10)", "mymod(phi*180./TMath::Pi(), 360/18.)", ok_eta&&Qn, ok_pad1 || ok_pad2,"", kRed); - TGraphAsymmErrors* hgp = draw_geff(t, " GEM pad matching CMS Simulation Preliminary;Generated muon #phi [deg];Effciency", "h_odd", "(40,-10,10)", "mymod(phi*180./TMath::Pi(), 360/18.)", ok_eta&&Qp, ok_pad1 || ok_pad2,"same", kBlue); - double maxi = 1.1; - double mini = 0.0; - hgn->SetMinimum(mini); - hgn->SetMaximum(maxi); - hgn->GetXaxis()->SetLabelSize(0.05); - hgn->GetYaxis()->SetLabelSize(0.05); - hgp->GetXaxis()->SetLabelSize(0.05); - hgp->GetYaxis()->SetLabelSize(0.05); - - TLine *l1 = new TLine(-5,mini,-5,maxi); - l1->SetLineStyle(2); - l1->Draw(); - TLine *l1 = new TLine(5,mini,5,maxi); - l1->SetLineStyle(2); - l1->Draw(); - - // hgn->Fit("pol0","R0","",-10,10); - // hgp->Fit("pol0","R0","",-10,10); - // double eff_neg = (hgn->GetFunction("pol0"))->GetParameter(0); - // double eff_pos = (hgp->GetFunction("pol0"))->GetParameter(0); - // std::cout << "negative efficiency" << eff_neg << " " - // << "positive efficiency" << eff_pos << std::endl; - - // ho = draw_eff(t, " GEM reconstruction efficiency CMS Simulation;local #phi [deg];Efficiency", "h_odd", "(150,-10,10)", "mymod(phi+TMath::Pi()/36., TMath::Pi()/18.) * 180./TMath::Pi()", ok_eta&&Qn, ok_pad1 || ok_pad2, "", kRed); - // he = draw_eff(t, " GEM reconstruction efficiency CMS Simulation;local #phi [deg];Efficiency", "h_odd", "(150,-10,10)", "mymod(phi+TMath::Pi()/36., TMath::Pi()/18.) * 180./TMath::Pi()", ok_eta&&Qp, ok_pad1 || ok_pad2, "same",kBlue); - - // TH1F* ho = draw_eff(t, " GEM reconstruction efficiency CMS Simulation;local #phi [deg];Efficiency", "h_odd", "(130,-5,5)", "fmod(180*phi/TMath::Pi(),5)", ok_lct1 && ok_eta , cut1, "", kRed); - // TH1F* he = draw_eff(t, " GEM reconstruction efficiency CMS Simulation;local #phi [deg];Efficiency", "h_evn", "(130,-5,5)", "fmod(180*phi/TMath::Pi(),5)", ok_lct2 && ok_eta , cut2, "same"); - // ho->SetMinimum(0.); - - TLegend *leg = new TLegend(0.25,0.23,.75,0.5, NULL, "brNDC"); - leg->SetBorderSize(0); - leg->SetFillStyle(0); - leg->SetTextSize(0.06); - leg->AddEntry((TObject*)0,"muon p_{T} = " + pt + " GeV/c",""); - leg->AddEntry(hgp, "Postive muons","l"); - leg->AddEntry(hgn, "Negative muons","l"); - leg->Draw(); - - // Print additional information - /* - TLatex* tex2 = new TLatex(.67,.8," L1 Trigger"); - tex2->SetTextSize(0.05); - tex2->SetNDC(); - tex2->Draw(); - */ - - // TLatex * tex = new TLatex(.66,.73,"1.64<|#eta|<2.12"); - TLatex * tex = new TLatex(.7,.2,"1.64<|#eta|<2.12"); - tex->SetTextSize(0.05); - tex->SetNDC(); - tex->Draw(); - - gPad->Print(p_name); -} - -void drawplot_eff_eta() -{ - - // gROOT->ProcessLine(".L effFunctions.C"); - - TCanvas* cEff = new TCanvas("cEff","cEff",700,450); - cEff->SetGridx(1); - cEff->SetGridy(1); - - TTree *gt = getTree(filesDir + "gem_csc_delta_pt40_pad4.root"); - - //ht = draw_geff(gt, "Eff. for a SimTrack to have an associated LCT;SimTrack |#eta|;Eff.", "h_odd", "(100,1.54,2.2)", "TMath::Abs(eta)", "", ok_lct1 || ok_lct2, "P", kRed); - //hh = draw_geff(gt, "Eff. for a SimTrack to have an associated LCT;SimTrack |#eta|;Eff.", "h_odd", "(100,1.54,2.2)", "TMath::Abs(eta)", "", ok_sh1 || ok_sh2, "P same", kViolet); - h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh1, ok_lct1, "P", kRed); - h2 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh2, ok_lct2, "P same"); - eff_base->GetYaxis()->SetRangeUser(0.6,1.05); - TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC"); - leg->SetBorderSize(0); - leg->SetFillStyle(0); - leg->AddEntry(h1, "odd chambers","l"); - leg->AddEntry(h2, "even chambers","l"); - leg->Draw(); - TLatex * tex = new TLatex(0.17, 0.16,"No Pile-Up"); - tex->SetNDC(); - tex->Draw(); - cEff->Print(plotDir + "lct_eff_for_Trk_vsTrkEta_pt40" + ext); - - - h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT and GEM Pad;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh1, ok_lct1 && ok_pad1, "P", kRed); - h2 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT and GEM Pad;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh2, ok_lct2 && ok_pad2, "P same"); - eff_base->GetYaxis()->SetRangeUser(0.6,1.05); - TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC"); - leg->SetBorderSize(0); - leg->SetFillStyle(0); - leg->AddEntry(h1, "odd chambers","l"); - leg->AddEntry(h2, "even chambers","l"); - leg->Draw(); - TLatex * tex = new TLatex(0.17, 0.16,"No Pile-Up"); - tex->SetNDC(); - tex->Draw(); - cEff->Print(plotDir + "gem_pad_and_lct_eff_for_Trk_vsTrkEta_pt40" + ext); - - return; - - h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated GEM Pad;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", "", ok_pad1 || ok_pad2, "P", kViolet); - eff_base->GetYaxis()->SetRangeUser(0.6,1.05); - TLatex * tex = new TLatex(0.17, 0.16,"No Pile-Up"); - tex->SetNDC(); - tex->Draw(); - cEff->Print(plotDir + "gem_pad0_eff_for_Trk_vsTrkEta_pt40" + ext); - - - - - TTree *gt15 = getTree(filesDir + "gem_csc_delta_pt15_pad4.root"); - h1 = draw_geff(gt15, "Eff. for a SimTrack to have an associated LCT;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_lct1 || ok_lct2, "P", kViolet+2); - cEff->Print(plotDir + "lct_eff_for_Trk_vsTrkEta_pt15" + ext); - - - ho = draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_lct_odd)", ok_lct1, ok_pad1, "P", kRed); - he = draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta_lct_even)", ok_lct2, ok_pad2, "P same"); - TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC"); - leg->SetBorderSize(0); - leg->SetFillStyle(0); - leg->AddEntry(he, "\"Close\" chambers","l"); - leg->AddEntry(ho, "\"Far\" chambers","l"); - leg->Draw(); - cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsLCTEta_pt40" + ext); - - draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1, ok_pad1, "P", kRed); - draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2, ok_pad2, "P same"); - leg->Draw(); - cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsTrkEta_pt40" + ext); - - draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_lct_odd)", ok_lct1, ok_pad1_overlap, "P", kRed); - draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta_lct_even)", ok_lct2, ok_pad2_overlap, "P same"); - leg->Draw(); - cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsLCTEta_pt40_overlap" + ext); - - draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1, ok_pad1_overlap, "P", kRed); - draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2, ok_pad2_overlap, "P same"); - leg->Draw(); - cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsTrkEta_pt40_overlap" + ext); - - //draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;z SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1 && Ep, ok_pad1_overlap, "P", kRed); - //draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;z SimTrack |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2 && Ep, ok_pad2_overlap, "P same"); - //draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;z SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_gemsh_odd)", ok_gsh1, ok_gdg1, "P", kRed); - h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_pad1 || ok_pad2, "P", kViolet); - h2 = draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_2pad1 || ok_2pad2, "P same", kViolet-6); - TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC"); - leg->SetBorderSize(0); - leg->SetFillStyle(0); - leg->AddEntry(h1, "at least one pad","l"); - leg->AddEntry(he, "two pads in two GEMs","l"); - leg->Draw(); - cEff->Print(plotDir + "gem_pad_eff_for_Trk_vsTrkEta_pt40" + ext); - - return; - draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_gsh1 || ok_gsh2, "P", kViolet); - draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_g2sh1 || ok_g2sh2 , "P", kOrange); - draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_copad1 || ok_copad2 , "P same", kRed); - - -} - -void drawplot_eff() -{ - gROOT->ProcessLine(".L effFunctions.C"); - gROOT->ProcessLine(".L tdrstyle.C"); - //setTDRStyle(); - - gStyle->SetTitleStyle(0); - gStyle->SetTitleAlign(13);// coord in top left - gStyle->SetTitleX(0.); - gStyle->SetTitleY(1.); - gStyle->SetTitleW(1); - gStyle->SetTitleH(0.058); - gStyle->SetTitleBorderSize(0); - - TCanvas* cEff = new TCanvas("cEff","cEff",700,500); - - // efficiency_1(filesDir + "gem_csc_delta_pt5_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt05" + ext, "5", false); - // efficiency_1(filesDir + "gem_csc_delta_pt10_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt10" + ext, "10", false); - // efficiency_1(filesDir + "gem_csc_delta_pt15_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt15" + ext, "15", false); - // efficiency_1(filesDir + "gem_csc_delta_pt20_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt20" + ext, "20", false); - // efficiency_1(filesDir + "gem_csc_delta_pt30_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt30" + ext, "30", false); - // efficiency_1(filesDir + "gem_csc_delta_pt40_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt40" + ext, "40", false); - - // efficiency_1(filesDir + "gem_csc_delta_pt5_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt05_overlap" + ext, "5", true); - // efficiency_1(filesDir + "gem_csc_delta_pt10_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt10_overlap" + ext, "10", true); - // efficiency_1(filesDir + "gem_csc_delta_pt15_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt15_overlap" + ext, "15", true); - // efficiency_1(filesDir + "gem_csc_delta_pt20_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt20_overlap" + ext, "20", true); - // efficiency_1(filesDir + "gem_csc_delta_pt30_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt30_overlap" + ext, "30", true); - // efficiency_1(filesDir + "gem_csc_delta_pt40_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_HS_pt40_overlap" + ext, "40", true); - - // efficiency_2(filesDir + "gem_csc_delta_pt5_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt05" + ext, "5", false); - // efficiency_2(filesDir + "gem_csc_delta_pt10_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt10" + ext, "10", false); - // efficiency_2(filesDir + "gem_csc_delta_pt15_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt15" + ext, "15", false); - // efficiency_2(filesDir + "gem_csc_delta_pt20_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt20" + ext, "20", false); - // efficiency_2(filesDir + "gem_csc_delta_pt30_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt30" + ext, "30", false); - // efficiency_2(filesDir + "gem_csc_delta_pt40_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt40" + ext, "40", false); - - // efficiency_2(filesDir + "gem_csc_delta_pt5_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt05_overlap" + ext, "5", true); - // efficiency_2(filesDir + "gem_csc_delta_pt10_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt10_overlap" + ext, "10", true); - // efficiency_2(filesDir + "gem_csc_delta_pt15_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt15_overlap" + ext, "15", true); - - efficiency_2(filesDir + "gem_csc_delta_pt20_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt20_overlap" + ext, "20", true); - - - // efficiency_2(filesDir + "gem_csc_delta_pt30_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt30_overlap" + ext, "30", true); - // efficiency_2(filesDir + "gem_csc_delta_pt40_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt40_overlap" + ext, "40", true); - - // drawplot_eff_eta(); -} - - -/* - TTree *gt = getTree("gem_csc_delta_pt40_pad4.root"); - - - draw_eff(gt, "Eff. ;p_{T}, GeV/c;Eff.", "hname", "(45,0.5,45.5)", "pt", ok_sh1 && ok_eta , ok_digi1) - draw_eff(gt, "Eff. ;p_{T}, GeV/c;Eff.", "hname", "(45,0.5,45.5)", "pt", ok_digi1 && ok_eta , ok_lct1) - draw_eff(gt, "Eff. ;p_{T}, GeV/c;Eff.", "hname", "(50,0.,50.)", "pt", ok_sh1 && ok_eta , ok_lct1) - - - draw_eff(gt, "Eff. of |CLCT pattern bend| selection for matched LCTs;p_{T}, GeV/c;Eff.", "hname2", "(50,0.,50.)", "pt", (ok_lct1||ok_lct2) && ok_eta, "TMath::Abs(bend_lct_odd)<2 || TMath::Abs(bend_lct_even)<2") - draw_eff(gt, "Eff. of |CLCT pattern bend| selection for matched LCTs;p_{T}, GeV/c;Eff.", "hname1", "(50,0.,50.)", "pt", (ok_lct1||ok_lct2) && ok_eta, "TMath::Abs(bend_lct_odd)<1 || TMath::Abs(bend_lct_even)<1","same",kBlack) - draw_eff(gt, "Eff. of |CLCT bend|<3 selection for matched LCTs;p_{T}, GeV/c;Eff.", "hname3", "(50,0.,50.)", "pt", (ok_lct1||ok_lct2) && ok_eta, "TMath::Abs(bend_lct_odd)<3 || TMath::Abs(bend_lct_even)<3","same",kGreen+2) - draw_eff(gt, "Eff. of |CLCT bend|<4 selection for matched LCTs;p_{T}, GeV/c;Eff.", "hname4", "(50,0.,50.)", "pt", (ok_lct1||ok_lct2) && ok_eta, "TMath::Abs(bend_lct_odd)<4 || TMath::Abs(bend_lct_even)<4","same",kRed) - - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;|#eta|;Eff.", "hname", "(90,1.5,2.2)", "TMath::Abs(eta)", ok_lct2, ok_pad2 ) - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;|#eta|;Eff.", "hname", "(90,1.5,2.2)", "TMath::Abs(eta)", ok_lct1, ok_pad1, "same" ) - - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;|#phi|;Eff.", "hname", "(128,0,3.2)", "TMath::Abs(phi)", ok_lct2 && ok_eta && ok_pt , ok_pad2 ) - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;|#phi|;Eff.", "hname", "(128,0,3.2)", "TMath::Abs(phi)", ok_lct1 && ok_eta && ok_pt , ok_pad1, "same" ) - - - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;p_{T}, GeV/c;Eff.", "h_odd", "(50,0.,50.)", "pt", ok_lct1 && ok_eta , ok_pad1) - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;p_{T}, GeV/c;Eff.", "h_evn", "(50,0.,50.)", "pt", ok_lct2 && ok_eta , ok_pad2, "same") - - - - - // efficiency vs half-strip - separate odd-even - TCut ok_eta = "TMath::Abs(eta)>1.64 && TMath::Abs(eta)<1.9" - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(130,0.5,130.5)", "hs_lct_odd", ok_lct1 && ok_eta , ok_pad1, "", kRed) - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_evn", "(130,0.5,130.5)", "hs_lct_even", ok_lct2 && ok_eta , ok_pad2, "same") - - // efficiency vs half-strip - including overlaps in odd&even - TCut ok_eta = "TMath::Abs(eta)>1.64 && TMath::Abs(eta)<1.9" - TCut ok_pad1_overlap = ok_pad1 || (ok_lct2 && ok_pad2); - TCut ok_pad2_overlap = ok_pad2 || (ok_lct1 && ok_pad1); - TTree *t = getTree("gem_csc_delta_pt20_pad4.root"); - - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_odd", "(130,0.5,130.5)", "hs_lct_odd", ok_lct1 && ok_eta , ok_pad1_overlap, "", kRed) - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT half-strip;Eff.", "h_evn", "(130,0.5,130.5)", "hs_lct_even", ok_lct2 && ok_eta , ok_pad2_overlap, "same") - - - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_lct_odd)", ok_lct1, ok_pad1, "", kRed) - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta_lct_even)", ok_lct2, ok_pad2, "same") - - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;trk |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1, ok_pad1, "", kRed) - draw_eff(gt, "Eff. for track with LCT to have GEM pad in chamber;trk |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2, ok_pad2, "same") - - - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_odd", "(50,0.,50.)", "pt", ok_lct1 && ok_eta , ok_pad1 && ok_dphi1) - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_env", "(50,0.,50.)", "pt", ok_lct2 && ok_eta , ok_pad2 && ok_dphi2, "same") - - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_odd", "(50,0.,50.)", "pt", ok_lct1 && ok_eta && ok_pad1, ok_dphi1) - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_evn", "(50,0.,50.)", "pt", ok_lct2 && ok_eta && ok_pad2, ok_dphi2, "same") - - - - - - // 98% pt10 - TCut ok_dphi1 = "TMath::Abs(dphi_pad_odd) < 0.01076" - TCut ok_dphi2 = "TMath::Abs(dphi_pad_even) < 0.004863" - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_odd_10", "(50,0.,50.)", "pt", ok_lct1 && ok_eta , ok_pad1 && ok_dphi1, "", kRed) - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_evn_10", "(50,0.,50.)", "pt", ok_lct2 && ok_eta , ok_pad2 && ok_dphi2, "same") - // 98% pt30 - TCut ok_dphi1 = "TMath::Abs(dphi_pad_odd) < 0.00571" - TCut ok_dphi2 = "TMath::Abs(dphi_pad_even) < 0.00306" - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_odd_20", "(50,0.,50.)", "pt", ok_lct1 && ok_eta , ok_pad1 && ok_dphi1, "same", kRed) - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_evn_20", "(50,0.,50.)", "pt", ok_lct2 && ok_eta , ok_pad2 && ok_dphi2, "same") - // 98% pt30 - TCut ok_dphi1 = "TMath::Abs(dphi_pad_odd) < 0.00426" - TCut ok_dphi2 = "TMath::Abs(dphi_pad_even) < 0.00256" - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_odd_30", "(50,0.,50.)", "pt", ok_lct1 && ok_eta , ok_pad1 && ok_dphi1, "same", kRed) - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_evn_30", "(50,0.,50.)", "pt", ok_lct2 && ok_eta , ok_pad2 && ok_dphi2, "same") - // 98% pt40 - TCut ok_dphi1 = "TMath::Abs(dphi_pad_odd) < 0.00351" - TCut ok_dphi2 = "TMath::Abs(dphi_pad_even) < 0.00231" - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_odd_40", "(50,0.,50.)", "pt", ok_lct1 && ok_eta , ok_pad1 && ok_dphi1, "same", kRed) - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "h_evn_40", "(50,0.,50.)", "pt", ok_lct2 && ok_eta , ok_pad2 && ok_dphi2, "same") - - - |#Delta#phi_{odd}(LCT,Pad)| < 5.5 mrad - |#Delta#phi_{even}(LCT,Pad)| < 3.1 mrad - |#Delta#eta(LCT,Pad)| < 0.08 - - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "hname", "(45,0.5,45.5)", "pt", ok_sh1 && ok_eta , ok_lct1 && ok_pad1 && ok_dphi1) - draw_eff(gt, "Eff. for track with LCT to have matched GEM pad;p_{T}, GeV/c;Eff.", "hname", "(45,0.5,45.5)", "pt", ok_sh2 && ok_eta , ok_lct2 && ok_pad2 && ok_dphi2, "same") - - - - - draw_eff(gt, "title;pt;Eff.", "hname", "(45,0.5,45.5)", "pt", ok_lct1 && ok_eta , ok_pad1 && ok_dphi1) - - draw_eff(gt, "title;pt;Eff.", "hname", "(45,0.5,45.5)", "pt", ok_lct2 && ok_eta , ok_pad2 && ok_dphi2, "same") - - - draw_eff(gt, "title;|#eta|;Eff.", "hname", "(45,1.5,2.2)", "TMath::Abs(eta)", ok_sh1 , ok_lct1 && ok_pad1 ) - - - draw_eff(gt, "title;|#phi|;Eff.", "hname", "(128,0,3.2)", "TMath::Abs(phi)", ok_sh2 , ok_lct2 && ok_pad2 ) - - - - - gt->Draw("TMath::Abs(eta)", ok_sh1, ""); - gt->Draw("TMath::Abs(eta)", ok_sh1 && ok_lct1, "same"); - gt->Draw("TMath::Abs(eta)", ok_sh1 && ok_lct1 && ok_pad1, "same"); - - gt->Draw("TMath::Abs(phi)", ok_sh1 && ok_lct1 && ok_pad1, ""); - gt->Draw("TMath::Abs(phi)", ok_sh1, ""); - gt->Draw("TMath::Abs(eta)", ok_sh1 && ok_lct1, "same"); - - gt->Draw("TMath::Abs(phi)", ok_sh1, ""); - gt->Draw("TMath::Abs(phi)", ok_sh1 && ok_lct1, "same"); - gt->Draw("TMath::Abs(phi)", ok_sh1 && ok_lct1 && ok_pad1, "same"); - - - gt->Draw("pt", ok_sh1, ""); - gt->Draw("pt", ok_sh1 && ok_lct1, "same"); - gt->Draw("pt", ok_sh1 && ok_lct1 && ok_pad1, "same"); - gt->Draw("pt", ok_sh1, ""); - gt->Draw("pt", ok_sh1 && ok_lct1 && ok_pad1, "same"); - - gt->Draw("pt>>h1", ok_sh1, ""); - dn=(TH1F*)h1->Clone("dn") - gt->Draw("pt>>h2", ok_sh1 && ok_lct1 && ok_pad1, "same"); - nm=(TH1F*)h2->Clone("nm") - - dn->Draw() - nm->Draw("same") - - nm->Divide(dn) - nm->Draw() - - gt->Draw("pt>>h2", ok_sh1 && ok_lct1, "same"); - nmlct=(TH1F*)h2->Clone("nmlct") - nmlct->Divide(dn) - - nm->Draw() - nmlct->Draw("same") -*/ diff --git a/SimMuL1/scripts/matchingEfficiency.py b/SimMuL1/scripts/matchingEfficiency.py index a30b88bbddf57..c129edce5cb8e 100644 --- a/SimMuL1/scripts/matchingEfficiency.py +++ b/SimMuL1/scripts/matchingEfficiency.py @@ -21,7 +21,7 @@ gStyle.SetOptStat(0) gStyle.SetTitleStyle(0) -gStyle.SetTitleAlign(13) ##// coord in top left +gStyle.SetTitleAlign(13) ## coord in top left gStyle.SetTitleX(0.) gStyle.SetTitleY(1.) gStyle.SetTitleW(1) @@ -63,107 +63,6 @@ def getDphi(eff,pt,evenOdd): return dphi_lct_pad["%s"%(eff)]["%s"%(pt)]["%s"%(evenOdd)] - -#_______________________________________________________________________________ -def gemTurnOn(filesDir, plotDir, eff, oddEven, ext): - """Produce plot with GEM high efficiency patterns""" - - pt = ["pt10","pt20","pt30","pt40"] - pt_labels = ["10","20","30","40"] -# pt_labels = ["10 GeV/c","20 GeV/c","30 GeV/c","40 GeV/c"] - dphis = [0.,0.,0.,0.] - - marker_colors = [kRed, kViolet+1, kAzure+2, kGreen-2] - marker_styles = [20,21,23,22] - - t = getTree("%sgem_csc_eff_pt2pt50_pad4.root"%(filesDir)); - - c = TCanvas("c","c",800,600) - c.SetGridx(1) - c.SetGridy(1) - c.cd() - h = TH1F(""," GEM-CSC bending Angle CMS Simulation Preliminary;Generated muon p_{T} [GeV/c];",50,0.,50.) - superscript = "p_{T}>p_{T}^{min}" - subscript = "0" -## h.GetYaxis().SetTitle(" |#Delta#phi_{{}^{(GEM,CSC)}}|<|#Delta#phi_{0}^{WP}| Cut Efficiency"); -## h.GetYaxis().SetTitle(" |#Delta#phi_{{}^{(GEM,CSC)}}|<|#Delta#phi_{%s}^{%s}| Cut Efficiency"%(subscript,superscript)); - h.GetYaxis().SetTitle(" |#Delta#phi_{{}^{(GEM,CSC)}}|<#Delta#phi_{%s} Cut Efficiency"%(subscript)); - h.GetYaxis().SetTitleOffset(.9) - h.SetStats(0) - - ## label sizes more leglible - h.GetXaxis().SetLabelSize(.05) - h.GetXaxis().SetLabelOffset(.005) - h.GetYaxis().SetLabelSize(.05) - h.GetYaxis().SetLabelOffset(.005) - - h.Draw("") - histoList = [] - for i in range(len(pt)): - dphi = getDphi("%s"%(eff),"%s"%(pt[i]),"%s"%(oddEven)) - dphis[i] = dphi - if oddEven=="even": - ok_dphi = TCut("TMath::Abs(dphi_pad_even) < %f"%(dphi)) - denom_cut = ok_pad2_lct2_eta - closeFar = "Close" - else: - ok_dphi = TCut("TMath::Abs(dphi_pad_odd) < %f"%(dphi)) - denom_cut = ok_pad1_lct1_eta - closeFar = "Far" - - h2 = draw_eff(t, "", "h2", "(50,0.,50.)", "pt", - denom_cut, ok_dphi, marker_colors[i], marker_styles[i]) - histoList.append(h2) - h2.SetMarkerSize(1) - h2.Draw("same") - - ## add legend - leg = TLegend(0.52,0.17,.93,0.57, "High efficiency patterns:", "brNDC") - for n in range(len(pt)): - superscript = "\"%s\""%(pt_labels[n]) - superscript = "p_{T}>%s"%(pt_labels[n]) - subscript = "0" - #leg.AddEntry(histoList[n], "#Delta#phi_{%s}^{%s} = %.1f mrad"%(subscript,superscript,dphis[n]*1000), "p") - leg.AddEntry(histoList[n], "#Delta#phi_{%s} = %.1f mrad"%(subscript,dphis[n]*1000), "p") - #leg.AddEntry(histoList[n], "WP = %s"%(pt_labels[n]), "p") - - - leg.SetBorderSize(0) - leg.SetMargin(0.1) - leg.SetFillStyle(0) - leg.SetFillStyle(1001) - leg.SetFillColor(kWhite) - leg.SetTextSize(0.05) - leg.Draw("same") - - ## Adding additional information - top right - """ - tex2 = TLatex(.75,.82,' L1 Trigger') - tex2.SetTextSize(0.05) - tex2.SetNDC() - tex2.Draw("same") - """ - - tex3 = TLatex(.735,.82,'1.64<|#eta|<2.14') - tex3.SetTextSize(0.05) - tex3.SetNDC() - tex3.Draw("same") - - ## hardcore nitpicking over here! - if closeFar == "Close": - xpos = 0.57 - else: - xpos = 0.611 - - tex = TLatex(xpos,.75,'"%s" chamber pairs'%(closeFar)) - tex.Draw("same") - tex.SetTextSize(0.05) - tex.SetNDC() - - ## save the file - c.SaveAs("%sGEM_turnon_%s_%s%s"%(plotDir, eff,oddEven,ext)) - - #_______________________________________________________________________________ def padMatchingEffVsGenMuonPhiForPosAndNegMuons( filesDir, plotDir, pt, doOverlaps, ext): @@ -184,7 +83,7 @@ def padMatchingEffVsGenMuonPhiForPosAndNegMuons( cut2 = ok_pad2 overlapStr = "" - t = getTree("%sgem_csc_delta_pt%d_pad4.root"%(filesDir,pt)); + t = getTree("%sgem_csc_delta_pt%d_pad4.root"%(filesDir,pt)) ## latest instructions by Vadim on 21-08-2013 ok_pad1_or_pad2 = TCut("%s || %s" %(ok_pad1.GetTitle(),ok_pad2.GetTitle())) @@ -194,7 +93,7 @@ def padMatchingEffVsGenMuonPhiForPosAndNegMuons( ## variables for the plot title = " " * 9 + "GEM pad matching" + " " * 16 + "CMS Simulation Preliminary" xTitle = "Generated muon #phi [deg]" - yTitle = "Efficiency" + yTitle = "Reconstruction efficiency" toPlot = "fmod(phi*180./TMath::Pi(), 360/18.)" h_bins = "(40,-10,10)" nBins = int(h_bins[1:-1].split(',')[0]) @@ -256,44 +155,45 @@ def padMatchingEffVsGenMuonPhiForPosAndNegMuons( tex.Draw() # gPad.Print("%sgem_pad_eff_for_LCT_vs_phi_pt20%s%s"%(plotDir,overlapStr,ext)) - c.Print("%sgem_pad_eff_for_LCT_vs_phi_pt20%s%s"%(plotDir,overlapStr,ext)) + c.Print("%sgem_pad_eff_for_LCT_vs_phi_pt%d%s%s"%(plotDir,pt,overlapStr,ext)) #_______________________________________________________________________________ -def efficiency_1(f_name, p_name, pt, overlap): +def padMatchingEffVsHalfStripForOddEven(filesDir, plotDir, pt, doOverlaps, ext): """efficiency vs half-strip - separate odd-even""" - """ - gStyle->SetTitleStyle(0); - gStyle->SetTitleAlign(13); // coord in top left - gStyle->SetTitleX(0.); - gStyle->SetTitleY(1.); - gStyle->SetTitleW(1); - gStyle->SetTitleH(0.058); - gStyle->SetTitleBorderSize(0); + gStyle.SetTitleStyle(0); + gStyle.SetTitleAlign(13); ##coord in top left + gStyle.SetTitleX(0.); + gStyle.SetTitleY(1.); + gStyle.SetTitleW(1); + gStyle.SetTitleH(0.058); + gStyle.SetTitleBorderSize(0); - gStyle->SetPadLeftMargin(0.126); - gStyle->SetPadRightMargin(0.04); - gStyle->SetPadTopMargin(0.06); - gStyle->SetPadBottomMargin(0.13); - gStyle->SetOptStat(0); - gStyle->SetMarkerStyle(1); + gStyle.SetPadLeftMargin(0.126); + gStyle.SetPadRightMargin(0.04); + gStyle.SetPadTopMargin(0.06); + gStyle.SetPadBottomMargin(0.13); + gStyle.SetOptStat(0); + gStyle.SetMarkerStyle(1); - ok_eta = "TMath::Abs(eta)>1.64 && TMath::Abs(eta)<2.12" - if (overlap): + ok_eta = TCut("TMath::Abs(eta)>1.64 && TMath::Abs(eta)<2.12") + if (doOverlaps): cut1 = ok_pad1_overlap cut2 = ok_pad2_overlap + overlapStr = "_overlap" else: - cut1 = ok_pad1 - cut2 = ok_pad2 - - t = getTree(f_name) - ho = draw_eff(t, " GEM reconstruction efficiency CMS Simulation Preliminary;LCT half-strip number;Efficiency", - "h_odd", "(130,0.5,130.5)", "hs_lct_odd", TCut("%s&&%s"(ok_lct1.GetTitle), ok_eta.GetTitle()), cut1, "", kRed) - he = draw_eff(t, " GEM reconstruction efficiency CMS Simulation Preliminary;LCT half-strip number;Efficiency", - "h_evn", "(130,0.5,130.5)", "hs_lct_even", TCut("%s&&%s"(ok_lct1.GetTitle), ok_eta.GetTitle()), cut2, "same") + cut1 = ok_pad1 + cut2 = ok_pad2 + overlapStr = "" + + t = getTree("%sgem_csc_delta_pt%d_pad4.root"%(filesDir,pt)) + ho = draw_geff(t, " GEM pad matching CMS Simulation Preliminary;LCT half-strip number;Efficiency", + "h_odd", "(130,0.5,130.5)", "hs_lct_odd", TCut("%s&&%s"%(ok_lct1.GetTitle(), ok_eta.GetTitle())), cut1, "", kRed) + he = draw_geff(t, " GEM pad matching CMS Simulation Preliminary;LCT half-strip number;Efficiency", + "h_evn", "(130,0.5,130.5)", "hs_lct_even", TCut("%s&&%s"%(ok_lct1.GetTitle(), ok_eta.GetTitle())), cut2, "same") ho.SetMinimum(0.) ho.GetXaxis().SetLabelSize(0.05) ho.GetYaxis().SetLabelSize(0.05) @@ -307,213 +207,142 @@ def efficiency_1(f_name, p_name, pt, overlap): leg.AddEntry(ho, "\"Far\" chamber pairs","l") leg.Draw(); - tex2 = TLatex(.67,.8," L1 Trigger") - tex2.SetTextSize(0.05) - tex2.SetNDC() - tex2.Draw() - tex = TLatex(.66,.73,"1.64<|#eta|<2.12") tex.SetTextSize(0.05) tex.SetNDC() tex.Draw() ## this has to be fixed - gPad.Print(p_name) - """ + c.Print("%sgem_pad_eff_for_LCT_vs_HS_pt%d%s%s"%(plotDir,pt,overlapStr,ext)) -""" -void efficiency_2(TString f_name, TString p_name, TString pt, bool overlap) -{ - // efficiency vs half-strip - including overlaps in odd&even - TCut ok_eta = "TMath::Abs(eta)>1.64 && TMath::Abs(eta)<2.12"; - TCut cut1; - TCut cut2; - if (overlap) - { - cut1 = ok_pad1_overlap; - cut2 = ok_pad2_overlap; - } - else - { - cut1 = ok_pad1; - cut2 = ok_pad2; - } - - TTree *t = getTree(f_name); - TH1F* ho = draw_eff(t, " GEM reconstruction efficiency CMS Simulation Preliminary;local #phi [deg];Efficiency", "h_odd", "(130,-5,5)", "fmod(180*phi/TMath::Pi(),5)", ok_lct1 && ok_eta , cut1, "", kRed); - TH1F* he = draw_eff(t, " GEM reconstruction efficiency CMS Simulation Preliminary;local #phi [deg];Efficiency", "h_evn", "(130,-5,5)", "fmod(180*phi/TMath::Pi(),5)", ok_lct2 && ok_eta , cut2, "same"); - ho->SetMinimum(0.); - ho->GetXaxis()->SetLabelSize(0.05); - ho->GetYaxis()->SetLabelSize(0.05); - - TLegend *leg = new TLegend(0.25,0.23,.75,0.5, NULL, "brNDC"); - leg->SetBorderSize(0); - leg->SetFillStyle(0); - leg->SetTextSize(0.06); - leg->AddEntry((TObject*)0,"muon p_{T} = " + pt + " GeV/c",""); - leg->AddEntry(he, "\"Close\" chamber pairs","l"); - leg->AddEntry(ho, "\"Far\" chamber pairs","l"); - leg->Draw(); - - // Print additional information - TLatex* tex2 = new TLatex(.67,.8," L1 Trigger"); - tex2->SetTextSize(0.05); - tex2->SetNDC(); - tex2->Draw(); +#_______________________________________________________________________________ +def padMatchingEffVsLctEtaForOddEven(filesDir, plotDir, pt, doOverlaps, ext): + """efficiency vs LCT eta - separate odd-even""" + + gStyle.SetTitleStyle(0); + gStyle.SetTitleAlign(13); ##coord in top left + gStyle.SetTitleX(0.); + gStyle.SetTitleY(1.); + gStyle.SetTitleW(1); + gStyle.SetTitleH(0.058); + gStyle.SetTitleBorderSize(0); - TLatex * tex = new TLatex(.66,.73,"1.64<|#eta|<2.12"); - tex->SetTextSize(0.05); - tex->SetNDC(); - tex->Draw(); - - gPad->Print(p_name); -} -""" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -def efficiency_1(f_name, p_name, overlap): - """Efficiency to match LCT to GEM pad vs half-strip for even and odd numbered chambers. Option to include chamber overlaps""" - - t = getTree(f_name) - if overlap: + gStyle.SetPadLeftMargin(0.126); + gStyle.SetPadRightMargin(0.04); + gStyle.SetPadTopMargin(0.06); + gStyle.SetPadBottomMargin(0.13); + gStyle.SetOptStat(0); + gStyle.SetMarkerStyle(1); + + ok_eta = TCut("TMath::Abs(eta)>1.64 && TMath::Abs(eta)<2.12") + if (doOverlaps): cut1 = ok_pad1_overlap cut2 = ok_pad2_overlap + overlapStr = "_overlap" else: cut1 = ok_pad1 cut2 = ok_pad2 + overlapStr = "" - ho = draw_eff(t, "Efficiency for track with LCT to have GEM pad in chamber;LCT half-strip;Efficiency", - "h_odd", "(130,0.5,130.5)", "hs_lct_odd", TCut("%s && %s" %(ok_lct1.GetTitle(),ok_eta.GetTitle())), cut1, kRed, 5) - he = draw_eff(t, "Efficiency for track with LCT to have GEM pad in chamber;LCT half-strip;Efficiency", - "h_evn", "(130,0.5,130.5)", "hs_lct_even", TCut("%s && %s" %(ok_lct2.GetTitle(),ok_eta.GetTitle())), cut2, kBlue, 5) - - c = TCanvas("c","c",700,500) - c.Clear() - c.SetGridx(1) - c.SetGridy(1) - h = TH1F("","Efficiency for track with LCT to have GEM pad in chamber",130,0.5,130.5) - h.SetTitle("Efficiency for track with LCT to have GEM pad in chamber") - h.GetXaxis().SetTitle("LCT half-strip") - h.GetYaxis().SetTitle("Efficiency") - h.SetStats(0) - h.Draw() - ho.Draw("same") - he.Draw("same") - - pt = f_name[f_name.find('pt'):] - pt = pt[2:] - pt = pt[:pt.find('_pad')] - leg = TLegend(0.40,0.2,.7,0.5,"","brNDC") + t = getTree("%sgem_csc_delta_pt%d_pad4.root"%(filesDir,pt)) + ho = draw_geff(t, " GEM pad matching CMS Simulation Preliminary;LCT |#eta|;Efficiency", + "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_lct_odd)", TCut("%s&&%s"%(ok_lct1.GetTitle(), ok_eta.GetTitle())), cut1, "", kRed) + he = draw_geff(t, " GEM pad matching CMS Simulation Preliminary;LCT |#eta|;Efficiency", + "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta_lct_even)", TCut("%s&&%s"%(ok_lct1.GetTitle(), ok_eta.GetTitle())), cut2, "same") + ho.SetMinimum(0.) + ho.GetXaxis().SetLabelSize(0.05) + ho.GetYaxis().SetLabelSize(0.05) + + leg = TLegend(0.25,0.23,.75,0.5, "", "brNDC"); leg.SetBorderSize(0) leg.SetFillStyle(0) - leg.SetTextSize(.05) - leg.AddEntry(0, "p_{T} = %s GeV/c"%(pt), "") - leg.AddEntry(0, "a pad spans 4 strips", "") - leg.AddEntry(ho,"odd chambers","l") - leg.AddEntry(he,"even chambers","l") - leg.Draw("same") - c.SaveAs(p_name) - -def drawplot_eff_eta(f_name, plotDir, ext = ".pdf"): - """Efficiency to match LCT to GEM pad vs LCT eta for even and odd numbered chambers. Option to include chamber overlaps""" + leg.SetTextSize(0.06) + leg.AddEntry(0,"muon p_{T} = %s GeV/c"%(pt),"") + leg.AddEntry(he, "\"Close\" chamber pairs","l") + leg.AddEntry(ho, "\"Far\" chamber pairs","l") + leg.Draw(); - c = TCanvas("c","c",700,500) - c.Clear() - c.SetGridx(1) - c.SetGridy(1) + tex = TLatex(.66,.73,"1.64<|#eta|<2.12") + tex.SetTextSize(0.05) + tex.SetNDC() + tex.Draw() + + ## this has to be fixed + c.Print("%sgem_pad_eff_for_LCT_vs_LCT_pt%d%s%s"%(plotDir,pt,overlapStr,ext)) - gt = getTree(f_name) - pt = f_name[f_name.find('pt'):] - pt = pt[2:] - pt = pt[:pt.find('_pad')] +#_______________________________________________________________________________ +def padMatchingEffVsSimTrackEtaForOddEven(filesDir, plotDir, pt, doOverlaps, ext): + """efficiency vs simtrack eta - separate odd-even""" + + gStyle.SetTitleStyle(0); + gStyle.SetTitleAlign(13); ##coord in top left + gStyle.SetTitleX(0.); + gStyle.SetTitleY(1.); + gStyle.SetTitleW(1); + gStyle.SetTitleH(0.058); + gStyle.SetTitleBorderSize(0); + + gStyle.SetPadLeftMargin(0.126); + gStyle.SetPadRightMargin(0.04); + gStyle.SetPadTopMargin(0.06); + gStyle.SetPadBottomMargin(0.13); + gStyle.SetOptStat(0); + gStyle.SetMarkerStyle(1); + + ok_eta = TCut("TMath::Abs(eta)>1.64 && TMath::Abs(eta)<2.12") + if (doOverlaps): + cut1 = ok_pad1_overlap + cut2 = ok_pad2_overlap + overlapStr = "_overlap" + else: + cut1 = ok_pad1 + cut2 = ok_pad2 + overlapStr = "" - ho = draw_eff(gt, "Efficiency for track with LCT to have GEM pad in chamber;LCT |#eta|;Efficiency", - "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_lct_odd)", ok_lct1, ok_pad1, kRed, 5) - he = draw_eff(gt, "Efficiency for track with LCT to have GEM pad in chamber;LCT |#eta|;Efficiency", - "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta_lct_even)", ok_lct2, ok_pad2, kBlue, 5) - h = TH1F("","Efficiency for track with LCT to have GEM pad in chamber",140,1.5,2.2) - h.SetTitle("Efficiency for track with LCT to have GEM pad in chamber") - h.GetXaxis().SetTitle("LCT |#eta|") - h.GetYaxis().SetTitle("Efficiency") - h.SetStats(0) - h.Draw() - ho.Draw("same") - he.Draw("same") - leg = TLegend(0.4,0.2,.7,0.5,"","brNDC") + t = getTree("%sgem_csc_delta_pt%d_pad4.root"%(filesDir,pt)) + ho = draw_geff(t, " GEM pad matching CMS Simulation Preliminary;SimTrack |#eta|;Efficiency", + "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", TCut("%s&&%s"%(ok_lct1.GetTitle(), ok_eta.GetTitle())), cut1, "", kRed) + he = draw_geff(t, " GEM pad matching CMS Simulation Preliminary;SimTrack |#eta|;Efficiency", + "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", TCut("%s&&%s"%(ok_lct1.GetTitle(), ok_eta.GetTitle())), cut2, "same") + ho.SetMinimum(0.) + ho.GetXaxis().SetLabelSize(0.05) + ho.GetYaxis().SetLabelSize(0.05) + + leg = TLegend(0.25,0.23,.75,0.5, "", "brNDC"); leg.SetBorderSize(0) leg.SetFillStyle(0) - leg.SetTextSize(.05) - leg.AddEntry(0, "p_{T} = %s GeV/c"%(pt), "") - leg.AddEntry(0, "a pad spans 4 strips", "") - leg.AddEntry(ho,"odd chambers","l") - leg.AddEntry(he,"even chambers","l") - leg.Draw() - c.SaveAs("%sgem_pad_eff_for_LCT_vsLCTEta_pt%s%s"%(plotDir,pt,ext)) + leg.SetTextSize(0.06) + leg.AddEntry(0,"muon p_{T} = %s GeV/c"%(pt),"") + leg.AddEntry(he, "\"Close\" chamber pairs","l") + leg.AddEntry(ho, "\"Far\" chamber pairs","l") + leg.Draw(); + + tex = TLatex(.66,.73,"1.64<|#eta|<2.12") + tex.SetTextSize(0.05) + tex.SetNDC() + tex.Draw() + + ## this has to be fixed + c.Print("%sgem_pad_eff_for_LCT_vs_TrkEta_pt%d%s%s"%(plotDir,pt,overlapStr,ext)) - draw_eff(gt, "Efficiency for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Efficiency", - "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1, ok_pad1, kRed, 5) - draw_eff(gt, "Efficiency for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Efficiency", - "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2, ok_pad2, kBlue, 5) - h = TH1F("","Efficiency for track with LCT to have GEM pad in chamber",140,1.5,2.2) - h.SetTitle("Efficiency for track with LCT to have GEM pad in chamber") - h.GetXaxis().SetTitle("SimTrack |#eta|") - h.GetYaxis().SetTitle("Efficiency") - h.SetStats(0) - h.Draw() - ho.Draw("same") - he.Draw("same") - leg = TLegend(0.40,0.2,.7,0.5,"","brNDC") - leg.SetBorderSize(0) - leg.SetFillStyle(0) - leg.SetTextSize(.05) - leg.AddEntry(0, "p_{T} = %s GeV/c"%(pt), "") - leg.AddEntry(0, "a pad spans 4 strips", "") - leg.AddEntry(ho,"odd chambers","l") - leg.AddEntry(he,"even chambers","l") - leg.Draw() - c.SaveAs("%sgem_pad_eff_for_LCT_vsTrkEta_pt%s%s"%(plotDir,pt,ext)) +def makePlots(ext): + input_dir = "files_09_10_2013" + output_dir = "plots_09_10_2013/track_matching_eff/" + + padMatchingEffVsGenMuonPhiForPosAndNegMuons(input_dir,output_dir, 20, True, ext) + padMatchingEffVsHalfStripForOddEven(input_dir,output_dir, 20, True, ext) + padMatchingEffVsLctEtaForOddEven(input_dir,output_dir, 20, True, ext) + padMatchingEffVsSimTrackEtaForOddEven(input_dir,output_dir, 20, True, ext) + +if __name__ == "__main__": + makePlots(".pdf") + makePlots(".png") + makePlots(".eps") + + + ### DO NOT REMOVE THE STUFF IN COMMENTS ### + ### WE MIGHT NEED IT LATER ON ### """ draw_eff(gt, "Efficiency for track with LCT to have GEM pad in chamber;z SimTrack |#eta|;Efficiency", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_gemsh_odd)", ok_gsh1, ok_gdg1, "P", kRed) @@ -566,40 +395,8 @@ def drawplot_eff_eta(f_name, plotDir, ext = ".pdf"): """ -def halfStripEfficiencies(filesDir, plotDir, ext): - """Plot the halfstrip efficiencies""" - - eff_halfStrip("%sgem_csc_delta_pt5_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt05%s"%(plotDir,ext)) - eff_halfStrip("%sgem_csc_delta_pt10_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt10%s"%(plotDir,ext)) - eff_halfStrip("%sgem_csc_delta_pt15_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt15%s"%(plotDir,ext)) - eff_halfStrip("%sgem_csc_delta_pt20_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt20%s"%(plotDir,ext)) - eff_halfStrip("%sgem_csc_delta_pt30_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt30%s"%(plotDir,ext)) - eff_halfStrip("%sgem_csc_delta_pt40_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt40%s"%(plotDir,ext)) - - eff_halfStrip_overlap("%sgem_csc_delta_pt5_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt05_overlap%s"%(plotDir,ext)) - eff_halfStrip_overlap("%sgem_csc_delta_pt10_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt10_overlap%s"%(plotDir,ext)) - eff_halfStrip_overlap("%sgem_csc_delta_pt15_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt15_overlap%s"%(plotDir,ext)) - eff_halfStrip_overlap("%sgem_csc_delta_pt20_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt20_overlap%s"%(plotDir,ext)) - eff_halfStrip_overlap("%sgem_csc_delta_pt30_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt30_overlap%s"%(plotDir,ext)) - eff_halfStrip_overlap("%sgem_csc_delta_pt40_pad4.root"%(filesDir), "%sgem_pad_eff_for_LCT_vs_HS_pt40_overlap%s"%(plotDir,ext)) - - -def etaMatchingEfficiencies(filesDir, plotDir, ext = ".pdf"): - """Plot the simtrack to LCT,Pad matching efficiency vs eta""" - - drawplot_eff_eta("%sgem_csc_delta_pt5_pad4.root"%(filesDir), plotDir, ext) - drawplot_eff_eta("%sgem_csc_delta_pt10_pad4.root"%(filesDir), plotDir, ext) - drawplot_eff_eta("%sgem_csc_delta_pt15_pad4.root"%(filesDir), plotDir, ext) - drawplot_eff_eta("%sgem_csc_delta_pt20_pad4.root"%(filesDir), plotDir, ext) - drawplot_eff_eta("%sgem_csc_delta_pt30_pad4.root"%(filesDir), plotDir, ext) - drawplot_eff_eta("%sgem_csc_delta_pt40_pad4.root"%(filesDir), plotDir, ext) - - - - - +""" def eff_hs_1(filesDir, plotDir, f_name, ext): - """Halfstrip matching efficiency dphi""" t = getTree("%s%s"%(filesDir, f_name)); # dphi = getDphi("%s"%(eff),"%s"%(pt[i]),"%s"%(oddEven)) @@ -619,7 +416,6 @@ def eff_hs_1(filesDir, plotDir, f_name, ext): def eff_hs_2(filesDir, plotDir, f_name, ext): - """Comment to be added here""" t = getTree("%s%s"%(filesDir, f_name)); c = TCanvas("c","c",800,600) @@ -636,7 +432,6 @@ def eff_hs_2(filesDir, plotDir, f_name, ext): c.SaveAs("%stest%s"%(plotDir, ext)) def eff_hs_3(filesDir, plotDir, f_name, ext): - """Comment to be added here""" t = getTree("%s%s"%(filesDir, f_name)); c = TCanvas("c","c",800,600) @@ -653,7 +448,6 @@ def eff_hs_3(filesDir, plotDir, f_name, ext): c.SaveAs("%stest%s"%(plotDir, ext)) def eff_hs_4(filesDir, plotDir, f_name, ext): - """Comment to be added here""" t = getTree("%s%s"%(filesDir, f_name)); c = TCanvas("c","c",800,600) @@ -671,7 +465,6 @@ def eff_hs_4(filesDir, plotDir, f_name, ext): def eff_hs_5(filesDir, plotDir, f_name, ext): - """Comment to be added here""" t = getTree("%s%s"%(filesDir, f_name)); c = TCanvas("c","c",800,600) @@ -689,7 +482,6 @@ def eff_hs_5(filesDir, plotDir, f_name, ext): def eff_hs_6(filesDir, plotDir, f_name, ext): - """Comment to be added here""" t = getTree("%s%s"%(filesDir, f_name)); c = TCanvas("c","c",800,600) @@ -706,7 +498,6 @@ def eff_hs_6(filesDir, plotDir, f_name, ext): c.SaveAs("%stest%s"%(plotDir, ext)) def eff_hs_7(filesDir, plotDir, f_name, ext): - """Comment to be added here""" t = getTree("%s%s"%(filesDir, f_name)); c = TCanvas("c","c",800,600) @@ -724,7 +515,6 @@ def eff_hs_7(filesDir, plotDir, f_name, ext): def eff_hs_8(filesDir, plotDir, f_name, ext): - """Comment to be added here""" t = getTree("%s%s"%(filesDir, f_name)); c = TCanvas("c","c",800,600) @@ -741,7 +531,6 @@ def eff_hs_8(filesDir, plotDir, f_name, ext): c.SaveAs("%stest%s"%(plotDir, ext)) def eff_hs_9(filesDir, plotDir, f_name, ext): - """Comment to be added here""" t = getTree("%s%s"%(filesDir, f_name)); c = TCanvas("c","c",800,600) @@ -761,7 +550,6 @@ def eff_hs_9(filesDir, plotDir, f_name, ext): def eff_hs_10(filesDir, plotDir, f_name, ext): - """Comment to be added here""" t = getTree("%s%s"%(filesDir, f_name)); c = TCanvas("c","c",800,600) @@ -776,6 +564,7 @@ def eff_hs_10(filesDir, plotDir, f_name, ext): he = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;p_{T} [GeV/c];Eff.", "h_odd", "(50,0.,50.)", "pt", ok_lct1_eta, ok_pad1, kRed) ho = draw_eff(t, "Eff. for track with LCT to have GEM pad in chamber;p_{T} [GeV/c];Eff.", "h_evn", "(50,0.,50.)", "pt", ok_lct2_eta, ok_pad2) c.SaveAs("%stest%s"%(plotDir, ext)) +""" """ def eff_hs_11(filesDir, plotDir, f_name, ext): @@ -797,40 +586,6 @@ def eff_hs_11(filesDir, plotDir, f_name, ext): c.SaveAs("%stest%s"%(plotDir, ext)) """ - -def eff_hs_all(filesDir, plotDir, f_name, ext): - - eff_hs_1(filesDir, plotDir, f_name, ext) - eff_hs_2(filesDir, plotDir, f_name, ext) - eff_hs_3(filesDir, plotDir, f_name, ext) - eff_hs_4(filesDir, plotDir, f_name, ext) - eff_hs_5(filesDir, plotDir, f_name, ext) - eff_hs_6(filesDir, plotDir, f_name, ext) - eff_hs_7(filesDir, plotDir, f_name, ext) - eff_hs_8(filesDir, plotDir, f_name, ext) - eff_hs_9(filesDir, plotDir, f_name, ext) - """ - eff_hs_10(filesDir, plotDir, f_name, ext) - eff_hs_11(filesDir, plotDir, f_name, ext) - """ - -def eff_hs(filesDir, plotDir, ext): - - eff_hs_all(filesDir, plotDir, "gem_csc_delta_pt5_pad4.root", ext) - eff_hs_all(filesDir, plotDir, "gem_csc_delta_pt10_pad4.root", ext) - eff_hs_all(filesDir, plotDir, "gem_csc_delta_pt15_pad4.root", ext) - eff_hs_all(filesDir, plotDir, "gem_csc_delta_pt20_pad4.root", ext) - eff_hs_all(filesDir, plotDir, "gem_csc_delta_pt30_pad4.root", ext) - eff_hs_all(filesDir, plotDir, "gem_csc_delta_pt40_pad4.root", ext) - - - - - - - - - ## gt = getTree("gem_csc_delta_pt40_pad4.root"); @@ -954,37 +709,5 @@ def eff_hs(filesDir, plotDir, ext): ## nm.Draw() ## nmlct.Draw("same") -if __name__ == "__main__": - """ - We don't always need all plots, hence lots of comments. - """ - - """ - halfStripEfficiencies("files/", "plots/efficiency/", ".pdf") - halfStripEfficiencies("files/", "plots/efficiency/", ".eps") - halfStripEfficiencies("files/", "plots/efficiency/", ".png") - - etaMatchingEfficiencies("files/", "plots/efficiency/", ".pdf") - etaMatchingEfficiencies("files/", "plots/efficiency/", ".eps") - etaMatchingEfficiencies("files/", "plots/efficiency/", ".png") - """ - - """ - gemTurnOn("files/", "plots/efficiency/", "98", "even", ".pdf") - gemTurnOn("files/", "plots/efficiency/", "98", "odd", ".pdf") - gemTurnOn("files/", "plots/efficiency/", "98", "even", ".png") - gemTurnOn("files/", "plots/efficiency/", "98", "odd", ".png") - gemTurnOn("files/", "plots/efficiency/", "98", "even", ".eps") - gemTurnOn("files/", "plots/efficiency/", "98", "odd", ".eps") - """ - -# efficiency_2(filesDir + "gem_csc_delta_pt20_pad4.root", plotDir + "gem_pad_eff_for_LCT_vs_phi_pt20_overlap" + ext, "20", true); - - padMatchingEffVsGenMuonPhiForPosAndNegMuons( - "files/","plots/tempDir/", 20, True, '.pdf') - padMatchingEffVsGenMuonPhiForPosAndNegMuons( - "files/","plots/tempDir/", 20, True, '.eps') - padMatchingEffVsGenMuonPhiForPosAndNegMuons( - "files/","plots/tempDir/", 20, True, '.png')