#include "TH1F.h"
#include "Nano.h"
#include "tqdm.h"
#include "ElectronSelections.h"
#include "MuonSelections.h"
#include "arbol.h"
#include "cutflow.h"
#include "looper.h"
using namespace std;
using namespace tas;
int main(int argc, char** argv)
{
arbol.
newBranch<
int>(
"leading_lep_id", -999);
arbol.
newBranch<
float>(
"leading_lep_pt", -999);
arbol.
newBranch<
float>(
"leading_lep_eta", -999);
arbol.
newBranch<
float>(
"leading_lep_phi", -999);
arbol.
newBranch<
int>(
"trailing_lep_id", -999);
arbol.
newBranch<
float>(
"trailing_lep_pt", -999);
arbol.
newBranch<
float>(
"trailing_lep_eta", -999);
arbol.
newBranch<
float>(
"trailing_lep_phi", -999);
TH1F* ld_lep_pt_hist = new TH1F("ld_lep_pt_hist", "ld_lep_pt_hist", 20, 0, 200);
TH1F* tr_lep_pt_hist = new TH1F("tr_lep_pt_hist", "tr_lep_pt_hist", 20, 0, 200);
cutflow.globals.newVar<TH1F>("ld_lep_pt_hist", *ld_lep_pt_hist);
cutflow.globals.newVar<TH1F>("tr_lep_pt_hist", *tr_lep_pt_hist);
"Bookkeeping",
[&]()
{
arbol.
setLeaf(
"event", nt.event());
return true;
},
[&]()
{
return 0.001;
}
);
cutflow.setRoot(root);
"DileptonPreselection",
[&]()
{
int n_tight_leps = 0;
int n_loose_not_tight_leps = 0;
Leptons leptons = getLeptons();
Lepton leading_lep;
Lepton trailing_lep;
for (auto& lep : leptons)
{
if (lep.pt() < 20) { continue; }
if (lep.idlevel() == SS::IDtight)
{
if (lep.pt() > leading_lep.pt())
{
trailing_lep = leading_lep;
leading_lep = lep;
}
else if (lep.pt() > trailing_lep.pt()) { trailing_lep = lep; }
n_tight_leps++;
}
if (lep.idlevel() == SS::IDfakable) { n_loose_not_tight_leps++; }
}
if (n_tight_leps == 2 && n_loose_not_tight_leps == 0)
{
arbol.
setLeaf<
int>(
"leading_lep_id", leading_lep.id());
arbol.
setLeaf<
float>(
"leading_lep_pt", leading_lep.pt());
arbol.
setLeaf<
float>(
"leading_lep_eta", leading_lep.eta());
arbol.
setLeaf<
float>(
"leading_lep_phi", leading_lep.phi());
arbol.
setLeaf<
int>(
"trailing_lep_id", trailing_lep.id());
arbol.
setLeaf<
float>(
"trailing_lep_pt", trailing_lep.pt());
arbol.
setLeaf<
float>(
"trailing_lep_eta", trailing_lep.eta());
arbol.
setLeaf<
float>(
"trailing_lep_phi", trailing_lep.phi());
return true;
}
else { return false; }
}
);
cutflow.insert("Bookkeeping", dilep_presel, Right);
Cut* monolep_or_fakes =
new LambdaCut(
"SingleLepOrFakes", [&]() {
return true; });
cutflow.insert("DileptonPreselection", monolep_or_fakes, Left);
"CheckDilepSign",
[&]()
{
int leading_lep_id = arbol.
getLeaf<
int>(
"leading_lep_id");
int trailing_lep_id = arbol.
getLeaf<
int>(
"trailing_lep_id");
return leading_lep_id*trailing_lep_id > 0;
}
);
cutflow.insert("DileptonPreselection", dilep_sign, Right);
Cut* SS_presel =
new LambdaCut(
"SSPreselection", [&]() {
return true; });
cutflow.insert("CheckDilepSign", SS_presel, Right);
"OSPreselection",
[&]()
{
TH1F& ld_lep_pt_hist = cutflow.globals.getRef<TH1F>("ld_lep_pt_hist");
TH1F& tr_lep_pt_hist = cutflow.globals.getRef<TH1F>("tr_lep_pt_hist");
ld_lep_pt_hist.Fill(arbol.
getLeaf<
float>(
"leading_lep_pt"));
tr_lep_pt_hist.Fill(arbol.
getLeaf<
float>(
"trailing_lep_pt"));
return true;
},
[&]()
{
return 0.25;
}
);
cutflow.insert("CheckDilepSign", OS_presel, Left);
tqdm bar;
[&](TTree* ttree)
{
nt.Init(ttree);
},
[&](int entry)
{
nt.GetEntry(entry);
bool passed = cutflow.run("OSPreselection");
if (passed) { arbol.
fill(); }
return;
}
);
bar.finish();
cutflow.print();
return 0;
}
Type getLeaf(TString branch_name)
std::string output_dir
Definition hepcli.h:36
TChain * input_tchain
Definition hepcli.h:52
std::string output_name
Definition hepcli.h:38
unsigned int n_events_processed
Definition looper.h:29