ATLAS Offline Software
JetForwardPFlowJvtTool.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 // JetForwardPFlowJvtTool.h
8 // Header file for class JetForwardPFlowJvtTool
9 // Author: Anastasia Kotsokechagia <anastasia.kotsokechagia@cern.ch>
10 
11 // Tool for calculating fjvt values for pflow jets.
12 // Short describtion of the tool;
13 // First central PU jets are built per vertex.
14 // Reconstructed calibrated jets are then used to calculate the per vertex missing momentum (miss-mom).
15 // The per vertex missing momentum is defined as: The vector some of the calibrated jet momenta (for jets with pt>20GeV && Rpt>0.1 wrt to the vertex) + tracks assosiated to the vertex (otherwise).
16 // PU Jets closeby (dR<0.3) to a HS jet are not considered.
17 // The fJVT value for every forward jet (fj) of the event is then calculated choosing the vertex with the largest negative miss-mom projection on the fj.
18 // User action: After initializing the tool the user has to call the modify(xAOD::JetContainer& jetCont) function. Argument in this fuction is the PFlow jet container of the event.
19 // The fjvt value for every forward jet of the container is then calculated and can be retrieved.
21  //Parameters
22  // m_orLabel: ""
23  // m_jetsName : "Container name for the output reconstructed PU jets "
24  // m_tightOP: "If true a tight fjvt threshold value is applied"
25  // m_outLabelFjvt: "Decorator for passing fJVT threshold (tight or loose)"
26  // m_jetchargedp4: "Name of the jet charged momentum 4-vector"
27  // m_etaThresh: "Maximum eta value for considering a jet as central"
28  // m_forwardMinPt: "Minimum forward jet pt"
29  // m_forwardMaxPt: "Maximum forward jet pt. If -1 no threshold is applied"
30  // m_centerMinPt: "Minimum central jet pt"
31  // m_centerMaxPt: "Maximum central jet pt. If -1 no threshold is applied"
32  // m_pvind: "Hard-Scatter primary vertex index of the event. If -1 it's automatically retrieved from the event"
33  // m_rptCut: "Rpt cut value for central PU jets contributing in the missing momentum calculation"
34  // m_jvtCut: "JVT threshold value for considering a central PU jet as HS"
35  // m_dzCut: "Dz=z-z0 cut value for pfo objects participating in the HS vertex jet reco"
36  // m_vertices: "Number of vertices for which the missing momentum is calculated"
37  // m_maxRap: "Maximum rapidity value in fastjet::AreaDefinition"
38  // m_neutMaxRap: "Maximum rapidity value for neutral pfos participating in jet reco"
39  // m_weight: "PFO weight value"
40  // m_pfoToolName: "Name of PFO retriever tool"
41  // m_wpfoToolName: "Name of PFO weighting tool"
42  // m_pfoJESName: "Name of jet calibration tool"
43  // m_jetAlgo: "Jet calibration collection name"
44  // m_calibconfig: "Calibration config for PFlow jets, need to be updated with latest one"
45  // m_calibSeq: "Calibration sequence to be applied"
46  // m_calibArea: "Calibration area"
47  // m_isdata: "True if data"
48 
49 
50 #ifndef FORWARDPFLOWJVTTOOL_JVT_FORWARDPFLOWJVTTOOL_H
51 #define FORWARDPFLOWJVTTOOL_JVT_FORWARDPFLOWJVTTOOL_H 1
52 
53 // STL includes
54 #include <string>
55 
56 // FrameWork includes
57 #include "AsgTools/ToolHandle.h"
58 #include "AsgTools/AsgTool.h"
62 #include "xAODJet/JetContainer.h"
65 
70 
71 // Pflow / FE tools
72 #include "PFlowUtils/FEHelpers.h"
76 
77 #include "AsgTools/ToolHandle.h"
79 
80 namespace pflow {
81  struct puJets {
82  std::shared_ptr<xAOD::JetContainer> jetCont;
83  std::shared_ptr<xAOD::JetAuxContainer> jetAuxCont;
84  };
85 }
86 
88  : public asg::AsgTool,
89  virtual public IJetDecorator{
91 
92 
93  // Public methods:
95  public:
96 
98  JetForwardPFlowJvtTool(const std::string& name);
99 
102 
103  virtual StatusCode initialize() override;
104 
105 
106  virtual StatusCode decorate(const xAOD::JetContainer& jetCont) const override;
107 
108  float getFJVT(const xAOD::Jet *jet,const std::vector<TVector2>& pileupMomenta) const;
109  bool isForwardJet(const xAOD::Jet *jet) const;
110  bool isCentralJet(const xAOD::Jet *jet) const;
111 
113  virtual std::vector<TVector2> calculateVertexMomenta(const xAOD::JetContainer *jets,int pvind, int vertices) const;
115  bool hasCloseByHSjet(const xAOD::Jet *jet, const xAOD::JetContainer *pjets ) const;
116  double getRpt(const xAOD::Jet *jet) const;
117  fastjet::PseudoJet pfoToPseudoJet(const xAOD::PFO* pfo, const CP::PFO_JetMETConfig_charge& theCharge, const xAOD::Vertex *vx) const;
118  fastjet::PseudoJet feToPseudoJet(const xAOD::FlowElement* fe, const CP::PFO_JetMETConfig_charge& theCharge, const xAOD::Vertex *vx) const;
119  std::size_t getPV() const;
120 
121  protected:
122 
123  SG::ReadHandleKey<jet::TrackVertexAssociation> m_tvaKey{this, "TrackVertexAssociation", "", "Input track-vertex association"};
124  Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", "SG key for the input jet container"};
125  Gaudi::Property<std::string> m_jetsName{this, "jetsName", "AntiKt4PUPFlowJets", "Container name for the output reconstructed PU jets"};
126  Gaudi::Property<std::string> m_jetchargedp4{this, "jetchargedp4", "JetChargedScaleMomentum", "Name of the jet charged momentum 4-vector"};
127 
128  Gaudi::Property<bool> m_isdata{this, "isdata", false, "True if data"};
129  Gaudi::Property<int> m_pvind{this, "pvind", -1, "Hard-Scatter primary vertex index of the event. If -1 it will be automatically retrieved from the event"};
130  Gaudi::Property<int> m_vertices{this, "vertices", 10, "Number of vertices for which the missing momentum is calculated"};
131  Gaudi::Property<bool> m_includePV{this, "includePV", false, "Flag to include jets and tracks associated to PV in the calculation"};
132  Gaudi::Property<double> m_etaThresh{this, "etaThresh", 2.5, "Maximum eta value for considering a jet as central"};
133  Gaudi::Property<double> m_forwardMinPt{this, "forwardMinPt", 18e3, "Minimum forward jet pt"};
134  Gaudi::Property<double> m_forwardMaxPt{this, "forwardMaxPt", -1, "Maximum forward jet pt. If -1 no threshold is applied"};
135  Gaudi::Property<double> m_centerMinPt{this, "centralMinPt", 20e3, "Minimum central jet pt"};
136  Gaudi::Property<double> m_centerMaxPt{this, "centralMaxPt", -1, "Maximum central jet pt. If -1 no threshold is applied"};
137  Gaudi::Property<double> m_fjvtThresh{this, "fjvtThresh", 15e3, "fjvt threshold value"};
138  Gaudi::Property<double> m_rptCut{this, "rptCut", 0.1, "Rpt cut value for central PU jets contributing in the missing momentum calculation"};
139  Gaudi::Property<double> m_jvtCut{this, "jvtCut", 0.2, "JVT threshold value for considering a central PU jet as HS"};
140  Gaudi::Property<double> m_dzCut{this, "dzCut", 2.0, "Dz=z=-z0 cut for pfo objects participating in the HS vertex jet reco"};
141  Gaudi::Property<double> m_maxRap{this, "maxRap", 2.5, "Maximum rapidity value in fastjet::AreaDefinition"};
142  Gaudi::Property<double> m_neutMaxRap{this, "neutMaxRap", 2.5, "Maximum rapidity value for neutral pfos participating in jet reco"};
143  Gaudi::Property<float> m_weight{this, "weight", 0, "PFO weight value"};
144  Gaudi::Property<bool> m_tightOP{this, "tightOP", false, "If true a tight fjvt threshold value is applied"};
145 
146  // not used?
147  //Gaudi::Property<std::string> m_jvtMomentName{"jvtMomentName", "", ""};
148  //Gaudi::Property<double> m_centerJvtThresh{"", 0, ""};
149 
150  SG::ReadHandleKey<xAOD::VertexContainer> m_vxContKey{this, "verticesName", "PrimaryVertices", "Container name of vertices to be retrieved"};
151  SG::ReadHandleKey<xAOD::PFOContainer> m_PFOKey{this, "PFOName", "CHSParticleFlowObjects", "SG Key for CHS PFO Container"};
152  SG::ReadHandleKey<xAOD::FlowElementContainer> m_FEKey{this, "FEName", "", "SG Key for CHS FlowElement Container (overrides PFO if not empty)"};
153 
154  SG::ReadDecorHandleKey<xAOD::JetContainer> m_passJvtKey{this, "passJvtName", "NNJvtPass", "SG key for output pass-JVT decoration"};
155  SG::ReadDecorHandleKey<xAOD::PFO> m_orKey{this, "ORName", "", "OR label"};
156  SG::ReadDecorHandleKey<xAOD::FlowElement> m_orFEKey{this, "ORNameFE", "", "OR label"};
157 
158  SG::WriteDecorHandleKey<xAOD::JetContainer> m_fjvtKey{this, "FjvtName", "passOnlyFJVT", "Decorator for passing fJVT threshold (tight or loose)"};
159  SG::WriteDecorHandleKey<xAOD::JetContainer> m_fjvtRawKey{this, "FjvtRawName", "fJvt", "Decorator for raw fJVT variable"};
160  SG::WriteDecorHandleKey<xAOD::JetContainer> m_isHSKey{this, "isHSName", "isJVTHS", "SG key for output isJVTHS decoration"};
161  SG::WriteDecorHandleKey<xAOD::JetContainer> m_isPUKey{this, "isPUName", "isJvtPU", "SG key for output isJVTPU decoration"};
162 
163  ToolHandle<CP::WeightPFOTool> m_wpfotool{this,"WeightPFOTool", "", "Weight PFO tool name"};
164  ToolHandle<IJetCalibrationTool> m_pfoJES{this,"JetCalibrationTool", "", "Jet calibration tool name"};
165 
166  };
167 #endif //> !FORWARDJVTTOOL_JVT_FORWARDJVTTOOL_H
JetForwardPFlowJvtTool::calculateVertexMomenta
virtual std::vector< TVector2 > calculateVertexMomenta(const xAOD::JetContainer *jets, int pvind, int vertices) const
Definition: JetForwardPFlowJvtTool.cxx:131
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
pflow::puJets::jetAuxCont
std::shared_ptr< xAOD::JetAuxContainer > jetAuxCont
Definition: JetForwardPFlowJvtTool.h:83
FEHelpers.h
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
FlowElementContainer.h
JetForwardPFlowJvtTool::isForwardJet
bool isForwardJet(const xAOD::Jet *jet) const
Definition: JetForwardPFlowJvtTool.cxx:346
JetForwardPFlowJvtTool::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jetCont) const override
Decorate a jet collection without otherwise modifying it.
Definition: JetForwardPFlowJvtTool.cxx:91
JetForwardPFlowJvtTool::m_centerMinPt
Gaudi::Property< double > m_centerMinPt
Definition: JetForwardPFlowJvtTool.h:135
JetForwardPFlowJvtTool::pfoToPseudoJet
fastjet::PseudoJet pfoToPseudoJet(const xAOD::PFO *pfo, const CP::PFO_JetMETConfig_charge &theCharge, const xAOD::Vertex *vx) const
Definition: JetForwardPFlowJvtTool.cxx:302
JetForwardPFlowJvtTool::hasCloseByHSjet
bool hasCloseByHSjet(const xAOD::Jet *jet, const xAOD::JetContainer *pjets) const
Definition: JetForwardPFlowJvtTool.cxx:176
JetForwardPFlowJvtTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: JetForwardPFlowJvtTool.h:124
JetForwardPFlowJvtTool::m_pvind
Gaudi::Property< int > m_pvind
Definition: JetForwardPFlowJvtTool.h:129
JetForwardPFlowJvtTool::tagTruth
StatusCode tagTruth(const xAOD::JetContainer *jets, const xAOD::JetContainer *truthJets)
Definition: JetForwardPFlowJvtTool.cxx:384
IJetDecorator
Interface for adding a decoration to a jet container.
Definition: IJetDecorator.h:21
JetForwardPFlowJvtTool::m_tvaKey
SG::ReadHandleKey< jet::TrackVertexAssociation > m_tvaKey
Definition: JetForwardPFlowJvtTool.h:123
JetForwardPFlowJvtTool::m_weight
Gaudi::Property< float > m_weight
Definition: JetForwardPFlowJvtTool.h:143
JetForwardPFlowJvtTool::m_isdata
Gaudi::Property< bool > m_isdata
Definition: JetForwardPFlowJvtTool.h:128
IWeightPFOTool.h
SG::ReadHandleKey< jet::TrackVertexAssociation >
JetForwardPFlowJvtTool::m_includePV
Gaudi::Property< bool > m_includePV
Definition: JetForwardPFlowJvtTool.h:131
IJetDecorator.h
JetForwardPFlowJvtTool::m_wpfotool
ToolHandle< CP::WeightPFOTool > m_wpfotool
Definition: JetForwardPFlowJvtTool.h:163
JetForwardPFlowJvtTool::m_pfoJES
ToolHandle< IJetCalibrationTool > m_pfoJES
Definition: JetForwardPFlowJvtTool.h:164
JetForwardPFlowJvtTool
Definition: JetForwardPFlowJvtTool.h:89
IJetCalibrationTool.h
JetForwardPFlowJvtTool::~JetForwardPFlowJvtTool
virtual ~JetForwardPFlowJvtTool()
Destructor:
JetForwardPFlowJvtTool::m_vertices
Gaudi::Property< int > m_vertices
Definition: JetForwardPFlowJvtTool.h:130
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
JetForwardPFlowJvtTool::m_isPUKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_isPUKey
Definition: JetForwardPFlowJvtTool.h:161
JetForwardPFlowJvtTool::m_jetchargedp4
Gaudi::Property< std::string > m_jetchargedp4
Definition: JetForwardPFlowJvtTool.h:126
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
pflow::puJets::jetCont
std::shared_ptr< xAOD::JetContainer > jetCont
Definition: JetForwardPFlowJvtTool.h:82
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
JetForwardPFlowJvtTool::getPV
std::size_t getPV() const
Definition: JetForwardPFlowJvtTool.cxx:364
JetForwardPFlowJvtTool::m_passJvtKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_passJvtKey
Definition: JetForwardPFlowJvtTool.h:154
JetForwardPFlowJvtTool::m_jetsName
Gaudi::Property< std::string > m_jetsName
Definition: JetForwardPFlowJvtTool.h:125
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JetForwardPFlowJvtTool::m_fjvtRawKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_fjvtRawKey
Definition: JetForwardPFlowJvtTool.h:159
JetForwardPFlowJvtTool::m_fjvtKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_fjvtKey
Definition: JetForwardPFlowJvtTool.h:158
JetForwardPFlowJvtTool::feToPseudoJet
fastjet::PseudoJet feToPseudoJet(const xAOD::FlowElement *fe, const CP::PFO_JetMETConfig_charge &theCharge, const xAOD::Vertex *vx) const
Definition: JetForwardPFlowJvtTool.cxx:324
JetForwardPFlowJvtTool::m_vxContKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vxContKey
Definition: JetForwardPFlowJvtTool.h:150
TrackVertexAssociation.h
JetForwardPFlowJvtTool::m_dzCut
Gaudi::Property< double > m_dzCut
Definition: JetForwardPFlowJvtTool.h:140
JetForwardPFlowJvtTool::m_rptCut
Gaudi::Property< double > m_rptCut
Definition: JetForwardPFlowJvtTool.h:138
JetForwardPFlowJvtTool::JetForwardPFlowJvtTool
JetForwardPFlowJvtTool(const std::string &name)
Constructor with parameters:
Definition: JetForwardPFlowJvtTool.cxx:32
WeightPFOTool.h
JetForwardPFlowJvtTool::isCentralJet
bool isCentralJet(const xAOD::Jet *jet) const
Definition: JetForwardPFlowJvtTool.cxx:352
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
pflow
Definition: JetForwardPFlowJvtTool.h:80
WriteDecorHandle.h
Handle class for adding a decoration to an object.
JetForwardPFlowJvtTool::m_FEKey
SG::ReadHandleKey< xAOD::FlowElementContainer > m_FEKey
Definition: JetForwardPFlowJvtTool.h:152
JetForwardPFlowJvtTool::m_jvtCut
Gaudi::Property< double > m_jvtCut
Definition: JetForwardPFlowJvtTool.h:139
JetForwardPFlowJvtTool::m_forwardMaxPt
Gaudi::Property< double > m_forwardMaxPt
Definition: JetForwardPFlowJvtTool.h:134
xAOD::PFO_v1
Class describing a particle flow object.
Definition: PFO_v1.h:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
JetForwardPFlowJvtTool::m_tightOP
Gaudi::Property< bool > m_tightOP
Definition: JetForwardPFlowJvtTool.h:144
JetForwardPFlowJvtTool::m_forwardMinPt
Gaudi::Property< double > m_forwardMinPt
Definition: JetForwardPFlowJvtTool.h:133
JetForwardPFlowJvtTool::m_orFEKey
SG::ReadDecorHandleKey< xAOD::FlowElement > m_orFEKey
Definition: JetForwardPFlowJvtTool.h:156
WriteDecorHandleKey.h
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
JetForwardPFlowJvtTool::m_fjvtThresh
Gaudi::Property< double > m_fjvtThresh
Definition: JetForwardPFlowJvtTool.h:137
pflow::puJets
Definition: JetForwardPFlowJvtTool.h:81
JetForwardPFlowJvtTool::m_neutMaxRap
Gaudi::Property< double > m_neutMaxRap
Definition: JetForwardPFlowJvtTool.h:142
JetForwardPFlowJvtTool::getRpt
double getRpt(const xAOD::Jet *jet) const
Definition: JetForwardPFlowJvtTool.cxx:358
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
JetContainer.h
JetForwardPFlowJvtTool::m_centerMaxPt
Gaudi::Property< double > m_centerMaxPt
Definition: JetForwardPFlowJvtTool.h:136
JetForwardPFlowJvtTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetForwardPFlowJvtTool.cxx:43
JetForwardPFlowJvtTool::m_maxRap
Gaudi::Property< double > m_maxRap
Definition: JetForwardPFlowJvtTool.h:141
JetForwardPFlowJvtTool::m_isHSKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_isHSKey
Definition: JetForwardPFlowJvtTool.h:160
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
CP::PFO_JetMETConfig_charge
PFO_JetMETConfig_charge
Definition: Reconstruction/PFlow/PFlowUtils/PFlowUtils/PFODefs.h:11
JetForwardPFlowJvtTool::m_PFOKey
SG::ReadHandleKey< xAOD::PFOContainer > m_PFOKey
Definition: JetForwardPFlowJvtTool.h:151
ReadDecorHandle.h
Handle class for reading a decoration on an object.
JetForwardPFlowJvtTool::m_etaThresh
Gaudi::Property< double > m_etaThresh
Definition: JetForwardPFlowJvtTool.h:132
JetAuxContainer.h
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
JetForwardPFlowJvtTool::buildPFlowPUjets
pflow::puJets buildPFlowPUjets(const xAOD::Vertex &vx) const
Definition: JetForwardPFlowJvtTool.cxx:186
ToolHandle.h
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
AsgTool.h
JetForwardPFlowJvtTool::getFJVT
float getFJVT(const xAOD::Jet *jet, const std::vector< TVector2 > &pileupMomenta) const
Definition: JetForwardPFlowJvtTool.cxx:121
JetForwardPFlowJvtTool::m_orKey
SG::ReadDecorHandleKey< xAOD::PFO > m_orKey
Definition: JetForwardPFlowJvtTool.h:155
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition: FlowElement_v1.h:25