An example of how to quickly make some plots at a certain point in the cutflow.
More...
#include <JetResponsePlots.h>
An example of how to quickly make some plots at a certain point in the cutflow.
Definition at line 31 of file JetResponsePlots.h.
◆ JetResponsePlots()
top::JetResponsePlots::JetResponsePlots |
( |
const std::string & |
name, |
|
|
TFile * |
outputFile, |
|
|
const std::string & |
params, |
|
|
std::shared_ptr< top::TopConfig > |
config, |
|
|
EL::Worker * |
wk = nullptr |
|
) |
| |
Setup some example plots.
Add a bunch of histograms.
- Parameters
-
name | The name of the directory to store histograms in, in the output file. e.g. you might have ee, mumu and emu. |
outputFile | The output file. Needs setting up at the very start so that we can attach the files. |
params | The arguments, e.g. for the binning of the plots. |
config | Instance of TopConfig |
wk | Only used by EventLoop, ok as nullptr as default. |
Definition at line 24 of file JetResponsePlots.cxx.
41 static const std::string truthWeightToolName =
"PMGTruthWeightTool";
42 if (asg::ToolStore::contains<PMGTools::IPMGTruthWeightTool>(truthWeightToolName))
m_PMGTruthWeights =
43 asg::ToolStore::get<PMGTools::IPMGTruthWeightTool>(truthWeightToolName);
45 std::unique_ptr<PMGTools::PMGTruthWeightTool> pmgtruthtool = std::make_unique<PMGTools::PMGTruthWeightTool>(truthWeightToolName);
53 if (
s.substr(0,7) ==
"deltaR:") {
54 m_deltaR = std::stof(
s.substr(7,
s.size() - 7));
56 }
else if (
s.substr(0,5) ==
"bins:") {
57 m_bins = std::stoi(
s.substr(5,
s.size() - 5));
58 }
else if (
s.substr(0,4) ==
"min:") {
59 m_min = std::stof(
s.substr(4,
s.size() - 4));
60 }
else if (
s.substr(0,4) ==
"max:") {
61 m_max = std::stof(
s.substr(4,
s.size() - 4));
62 }
else if (
s.substr(0,10) ==
"ptBinning:") {
63 const std::string
tmp =
s.substr(10,
s.size() - 4);
65 std::vector<std::string>
split;
67 for (
const std::string& istring :
split) {
71 throw std::runtime_error{
"ERROR: Can't understand argument " +
s +
"For JETRESPONSEPLOTS"};
76 throw std::invalid_argument{
"pT binning (x axis) size is smaller than 2"};
◆ apply()
Fill the histograms.
- Returns
- True because it doesn't select any events.
Implements top::EventSelectorBase.
Definition at line 90 of file JetResponsePlots.cxx.
98 if (
event.m_isLoose && !
m_config->doLooseEvents())
return true;
100 if (!
event.m_isLoose && !
m_config->doTightEvents())
return true;
102 const double nominalWeight =
event.m_info->auxdata<
float>(
"AnalysisTop_eventWeight");
◆ applyParticleLevel()
This does stuff based on the information in a particle level event.
The idea is that you implement this to return either true or false, based on the information held within the top::ParticleLevelEvent. If this function returns true, then the event is kept, otherwise it is removed. The function has a default implementation (which returns true) because it is expected that many EventSelector objects do not operate on ParticleLevelEvent objects.
- Parameters
-
top::ParticleLevelEvent | the current particle level event. |
true | if the event should be kept (i.e. it passed the selector criteria), false otherwise. |
Reimplemented in top::JetNGhostSelector, top::PrintEventSelector, top::PseudoTopRecoRun, top::NElectronNMuonTightSelector, top::NElectronNMuonSelector, top::NFwdElectronSelector, top::HTSelector, top::OSLeptonTightSelector, top::MLLSelector, top::MWTSelector, top::NElectronTightSelector, top::NFwdElectronTightSelector, top::NMuonTightSelector, top::OSLeptonSelector, top::METMWTSelector, top::METSelector, top::MLLWindow, top::NElectronSelector, top::NJetSelector, top::NMuonSelector, top::NPhotonSelector, top::NSoftMuonSelector, top::NTauSelector, top::SSLeptonTightSelector, top::SSLeptonSelector, top::ParticleLevelSelector, top::RecoLevelSelector, top::NVarRCJetSelector, top::NLargeJetSelector, and top::NRCJetSelector.
Definition at line 73 of file EventSelectorBase.h.
◆ FillHistograms()
Helper function to fill the histograms.
Definition at line 109 of file JetResponsePlots.cxx.
112 for (
const auto*
const jetPtr :
event.m_jets) {
113 int jet_flavor = -99;
114 bool status = jetPtr->getAttribute<
int>(
"HadronConeExclExtendedTruthLabelID", jet_flavor);
117 float matchedPt = -9999;
118 status = jetPtr->getAttribute<
float>(
"AnalysisTop_MatchedTruthJetPt", matchedPt);
122 if (matchedPt < 1
e-6)
continue;
124 const float response = jetPtr->pt() / matchedPt;
127 if (jet_flavor == 55) {
129 }
else if (jet_flavor == 5 || jet_flavor == 54) {
131 }
else if (jet_flavor == 4 || jet_flavor == 44) {
133 }
else if (jet_flavor == 15) {
136 status = jetPtr->getAttribute<
int>(
"PartonTruthLabelID", jet_flavor);
138 if (jet_flavor >= 1 && jet_flavor <= 3) {
140 }
else if (jet_flavor == 21) {
◆ name()
std::string top::JetResponsePlots::name |
( |
| ) |
const |
|
overridevirtual |
◆ m_bins
int top::JetResponsePlots::m_bins |
|
private |
◆ m_config
◆ m_deltaR
float top::JetResponsePlots::m_deltaR |
|
private |
◆ m_hists
std::shared_ptr<PlotManager> top::JetResponsePlots::m_hists |
|
private |
◆ m_max
float top::JetResponsePlots::m_max |
|
private |
◆ m_min
float top::JetResponsePlots::m_min |
|
private |
◆ m_nominalHashValue
std::size_t top::JetResponsePlots::m_nominalHashValue |
|
private |
◆ m_PMGTruthWeights
◆ m_ptBinning
std::vector<double> top::JetResponsePlots::m_ptBinning |
|
private |
The documentation for this class was generated from the following files:
void tokenize(const std::string &input, Container &output, const std::string &delimiters=" ", bool trim_empty=false)
Tokenize an input string using a set of delimiters.