ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::JetFitterTrackSelectorTool Class Reference

#include <JetFitterTrackSelectorTool.h>

Inheritance diagram for InDet::JetFitterTrackSelectorTool:
Collaboration diagram for InDet::JetFitterTrackSelectorTool:

Public Member Functions

virtual StatusCode initialize () override
 JetFitterTrackSelectorTool (const std::string &t, const std::string &n, const IInterface *p)
 ~JetFitterTrackSelectorTool ()
const Trk::SelectedTracksInJetdoTrackSelection (const xAOD::Vertex &primaryVertex, const TLorentzVector &jetMomentum, const std::vector< const xAOD::IParticle * > &inputTracks) const
std::vector< std::string > trackDecorationNames () const
 Return a list of the names of track decorations created by this tool, in order to allow them to be locked when the calling algorithm completes.
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 ()

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

std::string decorationName () const
 Return the name of the decoration we produce.
int computeTrackCompatibility (const xAOD::Vertex &primaryVertex, const TLorentzVector &jetMomentum, const xAOD::TrackParticle &trk_iter) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< Trk::IExtrapolatorm_extrapolator {this,"Extrapolator","Trk::Extrapolator/InDetExtrapolator",""}
ToolHandle< InDet::InDetJetFitterUtilsm_jetFitterUtils {this,"InDetJetFitterUtils","InDet::InDetJetFitterUtils/InDetJetFitterUtils",""}
ToolHandle< Trk::ITrackSelectorToolm_trkFilter {this,"TrackSelector","InDet::InDetDetailedTrackSelectorTool",""}
Gaudi::Property< bool > m_revertFromPositiveToNegativeTags {this,"revertFromPositiveToNegativeTags",false,""}
Gaudi::Property< double > m_cutCompatibilityPrimaryVertexForPositiveLifetimeTracks {this,"cutCompPrimaryVertexForPosLifetimeTracks",1e-1,""}
Gaudi::Property< double > m_cutCompatibilityPrimaryVertexForNegativeLifetimeTracks {this,"cutCompPrimaryVertexForNegLifetimeTracks",5e-2,""}
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 35 of file JetFitterTrackSelectorTool.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

◆ JetFitterTrackSelectorTool()

JetFitterTrackSelectorTool::JetFitterTrackSelectorTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 9 of file JetFitterTrackSelectorTool.cxx.

10 : AthAlgTool(t, n, p)
11 {
12 declareInterface< JetFitterTrackSelectorTool >(this);
13 }
AthAlgTool()
Default constructor:

◆ ~JetFitterTrackSelectorTool()

JetFitterTrackSelectorTool::~JetFitterTrackSelectorTool ( )
default

Member Function Documentation

◆ computeTrackCompatibility()

int JetFitterTrackSelectorTool::computeTrackCompatibility ( const xAOD::Vertex & primaryVertex,
const TLorentzVector & jetMomentum,
const xAOD::TrackParticle & trk_iter ) const
private

Definition at line 122 of file JetFitterTrackSelectorTool.cxx.

124 {
125
126 // Decorators for tracks
127 SG::AuxElement::Decorator< float > compatibilityDecorator(decorationName());
128
129 // Apply track filter
130 if ( !m_trkFilter->decision( track, &primaryVertex ) ) {
131 compatibilityDecorator ( track ) = 0.;
132 return -1;
133 }
134
135 // Recomputing Perigee w.r.t PV
136 Trk::PerigeeSurface mySurface( primaryVertex.position() );
137 std::unique_ptr<const Trk::TrackParameters> myMeasuredPerigee(m_extrapolator->extrapolate(
138 Gaudi::Hive::currentContext(),track.perigeeParameters(),mySurface ));
139
140 if ( !myMeasuredPerigee) {
141 ATH_MSG_DEBUG( " Extrapolation to primary vertex failed. Skipping track " );
142 compatibilityDecorator ( track ) = 0.;
143 return 0;
144 }
145
146
147 // Prepare for using jetFitterUtils (for the computation of the compatibility)
148 // Is this conrvertion really necessary?
149 Trk::RecVertex primaryVertexRecVertex( primaryVertex.position(),
150 primaryVertex.covariancePosition(),
151 primaryVertex.numberDoF(),
152 primaryVertex.chiSquared());
153
154 Amg::Vector3D jetMomSpatial( jetMomentum.X(),jetMomentum.Y(),jetMomentum.Z() );
155 double compatibilityValue = m_jetFitterUtils->compatibility( *myMeasuredPerigee,primaryVertexRecVertex ).first;
156 compatibilityValue = fabs( compatibilityValue ) * InDet::InDetJetFitterUtils::get3DLifetimeSignOfTrack( *myMeasuredPerigee,
157 jetMomSpatial,
158 primaryVertexRecVertex );
159
160 // Decorate
161 ATH_MSG_DEBUG( "compatibilityValue = " << compatibilityValue );
162 compatibilityDecorator ( track ) = compatibilityValue;
163
164 // Understand if primary or secondary track particle
165 double cutCompatibilityPVforPosTracks = m_cutCompatibilityPrimaryVertexForPositiveLifetimeTracks;
166 double cutCompatibilityPVforNegTracks = m_cutCompatibilityPrimaryVertexForNegativeLifetimeTracks;
167
169 cutCompatibilityPVforNegTracks = m_cutCompatibilityPrimaryVertexForPositiveLifetimeTracks;
170 cutCompatibilityPVforPosTracks = m_cutCompatibilityPrimaryVertexForNegativeLifetimeTracks;
171 }
172
173 if ( ( compatibilityValue < 0 &&
174 TMath::Prob( fabs( compatibilityValue ),2 ) < cutCompatibilityPVforNegTracks) ||
175 ( compatibilityValue >= 0 &&
176 TMath::Prob( fabs( compatibilityValue ),2 ) < cutCompatibilityPVforPosTracks ) )
177 return 2;
178 else return 1;
179
180 }
#define ATH_MSG_DEBUG(x)
static double get3DLifetimeSignOfTrack(const Trk::TrackParameters &track, const Amg::Vector3D &jetMomentum, const Trk::RecVertex &primaryVertex)
Gaudi::Property< double > m_cutCompatibilityPrimaryVertexForPositiveLifetimeTracks
std::string decorationName() const
Return the name of the decoration we produce.
ToolHandle< Trk::ITrackSelectorTool > m_trkFilter
Gaudi::Property< bool > m_revertFromPositiveToNegativeTags
Gaudi::Property< double > m_cutCompatibilityPrimaryVertexForNegativeLifetimeTracks
ToolHandle< InDet::InDetJetFitterUtils > m_jetFitterUtils
ToolHandle< Trk::IExtrapolator > m_extrapolator
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
float chiSquared() const
Returns the of the vertex fit as float.
const Amg::Vector3D & position() const
Returns the 3-pos.
Eigen::Matrix< double, 3, 1 > Vector3D

◆ 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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ 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>

◆ decorationName()

std::string JetFitterTrackSelectorTool::decorationName ( ) const
private

Return the name of the decoration we produce.

Definition at line 100 of file JetFitterTrackSelectorTool.cxx.

101 {
102 std::vector<std::string> out;
103 std::string toolname = this->name();
104 std::string delimiter = "_";
105 std::string::size_type firstDelimiter = toolname.find(delimiter);
106 std::string sub = toolname.substr(0, firstDelimiter);
108 sub += "FLIP_SIGN";
109 }
110 return std::string("JetFitter_TrackCompatibility_") + sub;
111 }

◆ 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.

◆ doTrackSelection()

const Trk::SelectedTracksInJet * JetFitterTrackSelectorTool::doTrackSelection ( const xAOD::Vertex & primaryVertex,
const TLorentzVector & jetMomentum,
const std::vector< const xAOD::IParticle * > & inputTracks ) const

Definition at line 38 of file JetFitterTrackSelectorTool.cxx.

40 {
41 // perform the track selection
42 // step 1, apply a track filter like "InDet::InDetDetailedTrackSelectorTool"
43 // step 2, calculate the compatibility of filtered tracks with primary vertex
44 // use this to deduce primaryTracks and secondaryTracks
45
46 ATH_MSG_DEBUG( "Doing track selection on " << inputTracks.size() << " tracks ... " );
47
48 // We need to use normal pointers instead of smart pointers since the code breaks.
49 // We have to fix this issue in the future
50 // if ( m_selectedTracks != nullptr ) delete m_selectedTracks; // May this break the code?
51 Trk::SelectedTracksInJet *selectedTracks = new Trk::SelectedTracksInJet();
52
53 // Vectors of Trk::ITrackLink to be given to m_selectedTracks once we understand if they are primary of secondary tracks
54 std::vector< const Trk::ITrackLink* > primaryTrackLinks;
55 std::vector< const Trk::ITrackLink* > secondaryTrackLinks;
56
57 // Running on input tracks
58 std::vector<const xAOD::IParticle *>::const_iterator trk_iter = inputTracks.begin();
59 std::vector<const xAOD::IParticle*>::const_iterator trk_end = inputTracks.end();
60
61 int counter = 0;
62 for ( ; trk_iter != trk_end; ++trk_iter ) {
63 // Convert xAOD::IParticle to xAOD::TrackParticle
64 const xAOD::TrackParticle * tmp = dynamic_cast< const xAOD::TrackParticle* > ( *trk_iter );
65 assert( tmp != nullptr ); // in principle should really check that inputTracks only contains TrackParticle objects
66
67 // Compute compatibility and understand track type
68 // -1: track filter failed
69 // 0: extrapolation of MeasuredPerigee failed
70 // 1: primary
71 // 2: secondary
72 int type = computeTrackCompatibility( primaryVertex,jetMomentum,*tmp );
73
74 // Create Trk::ITrackLink collections to be given to selected tracks
75 if (type==1 || type==2) {
76 ElementLink< xAOD::TrackParticleContainer > linkTP;
77 linkTP.setElement( tmp );
78 Trk::LinkToXAODTrackParticle* link= new Trk::LinkToXAODTrackParticle( linkTP );
79
80 if ( type == 1) primaryTrackLinks.push_back( link );
81 else if ( type == 2 ) secondaryTrackLinks.push_back( link );
82 }
83 else {
84 continue;
85 }
86
87 // How many tracks we are selecting
88 counter++;
89 }
90
91 ATH_MSG_DEBUG( " Total of selected tracks: "<< counter );
92
93 selectedTracks->setPrimaryTrackLinks( primaryTrackLinks );
94 selectedTracks->setSecondaryTrackLinks( secondaryTrackLinks );
95 return selectedTracks;
96 }
int computeTrackCompatibility(const xAOD::Vertex &primaryVertex, const TLorentzVector &jetMomentum, const xAOD::TrackParticle &trk_iter) const
void setPrimaryTrackLinks(std::vector< const ITrackLink * > &primaryTrackLinks)
Set the primary tracks (takes ownership of pointers)
void setSecondaryTrackLinks(std::vector< const ITrackLink * > &secondaryTracLinks)
Set the secondary tracks (takes ownership of pointers)
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ 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

◆ initialize()

StatusCode JetFitterTrackSelectorTool::initialize ( )
overridevirtual

Definition at line 17 of file JetFitterTrackSelectorTool.cxx.

17 {
18
19 if ( m_trkFilter.retrieve().isFailure() ) {
20 msg(MSG::ERROR) << " Unable to retrieve InDet::InDetDetailedTrackSelectorTool" << endmsg;
21 return StatusCode::FAILURE;
22 }
23
24 if ( m_jetFitterUtils.retrieve().isFailure() ) {
25 msg(MSG::ERROR) << " Unable to retrieve InDet::InDetJetFitterUtils/InDetJetFitterUtils" << endmsg;
26 return StatusCode::FAILURE;
27 }
28
29 if ( m_extrapolator.retrieve().isFailure() ) {
30 msg(MSG::ERROR) << " Unable to retrieve Trk::Extrapolator/InDetExtrapolator" << endmsg;
31 return StatusCode::FAILURE;
32 }
33
34 return StatusCode::SUCCESS;
35 }
#define endmsg
MsgStream & msg() const

◆ 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 & InDet::JetFitterTrackSelectorTool::interfaceID ( )
inlinestatic

Definition at line 38 of file JetFitterTrackSelectorTool.h.

38 {
40 }
static const InterfaceID IID_JetFitterTrackSelectorTool("JetFitterTrackSelectorTool", 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.

◆ trackDecorationNames()

std::vector< std::string > JetFitterTrackSelectorTool::trackDecorationNames ( ) const

Return a list of the names of track decorations created by this tool, in order to allow them to be locked when the calling algorithm completes.

Definition at line 117 of file JetFitterTrackSelectorTool.cxx.

118 {
119 return std::vector<std::string> { decorationName() };
120 }

◆ 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

Member Data Documentation

◆ m_cutCompatibilityPrimaryVertexForNegativeLifetimeTracks

Gaudi::Property< double > InDet::JetFitterTrackSelectorTool::m_cutCompatibilityPrimaryVertexForNegativeLifetimeTracks {this,"cutCompPrimaryVertexForNegLifetimeTracks",5e-2,""}
private

Definition at line 76 of file JetFitterTrackSelectorTool.h.

76{this,"cutCompPrimaryVertexForNegLifetimeTracks",5e-2,""};

◆ m_cutCompatibilityPrimaryVertexForPositiveLifetimeTracks

Gaudi::Property< double > InDet::JetFitterTrackSelectorTool::m_cutCompatibilityPrimaryVertexForPositiveLifetimeTracks {this,"cutCompPrimaryVertexForPosLifetimeTracks",1e-1,""}
private

Definition at line 75 of file JetFitterTrackSelectorTool.h.

75{this,"cutCompPrimaryVertexForPosLifetimeTracks",1e-1,""};

◆ 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_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_extrapolator

ToolHandle< Trk::IExtrapolator > InDet::JetFitterTrackSelectorTool::m_extrapolator {this,"Extrapolator","Trk::Extrapolator/InDetExtrapolator",""}
private

Definition at line 69 of file JetFitterTrackSelectorTool.h.

69{this,"Extrapolator","Trk::Extrapolator/InDetExtrapolator",""};

◆ m_jetFitterUtils

ToolHandle< InDet::InDetJetFitterUtils > InDet::JetFitterTrackSelectorTool::m_jetFitterUtils {this,"InDetJetFitterUtils","InDet::InDetJetFitterUtils/InDetJetFitterUtils",""}
private

Definition at line 70 of file JetFitterTrackSelectorTool.h.

70{this,"InDetJetFitterUtils","InDet::InDetJetFitterUtils/InDetJetFitterUtils",""};

◆ m_revertFromPositiveToNegativeTags

Gaudi::Property< bool > InDet::JetFitterTrackSelectorTool::m_revertFromPositiveToNegativeTags {this,"revertFromPositiveToNegativeTags",false,""}
private

Definition at line 74 of file JetFitterTrackSelectorTool.h.

74{this,"revertFromPositiveToNegativeTags",false,""};

◆ m_trkFilter

ToolHandle< Trk::ITrackSelectorTool > InDet::JetFitterTrackSelectorTool::m_trkFilter {this,"TrackSelector","InDet::InDetDetailedTrackSelectorTool",""}
private

Definition at line 71 of file JetFitterTrackSelectorTool.h.

71{this,"TrackSelector","InDet::InDetDetailedTrackSelectorTool",""};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ 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: