#include #include #include #include #include #include #include gROOT->Reset(); void run_DATA_Muons_WZ_HQ(std::string infile = "input.txt", std::string inputtype = "DATA", std::string inputstream = "Muons", std::string ntupletype = "WZ" ) { std::string line; std::ifstream ifs(infile.c_str()); std::vector fileList; if (ifs.is_open()) { while ( ifs.good() ) { getline (ifs,line); if (line.length() == 0) continue; for (size_t i=0,n; i <= line.length(); i=n+1) { n = line.find_first_of(',',i); if (n == string::npos) n = line.length(); string tmp = line.substr(i,n-i); fileList.push_back(tmp); } } } ifs.close(); // open input files TChain * Input_Chain = new TChain("physics"); for (int iFile=0; iFileAdd(fileList[iFile].c_str()); } /*TChain * Input_Chain = new TChain("physics"); cout << "files in Chain: "; for (size_t i=0,n; i <= fileList.length(); i=n+1) { n = fileList.find_first_of(',',i); if (n == string::npos) n = fileList.length(); std::string iFileName = fileList.substr(i,n-i); Input_Chain->Add(iFileName.c_str()); cout << iFileName << " "; } */ cout << endl; cout << "events: " << Input_Chain->GetEntries() << endl; gROOT->ProcessLine(".L checkOQ.C++"); gROOT->ProcessLine(".L egammaSFclass.C++"); //gROOT->ProcessLine(".L EnergyRescalerTool/EnergyRescaler.cxx++"); //gSystem->Load("GoodRunsLists/StandAlone/GoodRunsListsLib.so"); //gSystem->Load("PileupReweighting/StandAlone/libPileupReweightingLib.so"); gSystem->Load("Background.so"); //std::cout << "===> Loaded Background.so ") << endl; gROOT->ProcessLine(".L Background_defs.h"); ///////////////////////////////////////////////////////////////////////////////////////////////////// Background analysisObj(Input_Chain); //Creating class Object. ///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// // Arguments analysisObj.SetInputName(infile.c_str()); // WZ, TOP or 'Thomas' D3PDs analysisObj.SetNtupleType(ntupletype.c_str()); // Choose between OA or WZ //Is Analysis on "MC" or "DATA" analysisObj.SetInputType(inputtype.c_str()); //Electron or Muon streams (sets proper Triggers for DATA and MC) //Choose either "Egamma" or "Muons" analysisObj.SetInputStream(inputstream.c_str()); //Doesn't matter for MC ///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// //Function Info analysisObj.SetFunctionInfo("On"); // On or Off ///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// //Set Analysis Year - Only analysisObj.SetInputYear("2011"); //Only needed for MC //Set Athena Analysis Release analysisObj.SetAthenaRelease("rel16"); //Writing Out all events despite trigger. Set "On" or "Off". analysisObj.WriteAllEvents("On"); //Set skimming "On" or "Off" analysisObj.SetSkimming("Off"); //To output truth info, set "On" along with skimming "Off". analysisObj.SetOutputTruth("Off"); //To output electron, muon, and jet resolutions analysisObj.SetOutputResolutions("Off"); //To output some variables that may help to debug analysisObj.SetOutputDebuggingVariables("Off"); ///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// //Set Triggers (if outputted: Need to set WriteEvents == "On") //If no trigger is desired set to "NONE" analysisObj.SetElectronTrigger("EF_e20_medium"); analysisObj.Set2ElectronTrigger("EF_2e10_medium"); //analysisObj.Set3ElectronTrigger("EF_3e10_medium"); analysisObj.Set3ElectronTrigger("NONE"); analysisObj.SetMuonTrigger("EF_mu20_MG"); analysisObj.Set2MuonTrigger("EF_2mu10"); //analysisObj.Set3MuonTrigger("EF_3mu6"); analysisObj.Set3MuonTrigger("NONE"); //analysisObj.Set1Electron1MuonTrigger("EF_e10_loose_mu10"); analysisObj.Set1Electron1MuonTrigger("NONE"); //analysisObj.Set1Electron2MuonTrigger("EF_e10_medium_2mu6"); analysisObj.Set1Electron2MuonTrigger("NONE"); //analysisObj.Set2Electron1MuonTrigger("EF_2e10_medium_mu6"); analysisObj.Set2Electron1MuonTrigger("NONE"); analysisObj.SetJetTrigger("NONE"); //Trigger filtering "On" or "Off" analysisObj.Do1ElTrigger("On"); analysisObj.Do1MuTrigger("On"); analysisObj.Do2ElTrigger("On"); analysisObj.Do2MuTrigger("On"); analysisObj.Do3ElTrigger("Off"); analysisObj.Do3MuTrigger("Off"); analysisObj.Do1El1MuTrigger("Off"); analysisObj.Do1El2MuTrigger("Off"); analysisObj.Do2El1MuTrigger("Off"); analysisObj.Do1JetTrigger("Off"); //Trigger Efficiencies on MC: Set "On" or "Off". Make sure that the triggers used and electron/muon tightness criteria are the same. analysisObj.DoTriggerEfficiencies("Off"); ///////////////////////////////////////////////////////////////////////////////////////////////////// //Truth Analysis can be set "On" or "Off". Some Oxford Analysis ntuples do not contain truth info. analysisObj.DoTruthAnalysis("Off"); ///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// //Choose Analysis: _MODE_TR, _MODE_HQ, or _MODE_EL analysisObj.SetRunMode(_MODE_HQ); //if HQ analysis, choose W+jets, Z+jets or both by setting the following to "On". analysisObj.DoWjetsReconstruction("On"); analysisObj.DoZjetsReconstruction("On"); ///////////////////////////////////////////////////////////////////////////////////////////////////// //Set Electron quality //Set electron quality for el container : loose=1, medium=2, mediumIso=3, tight=4, tightIso=5. analysisObj.SetElectronQuality(2); //Set electron quality for Z reconstruction : loose=1, medium=2, mediumIso=3, tight=4, tightIso=5. analysisObj.SetZelQuality(2); //Set electron quality for W reconstruction : loose=1, medium=2, mediumIso=3, tight=4, tightIso=5. analysisObj.SetWelQuality(4); //Set W transverse mass cut analysisObj.SetWtransMassCut(40000.0); ///////////////////////////////////////////////////////////////////////////////////////////////////// //Set MET //Set to "Yes" for MET_RefFinal or to "No" for MET_LocHadTopo based MET analysisObj.SetMET_Ref("Yes"); ///////////////////////////////////////////////////////////////////////////////////////////////////// //Set Muon Algorithm //Choose either "mu_staco_" or "mu_muid_" analysisObj.SetMuonAlgorithmName_WZ("mu_staco_"); ///////////////////////////////////////////////////////////////////////////////////////////////////// //Set Jet Algorithm //rel15 //analysisObj.SetJetAlgorithmName_WZ("antikt4h1topo"); //analysisObj.SetBtagType("ip3d_pb"); //analysisObj.SetTruthJetAlgorithmName_WZ("antikt4truth"); //rel16 analysisObj.SetJetAlgorithmName_WZ("jet_AntiKt4TopoEM_"); analysisObj.SetBtagType("sv0_pb"); analysisObj.SetTruthJetAlgorithmName_WZ("jet_AntiKt4TruthAll_"); ///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// // For All ///////////////////////////////////////////////////////////////////////////////////////////////////// //Vertex (PV) Cuts: (minimum number of tracks for the PV, maximum z_PV in mm) analysisObj.SetVertexCuts(3., 200000.); //Electron Isolation -- Set Etcone20_pt_corrected cut -- Put Large number for no cut. analysisObj.SetEtCone20PtCorCut(40000000.0); //in MeV and affects only HQ analysis //Muon Hits And Vertex Cuts: (min # Pixel Hits (>), min # SCT Hits + SCT crossed Dead Sensors (>= 6), max # Holes, min z0 in mm, min d0 in mm) analysisObj.SetMuonHitsAndVertexCuts(1, 6, 3, 10, 10); //Muon ptcone20/mu_pt Cut analysisObj.SetMuPtcone20OverPtCut(0.1); //Jet Pile-Up Removal jvtxf cut analysisObj.SetPileUpRemovalCut(1.0); //Smearing analysisObj.SetDoElectronSmearing("No"); analysisObj.SetDoMuonSmearing("No"); //Pt Cuts analysisObj.SetElectronPt_Cut(25000.0); analysisObj.SetMuonPt_Cut(25000.0); analysisObj.SetJetPt_Cut(20000.0); analysisObj.SetMissingEtCut(10000.0); //Event is kept despite cut, but invariant mass isn't calculated //Eta Cuts analysisObj.SetElectronEta_Cut_min(-2.47); analysisObj.SetMuonEta_Cut_min(-2.4); analysisObj.SetJetEta_Cut_min(-4.5); analysisObj.SetElectronEta_Cut_max(2.47); analysisObj.SetMuonEta_Cut_max(2.4); analysisObj.SetJetEta_Cut_max(4.5); //e/e and mu/e DeltaR overlap removal analysisObj.SetDeltaRElElAndMuElOverlap_Cut(0.1, 0.1); // (e/e , mu/e) affects only TR analysis //Can remove two ETA ranges in the form (Range1_min, Ranges1_max, Range2_min, Ranges2_max) for electrons, muons, and jets analysisObj.RemoveElEtaRanges(1.37, 1.52, 0.0, 0.0); analysisObj.RemoveMuEtaRanges(0.0, 0.0, 0.0, 0.0); analysisObj.RemoveJetEtaRanges(0.0, 0.0, 0.0, 0.0); //Can remove two PHI ranges in the form (Range1_min, Ranges1_max, Range2_min, Ranges2_max) for electrons, muons, and jets analysisObj.RemoveElPhiRanges(0.0, 0.0, 0.0, 0.0); analysisObj.RemoveMuPhiRanges(0.0, 0.0, 0.0, 0.0); analysisObj.RemoveJetPhiRanges(0.0, 0.0, 0.0, 0.0); //W reconstruction Cuts analysisObj.Set_W_Pt_Cut(0.0); //DeltaR Cuts between the lepton and neutrino stemming from a W. Put Large number for no cut. analysisObj.SetDeltaRElNuCut(1000000.0); analysisObj.SetDeltaRMuNuCut(1000000.0); //Maximum to set on the vector sum of the three objects that reconstruct the heavy quark + the tagged jet. analysisObj.SetVectorSum_lnujj_Cut(1000000.0); // in MeV //Second Jet Cuts (HQ analysis) analysisObj.SetDeltaR_jet1_jet2_Cut(0.0); //Set min DeltaR between jet1 and jet2 analysisObj.SetDeltaPhi_jet1_jet2_Cut(0.0); //Set min DeltaPhi between jet1 and jet2 analysisObj.SetDeltaEta_jet1_jet2_Cut(0.0); //Set min DeltaEta between jet1 and jet2 analysisObj.SetDeltaR_W_jet2_Cut(0.0); //Set min DeltaR between W and jet2 analysisObj.SetDeltaPhi_W_jet2_Cut(0.0); //Set min DeltaPhi between W and jet2 analysisObj.SetDeltaEta_W_jet2_Cut(0.0); //Set min DeltaEta between W and jet2 analysisObj.SetJet2_minPt_Cut(15000.0); // in MeV. analysisObj.SetJet2_minEta_Cut(0.0); //0.0 is no cut. analysisObj.SetJet2_maxEta_Cut(5.0); //put same as general jet pt cut for no cut. //Z reconstruction Cuts analysisObj.SetInv_Mass_2El_Cut_min(25000.0); analysisObj.SetInv_Mass_2Mu_Cut_min(25000.0); analysisObj.SetInv_Mass_2El_Cut_max(25000.0); analysisObj.SetInv_Mass_2Mu_Cut_max(25000.0); analysisObj.SetJetsBTagProb_Cut(0.5); analysisObj.SetLeptonFakingJetDeltaR_Cut(0.2); //Truth Matching Cuts analysisObj.SetDeltaRElectronResCut(0.03); analysisObj.SetDeltaEMinForElTruthMatching(0.5); //The matched electron has to be within x*100% of the true energy. analysisObj.SetDeltaRMuonResCut(0.03); analysisObj.SetDeltaEMinForMuTruthMatching(0.5); //The matched muon has to be within x*100% of the true energy. analysisObj.SetDeltaRJetResCut(0.2); //Composite lepton analysis cut analysisObj.SetPtCutForStrandedElectron(20000.0); ///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// //Uncertainties //LES Uncertainty. Nominal = 0, Minus One Sigma = 1, Plus One Sigma = 2 analysisObj.SetLESUncertainty(0); //JES Uncertainty. Nominal = 0, Minus One Sigma = 1, Plus One Sigma = 2 analysisObj.SetJESUncertainty(0); //JER Uncertainty. Nominal = 0, Minus One Sigma = 1, Plus One Sigma = 2 analysisObj.SetJERUncertainty(0); //////////////////////////////////////////////////////////////////////////////////////////////////// //Histograms //To Output histograms, set the following to "On" analysisObj.OutputHistograms("Off"); //Histogram settings: (int nbins, double x min, double x max) analysisObj.SetInvMassHisto(100, 0.0, 1000000.0); analysisObj.SetWPtHisto(100, 0.0, 400000.0); analysisObj.SetWTransMassHisto(100, 0.0, 100000.0); analysisObj.SetDeltaRLepNuHisto(100, 0.0, 10.0); analysisObj.SetVectorSumlnujjHisto(100, 0.0, 100000.0); analysisObj.SetScalarPtHisto(100, 0.0, 1000000.0); analysisObj.SetDeltaRWJet2Histo(100, 0.0, 10.0); analysisObj.SetDeltaPhiWJet2Histo(100, 0.0, 3.5); analysisObj.SetDeltaEtaWJet2Histo(100, 0.0, 7.0); analysisObj.SetDeltaRJet1Jet2Histo(100, 0.0, 10.0); analysisObj.SetDeltaPhiJet1Jet2Histo(100, 0.0, 3.5); analysisObj.SetDeltaEtaJet1Jet2Histo(100, 0.0, 7.0); analysisObj.SetElEHisto(100, 0, 400000.0); analysisObj.SetElPtHisto(100, 0, 400000.0); analysisObj.SetElEtaHisto(100, -3, 3); analysisObj.SetElPhiHisto(100, -3.5, 3.5); analysisObj.SetElChargeHisto(4, -2, 2); analysisObj.SetElnBLHitsHisto(5, 0, 5); analysisObj.SetElQualityHisto(6, 0, 6); analysisObj.SetMuEHisto(100, 0, 400000.0); analysisObj.SetMuPtHisto(100, 0, 400000.0); analysisObj.SetMuEtaHisto(100, -3, 3); analysisObj.SetMuPhiHisto(100, -3.5, 3.5); analysisObj.SetMuChargeHisto(4, -2, 2); analysisObj.SetMuQualityHisto(4, 0, 4); analysisObj.SetJetEHisto(100, 0, 400000.0); analysisObj.SetJetPtHisto(100, 0, 400000.0); analysisObj.SetJetEtaHisto(100, -3, 3); analysisObj.SetJetPhiHisto(100, -3.5, 3.5); analysisObj.SetMETHisto(100, 0, 400000.0); analysisObj.SetMETxHisto(100, -400000.0, 400000.0); analysisObj.SetMETyHisto(100, -400000.0, 400000.0); analysisObj.SetMETzElpHisto(100, -400000.0, 400000.0); analysisObj.SetMETzElnHisto(100, -400000.0, 400000.0); analysisObj.SetMETzElsHisto(4, -2, 2); analysisObj.SetMETzMupHisto(100, -400000.0, 400000.0); analysisObj.SetMETzMunHisto(100, -400000.0, 400000.0); analysisObj.SetMETzMusHisto(4, -2, 2); analysisObj.SetElNumberHisto(8, 0, 8); analysisObj.SetMuNumberHisto(8, 0, 8); analysisObj.SetLepNumberHisto(8, 0, 8); analysisObj.SetJetNumberHisto(15, 0, 15); ///////////////////////////////////////////////////////////////////////////////////////////////////// //Number of events to run on //analysisObj.Loop(0,500); analysisObj.Loop(); ///////////////////////////////////////////////////////////////////////////////////////////////////// }