1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
| // -*- C++ -*-
#include "Rivet/Analysis.hh"
#include "Rivet/Projections/DirectFinalState.hh"
#include "Rivet/Projections/FastJets.hh"
#include "Rivet/Tools/Cutflow.hh"
namespace Rivet {
/// @brief Demonstrate use of the Cutflow(s) classes
class EXAMPLE_CUTFLOW : public Analysis {
public:
/// Constructor
RIVET_DEFAULT_ANALYSIS_CTOR(EXAMPLE_CUTFLOW);
/// @name Analysis methods
//@{
/// Set up projections and book histograms
void init() {
// Projections
const DirectFinalState leps(Cuts::abseta < 4 && (Cuts::abspid == PID::ELECTRON || Cuts::abspid == PID::MUON));
declare(leps, "Leptons");
const FinalState fs(Cuts::abseta < 4);
const FastJets jets(fs, FastJets::Algo::ANTIKT, 0.4);
declare(jets, "Jets");
// Histograms
// book(_s_cutflow, "cutflow");
// Cut-flows
_cutflows.addCutflow("JetLep", {"Jets", "Nlep", "pTlep1", "yLep1"});
_cutflows.addCutflow("DiBjet", {"Jets", "0Lep", "2Jet", "Nbjets", });
}
/// Do the analysis
void analyze(const Event& event) {
_cutflows.fillinit();
const Jets jets = apply<JetFinder>(event, "Jets").jetsByPt();
const Particles leps = apply<FinalState>(event, "Leptons").particlesByPt();
if (jets.empty()) vetoEvent;
_cutflows.fill(1);
if (!leps.empty()) {
_cutflows["JetLep"].fill(2);
if (!_cutflows["JetLep"].fillnext(leps[0].pT() < 20*GeV)) vetoEvent;
_cutflows["JetLep"].fillnext(leps[0].absrap() < 2.5);
} else {
Cutflow& cf = _cutflows["DiBjet"];
cf.fillnext();
const Jets bjets = filter_select(jets, hasBTag(Cuts::pT > 5*GeV));
cf.fillnext({jets.size() >= 2, bjets.size() == 2});
}
}
/// Finalize
void finalize() {
MSG_INFO("Cut-flow:\n" << _cutflows);
}
//@}
/// Cut-flow counters
Cutflows _cutflows;
};
// The hook for the plugin system
RIVET_DECLARE_PLUGIN(EXAMPLE_CUTFLOW);
}
|