ATLAS Offline Software
JetForwardJvtToolBDT.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // JetForwardJvtToolBDT.h
8 // Header file for class JetForwardJvtToolBDT
9 // Author: Louis Portales<louis.portales@cern.ch>
11 #ifndef FORWARDJVTTOOLBDT_JVT_FORWARDJVTTOOLBDT_H
12 #define FORWARDJVTTOOLBDT_JVT_FORWARDJVTTOOLBDT_H 1
13 
14 // STL includes
15 #include <string>
16 
17 // Root includes
18 #include "TMVA/Reader.h"
19 #include <TH3.h>
20 #include <TString.h>
21 #include <TFile.h>
22 
23 // FrameWork includes
24 #include "AsgTools/ToolHandle.h"
25 #include "AsgTools/AnaToolHandle.h"
27 
28 // EDM includes
30 #include "xAODJet/JetContainer.h"
36 #include "AsgTools/IAsgTool.h"
41 
42 
43 namespace TMVA{ class Reader; }
44 
46  : public asg::AsgTool,
47  virtual public IJetDecorator{
49 
50 
51  // Public methods:
53  public:
54 
55 
57  JetForwardJvtToolBDT(const std::string& name);
58 
61 
62  // Athena algtool's Hooks
63  virtual StatusCode initialize() override;
64 
65  virtual StatusCode decorate(const xAOD::JetContainer& jetCont) const override;
66 
67  // MVfJVT
68  StatusCode getInputs ( const xAOD::Jet *jet ) const;
69  float getMVfJVT ( const xAOD::Jet *jet, int pvind , const std::vector<TVector2>& pileupMomenta ) const;
70  float getFJVT ( const xAOD::Jet *jet, int pvind , const std::vector<TVector2>& pileupMomenta ) const;
71  bool forwardJet ( const xAOD::Jet *jet ) const;
72  bool centralJet ( const xAOD::Jet *jet ) const;
73  float getDrpt ( const xAOD::Jet *jet ) const;
74  int getJetVertex ( const xAOD::Jet *jet ) const;
75  bool passMVfJVT ( float mvfjvt , float pt, float eta ) const;
76 
78  std::vector<TVector2> calculateVertexMomenta(const xAOD::JetContainer *jets, int pvind) const;
79  int getPV() const;
80 
81 private:
82 
83  Gaudi::Property<std::string> m_configDir{this, "configDir", "JetPileupTag/MVfJVT/", "Configuration directory"};
84  Gaudi::Property<std::vector<std::string> > m_MVconfig{this, "ConfigFiles", {
85  "weights/MVfJVT_pt2030_etaHigh_muHigh.May2019.weights.xml",
86  "weights/MVfJVT_pt2030_etaLow_muHigh.May2019.weights.xml",
87  "weights/MVfJVT_pt3040_etaHigh_muHigh.May2019.weights.xml",
88  "weights/MVfJVT_pt3040_etaLow_muHigh.May2019.weights.xml",
89  "weights/MVfJVT_pt4050_etaHigh_muHigh.May2019.weights.xml",
90  "weights/MVfJVT_pt4050_etaLow_muHigh.May2019.weights.xml",
91  "weights/MVfJVT_pt50plus_etaHigh_muHigh.May2019.weights.xml",
92  "weights/MVfJVT_pt50plus_etaLow_muHigh.May2019.weights.xml",
93  "weights/MVfJVT_pt2030_etaHigh_muLow.May2019.weights.xml",
94  "weights/MVfJVT_pt2030_etaLow_muLow.May2019.weights.xml",
95  "weights/MVfJVT_pt3040_etaHigh_muLow.May2019.weights.xml",
96  "weights/MVfJVT_pt3040_etaLow_muLow.May2019.weights.xml",
97  "weights/MVfJVT_pt4050_etaHigh_muLow.May2019.weights.xml",
98  "weights/MVfJVT_pt4050_etaLow_muLow.May2019.weights.xml",
99  "weights/MVfJVT_pt50plus_etaHigh_muLow.May2019.weights.xml",
100  "weights/MVfJVT_pt50plus_etaLow_muLow.May2019.weights.xml"
101  }, "List of config file names"}; // pt [20,30,40,50,120] || |eta| [2.5,3.2,4.5] || mu [0,50,inf.];
102  Gaudi::Property<std::string> m_wpFile{this, "WPfile", "MVfJVT_WPs.Nov2019.root", "WP file"};
103 
104  std::unique_ptr< TFile > m_wpFileIn;
105  std::unique_ptr< TMVA::Reader > m_MVreader;
106  std::unique_ptr< TH3D > m_mvfjvtThresh;
107 
108  Gaudi::Property<double> m_etaThresh{this, "EtaThresh", 2.5, "Eta threshold"};
109  Gaudi::Property<double> m_forwardMinPt{this, "ForwardMinPt", 20e3, "Forward minimum pt"};
110  Gaudi::Property<double> m_forwardMaxPt{this, "ForwardMaxPt", 120e3, "Forward maximum pt"};
111  Gaudi::Property<double> m_centerMinPt{this, "CentralMinPt", 20e3, "Central minimum pt"};
112  Gaudi::Property<double> m_centerMaxPt{this, "CentralMaxPt", -1, "Central maximum pt (set to -1 for no limit)"};
113  Gaudi::Property<double> m_centerJvtThresh{this, "CentralJvtThresh", 0.11, "Central JVT threshold"};
114  Gaudi::Property<std::string> m_jvtMomentName{this, "JvtMomentName", "Jvt", "SG key for JVT moment"};
115  Gaudi::Property<double> m_centerDrptThresh{this, "CentralDrptThresh", 0.2, "Central drpt threshold"};
116  Gaudi::Property<double> m_maxStochPt{this, "CentralMaxStochPt", 35e3, "Central maximum stochpt"};
117  Gaudi::Property<double> m_jetScaleFactor{this, "JetScaleFactor", 0.4, "Jet scale factor"};
118  Gaudi::Property<std::string> m_OP{this, "OperatingPoint", "DEFAULT", "Selected operating point, can be 'LOOSE', 'TIGHT' or 'TIGHTER'"};
119  Gaudi::Property<bool> m_getTagger{this, "retrieveTagger", false, "Whether to retrieve the tagger"};
120  Gaudi::Property<bool> m_isAna{this, "AnaToolMode", false, "True if running in AnaTool mode"};
121  Gaudi::Property<int> m_pvind{this, "PVIndexHS", -1, ""};
122 
123  Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", "SG key of input jet container"};
124 
125  SG::WriteDecorHandleKey<xAOD::JetContainer> m_outMVKey{this, "OutputDecMV", "passMVFJVT", "SG key for the output MV decoration"};
126 
127  SG::WriteDecorHandleKey<xAOD::JetContainer> m_mvfjvtKey{this, "MVFJVTName", "MVfJVT", "SG key for the output MVfJVT decoration"};
128  SG::WriteDecorHandleKey<xAOD::JetContainer> m_cllambda2Key{this, "cllambda2Name", "LeadclSecondLambda", "SG key for the LeadclSecondLambda decoration"};
129  SG::WriteDecorHandleKey<xAOD::JetContainer> m_clwidthKey{this, "cletawidthName", "LeadclWidth", "SG key for the cluster eta width decoration"};
130  SG::WriteDecorHandleKey<xAOD::JetContainer> m_clisoKey{this, "clisoName", "SumclIso", "SG key for the cluster isolation decoration"};
131  SG::WriteDecorHandleKey<xAOD::JetContainer> m_clemprobKey{this, "clemprobName", "SumclEMprob", "SG key for the cluster EMprob decoration"};
132  SG::WriteDecorHandleKey<xAOD::JetContainer> m_cleKey{this, "cleName", "Sumcle", "SG key for the cluster energy decoration"};
133 
134  SG::ReadDecorHandleKey<xAOD::JetContainer> m_lcllambda2NTKey{this, "lcllambda2NTName", "LeadingClusterSecondLambda", "Leading cluster second lambda to use if getTagger is false"};
135  SG::ReadDecorHandleKey<xAOD::JetContainer> m_lcllambda2Key{this, "lcllambda2Name", "DFCommonJets_MVfJVT_LeadclSecondLambda", "Leading cluster second lambda to use if getTagger is true"};
136  SG::ReadDecorHandleKey<xAOD::JetContainer> m_lclwidthKey{this, "lclwidthName", "DFCommonJets_MVfJVT_LeadclWidth", "Leading cluster width to use if getTagger is true"};
137  SG::ReadDecorHandleKey<xAOD::JetContainer> m_lclisoKey{this, "lclisoName", "DFCommonJets_MVfJVT_SumclIso", "Leading cluster isolation to use if getTagger is true"};
138  SG::ReadDecorHandleKey<xAOD::JetContainer> m_lclemprobKey{this, "lclemprobName", "DFCommonJets_MVfJVT_SumclEMprob", "Leading cluster EMprob to use if getTagger is true"};
139  SG::ReadDecorHandleKey<xAOD::JetContainer> m_lcleKey{this, "lcleName", "DFCommonJets_MVfJVT_Sumcle", "Leading cluster energy to use if getTagger is true"};
140 
141  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfoName", "EventInfo", "SG key for input EventInfo"};
142  SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContainerKey{this, "VertexContainerName", "PrimaryVertices", "SG key for input vertex container"};
143  SG::ReadHandleKey<xAOD::CaloClusterContainer> m_caloClusterContainerKey{this, "CaloClusterContainerName" "CaloCalTopoClusters", "SG key for input calo cluster container"};
144  SG::ReadHandleKey<xAOD::MissingETContainer> m_trkMetKey{this, "TrackMetName", "MET_Track", "SG key for input track MET container"};
145 
146  SG::WriteDecorHandleKey<xAOD::JetContainer> m_isHSKey{this, "isHSName", "isJvtHS", "SG key for output isHS decoration"};
147  SG::WriteDecorHandleKey<xAOD::JetContainer> m_isPUKey{this, "isPUName", "isJvtPU", "SG key for output isPU decoration"};
148 
149 };
150 #endif //> !FORWARDJVTTOOLBDT_JVT_FORWARDJVTTOOLBDT_H
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
JetForwardJvtToolBDT::m_lcllambda2Key
SG::ReadDecorHandleKey< xAOD::JetContainer > m_lcllambda2Key
Definition: JetForwardJvtToolBDT.h:135
JetForwardJvtToolBDT::m_isHSKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_isHSKey
Definition: JetForwardJvtToolBDT.h:146
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
JetForwardJvtToolBDT::m_etaThresh
Gaudi::Property< double > m_etaThresh
Definition: JetForwardJvtToolBDT.h:108
JetForwardJvtToolBDT::m_lclisoKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_lclisoKey
Definition: JetForwardJvtToolBDT.h:137
PropertyWrapper.h
JetForwardJvtToolBDT::m_mvfjvtThresh
std::unique_ptr< TH3D > m_mvfjvtThresh
Definition: JetForwardJvtToolBDT.h:106
JetForwardJvtToolBDT::m_mvfjvtKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_mvfjvtKey
Definition: JetForwardJvtToolBDT.h:127
JetForwardJvtToolBDT::m_centerMaxPt
Gaudi::Property< double > m_centerMaxPt
Definition: JetForwardJvtToolBDT.h:112
JetForwardJvtToolBDT::m_clwidthKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_clwidthKey
Definition: JetForwardJvtToolBDT.h:129
JetForwardJvtToolBDT::m_configDir
Gaudi::Property< std::string > m_configDir
Definition: JetForwardJvtToolBDT.h:83
JetForwardJvtToolBDT::centralJet
bool centralJet(const xAOD::Jet *jet) const
Definition: JetForwardJvtToolBDT.cxx:389
JetForwardJvtToolBDT::getDrpt
float getDrpt(const xAOD::Jet *jet) const
Definition: JetForwardJvtToolBDT.cxx:415
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
JetForwardJvtToolBDT::~JetForwardJvtToolBDT
virtual ~JetForwardJvtToolBDT()
Destructor:
test_pyathena.pt
pt
Definition: test_pyathena.py:11
IJetDecorator
Interface for adding a decoration to a jet container.
Definition: IJetDecorator.h:21
JetForwardJvtToolBDT::m_pvind
Gaudi::Property< int > m_pvind
Definition: JetForwardJvtToolBDT.h:121
JetForwardJvtToolBDT
Definition: JetForwardJvtToolBDT.h:47
SG::ReadHandleKey< xAOD::EventInfo >
IJetDecorator.h
JetForwardJvtToolBDT::m_outMVKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_outMVKey
Definition: JetForwardJvtToolBDT.h:125
JetForwardJvtToolBDT::m_getTagger
Gaudi::Property< bool > m_getTagger
Definition: JetForwardJvtToolBDT.h:119
JetForwardJvtToolBDT::getJetVertex
int getJetVertex(const xAOD::Jet *jet) const
Definition: JetForwardJvtToolBDT.cxx:400
JetForwardJvtToolBDT::m_cllambda2Key
SG::WriteDecorHandleKey< xAOD::JetContainer > m_cllambda2Key
Definition: JetForwardJvtToolBDT.h:128
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
JetForwardJvtToolBDT::getInputs
StatusCode getInputs(const xAOD::Jet *jet) const
Definition: JetForwardJvtToolBDT.cxx:286
JetForwardJvtToolBDT::m_forwardMinPt
Gaudi::Property< double > m_forwardMinPt
Definition: JetForwardJvtToolBDT.h:109
JetForwardJvtToolBDT::m_trkMetKey
SG::ReadHandleKey< xAOD::MissingETContainer > m_trkMetKey
Definition: JetForwardJvtToolBDT.h:144
JetForwardJvtToolBDT::m_lcllambda2NTKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_lcllambda2NTKey
Definition: JetForwardJvtToolBDT.h:134
JetForwardJvtToolBDT::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jetCont) const override
Decorate a jet collection without otherwise modifying it.
Definition: JetForwardJvtToolBDT.cxx:132
JetForwardJvtToolBDT::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: JetForwardJvtToolBDT.h:141
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
JetForwardJvtToolBDT::m_centerMinPt
Gaudi::Property< double > m_centerMinPt
Definition: JetForwardJvtToolBDT.h:111
JetForwardJvtToolBDT::calculateVertexMomenta
std::vector< TVector2 > calculateVertexMomenta(const xAOD::JetContainer *jets, int pvind) const
Definition: JetForwardJvtToolBDT.cxx:351
JetForwardJvtToolBDT::tagTruth
StatusCode tagTruth(const xAOD::JetContainer *jets, const xAOD::JetContainer *truthJets)
Definition: JetForwardJvtToolBDT.cxx:444
JetForwardJvtToolBDT::m_lclemprobKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_lclemprobKey
Definition: JetForwardJvtToolBDT.h:138
CaloCluster.h
JetForwardJvtToolBDT::getFJVT
float getFJVT(const xAOD::Jet *jet, int pvind, const std::vector< TVector2 > &pileupMomenta) const
Definition: JetForwardJvtToolBDT.cxx:184
JetForwardJvtToolBDT::m_clemprobKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_clemprobKey
Definition: JetForwardJvtToolBDT.h:131
JetForwardJvtToolBDT::passMVfJVT
bool passMVfJVT(float mvfjvt, float pt, float eta) const
Definition: JetForwardJvtToolBDT.cxx:265
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JetForwardJvtToolBDT::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: JetForwardJvtToolBDT.h:123
JetForwardJvtToolBDT::m_wpFileIn
std::unique_ptr< TFile > m_wpFileIn
Definition: JetForwardJvtToolBDT.h:104
LHEF::Reader
Pythia8::Reader Reader
Definition: Prophecy4fMerger.cxx:11
JetForwardJvtToolBDT::m_lclwidthKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_lclwidthKey
Definition: JetForwardJvtToolBDT.h:136
JetForwardJvtToolBDT::m_clisoKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_clisoKey
Definition: JetForwardJvtToolBDT.h:130
IAsgTool.h
JetForwardJvtToolBDT::m_forwardMaxPt
Gaudi::Property< double > m_forwardMaxPt
Definition: JetForwardJvtToolBDT.h:110
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
WriteDecorHandle.h
Handle class for adding a decoration to an object.
JetForwardJvtToolBDT::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetForwardJvtToolBDT.cxx:38
AnaToolHandle.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
JetForwardJvtToolBDT::m_isPUKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_isPUKey
Definition: JetForwardJvtToolBDT.h:147
JetForwardJvtToolBDT::m_caloClusterContainerKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_caloClusterContainerKey
Definition: JetForwardJvtToolBDT.h:143
JetForwardJvtToolBDT::m_jetScaleFactor
Gaudi::Property< double > m_jetScaleFactor
Definition: JetForwardJvtToolBDT.h:117
EventInfo.h
JetForwardJvtToolBDT::m_MVreader
std::unique_ptr< TMVA::Reader > m_MVreader
Definition: JetForwardJvtToolBDT.h:105
WriteDecorHandleKey.h
JetForwardJvtToolBDT::m_cleKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_cleKey
Definition: JetForwardJvtToolBDT.h:132
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
JetForwardJvtToolBDT::m_wpFile
Gaudi::Property< std::string > m_wpFile
Definition: JetForwardJvtToolBDT.h:102
VertexContainer.h
JetContainer.h
JetForwardJvtToolBDT::m_maxStochPt
Gaudi::Property< double > m_maxStochPt
Definition: JetForwardJvtToolBDT.h:116
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
JetForwardJvtToolBDT::m_jvtMomentName
Gaudi::Property< std::string > m_jvtMomentName
Definition: JetForwardJvtToolBDT.h:114
ReadDecorHandle.h
Handle class for reading a decoration on an object.
CaloClusterContainer.h
JetForwardJvtToolBDT::m_OP
Gaudi::Property< std::string > m_OP
Definition: JetForwardJvtToolBDT.h:118
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
JetForwardJvtToolBDT::m_centerDrptThresh
Gaudi::Property< double > m_centerDrptThresh
Definition: JetForwardJvtToolBDT.h:115
JetForwardJvtToolBDT::getMVfJVT
float getMVfJVT(const xAOD::Jet *jet, int pvind, const std::vector< TVector2 > &pileupMomenta) const
Definition: JetForwardJvtToolBDT.cxx:199
JetForwardJvtToolBDT::m_isAna
Gaudi::Property< bool > m_isAna
Definition: JetForwardJvtToolBDT.h:120
JetForwardJvtToolBDT::m_lcleKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_lcleKey
Definition: JetForwardJvtToolBDT.h:139
ToolHandle.h
JetForwardJvtToolBDT::getPV
int getPV() const
Definition: JetForwardJvtToolBDT.cxx:428
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
JetForwardJvtToolBDT::forwardJet
bool forwardJet(const xAOD::Jet *jet) const
Definition: JetForwardJvtToolBDT.cxx:382
JetForwardJvtToolBDT::JetForwardJvtToolBDT
JetForwardJvtToolBDT(const std::string &name)
Constructor with parameters:
Definition: JetForwardJvtToolBDT.cxx:27
MissingETContainer.h
JetForwardJvtToolBDT::m_vertexContainerKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainerKey
Definition: JetForwardJvtToolBDT.h:142
TMVA
Definition: PhotonVertexSelectionTool.h:22
JetForwardJvtToolBDT::m_centerJvtThresh
Gaudi::Property< double > m_centerJvtThresh
Definition: JetForwardJvtToolBDT.h:113
JetForwardJvtToolBDT::m_MVconfig
Gaudi::Property< std::vector< std::string > > m_MVconfig
Definition: JetForwardJvtToolBDT.h:84