|
DAS
3.0
Das Analysis System
|
|
template<class Jet > |
bool | keepEvent (const vector< Jet > &jets, float pt1, float pt2) |
|
void | applyDijetSkim (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0}) |
|
template<class Jet , class Dimuon > |
bool | keepEvent (const vector< Jet > &jets, const Dimuon &dimuon, float zpt, float jpt) |
|
void | applyZJetSkim (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0}) |
|
◆ applyDijetSkim()
void DAS::Jets::applyDijetSkim |
( |
const vector< fs::path > & |
inputs, |
|
|
const fs::path & |
output, |
|
|
const pt::ptree & |
config, |
|
|
const int |
steering, |
|
|
const DT::Slice |
slice = {1,0} |
|
) |
| |
Skims the input tree to keep only events with at least two jets, with configurable pT thresholds.
- Parameters
-
inputs | input ROOT files (n-tuples) |
output | output ROOT file (n-tuple) |
config | config handled with `Darwin::Tools::options` |
steering | parameters obtained from explicit options |
slice | number and index of slice |
51 cout << __func__ <<
' ' << slice <<
" start" << endl;
55 auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
60 const auto pt1 =
config.get<
float>(
"skims.dijet.pt1");
61 metainfo.Set<
float>(
"skims",
"dijet",
"pt1", pt1);
63 const auto pt2 =
config.get<
float>(
"skims.dijet.pt2");
64 metainfo.Set<
float>(
"skims",
"dijet",
"pt2", pt2);
66 cout <<
"Skimming events: pt(jet1) > " << pt1 <<
"\t pt(jet2) > " << pt2 << endl;
68 vector<RecJet> * recJets =
nullptr;
71 tIn->SetBranchAddress(
"recJets", &recJets);
73 tOut->Branch(
"recDijet", &recDijet);
76 vector<GenJet> * genJets =
nullptr;
79 tIn->SetBranchAddress(
"genJets", &genJets);
81 tOut->Branch(
"genDijet", &genDijet);
84 if (!recJets && !genJets)
85 BOOST_THROW_EXCEPTION(
DE::BadInput(
"No jets in input tree", tIn) );
87 for (
DT::Looper looper(tIn, slice); looper(); ++looper) {
91 bool passesRec =
true, passesGen =
true;
94 passesRec =
keepEvent(*recJets, pt1, pt2);
95 if (passesRec) *recDijet = recJets->at(0) + recJets->at(1);
96 else recDijet->clear();
99 passesGen =
keepEvent(*genJets, pt1, pt2);
100 if (passesGen) *genDijet = genJets->at(0) + genJets->at(1);
101 else genDijet->clear();
104 if ((steering &
DT::fill) ==
DT::fill && (passesRec || passesGen)) tOut->Fill();
107 metainfo.Set<
bool>(
"git",
"complete",
true);
110 cout << __func__ <<
' ' << slice <<
" stop" << endl;
◆ applyZJetSkim()
void DAS::Jets::applyZJetSkim |
( |
const vector< fs::path > & |
inputs, |
|
|
const fs::path & |
output, |
|
|
const pt::ptree & |
config, |
|
|
const int |
steering, |
|
|
const DT::Slice |
slice = {1,0} |
|
) |
| |
Skims the input tree to keep only events with at least two jets, with configurable pT thresholds.
- Parameters
-
inputs | input ROOT files (n-tuples) |
output | output ROOT file (n-tuple) |
config | config handled with `Darwin::Tools::options` |
steering | parameters obtained from explicit options |
slice | number and index of slice |
53 cout << __func__ <<
' ' << slice <<
" start" << endl;
57 auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
62 const auto zpt =
config.get<
float>(
"skims.ZJet.zpt");
63 metainfo.Set<
float>(
"skims",
"ZJet",
"zpt", zpt);
65 const auto jpt =
config.get<
float>(
"skims.ZJet.jpt");
66 metainfo.Set<
float>(
"skims",
"ZJet",
"jpt", jpt);
68 cout <<
"Skimming events: pt(Z) > " << zpt <<
"\t pt(jet) > " << jpt << endl;
70 vector<RecJet> * recJets =
nullptr;
72 tIn->SetBranchAddress(
"recJets", &recJets);
73 vector<GenJet> * genJets =
nullptr;
75 tIn->SetBranchAddress(
"genJets", &genJets);
76 if (!recJets && !genJets)
77 BOOST_THROW_EXCEPTION(
DE::BadInput(
"No jets in input tree", tIn) );
81 tIn->SetBranchAddress(
"recDimuon", &recDimuon);
84 tIn->SetBranchAddress(
"genDimuon", &genDimuon);
85 if (!recDimuon && !genDimuon)
86 BOOST_THROW_EXCEPTION(
DE::BadInput(
"No dimuon in input tree", tIn) );
89 if (recJets && recDimuon) {
91 tOut->Branch(
"recZJet", &recZJet);
94 if (genJets && genDimuon) {
96 tOut->Branch(
"genZJet", &genZJet);
99 for (
DT::Looper looper(tIn, slice); looper(); ++looper) {
103 bool passesRec =
true, passesGen =
true;
106 passesRec =
keepEvent(*recJets, *recDimuon, zpt, jpt);
107 if (passesRec) *recZJet = *recDimuon + recJets->at(0);
108 else recZJet->clear();
111 passesGen =
keepEvent(*genJets, *genDimuon, zpt, jpt);
112 if (passesGen) *genZJet = *genDimuon + genJets->at(0);
113 else genZJet->clear();
116 if ((steering &
DT::fill) ==
DT::fill && (passesRec || passesGen)) tOut->Fill();
119 metainfo.Set<
bool>(
"git",
"complete",
true);
122 cout << __func__ <<
' ' << slice <<
" stop" << endl;
◆ keepEvent() [1/2]
bool DAS::Jets::keepEvent |
( |
const vector< Jet > & |
jets, |
|
|
const Dimuon & |
dimuon, |
|
|
float |
zpt, |
|
|
float |
jpt |
|
) |
| |
Checks whether an event should be kept.
38 return jets.size() >= 2 &&
jets[0].p4.Pt() > jpt &&
39 dimuon && dimuon.CorrP4().Pt() > zpt;
◆ keepEvent() [2/2]
bool DAS::Jets::keepEvent |
( |
const vector< Jet > & |
jets, |
|
|
float |
pt1, |
|
|
float |
pt2 |
|
) |
| |
Checks whether an event should be kept.
37 return jets.size() >= 2 &&
jets[0].p4.Pt() > pt1 &&
jets[1].p4.Pt() > pt2;
static bool verbose
Definition: Step.h:40
Di< GenJet, GenJet > GenDijet
Definition: Di.h:77
Di< GenDimuon, GenJet > GenZJet
Definition: Di.h:79
string jets
Definition: Ntupliser_cfg.py:41
config
Definition: Ntupliser_cfg.py:263
Di< RecDimuon, RecJet > RecZJet
Definition: Di.h:82
bool keepEvent(const vector< Jet > &jets, const Dimuon &dimuon, float zpt, float jpt)
Checks whether an event should be kept.
Definition: applyZJetSkim.cc:36
bool branchExists(const TTreePtr &tree, TString brName)
Definition: toolbox.h:27
Di< RecJet, RecJet > RecDijet
Definition: Di.h:80
def inputs
Definition: jercExample.py:118
bool keepEvent(const vector< Jet > &jets, float pt1, float pt2)
Checks whether an event should be kept.
Definition: applyDijetSkim.cc:35
#define DT_GetOutput(output)
Definition: FileUtils.h:96
Di< RecMuon, RecMuon > RecDimuon
Definition: Di.h:81
Di< GenMuon, GenMuon > GenDimuon
Definition: Di.h:78