ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::ConversionFinderUtils Class Referencefinal

Some helper tools like: hits counter. More...

#include <ConversionFinderUtils.h>

Inheritance diagram for InDet::ConversionFinderUtils:
Collaboration diagram for InDet::ConversionFinderUtils:

Public Member Functions

 ConversionFinderUtils (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~ConversionFinderUtils ()
virtual StatusCode initialize () override
virtual StatusCode finalize () override
double distBetweenTracks (const Trk::Track *trk_pos, const Trk::Track *trk_neg) const
 Approximate distance of minimum approach between tracks in pair.
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 ()
static double momFraction (const Trk::TrackParameters *per1, const Trk::TrackParameters *per2)
 helper functions
static std::unique_ptr< Trk::TrackaddNewPerigeeToTrack (const Trk::Track *track, const Trk::Perigee *mp)
 Add new perigee to track.
static xAOD::VertexcorrectVxCandidate (xAOD::Vertex *, Amg::Vector3D)
 Correct VxCandidate with respect to a user defined vertex.

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

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

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

Some helper tools like: hits counter.

Author
Tatjana Lenz , Thomas Koffas

Definition at line 27 of file ConversionFinderUtils.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

◆ ConversionFinderUtils()

InDet::ConversionFinderUtils::ConversionFinderUtils ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 29 of file ConversionFinderUtils.cxx.

32 : AthAlgTool(type, name, parent)
33 {
34 declareInterface<ConversionFinderUtils>(this);
35 }
AthAlgTool()
Default constructor:

◆ ~ConversionFinderUtils()

InDet::ConversionFinderUtils::~ConversionFinderUtils ( )
virtualdefault

Member Function Documentation

◆ addNewPerigeeToTrack()

std::unique_ptr< Trk::Track > InDet::ConversionFinderUtils::addNewPerigeeToTrack ( const Trk::Track * track,
const Trk::Perigee * mp )
static

Add new perigee to track.

Definition at line 133 of file ConversionFinderUtils.cxx.

135 {
136
137 // fitQuality from track
138 auto fq = track->fitQuality()->uniqueClone();
139 if(!fq) return nullptr;
140
141 // output datavector of TSOS
142 auto ntsos = std::make_unique<Trk::TrackStates>();
143 const Trk::TrackStates* tsos = track->trackStateOnSurfaces();
144 if(!tsos) {return nullptr;}
147 for(its=tsos->begin();its!=itse;++its) {
148
149 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
150 typePattern.set(Trk::TrackStateOnSurface::Perigee);
151 const Trk::TrackStateOnSurface* per_tsos =
153 ? new Trk::TrackStateOnSurface(nullptr, mp->uniqueClone(), nullptr, typePattern)
154 : (*its)->clone();
155 ntsos->push_back(per_tsos);
156 }
157
158 //Construct the new track
159 Trk::TrackInfo info;
160 return std::make_unique<Trk::Track>(info, std::move(ntsos), std::move(fq));
161 }
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
std::unique_ptr< ParametersBase< DIM, T > > uniqueClone() const
clone method for polymorphic deep copy returning unique_ptr; it is not overriden, but uses the existi...
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
DataVector< const Trk::TrackStateOnSurface > TrackStates

◆ correctVxCandidate()

xAOD::Vertex * InDet::ConversionFinderUtils::correctVxCandidate ( xAOD::Vertex * initVxCandidate,
Amg::Vector3D guessVertex )
static

Correct VxCandidate with respect to a user defined vertex.

Definition at line 164 of file ConversionFinderUtils.cxx.

166 {
167 Amg::Vector3D correctVertex(initVxCandidate->position().x()+guessVertex.x(),
168 initVxCandidate->position().y()+guessVertex.y(),
169 initVxCandidate->position().z()+guessVertex.z());
170
171 Amg::Vector3D globalVertexPosition(correctVertex.x(),correctVertex.y(),correctVertex.z());
172
173 std::vector<Trk::VxTrackAtVertex> tmpVTAV;
174
175 const std::vector<Trk::VxTrackAtVertex> &trkAtVtx = initVxCandidate->vxTrackAtVertex();
176 for (const auto& vtxTrack : trkAtVtx) {
177 const Trk::TrackParameters* vtxPer = vtxTrack.perigeeAtVertex();
178 const AmgVector(5)& iv = vtxPer->parameters();
179 AmgSymMatrix(5) em(*(vtxPer->covariance()));
180 Trk::PerigeeSurface surface (globalVertexPosition);
181
182 Trk::TrackParameters* tmpMeasPer =
183 surface
184 .createUniqueParameters<5, Trk::Charged>(
185 0., 0., iv[2], iv[3], iv[4], std::move(em))
186 .release();
187
188 Trk::VxTrackAtVertex trkV(vtxTrack.trackQuality().chiSquared(),
189 tmpMeasPer);
190 tmpVTAV.push_back(trkV);
191 }//end of loop over VxTracksAtVertex
192
193 if(tmpVTAV.size()!=2) return nullptr;
194
195 //Create the xAOD::Vertex and set the position and VxTrackAtVertex properly
196 xAOD::Vertex *vx = new xAOD::Vertex(*initVxCandidate);
197 vx->setPosition(correctVertex);
198 vx->vxTrackAtVertex().clear();
199 for (const auto& vtxTrack : tmpVTAV) {
200 vx->vxTrackAtVertex().push_back(vtxTrack);
201 }
202
203 return vx;
204 }//end of correct vxCandidate method
#define AmgSymMatrix(dim)
#define AmgVector(rows)
boost::graph_traits< boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS > >::vertex_descriptor Vertex
if(febId1==febId2)
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.
const Amg::Vector3D & position() const
Returns the 3-pos.
static std::string release
Definition computils.h:50
Eigen::Matrix< double, 3, 1 > Vector3D
ParametersBase< TrackParametersDim, Charged > TrackParameters

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

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

◆ distBetweenTracks()

double InDet::ConversionFinderUtils::distBetweenTracks ( const Trk::Track * trk_pos,
const Trk::Track * trk_neg ) const

Approximate distance of minimum approach between tracks in pair.

distance between two tracks

Definition at line 70 of file ConversionFinderUtils.cxx.

72 {
73
74 //position of the first measurement on the positive track
75 const Trk::MeasurementBase* first_pos_meas = trk_pos->measurementsOnTrack()->front();
76 Amg::Vector3D trk_hit_pos = first_pos_meas->globalPosition();
77
78 //check if really the first measurement
79 for (const Trk::MeasurementBase* m : *trk_pos->measurementsOnTrack())
80 if(trk_hit_pos.mag() > m->globalPosition().mag()) first_pos_meas = m;
81
82 trk_hit_pos = first_pos_meas->globalPosition();
83
84 //position of the first hit--->track2
85 const Trk::MeasurementBase* first_neg_meas = trk_neg->measurementsOnTrack()->front();
86 Amg::Vector3D trk_hit_neg = first_neg_meas->globalPosition();
87
88 //check if really the first measurement
89 for (const Trk::MeasurementBase* m : *trk_neg->measurementsOnTrack())
90 if(trk_hit_neg.mag() > m->globalPosition().mag()) first_neg_meas = m;
91
92 trk_hit_neg = first_neg_meas->globalPosition();
93 double distance = 1000.;
94
95 //check if measurements are on the same surface
96 if (first_pos_meas->associatedSurface() == first_neg_meas->associatedSurface()) distance =
97 std::sqrt(std::pow(trk_hit_pos[0] - trk_hit_neg[0],2.) + std::pow(trk_hit_pos[1] - trk_hit_neg[1],2.) +
98 std::pow(trk_hit_pos[2] - trk_hit_neg[2],2.));
99
100
101 //if not choose the track with the fist measurement closest to 000 and calculate the distance
102 //of the closest approach of another track to this measurement
103 else {
104
105 //define reference point and track parameter (--> perigees) of the second track
106 Amg::Vector3D ref_point;
107 const Trk::Perigee* perigee;
108
109 if (first_pos_meas->globalPosition().mag() < first_neg_meas->globalPosition().mag()) {
110 ref_point = first_pos_meas->globalPosition();
111 perigee = trk_neg->perigeeParameters();
112 } else {
113 ref_point = first_neg_meas->globalPosition();
114 perigee = trk_pos->perigeeParameters();
115 }
116
117 // when the helix can be approximated as a straight line, when the
118 // distance of closest approach can be calculated as distance^2 = [momentum
119 // x (ref_point-position)]^2/momentum^2
120 const Amg::Vector3D& momentum = perigee->momentum();
121 const Amg::Vector3D& position = perigee->position();
122 double p = momentum.mag();
123 Amg::Vector3D delta = position - ref_point;
124 distance = std::sqrt(std::pow(delta.mag(),2.) - std::pow((delta.adjoint()*momentum)[0]/p,2.));
125 }
126
127 ATH_MSG_DEBUG("Distance between two tracks = "<<distance);
128 return distance;
129 } // end of distBetweenTracks method
#define ATH_MSG_DEBUG(x)
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
virtual const Amg::Vector3D & globalPosition() const =0
Interface method to get the global Position.
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
const DataVector< const MeasurementBase > * measurementsOnTrack() const
return a pointer to a vector of MeasurementBase (NOT including any that come from outliers).
const Perigee * perigeeParameters() const
return Perigee.
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee

◆ 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 InDet::ConversionFinderUtils::finalize ( )
overridevirtual

Definition at line 48 of file ConversionFinderUtils.cxx.

48 {
49 return StatusCode::SUCCESS;
50 }

◆ initialize()

StatusCode InDet::ConversionFinderUtils::initialize ( )
overridevirtual

Definition at line 44 of file ConversionFinderUtils.cxx.

44 {
45 return StatusCode::SUCCESS;
46 }

◆ 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::ConversionFinderUtils::interfaceID ( )
static

Definition at line 39 of file ConversionFinderUtils.cxx.

40 {
42 }
static const InterfaceID IID_IConversionFinderUtils("InDet::ConversionFinderUtils", 1, 0)

◆ momFraction()

double InDet::ConversionFinderUtils::momFraction ( const Trk::TrackParameters * per1,
const Trk::TrackParameters * per2 )
static

helper functions

mom fraction

Momentum fraction of tracks in pair.

Definition at line 56 of file ConversionFinderUtils.cxx.

58 {
59
60 const Amg::Vector3D& mom_pos = per1->momentum();
61 const Amg::Vector3D& mom_neg = per2->momentum();
62 double momFraction = mom_pos.mag()/(mom_pos.mag() + mom_neg.mag());
63 return momFraction;
64 }
static double momFraction(const Trk::TrackParameters *per1, const Trk::TrackParameters *per2)
helper functions

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

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