ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::AlignTrackDresser Class Reference

#include <AlignTrackDresser.h>

Inheritance diagram for Trk::AlignTrackDresser:
Collaboration diagram for Trk::AlignTrackDresser:

Public Member Functions

 AlignTrackDresser (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual bool dressAlignTrack (AlignTrack *alignTrack) override
 dresses alignTrack with derivatives and other information
void setResiduals (AlignTrack *alignTrack) const
 sets residuals for TSOS on alignTrack
virtual void setLogStream (std::ostream *os) override
 sets the output stream for the logfile
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.

Protected Attributes

std::ostream * m_logStream = nullptr
 logfile output stream

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

ToolHandle< IDerivCalcToolm_derivCalcTool
unsigned int m_numBadCovWMatrix = 0
 number of tracks with invalid weight matrix from the deriv.calc.tool
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 33 of file AlignTrackDresser.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

◆ AlignTrackDresser()

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

Definition at line 25 of file AlignTrackDresser.cxx.

26 : AthAlgTool(type,name,parent)
27 {
28 declareInterface<IAlignTrackDresser>(this);
29 }
AthAlgTool()
Default constructor:

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

◆ dressAlignTrack()

bool AlignTrackDresser::dressAlignTrack ( AlignTrack * alignTrack)
overridevirtual

dresses alignTrack with derivatives and other information

Implements Trk::IAlignTrackDresser.

Definition at line 62 of file AlignTrackDresser.cxx.

63 {
64 // set hit residuals
65 setResiduals(alignTrack);
66
67 ATH_MSG_DEBUG("residuals set, getting partial derivatives from m_derivCalcTool="<<m_derivCalcTool);
68
69 // set partial derivatives of hit residuals w.r.t. alignment parameters
70 if (!m_derivCalcTool->setDerivatives(alignTrack))
71 return false;
72
73 // for global method we let the deriv.calc.tool calculate the weight matrix
74 // get W = V^{-1} R V^{-1} (simply V^{-1} for numerical derivatives)
75 bool Wisvalid = m_derivCalcTool->setResidualCovMatrix(alignTrack);
76
77 if (!Wisvalid) {
78 ATH_MSG_INFO("something is wrong with the cov matrix for the residuals.");
80 }
81
82 return Wisvalid;
83 }
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
unsigned int m_numBadCovWMatrix
number of tracks with invalid weight matrix from the deriv.calc.tool
void setResiduals(AlignTrack *alignTrack) const
sets residuals for TSOS on alignTrack
ToolHandle< IDerivCalcTool > m_derivCalcTool

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

Definition at line 54 of file AlignTrackDresser.cxx.

55 {
57 ATH_MSG_INFO("Total of "<<m_numBadCovWMatrix<<" tracks had invalid weight matrix.");
58 return StatusCode::SUCCESS;
59 }

◆ initialize()

StatusCode AlignTrackDresser::initialize ( )
overridevirtual

Definition at line 32 of file AlignTrackDresser.cxx.

33 {
34 ATH_MSG_DEBUG("in AlignTrackDresser initialize()");
35
36 // Get DerivCalcTool (will have to be moved to AlignTool)
37 if ( m_derivCalcTool.retrieve().isFailure() ) {
38 ATH_MSG_FATAL("Failed to retrieve tool " << m_derivCalcTool);
39 return StatusCode::FAILURE;
40 }
41 ATH_MSG_INFO("Retrieved tool " << m_derivCalcTool);
42
43 return StatusCode::SUCCESS;
44 }
#define ATH_MSG_FATAL(x)

◆ 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 & IAlignTrackDresser::interfaceID ( )
inlinestaticinherited

Definition at line 46 of file IAlignTrackDresser.h.

static const InterfaceID IID_TRK_IAlignTrackDresser("IAlignTrackDresser", 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 }

◆ setLogStream()

void AlignTrackDresser::setLogStream ( std::ostream * os)
overridevirtual

sets the output stream for the logfile

Reimplemented from Trk::IAlignTrackDresser.

Definition at line 47 of file AlignTrackDresser.cxx.

48 {
50 m_derivCalcTool->setLogStream(m_logStream);
51 }
std::ostream * m_logStream
logfile output stream

◆ setResiduals()

void AlignTrackDresser::setResiduals ( AlignTrack * alignTrack) const

sets residuals for TSOS on alignTrack

Definition at line 86 of file AlignTrackDresser.cxx.

87 {
88 if (alignTrack->residualVector())
89 ATH_MSG_ERROR("alignTrack already has residuals!");
90
91 const int NMEAS = alignTrack->nAlignTSOSMeas();
92 Amg::VectorX * residuals = new Amg::VectorX(NMEAS);
93
94 int imeas = 0;
95 AlignTSOSCollection::const_iterator atsosItr = alignTrack->firstAtsos();
96 for ( ; atsosItr != alignTrack->lastAtsos(); ++atsosItr) {
97
98 if (!(*atsosItr)->isValid())
99 continue;
100
101 std::vector<Residual>::const_iterator itRes = (**atsosItr).firstResidual();
102 for ( ; itRes != (**atsosItr).lastResidual() ; ++itRes, ++imeas) {
103 (*residuals)[imeas] = itRes->residual();
104 if (msgLvl(MSG::DEBUG)) {
105 double z=(**atsosItr).measurementOnTrack()->globalPosition().z();
106 ATH_MSG_DEBUG("pos.z: "<<z<<", res["<<imeas<<"]="<<itRes->residual()<<" res/sq["<<imeas<<"]="<<itRes->residualNorm());
107 }
108 }
109 }
110
111 if (imeas!=NMEAS) {
112 ATH_MSG_ERROR("problem with nmeas. imeas="<<imeas<<", NMEAS="<<NMEAS);
113 throw std::runtime_error("Error in AlignTrackDresser::setResiduals");
114 }
115
116 alignTrack->setResidualVector(residuals); // residuals owned by alignTrack
117 ATH_MSG_DEBUG("residuals set for AlignTrack");
118 }
#define ATH_MSG_ERROR(x)
bool msgLvl(const MSG::Level lvl) const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
@ z
global position (cartesian)
Definition ParamDefs.h:57

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

ToolHandle<IDerivCalcTool> Trk::AlignTrackDresser::m_derivCalcTool
private
Initial value:
{
this, "DerivCalcTool", "Trk::AnalyticalDerivCalcTool",
"tool for calculating derivatives of residuals wrt. alignment parameters"}

Definition at line 53 of file AlignTrackDresser.h.

53 {
54 this, "DerivCalcTool", "Trk::AnalyticalDerivCalcTool",
55 "tool for calculating derivatives of residuals wrt. alignment parameters"};

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

std::ostream* Trk::IAlignTrackDresser::m_logStream = nullptr
protectedinherited

logfile output stream

Definition at line 42 of file IAlignTrackDresser.h.

◆ m_numBadCovWMatrix

unsigned int Trk::AlignTrackDresser::m_numBadCovWMatrix = 0
private

number of tracks with invalid weight matrix from the deriv.calc.tool

Definition at line 57 of file AlignTrackDresser.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: