Пример #1
0
void ProduceMuonEfficiencyPlots(const string inputfile, int wp = 0,  int option = -1, string label = "") {

  string Label = "";
  if (label != "") Label = "_" + label;

  //--------------------------------------------------------------------------------------------------------------
  // Settings 
  //============================================================================================================== 
  bool printdebug = false;


  //*****************************************************************************************
  //Make some histograms
  //*****************************************************************************************
  TH1F *histDenominatorPt = new TH1F ("histDenominatorPt",";Muon p_{T} [GeV/c^{2}]; Number of Events", 50, 0 , 100);
  TH1F *histNumeratorPt = new TH1F ("histNumeratorPt",";Muon p_{T} [GeV/c^{2}]; Number of Events", 50, 0 , 100);
  TH1F *histDenominatorEta = new TH1F ("histDenominatorEta",";Muon Eta; Number of Events", 50, -2.5 , 2.5);
  TH1F *histNumeratorEta = new TH1F ("histNumeratorEta",";Muon Eta; Number of Events", 50, -2.5 , 2.5);
  TH1F *histDenominatorPhi = new TH1F ("histDenominatorPhi",";Muon Phi; Number of Events", 50, 0 , 3.2);
  TH1F *histNumeratorPhi = new TH1F ("histNumeratorPhi",";Muon Phi; Number of Events", 50, 0 , 3.2);
  TH1F *histDenominatorRho = new TH1F ("histDenominatorRho",";Muon Rho; Number of Events", 50, 0 , 100);
  TH1F *histNumeratorRho = new TH1F ("histNumeratorRho",";Muon Rho; Number of Events", 50, 0 , 100);
  TH1F *histDenominatorNpv = new TH1F ("histDenominatorNpv",";Muon Npv; Number of Events", 50, 0 , 100);
  TH1F *histNumeratorNpv = new TH1F ("histNumeratorNpv",";Muon Npv; Number of Events", 50, 0 , 100);
  TH1F *histDenominatorNpu = new TH1F ("histDenominatorNpu",";Muon Npu; Number of Events", 50, 0 , 100);
  TH1F *histNumeratorNpu = new TH1F ("histNumeratorNpu",";Muon Npu; Number of Events", 50, 0 , 100);

  TH2F *histDenominatorPtEta = new TH2F ("histDenominatorPtEta",";Photon p_{T} [GeV/c] ; Photon #eta; Number of Events", 50, 0 , 200, 50, -3.0, 3.0);
  TH2F *histNumeratorPtEta = new TH2F ("histNumeratorPtEta",";Photon p_{T} [GeV/c] ; Photon #eta; Number of Events", 50, 0 , 200, 50, -3.0, 3.0);

  //*******************************************************************************************
  //Read file
  //*******************************************************************************************                
  MuonTree *MuTree = new MuonTree;
  MuTree->LoadTree(inputfile.c_str());
  MuTree->InitTree(MuonTree::kMuTreeLight);

  cout << "Total Entries: " << MuTree->tree_->GetEntries() << "\n";
  int nentries = MuTree->tree_->GetEntries();
  for(UInt_t ientry=0; ientry < MuTree->tree_->GetEntries(); ientry++) {       	
    MuTree->tree_->GetEntry(ientry);

    if (ientry % 100000 == 0) cout << "Event " << ientry << endl;

    //Cuts
    if (MuTree->fMuGenPt < 5) continue;
    if (abs(MuTree->fMuGenEta) > 2.4) continue;

    if (!(MuTree->fMuPt > 5)) continue;

    //For Iso only efficiency require ID cuts   
    if (wp == 10 || wp == 11) {
      if (!(MuTree->fMuPt > 0 && MuTree->fMuIsLoose  && fabs(MuTree->fMuIP3dSig)<4)) continue;
    } 

    //For Trigger efficiency require tight selection
    if (wp >= 100 ){
      if (!(MuTree->fPassTightSelection)) continue;
    }

    if (option==0) {
      //**** PT - ETA ****
      histDenominatorPtEta->Fill(MuTree->fMuGenPt,MuTree->fMuGenEta);
      if(PassSelection(MuTree,wp)) {
	histNumeratorPtEta->Fill(MuTree->fMuGenPt,MuTree->fMuGenEta);
      }


      //**** PT ****
      histDenominatorPt->Fill(MuTree->fMuGenPt);

      //Numerator
      if(PassSelection(MuTree,wp)) {
        histNumeratorPt->Fill(MuTree->fMuGenPt);        
      }


      //**** Eta ****
      if (fabs(MuTree->fMuGenPt) > 30) {
	histDenominatorEta->Fill(MuTree->fMuGenEta);

	//Numerator
	if(PassSelection(MuTree,wp)) {
	  histNumeratorEta->Fill(MuTree->fMuGenEta);        
	}

      }

      //**** Phi ****
      if (fabs(MuTree->fMuGenEta) < 2.4) {
	histDenominatorPhi->Fill(MuTree->fMuGenPhi);

	//Numerator
	if(PassSelection(MuTree,wp)) {
	  histNumeratorPhi->Fill(MuTree->fMuGenPhi);        
	}

      }

      //**** Rho ****
      if (fabs(MuTree->fMuGenEta) < 2.4) {
	histDenominatorRho->Fill(MuTree->fRho);

	//Numerator
	if(PassSelection(MuTree,wp)) {
	  histNumeratorRho->Fill(MuTree->fRho);        
	}

      }
      //**** Npv ****
      if (fabs(MuTree->fMuGenEta) < 2.4) {
	histDenominatorNpv->Fill(MuTree->fNVertices);

	//Numerator
	if(PassSelection(MuTree,wp)) {
	  histNumeratorNpv->Fill(MuTree->fNVertices);        
	}

      }

      // //**** Npu ****
      // if (fabs(MuTree->fMuGenEta) < 2.4) {
      //   histDenominatorNpu->Fill(MuTree->);

      //   //Numerator
      //   if(PassSelection(MuTree,wp)) {
      //     histNumeratorNpu->Fill(MuTree->);        
      //   }

      // }
    }
    if (option==1) {
      //**** PT - ETA ****
      histDenominatorPtEta->Fill(MuTree->fMuPt,MuTree->fMuEta);
      if(PassSelection(MuTree,wp)) {
	histNumeratorPtEta->Fill(MuTree->fMuPt,MuTree->fMuEta);
      }


      //**** PT ****
      histDenominatorPt->Fill(MuTree->fMuPt);

      //Numerator
      if(PassSelection(MuTree,wp)) {
        histNumeratorPt->Fill(MuTree->fMuPt);        
      }


      //**** Eta ****
      if (fabs(MuTree->fMuPt) > 55) {
	histDenominatorEta->Fill(MuTree->fMuEta);

	//Numerator
	if(PassSelection(MuTree,wp)) {
	  histNumeratorEta->Fill(MuTree->fMuEta);        
	}

      }

      //**** Phi ****
      if (fabs(MuTree->fMuEta) < 2.4) {
	histDenominatorPhi->Fill(MuTree->fMuPhi);

	//Numerator
	if(PassSelection(MuTree,wp)) {
	  histNumeratorPhi->Fill(MuTree->fMuPhi);        
	}

      }

      //**** Rho ****
      if (fabs(MuTree->fMuEta) < 2.4) {
	histDenominatorRho->Fill(MuTree->fRho);

	//Numerator
	if(PassSelection(MuTree,wp)) {
	  histNumeratorRho->Fill(MuTree->fRho);        
	}

      }
      //**** Npv ****
      if (fabs(MuTree->fMuEta) < 2.4) {
	histDenominatorNpv->Fill(MuTree->fNVertices);

	//Numerator
	if(PassSelection(MuTree,wp)) {
	  histNumeratorNpv->Fill(MuTree->fNVertices);        
	}

      }

    
    }



  }


  //--------------------------------------------------------------------------------------------------------------
  // Make Efficiency Plots
  //==============================================================================================================

  TGraphAsymmErrors *efficiency_pt = createEfficiencyGraph(histNumeratorPt, histDenominatorPt, "Efficiency_Pt" , vector<double>() ,  -99, -99, 0, 1);
  TGraphAsymmErrors *efficiency_eta = createEfficiencyGraph(histNumeratorEta, histDenominatorEta, "Efficiency_Eta" , vector<double>() ,  -99, -99, 0, 1);
  TGraphAsymmErrors *efficiency_phi = createEfficiencyGraph(histNumeratorPhi, histDenominatorPhi, "Efficiency_Phi" , vector<double>() ,  -99, -99, 0, 1);
  TGraphAsymmErrors *efficiency_rho = createEfficiencyGraph(histNumeratorRho, histDenominatorRho, "Efficiency_Rho" , vector<double>() ,  -99, -99, 0, 1);
  TGraphAsymmErrors *efficiency_npv = createEfficiencyGraph(histNumeratorNpv, histDenominatorNpv, "Efficiency_Npv" , vector<double>() ,  -99, -99, 0, 1);
  TGraphAsymmErrors *efficiency_npu = createEfficiencyGraph(histNumeratorNpu, histDenominatorNpu, "Efficiency_Npu" , vector<double>() ,  -99, -99, 0, 1);  
  TH2F *efficiency_pteta = createEfficiencyHist2D(histNumeratorPtEta, histDenominatorPtEta, "Efficiency_PtEta" , vector<double>() ,vector<double>());  


  //--------------------------------------------------------------------------------------------------------------
  // Draw
  //==============================================================================================================
  TCanvas *cv =0;

  cv = new TCanvas("cv","cv",800,600);
  efficiency_pt->Draw("AP");
  efficiency_pt->SetTitle("");
  efficiency_pt->GetYaxis()->SetRangeUser(0.0,1.0);
  cv->SaveAs(("Efficiency"+Label+"_Pt.gif").c_str());

  cv = new TCanvas("cv","cv",800,600);
  efficiency_eta->Draw("AP");
  efficiency_eta->SetTitle("");
  efficiency_eta->GetYaxis()->SetRangeUser(0.0,1.0);
  cv->SaveAs(("Efficiency"+Label+"_Eta.gif").c_str());

  cv = new TCanvas("cv","cv",800,600);
  efficiency_phi->Draw("AP");
  efficiency_phi->SetTitle("");
  efficiency_phi->GetYaxis()->SetRangeUser(0.0,1.0);
  cv->SaveAs(("Efficiency"+Label+"_Phi.gif").c_str());

  cv = new TCanvas("cv","cv",800,600);
  efficiency_rho->Draw("AP");
  efficiency_rho->SetTitle("");
  efficiency_rho->GetYaxis()->SetRangeUser(0.0,1.0);
  cv->SaveAs(("Efficiency"+Label+"_Rho.gif").c_str());

  cv = new TCanvas("cv","cv",800,600);
  efficiency_npv->Draw("AP");
  efficiency_npv->SetTitle("");
  efficiency_npv->GetYaxis()->SetRangeUser(0.0,1.0);
  cv->SaveAs(("Efficiency"+Label+"_Npv.gif").c_str());

  cv = new TCanvas("cv","cv",800,600);
  efficiency_npu->Draw("AP");
  efficiency_npu->SetTitle("");
  efficiency_npu->GetYaxis()->SetRangeUser(0.0,1.0);
  cv->SaveAs(("Efficiency"+Label+"_Npu.gif").c_str());


  //--------------------------------------------------------------------------------------------------------------
  // Output
  //==============================================================================================================
  TFile *file = TFile::Open(("Efficiency"+Label+".root").c_str(), "UPDATE");
  file->cd();
  file->WriteTObject(efficiency_pt, "Efficiency_Pt", "WriteDelete");
  file->WriteTObject(efficiency_eta, "Efficiency_Eta", "WriteDelete");
  file->WriteTObject(efficiency_phi, "Efficiency_Phi", "WriteDelete");
  file->WriteTObject(efficiency_rho, "Efficiency_Rho", "WriteDelete");
  file->WriteTObject(efficiency_npv, "Efficiency_NPV", "WriteDelete");
  file->WriteTObject(efficiency_npu, "Efficiency_NPU", "WriteDelete");
  file->WriteTObject(efficiency_pteta, "Efficiency_PtEta", "WriteDelete");

  file->Close();
  delete file;       

}
void ProduceElectronEfficiencyPlots(const string inputfile, int wp, int option = -1, string label = "") {
 
  string Label = "";
  if (label != "") Label = "_" + label;

  //--------------------------------------------------------------------------------------------------------------
  // Settings 
  //============================================================================================================== 
  bool printdebug = false;


  //*****************************************************************************************
  //Make some histograms
  //*****************************************************************************************
  TH1F *histDenominatorPt = new TH1F ("histDenominatorPt",";Electron p_{T} [GeV/c^{2}]; Number of Events", 50, 0 , 100);
  TH1F *histNumeratorPt = new TH1F ("histNumeratorPt",";Electron p_{T} [GeV/c^{2}]; Number of Events", 50, 0 , 100);
  TH1F *histDenominatorEta = new TH1F ("histDenominatorEta",";Electron Eta; Number of Events", 50, -2.5 , 2.5);
  TH1F *histNumeratorEta = new TH1F ("histNumeratorEta",";Electron Eta; Number of Events", 50, -2.5 , 2.5);
  TH1F *histDenominatorPhi = new TH1F ("histDenominatorPhi",";Electron Phi; Number of Events", 50, 0 , 3.2);
  TH1F *histNumeratorPhi = new TH1F ("histNumeratorPhi",";Electron Phi; Number of Events", 50, 0 , 3.2);
  TH1F *histDenominatorRho = new TH1F ("histDenominatorRho",";Electron Rho; Number of Events", 50, 0 , 100);
  TH1F *histNumeratorRho = new TH1F ("histNumeratorRho",";Electron Rho; Number of Events", 50, 0 , 100);
  TH1F *histDenominatorNpv = new TH1F ("histDenominatorNpv",";Electron Npv; Number of Events", 50, 0 , 100);
  TH1F *histNumeratorNpv = new TH1F ("histNumeratorNpv",";Electron Npv; Number of Events", 50, 0 , 100);
  TH1F *histDenominatorNpu = new TH1F ("histDenominatorNpu",";Electron Npu; Number of Events", 50, 0 , 100);
  TH1F *histNumeratorNpu = new TH1F ("histNumeratorNpu",";Electron Npu; Number of Events", 50, 0 , 100);

  TH2F *histDenominatorPtEta = new TH2F ("histDenominatorPtEta",";Photon p_{T} [GeV/c] ; Photon #eta; Number of Events", 50, 0 , 200, 50, -3.0, 3.0);
  TH2F *histNumeratorPtEta = new TH2F ("histNumeratorPtEta",";Photon p_{T} [GeV/c] ; Photon #eta; Number of Events", 50, 0 , 200, 50, -3.0, 3.0);

  //*******************************************************************************************
  //Read file
  //*******************************************************************************************                
  ElectronTree *EleTree = new ElectronTree;
  EleTree->LoadTree(inputfile.c_str());
  EleTree->InitTree(ElectronTree::kEleTreeLight);

  cout << "Total Entries: " << EleTree->tree_->GetEntries() << "\n";
  int nentries = EleTree->tree_->GetEntries();
  for(UInt_t ientry=0; ientry < EleTree->tree_->GetEntries(); ientry++) {       	
    EleTree->tree_->GetEntry(ientry);

    if (ientry % 100000 == 0) cout << "Event " << ientry << endl;

    //Cuts
    if (EleTree->fEleGenPt < 5) continue;
    if (abs(EleTree->fEleGenEta) > 2.4) continue;

    //if (!(EleTree->fElePt > 5)) continue;
    //if (option == 1 && !passPreselection(EleTree)) continue;

    //for isolation efficiency, require that it passes ID first
    if (wp == 11) {
      if (!passIDMVANonTrigVeto(EleTree)) continue;
    }

    //for trigger require pass Tight
    if (wp >= 100) {
      if (!(EleTree->fPassTightSelection)) continue;
    }


    if (option == 0) {
      //**** PT - ETA ****
      histDenominatorPtEta->Fill(EleTree->fEleGenPt,EleTree->fEleGenEta);
      if(PassSelection(EleTree,wp)) {
	histNumeratorPtEta->Fill(EleTree->fEleGenPt,EleTree->fEleGenEta);
      }


      //**** PT ****
      histDenominatorPt->Fill(EleTree->fEleGenPt);

      //Numerator
      if(PassSelection(EleTree,wp)) {
        histNumeratorPt->Fill(EleTree->fEleGenPt);        
      }


      //**** Eta ****
      if (fabs(EleTree->fEleGenPt) > 30) {
	histDenominatorEta->Fill(EleTree->fEleGenEta);

	//Numerator
	if(PassSelection(EleTree,wp)) {
	  histNumeratorEta->Fill(EleTree->fEleGenEta);        
	}

      }

      //**** Phi ****
      if (fabs(EleTree->fEleGenEta) < 2.4) {
	histDenominatorPhi->Fill(EleTree->fEleGenPhi);

	//Numerator
	if(PassSelection(EleTree,wp)) {
	  histNumeratorPhi->Fill(EleTree->fEleGenPhi);        
	}

      }

      //**** Rho ****
      if (fabs(EleTree->fEleGenEta) < 2.4) {
	histDenominatorRho->Fill(EleTree->fRho);

	//Numerator
	if(PassSelection(EleTree,wp)) {
	  histNumeratorRho->Fill(EleTree->fRho);        
	}

      }
      //**** Npv ****
      if (fabs(EleTree->fEleGenEta) < 2.4) {
	histDenominatorNpv->Fill(EleTree->fNVertices);

	//Numerator
	if(PassSelection(EleTree,wp)) {
	  histNumeratorNpv->Fill(EleTree->fNVertices);        
	}

      }

      // //**** Npu ****
      // if (fabs(EleTree->fEleGenEta) < 2.4) {
      //   histDenominatorNpu->Fill(EleTree->);

      //   //Numerator
      //   if(PassSelection(EleTree,wp)) {
      //     histNumeratorNpu->Fill(EleTree->);        
      //   }

      // }
    }

    if (option == 1) {

      if (!(EleTree->fElePt > 0)) continue;

      //**** PT - ETA ****
      histDenominatorPtEta->Fill(EleTree->fElePt,EleTree->fEleEta);
      if(PassSelection(EleTree,wp)) {
	histNumeratorPtEta->Fill(EleTree->fElePt,EleTree->fEleEta);
      }


      //**** PT ****
      histDenominatorPt->Fill(EleTree->fElePt);

      //Numerator
      if(PassSelection(EleTree,wp)) {
        histNumeratorPt->Fill(EleTree->fElePt);        
      }


      //**** Eta ****
      if (fabs(EleTree->fElePt) > 30) {
	histDenominatorEta->Fill(EleTree->fEleEta);

	//Numerator
	if(PassSelection(EleTree,wp)) {
	  histNumeratorEta->Fill(EleTree->fEleEta);        
	}

      }

      //**** Phi ****
      if (fabs(EleTree->fEleEta) < 2.4) {
	histDenominatorPhi->Fill(EleTree->fElePhi);

	//Numerator
	if(PassSelection(EleTree,wp)) {
	  histNumeratorPhi->Fill(EleTree->fElePhi);        
	}

      }

      //**** Rho ****
      if (fabs(EleTree->fEleEta) < 2.4) {
	histDenominatorRho->Fill(EleTree->fRho);

	//Numerator
	if(PassSelection(EleTree,wp)) {
	  histNumeratorRho->Fill(EleTree->fRho);        
	}

      }
      //**** Npv ****
      if (fabs(EleTree->fEleEta) < 2.4) {
	histDenominatorNpv->Fill(EleTree->fNVertices);

	//Numerator
	if(PassSelection(EleTree,wp)) {
	  histNumeratorNpv->Fill(EleTree->fNVertices);        
	}

      }

      // //**** Npu ****
      // if (fabs(EleTree->fEleEta) < 2.4) {
      //   histDenominatorNpu->Fill(EleTree->);

      //   //Numerator
      //   if(PassSelection(EleTree,wp)) {
      //     histNumeratorNpu->Fill(EleTree->);        
      //   }

      // }
    }


  }


  //--------------------------------------------------------------------------------------------------------------
  // Make Efficiency Plots
  //==============================================================================================================

  TGraphAsymmErrors *efficiency_pt = createEfficiencyGraph(histNumeratorPt, histDenominatorPt, "Efficiency_Pt" , vector<double>() ,  -99, -99, 0, 1);
  TGraphAsymmErrors *efficiency_eta = createEfficiencyGraph(histNumeratorEta, histDenominatorEta, "Efficiency_Eta" , vector<double>() ,  -99, -99, 0, 1);
  TGraphAsymmErrors *efficiency_phi = createEfficiencyGraph(histNumeratorPhi, histDenominatorPhi, "Efficiency_Phi" , vector<double>() ,  -99, -99, 0, 1);
  TGraphAsymmErrors *efficiency_rho = createEfficiencyGraph(histNumeratorRho, histDenominatorRho, "Efficiency_Rho" , vector<double>() ,  -99, -99, 0, 1);
  TGraphAsymmErrors *efficiency_npv = createEfficiencyGraph(histNumeratorNpv, histDenominatorNpv, "Efficiency_Npv" , vector<double>() ,  -99, -99, 0, 1);
  TGraphAsymmErrors *efficiency_npu = createEfficiencyGraph(histNumeratorNpu, histDenominatorNpu, "Efficiency_Npu" , vector<double>() ,  -99, -99, 0, 1);  
  TH2F *efficiency_pteta = createEfficiencyHist2D(histNumeratorPtEta, histDenominatorPtEta, "Efficiency_PtEta" , vector<double>() ,vector<double>());  


  //--------------------------------------------------------------------------------------------------------------
  // Draw
  //==============================================================================================================
  TCanvas *cv =0;

  cv = new TCanvas("cv","cv",800,600);
  efficiency_pt->Draw("AP");
  efficiency_pt->SetTitle("");
  efficiency_pt->GetYaxis()->SetRangeUser(0.0,1.0);
  efficiency_pt->GetXaxis()->SetTitle("Electron p_{T} [GeV/c]");
  efficiency_pt->GetYaxis()->SetTitle("Efficiency");
  efficiency_pt->GetYaxis()->SetTitleOffset(1.2);
  efficiency_pt->SetLineWidth(3);  
  cv->SaveAs(("Efficiency"+Label+"_Pt.gif").c_str());

  cv = new TCanvas("cv","cv",800,600);
  efficiency_eta->Draw("AP");
  efficiency_eta->SetTitle("");
  efficiency_eta->GetYaxis()->SetRangeUser(0.0,1.0);
  efficiency_eta->GetXaxis()->SetTitle("Electron #eta");
  efficiency_eta->GetYaxis()->SetTitle("Efficiency");
  efficiency_eta->GetYaxis()->SetTitleOffset(1.2);
  efficiency_eta->SetLineWidth(3);  
  cv->SaveAs(("Efficiency"+Label+"_Eta.gif").c_str());

  cv = new TCanvas("cv","cv",800,600);
  efficiency_phi->Draw("AP");
  efficiency_phi->SetTitle("");
  efficiency_phi->GetYaxis()->SetRangeUser(0.0,1.0);
  efficiency_phi->GetXaxis()->SetTitle("Electron #phi");
  efficiency_phi->GetYaxis()->SetTitle("Efficiency");
  efficiency_phi->GetYaxis()->SetTitleOffset(1.2);
  cv->SaveAs(("Efficiency"+Label+"_Phi.gif").c_str());

  cv = new TCanvas("cv","cv",800,600);
  efficiency_rho->Draw("AP");
  efficiency_rho->SetTitle("");
  efficiency_rho->GetYaxis()->SetRangeUser(0.0,1.0);
  efficiency_rho->GetXaxis()->SetTitle("#rho");
  efficiency_rho->GetYaxis()->SetTitle("Efficiency");
  efficiency_rho->GetYaxis()->SetTitleOffset(1.2);
  cv->SaveAs(("Efficiency"+Label+"_Rho.gif").c_str());

  cv = new TCanvas("cv","cv",800,600);
  efficiency_npv->Draw("AP");
  efficiency_npv->SetTitle("");
  efficiency_npv->GetYaxis()->SetRangeUser(0.0,1.0);
  efficiency_npv->GetXaxis()->SetTitle("Number of Reconstructed Primary Vertices");
  efficiency_npv->GetYaxis()->SetTitle("Efficiency");
  efficiency_npv->GetYaxis()->SetTitleOffset(1.2);
  efficiency_npv->SetLineWidth(3);  
  efficiency_npv->GetXaxis()->SetRangeUser(0,40);
  cv->SaveAs(("Efficiency"+Label+"_Npv.gif").c_str());

  cv = new TCanvas("cv","cv",800,600);
  efficiency_npu->Draw("AP");
  efficiency_npu->SetTitle("");
  efficiency_npu->GetYaxis()->SetRangeUser(0.0,1.0);
  efficiency_npu->GetXaxis()->SetTitle("Number of Pileup Interactions");
  efficiency_npu->GetYaxis()->SetTitle("Efficiency");
  efficiency_npu->GetYaxis()->SetTitleOffset(1.2);
  cv->SaveAs(("Efficiency"+Label+"_Npu.gif").c_str());


  //--------------------------------------------------------------------------------------------------------------
  // Output
  //==============================================================================================================
  TFile *file = TFile::Open(("Efficiency"+Label+".root").c_str(), "UPDATE");
  file->cd();
  file->WriteTObject(efficiency_pt, "Efficiency_Pt", "WriteDelete");
  file->WriteTObject(efficiency_eta, "Efficiency_Eta", "WriteDelete");
  file->WriteTObject(efficiency_phi, "Efficiency_Phi", "WriteDelete");
  file->WriteTObject(efficiency_rho, "Efficiency_Rho", "WriteDelete");
  file->WriteTObject(efficiency_npv, "Efficiency_NPV", "WriteDelete");
  file->WriteTObject(efficiency_npu, "Efficiency_NPU", "WriteDelete");
  file->WriteTObject(efficiency_pteta, "Efficiency_PtEta", "WriteDelete");

  file->Close();
  delete file;       

}