ATLAS Offline Software
JetVertexNNTagger.h
Go to the documentation of this file.
1 // this file is -*- C++ -*-
2 /*
3  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 #ifndef JETVERTEXNNTAGGER_H
7 #define JETVERTEXNNTAGGER_H
8 
18 
19 #include <string>
20 #include <vector>
21 #include <utility>
22 #include <memory>
23 #include <functional>
24 #include <optional>
25 
27 #include "AsgTools/AsgTool.h"
33 
34 #include "xAODJet/JetContainer.h"
36 
37 #include "lwtnn/generic/FastGraph.hh"
38 
39 namespace JetPileupTag {
40 
41  // Because there is no SystemOfUnits.h in AnalysisBase
42  constexpr float GeV=1e3;
43 
45  : public asg::AsgTool,
46  virtual public IJetDecorator
47  {
49 
50  public:
52  JetVertexNNTagger(const std::string& name);
55 
56  // Called in parent initialize()
57  virtual StatusCode initialize() override;
58 
59  // Inherited method to decorate a jet container
60  virtual StatusCode decorate(const xAOD::JetContainer& jetCont) const override;
61 
62  private:
63 
64  // Retrieve hard scatter vertex for its index. Return nullptr if one cannot be found
65  const xAOD::Vertex *findHSVertex(const xAOD::VertexContainer& vertices) const;
66 
67  // Evaluate JVT from Rpt and JVFcorr
68  float evaluateJvt(float rpt, float jvfcorr, size_t ptbin, size_t etabin) const;
69 
72  std::unique_ptr<lwt::generic::FastGraph<double> > m_lwnn {nullptr};
73  // The Jvt bins and cut map
75 
76  // Generically needed for moment tools
77  Gaudi::Property<std::string> m_jetContainerName{this,"JetContainer", "", "SG key for the input jet container"};
78  Gaudi::Property<bool> m_suppressInputDeps{this, "SuppressInputDependence", false, "Will JVFCorr and SumPtTrk be created in the same algorithm that uses this tool?"};
79  Gaudi::Property<bool> m_suppressOutputDeps{this, "SuppressOutputDependence", false, "Ignore creating the output decoration dependency for data flow; for analysis"};
80 
81  // NN configuration
82  Gaudi::Property<std::string> m_NNConfigDir{this,"NNConfigDir", "JetPileupTag/NNJvt/2022-03-22", "PathResolver-accessible directory holding config files"};
83  Gaudi::Property<std::string> m_NNParamFileName{this,"NNParamFile", "NNJVT.Network.graph.Offline.Nonprompt_All_MaxWeight.json", "Name of json file containing network parameters"};
84  Gaudi::Property<std::string> m_NNCutFileName{this,"NNCutFile", "NNJVT.Cuts.FixedEffPt.Offline.Nonprompt_All_MaxW.json", "Name of json file containing network parameters"};
85  // Additional steering
86  Gaudi::Property<float> m_maxpt_for_cut{this,"MaxPtForCut", 60*GeV, "Jet pt above which no cut is applied"};
87 
88 
89  // Access to inputs from StoreGate
90  SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContainer_key{this, "VertexContainer", "PrimaryVertices", "SG key for input vertex container"};
91  SG::ReadDecorHandleKey<xAOD::JetContainer> m_jvfCorrKey{this, "JVFCorrName", "JVFCorr", "SG key for input JVFCorr decoration"};
92  SG::ReadDecorHandleKey<xAOD::JetContainer> m_sumPtTrkKey{this, "SumPtTrkName", "SumPtTrkPt500", "SG key for input SumPtTrk decoration"};
93  SG::WriteDecorHandleKey<xAOD::JetContainer> m_jvtKey{this, "JVTName", "NNJvt", "SG key for output JVT decoration"};
94  SG::WriteDecorHandleKey<xAOD::JetContainer> m_rptKey{this, "RpTName", "NNJvtRpt", "SG key for output RpT decoration"};
95  SG::WriteDecorHandleKey<xAOD::JetContainer> m_passJvtKey{this, "passJvtName", "NNJvtPass", "SG key for output pass-JVT decoration"};
96  };
97 
98 }
99 #endif
JetPileupTag::JetVertexNNTagger::m_maxpt_for_cut
Gaudi::Property< float > m_maxpt_for_cut
Definition: JetVertexNNTagger.h:86
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
JetPileupTag::JetVertexNNTagger
Definition: JetVertexNNTagger.h:47
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
JetPileupTag::NNJvtCutMap
The NNJvt cut maps.
Definition: NNJvtBinning.h:50
JetPileupTag::JetVertexNNTagger::evaluateJvt
float evaluateJvt(float rpt, float jvfcorr, size_t ptbin, size_t etabin) const
Definition: JetVertexNNTagger.cxx:116
JetPileupTag::JetVertexNNTagger::m_jvtKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jvtKey
Definition: JetVertexNNTagger.h:93
JetPileupTag::JetVertexNNTagger::m_cutMap
NNJvtCutMap m_cutMap
Definition: JetVertexNNTagger.h:74
JetPileupTag::JetVertexNNTagger::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetVertexNNTagger.cxx:34
IJetDecorator
Interface for adding a decoration to a jet container.
Definition: IJetDecorator.h:21
JetPileupTag::JetVertexNNTagger::JetVertexNNTagger
JetVertexNNTagger(const std::string &name)
Constructor with a tool name.
Definition: JetVertexNNTagger.cxx:29
JetPileupTag::JetVertexNNTagger::findHSVertex
const xAOD::Vertex * findHSVertex(const xAOD::VertexContainer &vertices) const
Definition: JetVertexNNTagger.cxx:128
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
IJetDecorator.h
JetPileupTag
Definition: JetVertexNNTagger.h:39
JetPileupTag::JetVertexNNTagger::m_suppressOutputDeps
Gaudi::Property< bool > m_suppressOutputDeps
Definition: JetVertexNNTagger.h:79
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
JetPileupTag::JetVertexNNTagger::m_vertexContainer_key
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
Definition: JetVertexNNTagger.h:90
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
JetPileupTag::JetVertexNNTagger::m_rptKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_rptKey
Definition: JetVertexNNTagger.h:94
JetPileupTag::JetVertexNNTagger::~JetVertexNNTagger
~JetVertexNNTagger()
Destructor.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
JetPileupTag::JetVertexNNTagger::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: JetVertexNNTagger.h:77
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
JetPileupTag::JetVertexNNTagger::m_NNConfigDir
Gaudi::Property< std::string > m_NNConfigDir
Definition: JetVertexNNTagger.h:82
WriteDecorHandleKey.h
JetPileupTag::JetVertexNNTagger::m_suppressInputDeps
Gaudi::Property< bool > m_suppressInputDeps
Definition: JetVertexNNTagger.h:78
VertexContainer.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
JetContainer.h
JetPileupTag::JetVertexNNTagger::m_jvfCorrKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jvfCorrKey
Definition: JetVertexNNTagger.h:91
JetPileupTag::JetVertexNNTagger::m_passJvtKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_passJvtKey
Definition: JetVertexNNTagger.h:95
JetPileupTag::JetVertexNNTagger::m_sumPtTrkKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_sumPtTrkKey
Definition: JetVertexNNTagger.h:92
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
JetPileupTag::GeV
constexpr float GeV
Definition: JetVertexNNTagger.h:42
JetPileupTag::JetVertexNNTagger::m_NNCutFileName
Gaudi::Property< std::string > m_NNCutFileName
Definition: JetVertexNNTagger.h:84
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
JetPileupTag::JetVertexNNTagger::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jetCont) const override
Decorate a jet collection without otherwise modifying it.
Definition: JetVertexNNTagger.cxx:146
AsgTool.h
JetPileupTag::JetVertexNNTagger::m_lwnn
std::unique_ptr< lwt::generic::FastGraph< double > > m_lwnn
Internal members for interpreting jet inputs and NN configuration.
Definition: JetVertexNNTagger.h:72
NNJvtBinning.h
JetPileupTag::JetVertexNNTagger::m_NNParamFileName
Gaudi::Property< std::string > m_NNParamFileName
Definition: JetVertexNNTagger.h:83