// Author: Ben Tannenwald // Date: Feb 27, 2018 // Purpose: Macro to make trigger correlation/efficiency plots #include #include #include #include #include #include #include #include #include #include #include #include // #include "include/YggdrasilEventVars.h" #include "include/EventVars.h" #include "include/trigEffStudy.h" #include "include/histogramHandler.h" // Object Handlers #include "src/leptonHandler.C" #include "src/jetMetHandler.C" #include #include // std::setprecision #include #include #include #include // void printProgBar( const int percent ); void printProgBar( const int& percent ); void plot2Dcorr( TCanvas*& c0, TH2D*& h0, string xtitle, string ytitle); void trigEffStudy(string p_topDir="", string p_isMC="", string p_passFile="", string p_trigSF="", int era=0) { // *** 0. Set style, set file, set output directory // ** A. Set output directory and global bools topDir = "plots_19_6_2020_MC_2016_withSFs_9_1/"; if (p_topDir != "") topDir = p_topDir; isMC = true; isTrigSF = true; if (p_isMC != "") isMC = (p_isMC=="true" || p_isMC=="True") ? true : false; if (p_trigSF != "") isTrigSF = (p_trigSF=="true" || p_trigSF=="True") ? true : false; if(isTrigSF) cout<<"### p_trigSF=="<AddFile("/afs/cern.ch/user/m/mcostare/CMSSW_10_2_26/src/TopAnalysis/Configuration/analysis/tt-triggerEfficiency-DL/MC2016.root"); fChain->AddFile("/afs/cern.ch/user/m/mcostare/CMSSW_10_2_26/src/TopAnalysis/Configuration/analysis/tt-triggerEfficiency-DL/MC2016.root"); } else{ // data! fChain->AddFile("/afs/cern.ch/user/m/mcostare/CMSSW_10_2_26/src/TopAnalysis/Configuration/analysis/tt-triggerEfficiency-DL/Data2016.root"); } } else // pass name of analysis file --> this probably means Condor submission fChain->AddFile( p_passFile.c_str() ); } else{ // entire directory if (isMC) fileList=""; //fileList="input_file"; else // data! fileList=""; // check to make sure fileList if(gSystem->AccessPathName(fileList.c_str()) ) { cout<<"Input list file /"<Exit(0); } TFileCollection *fc= new TFileCollection("fc","files",fileList.c_str()); fChain->AddFileInfoList((TCollection*)fc->GetList()); } // ** C. Check subdirectory structure for requested options and create directories if necessary // * i. Check if topdir exists struct stat sb; if (!(stat(topDir.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode))){ cout << "top-level director, " << topDir << " , DNE. Creating now" << endl; mkdir(topDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH); } // * ii. Create corr2D subdir std::string sampleDir = ""; if(isMC) sampleDir = "/MC"; else sampleDir = "/data"; topDir = (topDir + sampleDir + "/").c_str(); if (!(stat(topDir.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode))){ cout << "sample subdirectory , " << topDir << " , DNE. Creating now" << endl; mkdir(topDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH); } // * iii. Set output file if(p_passFile == "") outfile = new TFile( (topDir + "/outfile.root").c_str(), "RECREATE"); else // add identifier so no overwrites outfile = new TFile( (topDir + "/outfile" + p_passFile.substr(p_passFile.find_last_of("_"), p_passFile.find(".root")) ).c_str(), "RECREATE"); // * iv. Create corr2D subdir std::string tempDir = (topDir + "corr2D" + "/").c_str(); if (!(stat(tempDir.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode))){ cout << "corr2D subdirectory , " << tempDir << " , DNE. Creating now" << endl; mkdir(tempDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH); } // ** D. CMS Style // setTDRStyle(); setTDRStyle_teliko(); writeExtraText = true; // if extra text //extraText = "Internal"; // default extra text is "Preliminary" lumi_sqrtS = "#sqrt{s} = 13 TeV"; // used with iPeriod = 0, e.g. for simulation-only plots (default is an empty string) int iPeriod = 0; // 1=7TeV, 2=8TeV, 3=7+8TeV, 7=7+8+13TeV, 0=free form (uses lumi_sqrtS) // *** 1. Define histograms and canvasses TCanvas *c0 = new TCanvas("c0", "c0", 50, 50, 800, 600); initializeHistograms(a_HLT_allMET, "HLT_allMET", true); initializeHistograms(a_HLT_DoubleMu_OR, "HLT_DoubleMu_OR"); initializeHistograms(a_HLT_DoubleEl_OR, "HLT_DoubleEl_OR"); initializeHistograms(a_HLT_EMu_OR, "HLT_EMu_OR"); initializeHistograms(a_DoubleMu_OR__X__allMET, "DoubleMu_OR__X__allMET"); initializeHistograms(a_DoubleEl_OR__X__allMET, "DoubleEl_OR__X__allMET"); initializeHistograms(a_EMu_OR__X__allMET, "EMu_OR__X__allMET"); initializeHistograms(a_HLT_DoubleMu_OR_NJETSHIGH, "HLT_DoubleMu_OR_NJETSHIGH"); initializeHistograms(a_HLT_DoubleEl_OR_NJETSHIGH, "HLT_DoubleEl_OR_NJETSHIGH"); initializeHistograms(a_HLT_EMu_OR_NJETSHIGH, "HLT_EMu_OR_NJETSHIGH"); initializeHistograms(a_DoubleMu_OR__X__allMET_NJETSHIGH, "DoubleMu_OR__X__allMET_NJETSHIGH"); initializeHistograms(a_DoubleEl_OR__X__allMET_NJETSHIGH, "DoubleEl_OR__X__allMET_NJETSHIGH"); initializeHistograms(a_EMu_OR__X__allMET_NJETSHIGH, "EMu_OR__X__allMET_NJETSHIGH"); initializeHistograms(a_HLT_DoubleMu_OR_NJETSLOW, "HLT_DoubleMu_OR_NJETSLOW"); initializeHistograms(a_HLT_DoubleEl_OR_NJETSLOW, "HLT_DoubleEl_OR_NJETSLOW"); initializeHistograms(a_HLT_EMu_OR_NJETSLOW, "HLT_EMu_OR_NJETSLOW"); initializeHistograms(a_DoubleMu_OR__X__allMET_NJETSLOW, "DoubleMu_OR__X__allMET_NJETSLOW"); initializeHistograms(a_DoubleEl_OR__X__allMET_NJETSLOW, "DoubleEl_OR__X__allMET_NJETSLOW"); initializeHistograms(a_EMu_OR__X__allMET_NJETSLOW, "EMu_OR__X__allMET_NJETSLOW"); initializeHistograms(a_HLT_DoubleMu_OR_NPVHIGH, "HLT_DoubleMu_OR_NPVHIGH"); initializeHistograms(a_HLT_DoubleEl_OR_NPVHIGH, "HLT_DoubleEl_OR_NPVHIGH"); initializeHistograms(a_HLT_EMu_OR_NPVHIGH, "HLT_EMu_OR_NPVHIGH"); initializeHistograms(a_DoubleMu_OR__X__allMET_NPVHIGH, "DoubleMu_OR__X__allMET_NPVHIGH"); initializeHistograms(a_DoubleEl_OR__X__allMET_NPVHIGH, "DoubleEl_OR__X__allMET_NPVHIGH"); initializeHistograms(a_EMu_OR__X__allMET_NPVHIGH, "ESetBranchAddressMu_OR__X__allMET_NPVHIGH"); initializeHistograms(a_HLT_DoubleMu_OR_NPVLOW, "HLT_DoubleMu_OR_NPVLOW"); initializeHistograms(a_HLT_DoubleEl_OR_NPVLOW, "HLT_DoubleEl_OR_NPVLOW"); initializeHistograms(a_HLT_EMu_OR_NPVLOW, "HLT_EMu_OR_NPVLOW"); initializeHistograms(a_DoubleMu_OR__X__allMET_NPVLOW, "DoubleMu_OR__X__allMET_NPVLOW"); initializeHistograms(a_DoubleEl_OR__X__allMET_NPVLOW, "DoubleEl_OR__X__allMET_NPVLOW"); initializeHistograms(a_EMu_OR__X__allMET_NPVLOW, "EMu_OR__X__allMET_NPVLOW"); initializeHistograms(a_HLT_DoubleMu_OR_METHIGH, "HLT_DoubleMu_OR_METHIGH"); initializeHistograms(a_HLT_DoubleEl_OR_METHIGH, "HLT_DoubleEl_OR_METHIGH"); initializeHistograms(a_HLT_EMu_OR_METHIGH, "HLT_EMu_OR_METHIGH"); initializeHistograms(a_DoubleMu_OR__X__allMET_METHIGH, "DoubleMu_OR__X__allMET_METHIGH"); initializeHistograms(a_DoubleEl_OR__X__allMET_METHIGH, "DoubleEl_OR__X__allMET_METHIGH"); initializeHistograms(a_EMu_OR__X__allMET_METHIGH, "EMu_OR__X__allMET_METHIGH"); initializeHistograms(a_HLT_DoubleMu_OR_METLOW, "HLT_DoubleMu_OR_METLOW"); initializeHistograms(a_HLT_DoubleEl_OR_METLOW, "HLT_DoubleEl_OR_METLOW"); initializeHistograms(a_HLT_EMu_OR_METLOW, "HLT_EMu_OR_METLOW"); initializeHistograms(a_DoubleMu_OR__X__allMET_METLOW, "DoubleMu_OR__X__allMET_METLOW"); initializeHistograms(a_DoubleEl_OR__X__allMET_METLOW, "DoubleEl_OR__X__allMET_METLOW"); initializeHistograms(a_EMu_OR__X__allMET_METLOW, "EMu_OR__X__allMET_METLOW"); // *** 2. Set tree structure and variables to read eve=0; fChain->SetBranchAddress("selection", &eve ); //fChain->SetBranchAddress("*", &eve ); //fChain->GetLeaf("*"); // ULong64_t evt_; ////////////////////////////////////////////////MINHA MODIFICAÇÂO////////////////////////////////////// // // Declaration of leaf types // Double_t evtWeight; // Bool_t HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_; // Bool_t HLT_Ele25_eta2p1_WPTight_Gsf_; // Bool_t HLT_DoubleEle33_CaloIdL_GsfTrkIdVL_MW_; // Bool_t HLT_TrkMu15_DoubleTrkMu5NoFiltersNoVtx_; // Bool_t HLT_Ele115_CaloIdVT_GsfTrkIdT_; // Bool_t HLT_Ele27_WPLoose_Gsf_WHbbBoost_; // Bool_t HLT_DoubleEle24_22_eta2p1_WPLoose_Gsf_; // Bool_t HLT_DoubleEle37_Ele27_CaloIdL_GsfTrkIdVL_; // Bool_t HLT_Ele24_eta2p1_WPLoose_Gsf_; // Bool_t HLT_Ele25_eta2p1_WPLoose_Gsf_; // Bool_t HLT_Ele27_eta2p1_WPTight_Gsf_; // Bool_t HLT_PFMET300_; // Bool_t HLT_MET200_; // Bool_t HLT_PFHT300_PFMET110_; // Bool_t HLT_PFMET170_HBHECleaned_; // Bool_t HLT_PFMET120_PFMHT120_IDTight_; // Bool_t HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_; // UInt_t run_; // UInt_t lumi_; // ULong64_t evt_; // Int_t numPVs_; // Float_t puSF_; // Bool_t PassMETFilters_; // Bool_t GoodFirstPV_; // Float_t genWeight_; // vector *jet_pt_; // vector *jet_eta_; // vector *jet_phi_; // vector *jet_m_; // vector *jet_regFactor; // vector *lepton_pt_; // vector *lepton_eta_; // vector *lepton_phi_; // vector *lepton_e_; // vector *lepton_scEta_; // vector *lepton_isMuon_; // vector *lepton_isTight_; // vector *lepton_charge_; // vector *lepton_relIso; // vector *lepton_IDSF_; // vector *lepton_recoIsoSF_; // vector *lepton_energyCorr_; // Float_t MET_; // Float_t MET_phi_; // Float_t MET_Type1xy_; // Float_t MET_Type1xy_phi_; // Float_t MET_Type1xy_sync_; // Float_t MET_Type1xy_phi_sync_; // // List of branches // TBranch *b_evtWeight; //! // TBranch *b_HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_; //! // TBranch *b_HLT_Ele25_eta2p1_WPTight_Gsf_; //! // TBranch *b_HLT_DoubleEle33_CaloIdL_GsfTrkIdVL_MW_; //! // TBranch *b_HLT_TrkMu15_DoubleTrkMu5NoFiltersNoVtx_; //! // TBranch *b_HLT_Ele115_CaloIdVT_GsfTrkIdT_; //! // TBranch *b_HLT_Ele27_WPLoose_Gsf_WHbbBoost_; //! // TBranch *b_HLT_DoubleEle24_22_eta2p1_WPLoose_Gsf_; //! // TBranch *b_HLT_DoubleEle37_Ele27_CaloIdL_GsfTrkIdVL_; //! // TBranch *b_HLT_Ele24_eta2p1_WPLoose_Gsf_; //! // TBranch *b_HLT_Ele25_eta2p1_WPLoose_Gsf_; //! // TBranch *b_HLT_Ele27_eta2p1_WPTight_Gsf_; //! // TBranch *b_HLT_PFMET300_; //! // TBranch *b_HLT_MET200_; //! // TBranch *b_HLT_PFHT300_PFMET110_; //! // TBranch *b_HLT_PFMET170_HBHECleaned_; //! // TBranch *b_HLT_PFMET120_PFMHT120_IDTight_; //! // TBranch *b_HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_; //! // TBranch *b_run_; //! // TBranch *b_lumi_; //! // TBranch *b_evt_; //! // TBranch *b_numPVs_; //! // TBranch *b_puSF_; //! // TBranch *b_PassMETFilters_; //! // TBranch *b_GoodFirstPV_; //! // TBranch *b_genWeight_; //! // TBranch *b_jet_pt_; //! // TBranch *b_jet_eta_; //! // TBranch *b_jet_phi_; //! // TBranch *b_jet_m_; //! // TBranch *b_jet_regFactor; //! // TBranch *b_lepton_pt_; //! // TBranch *b_lepton_eta_; //! // TBranch *b_lepton_phi_; //! // TBranch *b_lepton_e_; //! // TBranch *b_lepton_scEta_; //! // TBranch *b_lepton_isMuon_; //! // TBranch *b_lepton_isTight_; //! // TBranch *b_lepton_charge_; //! // TBranch *b_lepton_relIso; //! // TBranch *b_lepton_IDSF_; //! // TBranch *b_lepton_recoIsoSF_; //! // TBranch *b_lepton_energyCorr_; //! // TBranch *b_MET_; //! // TBranch *b_MET_phi_; //! // TBranch *b_MET_Type1xy_; //! // TBranch *b_MET_Type1xy_phi_; //! // TBranch *b_MET_Type1xy_sync_; //! // TBranch *b_MET_Type1xy_phi_sync_; //! // fChain->SetBranchAddress("evtWeight", &eve, &b_evtWeight); // fChain->SetBranchAddress("evt_", &evt_,&eve); // fChain->SetBranchAddress("evtWeight", &eve); // fChain->SetBranchAddress("HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_", &eve); // fChain->SetBranchAddress("HLT_Ele25_eta2p1_WPTight_Gsf_", &eve); // fChain->SetBranchAddress("HLT_DoubleEle33_CaloIdL_GsfTrkIdVL_MW_", &eve); // fChain->SetBranchAddress("HLT_TrkMu15_DoubleTrkMu5NoFiltersNoVtx_", &eve); // fChain->SetBranchAddress("HLT_Ele115_CaloIdVT_GsfTrkIdT_", &eve); // fChain->SetBranchAddress("HLT_Ele27_WPLoose_Gsf_WHbbBoost_", &eve); // fChain->SetBranchAddress("HLT_DoubleEle24_22_eta2p1_WPLoose_Gsf_", &eve); // fChain->SetBranchAddress("HLT_DoubleEle37_Ele27_CaloIdL_GsfTrkIdVL_", &eve); // fChain->SetBranchAddress("HLT_Ele24_eta2p1_WPLoose_Gsf_", &eve); // fChain->SetBranchAddress("HLT_Ele25_eta2p1_WPLoose_Gsf_", &eve); // fChain->SetBranchAddress("HLT_Ele27_eta2p1_WPTight_Gsf_", &eve); // fChain->SetBranchAddress("HLT_PFMET300_", &eve); // fChain->SetBranchAddress("HLT_MET200_", &eve); // fChain->SetBranchAddress("HLT_PFHT300_PFMET110_", &eve); // fChain->SetBranchAddress("HLT_PFMET170_HBHECleaned_", &eve); // fChain->SetBranchAddress("HLT_PFMET120_PFMHT120_IDTight_", &eve); // fChain->SetBranchAddress("HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_", &eve); // fChain->SetBranchAddress("run_", &eve); // fChain->SetBranchAddress("lumi_", &eve); //fChain->SetBranchAddress("evt_", &eve); // fChain->SetBranchAddress("numPVs_", &eve); // fChain->SetBranchAddress("puSF_", &eve); // fChain->SetBranchAddress("PassMETFilters_", &eve); // fChain->SetBranchAddress("GoodFirstPV_", &eve); // fChain->SetBranchAddress("genWeight_", &eve); // fChain->SetBranchAddress("jet_pt_", &eve); // fChain->SetBranchAddress("jet_eta_", &eve); // fChain->SetBranchAddress("jet_phi_", &eve); // fChain->SetBranchAddress("jet_m_", &eve); // fChain->SetBranchAddress("jet_regFactor", &eve); // fChain->SetBranchAddress("lepton_pt_", &eve); // fChain->SetBranchAddress("lepton_eta_", &eve); // fChain->SetBranchAddress("lepton_phi_", &eve); // fChain->SetBranchAddress("lepton_e_", &eve); // fChain->SetBranchAddress("lepton_scEta_", &eve); // fChain->SetBranchAddress("lepton_isMuon_", &eve); // fChain->SetBranchAddress("lepton_isTight_", &eve); // fChain->SetBranchAddress("lepton_charge_", &eve); // fChain->SetBranchAddress("lepton_relIso", &eve); // fChain->SetBranchAddress("lepton_IDSF_", &eve); // fChain->SetBranchAddress("lepton_recoIsoSF_", &eve); // fChain->SetBranchAddress("lepton_energyCorr_", &eve); // fChain->SetBranchAddress("MET_", &eve); // fChain->SetBranchAddress("MET_phi_", &eve); // fChain->SetBranchAddress("MET_Type1xy_", &eve); // fChain->SetBranchAddress("MET_Type1xy_phi_", &eve); // fChain->SetBranchAddress("MET_Type1xy_sync_", &eve); // fChain->SetBranchAddress("MET_Type1xy_phi_sync_", &eve); // fChain->SetBranchAddress("evtWeight", &evtWeight, &b_evtWeight); // fChain->SetBranchAddress("HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_", &HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_, &b_HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_); // fChain->SetBranchAddress("HLT_Ele25_eta2p1_WPTight_Gsf_", &HLT_Ele25_eta2p1_WPTight_Gsf_, &b_HLT_Ele25_eta2p1_WPTight_Gsf_); // fChain->SetBranchAddress("HLT_DoubleEle33_CaloIdL_GsfTrkIdVL_MW_", &HLT_DoubleEle33_CaloIdL_GsfTrkIdVL_MW_, &b_HLT_DoubleEle33_CaloIdL_GsfTrkIdVL_MW_); // fChain->SetBranchAddress("HLT_TrkMu15_DoubleTrkMu5NoFiltersNoVtx_", &HLT_TrkMu15_DoubleTrkMu5NoFiltersNoVtx_, &b_HLT_TrkMu15_DoubleTrkMu5NoFiltersNoVtx_); // fChain->SetBranchAddress("HLT_Ele115_CaloIdVT_GsfTrkIdT_", &HLT_Ele115_CaloIdVT_GsfTrkIdT_, &b_HLT_Ele115_CaloIdVT_GsfTrkIdT_); // fChain->SetBranchAddress("HLT_Ele27_WPLoose_Gsf_WHbbBoost_", &HLT_Ele27_WPLoose_Gsf_WHbbBoost_, &b_HLT_Ele27_WPLoose_Gsf_WHbbBoost_); // fChain->SetBranchAddress("HLT_DoubleEle24_22_eta2p1_WPLoose_Gsf_", &HLT_DoubleEle24_22_eta2p1_WPLoose_Gsf_, &b_HLT_DoubleEle24_22_eta2p1_WPLoose_Gsf_); // fChain->SetBranchAddress("HLT_DoubleEle37_Ele27_CaloIdL_GsfTrkIdVL_", &HLT_DoubleEle37_Ele27_CaloIdL_GsfTrkIdVL_, &b_HLT_DoubleEle37_Ele27_CaloIdL_GsfTrkIdVL_); // fChain->SetBranchAddress("HLT_Ele24_eta2p1_WPLoose_Gsf_", &HLT_Ele24_eta2p1_WPLoose_Gsf_, &b_HLT_Ele24_eta2p1_WPLoose_Gsf_); // fChain->SetBranchAddress("HLT_Ele25_eta2p1_WPLoose_Gsf_", &HLT_Ele25_eta2p1_WPLoose_Gsf_, &b_HLT_Ele25_eta2p1_WPLoose_Gsf_); // fChain->SetBranchAddress("HLT_Ele27_eta2p1_WPTight_Gsf_", &HLT_Ele27_eta2p1_WPTight_Gsf_, &b_HLT_Ele27_eta2p1_WPTight_Gsf_); // fChain->SetBranchAddress("HLT_PFMET300_", &HLT_PFMET300_, &b_HLT_PFMET300_); // fChain->SetBranchAddress("HLT_MET200_", &HLT_MET200_, &b_HLT_MET200_); // fChain->SetBranchAddress("HLT_PFHT300_PFMET110_", &HLT_PFHT300_PFMET110_, &b_HLT_PFHT300_PFMET110_); // fChain->SetBranchAddress("HLT_PFMET170_HBHECleaned_", &HLT_PFMET170_HBHECleaned_, &b_HLT_PFMET170_HBHECleaned_); // fChain->SetBranchAddress("HLT_PFMET120_PFMHT120_IDTight_", &HLT_PFMET120_PFMHT120_IDTight_, &b_HLT_PFMET120_PFMHT120_IDTight_); // fChain->SetBranchAddress("HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_", &HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_, &b_HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_); // fChain->SetBranchAddress("run_", &run_, &b_run_); // fChain->SetBranchAddress("lumi_", &lumi_, &b_lumi_); fChain->SetBranchAddress("evt_", &evt_, &b_evt_); // fChain->SetBranchAddress("numPVs_", &numPVs_, &b_numPVs_); // fChain->SetBranchAddress("puSF_", &puSF_, &b_puSF_); // fChain->SetBranchAddress("PassMETFilters_", &PassMETFilters_, &b_PassMETFilters_); // fChain->SetBranchAddress("GoodFirstPV_", &GoodFirstPV_, &b_GoodFirstPV_); // fChain->SetBranchAddress("genWeight_", &genWeight_, &b_genWeight_); // fChain->SetBranchAddress("jet_pt_", &jet_pt_, &b_jet_pt_); // fChain->SetBranchAddress("jet_eta_", &jet_eta_, &b_jet_eta_); // fChain->SetBranchAddress("jet_phi_", &jet_phi_, &b_jet_phi_); // fChain->SetBranchAddress("jet_m_", &jet_m_, &b_jet_m_); // fChain->SetBranchAddress("jet_regFactor", &jet_regFactor, &b_jet_regFactor); // fChain->SetBranchAddress("lepton_pt_", &lepton_pt_, &b_lepton_pt_); // fChain->SetBranchAddress("lepton_eta_", &lepton_eta_, &b_lepton_eta_); // fChain->SetBranchAddress("lepton_phi_", &lepton_phi_, &b_lepton_phi_); // fChain->SetBranchAddress("lepton_e_", &lepton_e_, &b_lepton_e_); // fChain->SetBranchAddress("lepton_scEta_", &lepton_scEta_, &b_lepton_scEta_); // fChain->SetBranchAddress("lepton_isMuon_", &lepton_isMuon_, &b_lepton_isMuon_); // fChain->SetBranchAddress("lepton_isTight_", &lepton_isTight_, &b_lepton_isTight_); // fChain->SetBranchAddress("lepton_charge_", &lepton_charge_, &b_lepton_charge_); // fChain->SetBranchAddress("lepton_relIso", &lepton_relIso, &b_lepton_relIso); // fChain->SetBranchAddress("lepton_IDSF_", &lepton_IDSF_, &b_lepton_IDSF_); // fChain->SetBranchAddress("lepton_recoIsoSF_", &lepton_recoIsoSF_, &b_lepton_recoIsoSF_); // fChain->SetBranchAddress("lepton_energyCorr_", &lepton_energyCorr_, &b_lepton_energyCorr_); // fChain->SetBranchAddress("MET_", &MET_, &b_MET_); // fChain->SetBranchAddress("MET_phi_", &MET_phi_, &b_MET_phi_); // fChain->SetBranchAddress("MET_Type1xy_", &MET_Type1xy_, &b_MET_Type1xy_); // fChain->SetBranchAddress("MET_Type1xy_phi_", &MET_Type1xy_phi_, &b_MET_Type1xy_phi_); // fChain->SetBranchAddress("MET_Type1xy_sync_", &MET_Type1xy_sync_, &b_MET_Type1xy_sync_); // fChain->SetBranchAddress("MET_Type1xy_phi_sync_", &MET_Type1xy_phi_sync_, &b_MET_Type1xy_phi_sync_); //////////////////////////////////////////////////////////////////// //fChain->GetLeaf(*); EventVars:: lepTool.era_=era; lepTool.setFlags(isMC, p_passFile.c_str()); jetMetTool.era_=era; long processed=0; // *** 3. Start looping! long t_entries = fChain->GetEntries(); cout << "Chain entries: " << t_entries << endl; printProgBar(0.); int counter=0; //Charis for(int i = 0; i < t_entries; i++) { // for(int i = 0; i < 3000000; i++) { // if ( t_entries > 100) { // if ((i+1)%(5*t_entries/100)==0) printProgBar(100*i/t_entries +1); // } // if (i == t_entries-1) {printProgBar(100); cout << endl;} processed++; if(processed % 1000 == 0) { int progress = 100*(float)processed/t_entries; printProgBar(progress); } fChain->GetEntry(i); // ** 0. Set debug flags per event std::cout<<"eve->evt_ : " <evt_<evt_ == 3280938 || eve->evt_ == 6895311 || eve->evt_ == 7772097 || eve->evt_ == 6896348 || eve->evt_ == 7984706 || eve->evt_ == 7247651 || eve->evt_ == 6896671)) isDebug = true; else isDebug = false; // ** I. Get objects std::cout<<"eve->evt_ 2: "<Write(); outfile->cd(); TIter next(a_Efficiencies); while ( TEfficiency *tEff = (TEfficiency*)next() ) tEff->Write(); } // delete c0; return; } void printProgBar(const int& progress ) { std::string progressBar = "["; for(int i = 0; i <= progress; i++){ if(i%1 == 0) progressBar += "#"; } for(int i = 0; i < 100 - progress; i++){ if(i%1 == 0) progressBar += " "; } progressBar = progressBar + "] " + std::to_string(progress) + "% of Events processed"; std::cout << "\r" << progressBar << std::flush; if(progress == 100) std::cout << std::endl; }