ATLAS Offline Software
Loading...
Searching...
No Matches
Rec::GNNVertexFitterTool Class Reference

#include <GNNVertexFitterTool.h>

Inheritance diagram for Rec::GNNVertexFitterTool:
Collaboration diagram for Rec::GNNVertexFitterTool:

Classes

struct  WrkVrt

Public Member Functions

 GNNVertexFitterTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~GNNVertexFitterTool ()
StatusCode initialize ()
StatusCode finalize ()
virtual StatusCode fitAllVertices (const xAOD::JetContainer *, xAOD::VertexContainer *, const xAOD::Vertex &primaryVertex, const EventContext &) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Public Attributes

ToolHandle< Trk::TrkVKalVrtFitterm_vertexFitterTool
SG::ReadDecorHandleKey< xAOD::JetContainerm_trackLinksKey
SG::ReadDecorHandleKey< xAOD::JetContainerm_trackOriginsKey
SG::ReadDecorHandleKey< xAOD::JetContainerm_vertexLinksKey
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this, "eventInfoKey", "EventInfo", "EventInfo container to use"}
SG::WriteDecorHandleKey< xAOD::JetContainerm_jetWriteDecorKeyVertexLink
SG::WriteDecorHandleKey< xAOD::JetContainerm_jetWriteDecorKeyVertexNumber
SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"}
const xAOD::Vertexm_thePV {}

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

TLorentzVector TotalMom (const std::vector< const xAOD::TrackParticle * > &selTrk) const
double vrtVrtDist (const xAOD::Vertex &primVrt, const Amg::Vector3D &secVrt, const std::vector< double > &vrtErr, double &signif) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::AuxElement::Decorator< float > m_deco_mass
SG::AuxElement::Decorator< float > m_deco_pt
SG::AuxElement::Decorator< float > m_deco_charge
SG::AuxElement::Decorator< float > m_deco_vPos
SG::AuxElement::Decorator< float > m_deco_lxy
SG::AuxElement::Decorator< float > m_deco_sig3D
SG::AuxElement::Decorator< float > m_deco_deltaR
SG::AuxElement::Decorator< float > m_deco_ntrk
SG::AuxElement::Decorator< float > m_deco_lxyz
SG::AuxElement::Decorator< float > m_deco_eFrac
SG::AuxElement::Decorator< float > m_deco_nHFTracks
StringProperty m_gnnModel {this, "GNNModel", "GN2v01", "GNN model being used" }
StringProperty m_jetCollection {this, "JetCollection", "AntiKt4EMPFlowJets", "Jet Collection being used" }
BooleanProperty m_includePrimaryVertex {this, "includePrimaryVertex", false, "Include Primary Vertices"}
BooleanProperty m_removeNonHFVertices {this, "removeNonHFVertices", true, "Remove vertices with no heavy flavour tracks"}
BooleanProperty m_doInclusiveVertexing {this, "doInclusiveVertexing", false, "Merge all vertices so that there is at most one vertex per jet"}
DoubleProperty m_maxChi2 {this, "maxChi2", 20, "Maximum Chi Squared"}
BooleanProperty m_applyCuts {this, "applyCuts", false, "Cut on vertex properties"}
DoubleProperty m_minLxy {this, "minLxy", 0.0, "Minimum radial distance from the PV"}
DoubleProperty m_maxLxy {this, "maxLxy", 1e5, "Maximum radial distance from the PV"}
DoubleProperty m_minSig3D {this, "minSig3D", 0, "Minimum 3D significance from the PV"}
DoubleProperty m_HFRatioThres {this, "HFRatio", 0.0, "The threshold for the Ratio between HF tracks and all track for a vertex"}
DoubleProperty m_minNTrack {this, "minNTrk", 2, "Minimum number of tracks in a vertex"}
double m_massPi {}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 49 of file GNNVertexFitterTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ GNNVertexFitterTool()

Rec::GNNVertexFitterTool::GNNVertexFitterTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 18 of file GNNVertexFitterTool.cxx.

20 : AthAlgTool(type, name, parent), m_vertexFitterTool("Trk::TrkVKalVrtFitter/VertexFitterTool", this),
21 m_deco_mass("mass"),
22 m_deco_pt("pt"),
23 m_deco_charge("charge"),
24 m_deco_vPos("vPos"),
25 m_deco_lxy("Lxy"),
26 m_deco_sig3D("significance3D"),
27 m_deco_deltaR("deltaR"),
28 m_deco_ntrk("ntrk"),
29 m_deco_lxyz("Lxyz"),
30 m_deco_eFrac("efracsv"),
31 m_deco_nHFTracks("nHFtrk"){
32 declareInterface<IGNNVertexFitterInterface>(this);
33 declareProperty("JetTrackLinks", m_trackLinksKey = "AntiKt4EMPFlow."+m_gnnModel+"_TrackLinks");
34 declareProperty("JetTrackOrigins", m_trackOriginsKey = "AntiKt4EMPFlow."+m_gnnModel+"_TrackOrigin");
35 declareProperty("JetVertexLinks", m_vertexLinksKey = "AntiKt4EMPFlow."+m_gnnModel+"_VertexIndex");
36 declareProperty("VertexFitterTool", m_vertexFitterTool, "Vertex fitting tool");
38}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ToolHandle< Trk::TrkVKalVrtFitter > m_vertexFitterTool
SG::AuxElement::Decorator< float > m_deco_deltaR
SG::AuxElement::Decorator< float > m_deco_eFrac
SG::ReadDecorHandleKey< xAOD::JetContainer > m_trackOriginsKey
SG::AuxElement::Decorator< float > m_deco_pt
SG::AuxElement::Decorator< float > m_deco_charge
SG::AuxElement::Decorator< float > m_deco_lxyz
SG::ReadDecorHandleKey< xAOD::JetContainer > m_trackLinksKey
SG::AuxElement::Decorator< float > m_deco_vPos
SG::AuxElement::Decorator< float > m_deco_nHFTracks
SG::AuxElement::Decorator< float > m_deco_ntrk
SG::AuxElement::Decorator< float > m_deco_sig3D
SG::ReadDecorHandleKey< xAOD::JetContainer > m_vertexLinksKey
SG::AuxElement::Decorator< float > m_deco_mass
SG::AuxElement::Decorator< float > m_deco_lxy
constexpr double chargedPionMassInMeV
the mass of the charged pion (in MeV)

◆ ~GNNVertexFitterTool()

Rec::GNNVertexFitterTool::~GNNVertexFitterTool ( )
virtual

Definition at line 41 of file GNNVertexFitterTool.cxx.

41{ ATH_MSG_DEBUG("GNNVertexFitterTool destructor called"); }
#define ATH_MSG_DEBUG(x)

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode Rec::GNNVertexFitterTool::finalize ( )

Definition at line 358 of file GNNVertexFitterTool.cxx.

358{ return StatusCode::SUCCESS; }

◆ fitAllVertices()

StatusCode Rec::GNNVertexFitterTool::fitAllVertices ( const xAOD::JetContainer * inJetContainer,
xAOD::VertexContainer * outVertexContainer,
const xAOD::Vertex & primaryVertex,
const EventContext & ctx ) const
virtual

Implements Rec::IGNNVertexFitterInterface.

Definition at line 106 of file GNNVertexFitterTool.cxx.

108 {
109
110 using TLC = std::vector<ElementLink<DataVector<xAOD::TrackParticle_v1>>>;
111 using TL = ElementLink<DataVector<xAOD::TrackParticle_v1>>;
112
113 // Read Decor Handle for Track links and Vertex links
114 SG::ReadDecorHandle<xAOD::JetContainer, TLC> trackLinksHandle(m_trackLinksKey, ctx);
115 SG::ReadDecorHandle<xAOD::JetContainer, std::vector<char>> trackOriginsHandle(m_trackOriginsKey, ctx);
116 SG::ReadDecorHandle<xAOD::JetContainer, std::vector<char>> vertexLinksHandle(m_vertexLinksKey, ctx);
117 SG::WriteDecorHandle<xAOD::JetContainer, std::vector<ElementLink<xAOD::VertexContainer>>>
118 jetWriteDecorHandleVertexLink(m_jetWriteDecorKeyVertexLink, ctx);
119
120 // Loop over the jets
121 for (const xAOD::Jet* jet : *inJetContainer) {
122
123 // Retrieve the Vertex and Track Collections
124 auto vertexCollection = vertexLinksHandle(*jet);
125 auto trackCollection = trackLinksHandle(*jet);
126 auto trackOriginCollection = trackOriginsHandle(*jet);
127
128 using indexList = std::vector<int>;
129 using trackCountMap = std::map<char, std::set<TL>>;
130
131 indexList iList(vertexCollection.size());
132
133 trackCountMap allTracksMap; // All the vertices and the corresponding track links
134 trackCountMap heavyFlavourVertexMap; // All Heavy Flavour Tracks associated with a vertex
135 trackCountMap primaryVertexMap; // All Primary Tracks associated with a vertex
136 trackCountMap fittingMap; // Map filled with vertices to be fitted
137
138 fittingMap.clear();
139 heavyFlavourVertexMap.clear();
140 primaryVertexMap.clear();
141 allTracksMap.clear();
142
143 // Fill the map of predicted vertex indices -> tracks
144 for (int index=0; index < int(vertexCollection.size()); index++){
145
146 auto vertex = vertexCollection[index];
147 auto trackOrigin = trackOriginCollection[index];
148 auto trackLink = trackCollection[index];
149
150 allTracksMap[vertex].insert(trackLink);
151
152 // Add heavy flavour tracks associated to each vertex to the map
153 if (InDet::ExclusiveOrigin::FromB == trackOrigin || InDet::ExclusiveOrigin::FromBC == trackOrigin ||
154 InDet::ExclusiveOrigin::FromC == trackOrigin) {
155 heavyFlavourVertexMap[vertex].insert(trackLink);
156 }
157 // Add primary tracks associated to each vertex to the map
158 else if (InDet::ExclusiveOrigin::Primary == trackOrigin) {
159 primaryVertexMap[vertex].insert(trackLink);
160 }
161 };
162
163 // determine the vertex with the largest number of primary tracks
164 auto pvCandidate = std::max_element(
165 primaryVertexMap.begin(), primaryVertexMap.end(),
166 [](const auto& a, const auto& b) { return a.second.size() < b.second.size(); }
167 )->first;
168
169 // filter the vertices according to the configurable options
170 for (const auto &vertexTrackPair : allTracksMap) {
171 // unpack vertexTrackPair
172 const auto &[vertex, trackLinks] = vertexTrackPair;
173 // remove the primary vertex unless requested
175 if(vertex == pvCandidate) {
176 continue;
177 }
178 }
179 // remove vertices which do not contain any heavy flavour tracks if requested
181 if (heavyFlavourVertexMap.find(vertex) == heavyFlavourVertexMap.end()) {
182 continue;
183 }
184 }
185 // remove vertices which contain insufficient heavy flavour tracks if requested
186 if(m_HFRatioThres > 0) {
187 if (heavyFlavourVertexMap.find(vertex) != heavyFlavourVertexMap.end() &&
188 (static_cast<float>(heavyFlavourVertexMap[vertex].size()) / trackLinks.size()) < m_HFRatioThres) {
189 continue;
190 }
191 }
192 // now we've passed all vertex filtering, add the vertex to the fittingMap
193 fittingMap.insert(std::pair<char, std::set<TL>>(vertex, trackLinks));
194 }
195 // If inclusive vertexing is requested, merge the vertices
197 // Define the key for the merged vertex
198 const char mergedVertexKey = 0;
199 std::set<TL> mergedSet;
200 std::set<TL> combinedHFTracks;
201
202 // Iterate over the fittingMap to merge all sets into a single set
203 for (const auto &vertexTrackPair : fittingMap) {
204 // Insert all elements from trackLinks into mergedSet
205 mergedSet.insert(vertexTrackPair.second.begin(), vertexTrackPair.second.end());
206 combinedHFTracks.insert(heavyFlavourVertexMap[vertexTrackPair.first].begin(), heavyFlavourVertexMap[vertexTrackPair.first].end());
207 }
208
209 // Clear fittingMap and insert the merged set under the mergedVertexKey
210 fittingMap.clear();
211 fittingMap[mergedVertexKey] = std::move(mergedSet);
212 heavyFlavourVertexMap.clear();
213 heavyFlavourVertexMap[mergedVertexKey] = std::move(combinedHFTracks);
214 }
215
216 // Working xAOD
217 std::unique_ptr<workVectorArrxAOD> xAODwrk (new workVectorArrxAOD());
218 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{m_beamSpotKey, ctx};
219
220 // Beam Conditions
221 xAODwrk->beamX = beamSpotHandle->beamPos().x();
222 xAODwrk->beamY = beamSpotHandle->beamPos().y();
223 xAODwrk->beamZ = beamSpotHandle->beamPos().z();
224 xAODwrk->tanBeamTiltX = tan(beamSpotHandle->beamTilt(0));
225 xAODwrk->tanBeamTiltY = tan(beamSpotHandle->beamTilt(1));
226
227 std::unique_ptr<std::vector<WrkVrt>> wrkVrtSet = std::make_unique<std::vector<WrkVrt>>();
228 WrkVrt newvrt;
229 newvrt.Good = true;
230 std::unique_ptr<Trk::IVKalState> state = m_vertexFitterTool->makeState();
231 std::vector<const xAOD::NeutralParticle *> neutralPartDummy(0);
232 Amg::Vector3D IniVrt(0., 0., 0.);
233
234 for (const auto &pair : fittingMap) {
235 // Need at least 2 tracks to perform a fit
236 if (pair.second.size() >= 2) {
237 int NTRKS = pair.second.size();
238 std::vector<double> InpMass(NTRKS, m_massPi);
239 m_vertexFitterTool->setMassInputParticles(InpMass, *state);
240
241 xAODwrk->listSelTracks.clear();
242
243 for (auto TrackLink : pair.second) {
244 xAODwrk->listSelTracks.push_back(*TrackLink);
245 }
246
247 Amg::Vector3D FitVertex, vDist;
248 TLorentzVector jetDir(jet->p4()); // Jet Direction
249
250 // Get Estimate
251 StatusCode sc = m_vertexFitterTool->VKalVrtFitFast(xAODwrk->listSelTracks, FitVertex, *state);
252
253 if (sc.isFailure() || FitVertex.perp() > m_maxLxy) { /* No initial estimation */
254 IniVrt = primVrt.position();
256 IniVrt.setZero();
257 } else {
258 vDist = FitVertex - primVrt.position();
259 double JetVrtDir = jetDir.Px() * vDist.x() + jetDir.Py() * vDist.y() + jetDir.Pz() * vDist.z();
261 JetVrtDir = fabs(JetVrtDir); /* Always positive when primary vertex is seeked for*/
262 if (JetVrtDir > 0.)
263 IniVrt = FitVertex; /* Good initial estimation */
264 else
265 IniVrt = primVrt.position();
266 }
267
268 m_vertexFitterTool->setApproximateVertex(IniVrt.x(), IniVrt.y(), IniVrt.z(), *state);
269
270 // Perform the Vertex Fit
271 sc = (m_vertexFitterTool->VKalVrtFit(xAODwrk->listSelTracks, neutralPartDummy, newvrt.vertex, newvrt.vertexMom,
272 newvrt.vertexCharge, newvrt.vertexCov, newvrt.chi2PerTrk, newvrt.trkAtVrt,
273 newvrt.chi2, *state, false));
274 if (sc.isFailure())
275 continue;
276
277 // Chi2 Cut
278 auto NDOF = 2 * (newvrt.trkAtVrt.size()) - 3.0; // From VrtSecInclusive
279
280 if (newvrt.chi2 / NDOF >= m_maxChi2)
281 continue;
282 ATH_MSG_DEBUG("Found IniVertex=" << newvrt.vertex[0] << ", " << newvrt.vertex[1] << ", " << newvrt.vertex[2]
283 << " trks " << newvrt.trkAtVrt.size());
284
285 Amg::Vector3D vDir = newvrt.vertex - primVrt.position(); // Vertex Dirction in relation to Primary
286
287 Amg::Vector3D jetVrtDir(jet->p4().Px(), jet->p4().Py(), jet->p4().Pz());
288
289 double vPos =
290 (vDir.x() * newvrt.vertexMom.Px() + vDir.y() * newvrt.vertexMom.Py() + vDir.z() * newvrt.vertexMom.Pz()) /
291 newvrt.vertexMom.Rho();
292
293 double Lxy = sqrt(vDir[0] * vDir[0] + vDir[1] * vDir[1]);
294 double Lxyz = sqrt(vDir[0] * vDir[0] + vDir[1] * vDir[1] + vDir[2] * vDir[2]);
295 ATH_MSG_DEBUG("Lxyz " << Lxyz);
296
297 double drJPVSV = Amg::deltaR(jetVrtDir, vDir); // DeltaR
298
299 int ntrk = newvrt.trkAtVrt.size(); // # Tracks in Vertex
300
301 TLorentzVector MomentumVtx = TotalMom(xAODwrk->listSelTracks);
302
303 double eRatio = MomentumVtx.E() / jet->p4().E();
304 double signif3D;
305 [[maybe_unused]] double distToPV = vrtVrtDist(primVrt, newvrt.vertex, newvrt.vertexCov, signif3D);
306
307 // apply quality cuts
308 if (m_applyCuts) {
309 // cut on minimum number of tracks in the vertex
310 if (ntrk < m_minNTrack)
311 continue;
312 // cut on 3D significance
313 if (signif3D < m_minSig3D)
314 continue;
315 // cut on minumum transverse displacement from the PV
316 if (Lxy < m_minLxy )
317 continue;
318 }
319
320 // Register Container
321 auto* GNNvertex = outVertexContainer->emplace_back(new xAOD::Vertex);
322
323 for (const auto *trk : xAODwrk->listSelTracks) {
324 ElementLink<xAOD::TrackParticleContainer> link_trk(
325 *(dynamic_cast<const xAOD::TrackParticleContainer *>(trk->container())),
326 trk->index());
327 GNNvertex->addTrackAtVertex(link_trk, 1.);
328 }
329
330 //Add Vertex Info into Container
332 GNNvertex->setPosition(newvrt.vertex);
333 GNNvertex->setFitQuality(newvrt.chi2, NDOF);
334
335 m_deco_mass(*GNNvertex) = newvrt.vertexMom.M();
336 m_deco_pt(*GNNvertex) = newvrt.vertexMom.Perp();
337 m_deco_charge(*GNNvertex) = newvrt.vertexCharge;
338 m_deco_vPos(*GNNvertex) = vPos;
339 m_deco_lxy(*GNNvertex) = Lxy;
340 m_deco_lxyz(*GNNvertex) = Lxyz;
341 m_deco_sig3D(*GNNvertex) = signif3D;
342 m_deco_ntrk(*GNNvertex) = ntrk;
343 m_deco_deltaR(*GNNvertex) = drJPVSV;
344 m_deco_eFrac(*GNNvertex) = eRatio;
345 m_deco_nHFTracks(*GNNvertex) = heavyFlavourVertexMap[pair.first].size();
346
347 ElementLink<xAOD::VertexContainer> linkVertex;
348 linkVertex.setElement(GNNvertex);
349 linkVertex.setStorableObject(*outVertexContainer);
350 jetWriteDecorHandleVertexLink(*jet).push_back(linkVertex);
351
352 } // end of 2 Track requirement
353 }
354 } // end loop over jets
355 return StatusCode::SUCCESS;
356} // end performVertexFit
static Double_t a
static Double_t sc
ElementLink< xAOD::TrackParticleContainer > TrackLink
value_type emplace_back(value_type pElem)
Add an element to the end of the collection.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetWriteDecorKeyVertexLink
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
BooleanProperty m_removeNonHFVertices
BooleanProperty m_doInclusiveVertexing
TLorentzVector TotalMom(const std::vector< const xAOD::TrackParticle * > &selTrk) const
BooleanProperty m_includePrimaryVertex
double vrtVrtDist(const xAOD::Vertex &primVrt, const Amg::Vector3D &secVrt, const std::vector< double > &vrtErr, double &signif) const
void setVertexType(VxType::VertexType vType)
Set the type of the vertex.
Eigen::Matrix< double, 3, 1 > Vector3D
double deltaR(const Amg::Vector3D &v1, const Amg::Vector3D &v2)
str index
Definition DeMoScan.py:362
::StatusCode StatusCode
StatusCode definition for legacy code.
@ SecVtx
Secondary vertex.
Jet_v1 Jet
Definition of the current "jet version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".

◆ initialize()

StatusCode Rec::GNNVertexFitterTool::initialize ( )

Definition at line 43 of file GNNVertexFitterTool.cxx.

43 {
44
45 ATH_MSG_DEBUG("GNNVertexFitter Tool in initialize()");
46
47 // Initialize keys
48 ATH_CHECK(m_trackLinksKey.initialize());
49 ATH_CHECK(m_trackOriginsKey.initialize());
50 ATH_CHECK(m_vertexLinksKey.initialize());
51
52 std::string linkNameMod = "";
53 if (m_doInclusiveVertexing) linkNameMod = "Inclusive";
54 m_jetWriteDecorKeyVertexLink = m_jetCollection + "."+linkNameMod+"GNNVerticesLink";
56
57 // Retrieve tools
58 ATH_CHECK(m_vertexFitterTool.retrieve());
59 // Additional Info for Vertex Fit
60 ATH_CHECK(m_beamSpotKey.initialize());
61 ATH_CHECK(m_eventInfoKey.initialize());
62
63 return StatusCode::SUCCESS;
64}
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Rec::IGNNVertexFitterInterface::interfaceID ( )
inlinestaticinherited

Definition at line 19 of file IGNNVertexFitterInterface.h.

static const InterfaceID IID_IGNNVertexFitterInterface("IGNNVertexFitterInterface", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ TotalMom()

TLorentzVector Rec::GNNVertexFitterTool::TotalMom ( const std::vector< const xAOD::TrackParticle * > & selTrk) const
private

Definition at line 67 of file GNNVertexFitterTool.cxx.

67 {
68 TLorentzVector sum(0., 0., 0., 0.);
69 for (int i = 0; i < (int)selTrk.size(); ++i) {
70 if (selTrk[i] == NULL)
71 continue;
72 sum += selTrk[i]->p4();
73 }
74 return sum;
75}

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ vrtVrtDist()

double Rec::GNNVertexFitterTool::vrtVrtDist ( const xAOD::Vertex & primVrt,
const Amg::Vector3D & secVrt,
const std::vector< double > & vrtErr,
double & signif ) const
private

Definition at line 78 of file GNNVertexFitterTool.cxx.

79 {
80 double distx = primVrt.x() - secVrt.x();
81 double disty = primVrt.y() - secVrt.y();
82 double distz = primVrt.z() - secVrt.z();
83
84 AmgSymMatrix(3) primCovMtx = primVrt.covariancePosition(); // Create
85 primCovMtx(0, 0) += secVrtErr[0];
86 primCovMtx(0, 1) += secVrtErr[1];
87 primCovMtx(1, 0) += secVrtErr[1];
88 primCovMtx(1, 1) += secVrtErr[2];
89 primCovMtx(0, 2) += secVrtErr[3];
90 primCovMtx(2, 0) += secVrtErr[3];
91 primCovMtx(1, 2) += secVrtErr[4];
92 primCovMtx(2, 1) += secVrtErr[4];
93 primCovMtx(2, 2) += secVrtErr[5];
94
95 AmgSymMatrix(3) wgtMtx = primCovMtx.inverse();
96
97 signif = distx * wgtMtx(0, 0) * distx + disty * wgtMtx(1, 1) * disty + distz * wgtMtx(2, 2) * distz +
98 2. * distx * wgtMtx(0, 1) * disty + 2. * distx * wgtMtx(0, 2) * distz + 2. * disty * wgtMtx(1, 2) * distz;
99 signif = std::sqrt(std::abs(signif));
100 if (signif != signif)
101 signif = 0.;
102 return std::sqrt(distx * distx + disty * disty + distz * distz);
103}
#define AmgSymMatrix(dim)
if(febId1==febId2)
float z() const
Returns the z position.
float y() const
Returns the y position.
float x() const
Returns the x position.

Member Data Documentation

◆ m_applyCuts

BooleanProperty Rec::GNNVertexFitterTool::m_applyCuts {this, "applyCuts", false, "Cut on vertex properties"}
private

Definition at line 122 of file GNNVertexFitterTool.h.

122{this, "applyCuts", false, "Cut on vertex properties"};

◆ m_beamSpotKey

SG::ReadCondHandleKey<InDet::BeamSpotData> Rec::GNNVertexFitterTool::m_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"}

Definition at line 80 of file GNNVertexFitterTool.h.

80{this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"};

◆ m_deco_charge

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_charge
private

Definition at line 106 of file GNNVertexFitterTool.h.

◆ m_deco_deltaR

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_deltaR
private

Definition at line 110 of file GNNVertexFitterTool.h.

◆ m_deco_eFrac

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_eFrac
private

Definition at line 113 of file GNNVertexFitterTool.h.

◆ m_deco_lxy

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_lxy
private

Definition at line 108 of file GNNVertexFitterTool.h.

◆ m_deco_lxyz

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_lxyz
private

Definition at line 112 of file GNNVertexFitterTool.h.

◆ m_deco_mass

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_mass
private

Definition at line 104 of file GNNVertexFitterTool.h.

◆ m_deco_nHFTracks

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_nHFTracks
private

Definition at line 114 of file GNNVertexFitterTool.h.

◆ m_deco_ntrk

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_ntrk
private

Definition at line 111 of file GNNVertexFitterTool.h.

◆ m_deco_pt

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_pt
private

Definition at line 105 of file GNNVertexFitterTool.h.

◆ m_deco_sig3D

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_sig3D
private

Definition at line 109 of file GNNVertexFitterTool.h.

◆ m_deco_vPos

SG::AuxElement::Decorator<float> Rec::GNNVertexFitterTool::m_deco_vPos
private

Definition at line 107 of file GNNVertexFitterTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doInclusiveVertexing

BooleanProperty Rec::GNNVertexFitterTool::m_doInclusiveVertexing {this, "doInclusiveVertexing", false, "Merge all vertices so that there is at most one vertex per jet"}
private

Definition at line 120 of file GNNVertexFitterTool.h.

120{this, "doInclusiveVertexing", false, "Merge all vertices so that there is at most one vertex per jet"};

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> Rec::GNNVertexFitterTool::m_eventInfoKey {this, "eventInfoKey", "EventInfo", "EventInfo container to use"}

Definition at line 71 of file GNNVertexFitterTool.h.

71{this, "eventInfoKey", "EventInfo", "EventInfo container to use"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_gnnModel

StringProperty Rec::GNNVertexFitterTool::m_gnnModel {this, "GNNModel", "GN2v01", "GNN model being used" }
private

Definition at line 116 of file GNNVertexFitterTool.h.

116{this, "GNNModel", "GN2v01", "GNN model being used" };

◆ m_HFRatioThres

DoubleProperty Rec::GNNVertexFitterTool::m_HFRatioThres {this, "HFRatio", 0.0, "The threshold for the Ratio between HF tracks and all track for a vertex"}
private

Definition at line 126 of file GNNVertexFitterTool.h.

126{this, "HFRatio", 0.0, "The threshold for the Ratio between HF tracks and all track for a vertex"};

◆ m_includePrimaryVertex

BooleanProperty Rec::GNNVertexFitterTool::m_includePrimaryVertex {this, "includePrimaryVertex", false, "Include Primary Vertices"}
private

Definition at line 118 of file GNNVertexFitterTool.h.

118{this, "includePrimaryVertex", false, "Include Primary Vertices"};

◆ m_jetCollection

StringProperty Rec::GNNVertexFitterTool::m_jetCollection {this, "JetCollection", "AntiKt4EMPFlowJets", "Jet Collection being used" }
private

Definition at line 117 of file GNNVertexFitterTool.h.

117{this, "JetCollection", "AntiKt4EMPFlowJets", "Jet Collection being used" };

◆ m_jetWriteDecorKeyVertexLink

SG::WriteDecorHandleKey<xAOD::JetContainer> Rec::GNNVertexFitterTool::m_jetWriteDecorKeyVertexLink
Initial value:
{
this, "jetDecorKeyJetLink", "", "WriteDecorHandleKey for adding VertexLink to Jets"}

Definition at line 74 of file GNNVertexFitterTool.h.

74 {
75 this, "jetDecorKeyJetLink", "", "WriteDecorHandleKey for adding VertexLink to Jets"};

◆ m_jetWriteDecorKeyVertexNumber

SG::WriteDecorHandleKey<xAOD::JetContainer> Rec::GNNVertexFitterTool::m_jetWriteDecorKeyVertexNumber
Initial value:
{
this, "jetDecorKeyVertexNumber", "", "WriteDecorHandleKey for adding number of vertices within a Jet"}

Definition at line 76 of file GNNVertexFitterTool.h.

76 {
77 this, "jetDecorKeyVertexNumber", "", "WriteDecorHandleKey for adding number of vertices within a Jet"};

◆ m_massPi

double Rec::GNNVertexFitterTool::m_massPi {}
private

Definition at line 128 of file GNNVertexFitterTool.h.

128{};

◆ m_maxChi2

DoubleProperty Rec::GNNVertexFitterTool::m_maxChi2 {this, "maxChi2", 20, "Maximum Chi Squared"}
private

Definition at line 121 of file GNNVertexFitterTool.h.

121{this, "maxChi2", 20, "Maximum Chi Squared"};

◆ m_maxLxy

DoubleProperty Rec::GNNVertexFitterTool::m_maxLxy {this, "maxLxy", 1e5, "Maximum radial distance from the PV"}
private

Definition at line 124 of file GNNVertexFitterTool.h.

124{this, "maxLxy", 1e5, "Maximum radial distance from the PV"};

◆ m_minLxy

DoubleProperty Rec::GNNVertexFitterTool::m_minLxy {this, "minLxy", 0.0, "Minimum radial distance from the PV"}
private

Definition at line 123 of file GNNVertexFitterTool.h.

123{this, "minLxy", 0.0, "Minimum radial distance from the PV"};

◆ m_minNTrack

DoubleProperty Rec::GNNVertexFitterTool::m_minNTrack {this, "minNTrk", 2, "Minimum number of tracks in a vertex"}
private

Definition at line 127 of file GNNVertexFitterTool.h.

127{this, "minNTrk", 2, "Minimum number of tracks in a vertex"};

◆ m_minSig3D

DoubleProperty Rec::GNNVertexFitterTool::m_minSig3D {this, "minSig3D", 0, "Minimum 3D significance from the PV"}
private

Definition at line 125 of file GNNVertexFitterTool.h.

125{this, "minSig3D", 0, "Minimum 3D significance from the PV"};

◆ m_removeNonHFVertices

BooleanProperty Rec::GNNVertexFitterTool::m_removeNonHFVertices {this, "removeNonHFVertices", true, "Remove vertices with no heavy flavour tracks"}
private

Definition at line 119 of file GNNVertexFitterTool.h.

119{this, "removeNonHFVertices", true, "Remove vertices with no heavy flavour tracks"};

◆ m_thePV

const xAOD::Vertex* Rec::GNNVertexFitterTool::m_thePV {}

Definition at line 83 of file GNNVertexFitterTool.h.

83{};

◆ m_trackLinksKey

SG::ReadDecorHandleKey<xAOD::JetContainer> Rec::GNNVertexFitterTool::m_trackLinksKey
Initial value:
{this, "trackLinksKey", "",
"Jet GNN Deco Read Key for track link"}

Definition at line 65 of file GNNVertexFitterTool.h.

65 {this, "trackLinksKey", "",
66 "Jet GNN Deco Read Key for track link"};

◆ m_trackOriginsKey

SG::ReadDecorHandleKey<xAOD::JetContainer> Rec::GNNVertexFitterTool::m_trackOriginsKey
Initial value:
{this, "trackOriginsKey", "",
"Jet GNN Deco Read Key for track origin"}

Definition at line 67 of file GNNVertexFitterTool.h.

67 {this, "trackOriginsKey", "",
68 "Jet GNN Deco Read Key for track origin"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexFitterTool

ToolHandle<Trk::TrkVKalVrtFitter> Rec::GNNVertexFitterTool::m_vertexFitterTool

Definition at line 62 of file GNNVertexFitterTool.h.

◆ m_vertexLinksKey

SG::ReadDecorHandleKey<xAOD::JetContainer> Rec::GNNVertexFitterTool::m_vertexLinksKey
Initial value:
{this, "vertexLinksKey", "",
"Jet GNN Deco Read Key for vertex link"}

Definition at line 69 of file GNNVertexFitterTool.h.

69 {this, "vertexLinksKey", "",
70 "Jet GNN Deco Read Key for vertex link"};

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: