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

#include <AnalyticalDerivCalcTool.h>

Inheritance diagram for Trk::AnalyticalDerivCalcTool:
Collaboration diagram for Trk::AnalyticalDerivCalcTool:

Public Types

enum  SolveOption {
  NONE = 0 , SOLVE = 1 , SOLVE_FAST = 2 , DIRECT_SOLVE = 3 ,
  DIRECT_SOLVE_FAST = 4 , DIRECT_SOLVE_CLUSTER = 5
}
 enum of different solving options More...

Public Member Functions

 AnalyticalDerivCalcTool (const std::string &type, const std::string &name, const IInterface *parent)
StatusCode initialize () override
StatusCode finalize () override
bool setDerivatives (AlignTrack *alignTrack) override
 sets analytical partial derivatives of residuals w.r.t alignment parameters for TSOS on alignTrack.
void showStatistics () override
 not used yet
bool setResidualCovMatrix (AlignTrack *alignTrack) const override
 sets residual covariance matrix
void setSolveOption (int solveOption)
 solving option (see enum above)
virtual void setLogStream (std::ostream *os)
 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 ()
 Retrieve interface ID.

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

bool getMeasErrorMatrix (const AlignTrack *alignTrack, Amg::MatrixX &V) const
bool getTrkParamCovMatrix (const AlignTrack *alignTrack, Amg::MatrixX &HCH) const
bool checkValidity (const Amg::MatrixX &R) const
std::vector< Amg::VectorXgetDerivatives (AlignTrack *alignTrack, const AlignModule *module)
void checkResidualType (const AlignTrack *alignTrack)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

PublicToolHandle< IAlignModuleToolm_alignModuleTool
const AtlasDetectorIDm_idHelper = nullptr
MeasurementTypeIDm_measTypeIdHelper = nullptr
std::vector< std::pair< const AlignModule *, std::vector< Amg::VectorX > > > m_derivatives
BooleanProperty m_useLocalSetting
BooleanProperty m_useIntrinsicPixelErrors
BooleanProperty m_useIntrinsicSCTErrors
BooleanProperty m_useIntrinsicTRTErrors
int m_residualType = Trk::AlignResidualType::HitOnly
 residual type to be used in the calculations
bool m_residualTypeSet = false
 do we have the residual type set?
BooleanProperty m_storeDerivatives
int m_solveOption = 0
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 41 of file AnalyticalDerivCalcTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ SolveOption

enum of different solving options

Enumerator
NONE 

not solve in any case (to be used when ipc)

SOLVE 

solving after data accumulation (LAPACK)

SOLVE_FAST 

Fast (Eigen method) solving after data accumulation.

DIRECT_SOLVE 

direct solving (LAPACK), already available matrix & vector

DIRECT_SOLVE_FAST 

direct Fast (Eigen method) solving, already available matrix & vector

DIRECT_SOLVE_CLUSTER 

computation of alignment parameters from SCALAPAK already solved matrix

Definition at line 41 of file IDerivCalcTool.h.

41 {
42 NONE = 0,
43 SOLVE = 1,
44 SOLVE_FAST = 2,
45 DIRECT_SOLVE = 3,
48 }; // this is also defined in TrkGlobAlign class
@ DIRECT_SOLVE_FAST
direct Fast (Eigen method) solving, already available matrix & vector
@ DIRECT_SOLVE_CLUSTER
computation of alignment parameters from SCALAPAK already solved matrix
@ SOLVE
solving after data accumulation (LAPACK)
@ SOLVE_FAST
Fast (Eigen method) solving after data accumulation.
@ NONE
not solve in any case (to be used when ipc)
@ DIRECT_SOLVE
direct solving (LAPACK), already available matrix & vector

Constructor & Destructor Documentation

◆ AnalyticalDerivCalcTool()

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

Definition at line 31 of file AnalyticalDerivCalcTool.cxx.

34 : AthAlgTool(type,name,parent)
35 {
36 declareInterface<IDerivCalcTool>(this);
37 }
AthAlgTool()
Default constructor:

Member Function Documentation

◆ checkResidualType()

void AnalyticalDerivCalcTool::checkResidualType ( const AlignTrack * alignTrack)
private

Definition at line 815 of file AnalyticalDerivCalcTool.cxx.

816 {
817 // get first AlignTSOS of the AlignTrack
818 // this assumes that for unbiased or DCA residuals the scatterers
819 // and energy deposits are not included in the AlignTSOSSollection
820 const AlignTSOS * atsos = *(alignTrack->firstAtsos());
821
822 // get residual type of the first residual
823 m_residualType = atsos->firstResidual()->residualType();
824 ATH_MSG_DEBUG("setting residualType to "<<m_residualType);
825
826 m_residualTypeSet = true;
827 }
#define ATH_MSG_DEBUG(x)
int m_residualType
residual type to be used in the calculations
bool m_residualTypeSet
do we have the residual type set?

◆ checkValidity()

bool AnalyticalDerivCalcTool::checkValidity ( const Amg::MatrixX & R) const
private

Definition at line 510 of file AnalyticalDerivCalcTool.cxx.

511 {
512 // perform some sort of sanity check. depending on how many hits
513 // on the track we use, R can have zero determinant, but it
514 // should definitely not be negative. for now, we'll just check
515 // that all diagonal elements are positive and that all correlation
516 // coefficients are within bounds
517
518 bool Risvalid(true);
519 const double epsilon=1e-10;
520 for( int irow=0; irow<R.rows(); ++irow) {
521
522 Risvalid = Risvalid && R(irow,irow)>0;
523 if ( msgLvl(MSG::DEBUG) ) {
524 if( !(R(irow,irow)>0) )
525 msg(MSG::DEBUG) << "matrix invalid: (" << irow << "," << irow<<") = " << R(irow,irow) << endmsg;
526 }
527 else if (!Risvalid)
528 break;
529
530 for(int icol=0; icol<=irow; ++icol) {
531 // this one must be true if everything else succeeded
532 double Rcorr = R(irow,icol)/sqrt(R(irow,irow)*R(icol,icol));
533 if( Rcorr+epsilon<-1 || Rcorr-epsilon>1 )
534 {
535 Risvalid = false;
536 if (msgLvl(MSG::DEBUG))
537 ATH_MSG_DEBUG("matrix corr invalid for (" << irow << "," << icol << ") Rcorr = " << Rcorr);
538 else
539 break;
540 }
541 }
542 }
543
544 if( !Risvalid ) {
545 ATH_MSG_WARNING("Checked matrix is invalid.");
546 ATH_MSG_WARNING("R: \n"<<R);
547 }
548 return Risvalid;
549 }
#define endmsg
#define ATH_MSG_WARNING(x)
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)

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

◆ 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 AnalyticalDerivCalcTool::finalize ( )
override

Definition at line 58 of file AnalyticalDerivCalcTool.cxx.

59 {
60 ATH_MSG_DEBUG("in AnalyticalDerivCalcTool::finalize()");
61 return StatusCode::SUCCESS;
62 }

◆ getDerivatives()

std::vector< Amg::VectorX > AnalyticalDerivCalcTool::getDerivatives ( AlignTrack * alignTrack,
const AlignModule * module )
private

for L16 in local stave frame Bowing Parameterised by a 2nd order polynomial
const double localy = refPos.y(); stave length in the IBL – we will see if there a more generic way of doing this const double y0y0 = 366.5*366.5; refPos.y() should be the y position along in the AlignModule Frame projR[AlignModule::BowX] = Rxx * ( localy*localy - y0y0 ) / y0y0; projR[AlignModule::BowX] = -Rxx * ( localy*localy ) / y0y0; // change the bowing base

for L11 in global frame Bowing Parameterised by a 2nd order polynomial
const double localz = refPos.z();
stave length in the IBL – we will see if there a more generic way of doing this
const double z0z0 = 366.5*366.5;
refPos.z() should be the z position along in the AlignModule Frame projR[AlignModule::BowX] = -projR[AlignModule::RotZ] / refPos.perp() * ( localz*localz - z0z0 ) / z0z0;

try a generic formula:

Definition at line 552 of file AnalyticalDerivCalcTool.cxx.

553 {
554 // module-specific transforms
555 Amg::Transform3D globalFrameToAlignFrame = module->globalFrameToAlignFrame();
556 ATH_MSG_DEBUG("globalFrameToAlignFrame: ");
557 ATH_MSG_DEBUG(globalFrameToAlignFrame(0,0)<<" "<<
558 globalFrameToAlignFrame(0,1)<<" "<<
559 globalFrameToAlignFrame(0,2));
560 ATH_MSG_DEBUG(globalFrameToAlignFrame(1,0)<<" "<<
561 globalFrameToAlignFrame(1,1)<<" "<<
562 globalFrameToAlignFrame(1,2));
563 ATH_MSG_DEBUG(globalFrameToAlignFrame(2,0)<<" "<<
564 globalFrameToAlignFrame(2,1)<<" "<<
565 globalFrameToAlignFrame(2,2));
566
567 Amg::RotationMatrix3D globalToAlignFrameRotation = module->globalToAlignFrameRotation();
568 ATH_MSG_DEBUG("globalToAlignFrameRotation: ");
569 ATH_MSG_DEBUG(globalToAlignFrameRotation(0,0)<<" "<<
570 globalToAlignFrameRotation(0,1)<<" "<<
571 globalToAlignFrameRotation(0,2));
572 ATH_MSG_DEBUG(globalToAlignFrameRotation(1,0)<<" "<<
573 globalToAlignFrameRotation(1,1)<<" "<<
574 globalToAlignFrameRotation(1,2));
575 ATH_MSG_DEBUG(globalToAlignFrameRotation(2,0)<<" "<<
576 globalToAlignFrameRotation(2,1)<<" "<<
577 globalToAlignFrameRotation(2,2));
578
579 DataVector<AlignPar> * alignPars = m_alignModuleTool->getAlignPars(module);
580 const int nAlignPar = alignPars->size();
581
582 //Create derivatives storage vector and initialise them ro zero
583 std::vector<Amg::VectorX> derivatives( nAlignPar+3 , Amg::VectorX(alignTrack->nAlignTSOSMeas()));
584 for(int i(0); i<nAlignPar+3; ++i) derivatives[i].setZero();
585
586 int imeas(0);
587 AlignTSOSCollection::iterator iatsos = alignTrack->firstAtsos();
588 for (; iatsos != alignTrack->lastAtsos(); ++iatsos) {
589
590 AlignTSOS * alignTSOS = *iatsos;
591 if (!alignTSOS->isValid() || nullptr==alignTSOS->module())
592 continue;
593
594 // we only calculate the derivatives if the AlignTSOS belongs to the align module
595 int nResDim = alignTSOS->nResDim();
596 if (alignTSOS->module() != module) {
597 imeas += nResDim;
598 continue;
599 }
600
601 // derivatives to be stored on the AlignTSOS
602 std::vector<Amg::VectorX> * atsosDerivs = nullptr;
603 std::vector<Amg::VectorX> * atsosDerVtx = nullptr;
604 if (m_storeDerivatives) {
605 atsosDerivs = new std::vector<Amg::VectorX>(nResDim,Amg::VectorX(nAlignPar));
606 atsosDerVtx = new std::vector<Amg::VectorX>(nResDim,Amg::VectorX(3));
607 ATH_MSG_DEBUG("nResDim = "<<nResDim<<" vector size is "<<atsosDerivs->size());
608 ATH_MSG_DEBUG("nAlignPar = "<<nAlignPar<<" CLHEP::HepVector size is "<<atsosDerivs->at(0).rows());
609 }
610
611 // Get the rotation to the frame in which the residual is
612 // defined. In this frame the trkdistance is the x-coordinate.
613
614 const TrackParameters * mtp = alignTSOS->trackParameters();
615 if (!mtp || !(mtp->covariance()) ) continue;
616 Amg::RotationMatrix3D localToGlobalRotation = mtp->measurementFrame();
617
618
619 ATH_MSG_DEBUG( "localToGlobalRotation:");
620 ATH_MSG_DEBUG(localToGlobalRotation(0,0) << " " <<
621 localToGlobalRotation(0,1) << " " <<
622 localToGlobalRotation(0,2));
623 ATH_MSG_DEBUG(localToGlobalRotation(1,0) << " " <<
624 localToGlobalRotation(1,1) << " " <<
625 localToGlobalRotation(1,2));
626 ATH_MSG_DEBUG(localToGlobalRotation(2,0) << " " <<
627 localToGlobalRotation(2,1) << " " <<
628 localToGlobalRotation(2,2));
629
630 if(double alphastrip=alignTSOS->alphaStrip()) {
631 ATH_MSG_DEBUG( "applying fanout rotation : " << alphastrip );
632 localToGlobalRotation = localToGlobalRotation * Amg::AngleAxis3D(alphastrip, Amg::Vector3D(0.,0.,1.));
633 ATH_MSG_DEBUG( "localToGlobalRotation * fanout_rotation:");
634 ATH_MSG_DEBUG(localToGlobalRotation(0,0) << " " <<
635 localToGlobalRotation(0,1) << " " <<
636 localToGlobalRotation(0,2));
637 ATH_MSG_DEBUG(localToGlobalRotation(1,0) << " " <<
638 localToGlobalRotation(1,1) << " " <<
639 localToGlobalRotation(1,2));
640 ATH_MSG_DEBUG(localToGlobalRotation(2,0) << " " <<
641 localToGlobalRotation(2,1) << " " <<
642 localToGlobalRotation(2,2));
643 }
644
645 // get the position of the track in the alignmentframe.
646 Amg::Vector3D refPos = globalFrameToAlignFrame * alignTSOS->trackParameters()->position();
647 ATH_MSG_DEBUG("refPos: "<<refPos);
648
649
650 const Amg::RotationMatrix3D R = globalToAlignFrameRotation * localToGlobalRotation;
651 ATH_MSG_DEBUG("R:");
652 ATH_MSG_DEBUG(R(0,0) << " " << R(0,1) << " " << R(0,2));
653 ATH_MSG_DEBUG(R(1,0) << " " << R(1,1) << " " << R(1,2));
654 ATH_MSG_DEBUG(R(2,0) << " " << R(2,1) << " " << R(2,2));
655
656 // In the SCT measurement frame:
657 // x --> perpendicular to strips in wafer plane
658 // y --> along strips in wafer plane
659 // z --> perpendicular to wafer plane
660
661 // In the TRT measurement frame:
662 // x --> perpendicular to track and straw
663 // y --> along straw wire
664 // z --> perpendicular to x and y (but not parallel to track!)
665
666 // now 'correct' for the track angle in the measurement frame.
667 const TrackParameters * trkpars = nullptr;
668 if(m_residualType == HitOnly) {
669 ATH_MSG_DEBUG("using BIASED track parameters");
670 trkpars = alignTSOS->trackParameters();
671 }
672 else {
673 ATH_MSG_DEBUG("using UNBIASED track parameters");
674 trkpars = alignTSOS->unbiasedTrackPars();
675 }
676
677
678 Amg::Vector3D trackdir = localToGlobalRotation.inverse() * trkpars->momentum();
679 ATH_MSG_DEBUG( "trackdir " << trackdir[0] << " " << trackdir[1] << " " << trackdir[2]);
680
681 // for 1-dimensional measurements and Pixel-x
682 ATH_MSG_DEBUG( "trackdir.z(): " << trackdir.z() );
683 double cotphi_x = trackdir.x() / trackdir.z();
684
685 // some 1D measurements are in Y direction (e.g. in CSC)
686 // so we need the other angle
687 if (alignTSOS->measDir() == Trk::y)
688 cotphi_x = trackdir.y() / trackdir.z();
689
690
691 double Rxx = R(0,0) - cotphi_x * R(0,2);
692 double Ryx = R(1,0) - cotphi_x * R(1,2);
693 double Rzx = R(2,0) - cotphi_x * R(2,2);
694 ATH_MSG_DEBUG("Rxx/Ryx/Rzx: " << Rxx << "/" << Ryx << "/" << Rzx);
695
696 double projR[AlignModule::NTransformPar];
697 projR[AlignModule::TransX] = Rxx;
698 projR[AlignModule::TransY] = Ryx;
699 projR[AlignModule::TransZ] = Rzx;
700 projR[AlignModule::RotX] = -Ryx * refPos.z() + Rzx * refPos.y();
701 projR[AlignModule::RotY] = -Rzx * refPos.x() + Rxx * refPos.z();
702 projR[AlignModule::RotZ] = -Rxx * refPos.y() + Ryx * refPos.x();
703 projR[AlignModule::BowX] = 0;
704 projR[AlignModule::BowY] = 0;
705 projR[AlignModule::BowZ] = 0;
706
716
725
726
728 const double localz = alignTSOS->trackParameters()->position().z(); // - globalToAlignFrameTranslation().z(); // the last term to be doublechecked!
729 // stave length in the IBL -- we will see if there is a more generic way of doing this
730 const double z0z0 = 366.5*366.5;
731
732 projR[AlignModule::BowX] = ( localz*localz - z0z0) / z0z0; // this formula should work for both L11 ans L16, sign to be checked!
733
734
735 // prepare derivatives w.r.t. the vertex position:
736 Amg::Vector3D RxLoc(Rxx, Ryx, Rzx);
737 Amg::Vector3D RxGlob=-1.0 * (globalToAlignFrameRotation.inverse() * RxLoc); // to be double checked!!!
738
739 for (int ipar=0; ipar<nAlignPar; ipar++) {
740 const AlignPar * alignPar = (*alignPars)[ipar];
741 int paramType = alignPar->paramType();
742 //double sigma = alignPar->sigma();
743 ATH_MSG_DEBUG("ipar="<<ipar<<", paramType="<<paramType);
744 derivatives[ipar][imeas] = projR[paramType];//*sigma;
746 (*atsosDerivs)[0][ipar] = projR[paramType];//*sigma;
747 }
748 // the dr/db bit:
749 for (int ipar=0; ipar<3; ipar++) {
750 derivatives[nAlignPar+ipar][imeas] = RxGlob[ipar];
751 if (m_storeDerivatives) (*atsosDerVtx)[0][ipar] = RxGlob[ipar];
752 }
753
754 for (int i=0;i<nAlignPar+3;i++)
755 ATH_MSG_DEBUG("derivatives["<<i<<"]["<<imeas<<"]="<<derivatives[i][imeas]);
756
757 imeas++;
758
759 if (nResDim>1) {
760 // for Pixel the second measurement has to be corrected
761 // for the second angle
762 double cotphi_y = trackdir.y() / trackdir.z() ;
763 double Rxy = R(0,1) - cotphi_y * R(0,2) ;
764 double Ryy = R(1,1) - cotphi_y * R(1,2) ;
765 double Rzy = R(2,1) - cotphi_y * R(2,2) ;
766 ATH_MSG_DEBUG("Rxy/Ryy/Rzy: " << Rxy << "/" << Ryy << "/" << Rzy);
767
768 projR[AlignModule::TransX] = Rxy;
769 projR[AlignModule::TransY] = Ryy;
770 projR[AlignModule::TransZ] = Rzy;
771 projR[AlignModule::RotX] = -Ryy * refPos.z() + Rzy * refPos.y();
772 projR[AlignModule::RotY] = -Rzy * refPos.x() + Rxy * refPos.z();
773 projR[AlignModule::RotZ] = -Rxy * refPos.y() + Ryy * refPos.x();
774
775 //Possibly could add the bowing correction -- very weakly coupled to y residuals
776 projR[AlignModule::BowX] = 0;
777 projR[AlignModule::BowY] = 0;
778 projR[AlignModule::BowZ] = 0;
779
780
781 // prepare derivatives w.r.t. the vertex position:
782 Amg::Vector3D RyLoc(Rxy, Ryy, Rzy);
783 Amg::Vector3D RyGlob=-1.0 * (globalToAlignFrameRotation.inverse() * RyLoc); // to be double checked!!!
784
785 for (int ipar=0; ipar<nAlignPar; ipar++) {
786 const AlignPar * alignPar = (*alignPars)[ipar];
787 int paramType = alignPar->paramType();
788 ATH_MSG_DEBUG("2nd dim, ipar="<<ipar<<", paramType="<<paramType);
789 //double sigma=alignPar->sigma();
790 derivatives[ipar][imeas] = projR[paramType];//*sigma;
792 (*atsosDerivs)[1][ipar] = projR[paramType];//*sigma;
793 }
794
795 // the dr/db bit:
796 for (int ipar=0; ipar<3; ipar++) {
797 derivatives[nAlignPar+ipar][imeas] = RyGlob[ipar];
798 if (m_storeDerivatives) (*atsosDerVtx)[1][ipar] = RyGlob[ipar];
799 }
800
801 for (int i=0;i<nAlignPar+3;i++)
802 ATH_MSG_DEBUG("2nd dim: derivatives["<<i<<"]["<<imeas<<"]="<<derivatives[i][imeas]);
803
804 imeas++;
805 }
806
807 alignTSOS->setDerivatives(atsosDerivs);
808 alignTSOS->setDerivativesVtx(atsosDerVtx);
809 }
810 ATH_MSG_DEBUG("returning derivatives");
811 return derivatives;
812 }
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
size_type size() const noexcept
Returns the number of elements in the collection.
PublicToolHandle< IAlignModuleTool > m_alignModuleTool
const Amg::Vector3D & momentum() const
Access method for the momentum.
Eigen::AngleAxisd AngleAxis3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
@ y
Definition ParamDefs.h:56
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ getMeasErrorMatrix()

bool AnalyticalDerivCalcTool::getMeasErrorMatrix ( const AlignTrack * alignTrack,
Amg::MatrixX & V ) const
private

Definition at line 494 of file AnalyticalDerivCalcTool.cxx.

495 {
496 int index(0);
497 AlignTSOSCollection::const_iterator itAtsos=alignTrack->firstAtsos();
498 for (; itAtsos != alignTrack->lastAtsos(); ++itAtsos) {
499
500 std::vector<Residual>::const_iterator itRes=(**itAtsos).firstResidual();
501 for (; itRes!=(**itAtsos).lastResidual(); ++itRes,index++) {
502
503 V(index,index) = itRes->errSq();
504 }
505 }
506 return checkValidity(V);
507 }
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
bool checkValidity(const Amg::MatrixX &R) const
str index
Definition DeMoScan.py:362

◆ getTrkParamCovMatrix()

bool AnalyticalDerivCalcTool::getTrkParamCovMatrix ( const AlignTrack * alignTrack,
Amg::MatrixX & HCH ) const
private

Definition at line 264 of file AnalyticalDerivCalcTool.cxx.

265 {
266
267 // get derivative matrices from fitter
268 const Amg::MatrixX * H0 = alignTrack->derivativeMatrix();
269 const Amg::MatrixX * C = alignTrack->fullCovarianceMatrix(); //symmetric matrix
270
271 // H0 is a q0 x p matrix,
272 // C is a p x p matrix,
273 // q0 = number of tsos measurements
274 // p = number perigee params+2*nscat+nbrem
275
276 if( H0==nullptr || C==nullptr) {
277 ATH_MSG_ERROR("no derivative matrix or cov matrix stored on AlignTrack!"
278 << "This should have been done in AlignTrackPreProcessor!"
279 << H0 << " " << C );
280 return false;
281 }
282
283 ATH_MSG_DEBUG("H0 ( "<<H0->rows()<<" x "<<H0->cols()<<" )");
284 ATH_MSG_DEBUG("H0: "<<(*H0));
285 ATH_MSG_DEBUG("C ( "<<C->rows()<<" x "<<C->cols()<<" )");
286 ATH_MSG_DEBUG("C: "<<(*C));
287
288
289 int Csize(C->rows());
290 Amg::MatrixX CC(*C); // take a copy of C //symmetric matrix
291 int ierr(0);
292 bool amendC( !(alignTrack->refitD0() && alignTrack->refitZ0() &&
293 alignTrack->refitPhi() && alignTrack->refitTheta() &&
294 alignTrack->refitQovP()) );
295
296 // amendC = true; // FUDGE!
297
298 if( amendC ) {
299 // test with AlSymMat:
300 // build AlSymMat instance from
301 AlSymMat* CA = new AlSymMat(Csize);
302
303 // take a copy of C:
304 for( int ii=0; ii<Csize; ++ii ) {
305 for( int jj=ii; jj<Csize; ++jj ) {
306 CA->elemr(ii,jj) = (*C)(ii,jj);
307 }
308 }
309
310 // first inversion:
311 ierr = CA->invert();
312 if( ierr ) {
313 ATH_MSG_ERROR("First inversion of matrix CA failed with LAPACK status flag " << ierr);
314 return false;
315 } else {
316 // disable selected track parametrs (remove from refit).
317 // It is your duty to assure that corresponding constraints have been imposed!
318 if( !(alignTrack->refitD0()) ) {
319 for(int ii=0; ii<(Csize); ++ii) CA->elemr(0,ii)=0.0; // should do the trick. It is a CLHEP::HepSymMatrix!
320 CA->elemr(0,0)=1.0;
321 }
322 if( !(alignTrack->refitZ0()) ) {
323 for(int ii=0; ii<(Csize); ++ii) CA->elemr(1,ii)=0.0; // should do the trick. It is a CLHEP::HepSymMatrix!
324 CA->elemr(1,1)=1.0;
325 }
326 if( !(alignTrack->refitPhi()) ) {
327 for(int ii=0; ii<(Csize); ++ii) CA->elemr(2,ii)=0.0; // should do the trick. It is a CLHEP::HepSymMatrix!
328 CA->elemr(2,2)=1.0;
329 }
330 if( !(alignTrack->refitTheta()) ) {
331 for(int ii=0; ii<(Csize); ++ii) CA->elemr(3,ii)=0.0; // should do the trick. It is a CLHEP::HepSymMatrix!
332 CA->elemr(3,3)=1.0;
333 }
334 if( !(alignTrack->refitQovP()) ) {
335 for(int ii=0; ii<(Csize); ++ii) CA->elemr(4,ii)=0.0; // should do the trick. It is a CLHEP::HepSymMatrix!
336 CA->elemr(4,4)=1.0;
337 }
338
339
340 // invert back:
341 ierr = CA->invert();
342 if( ierr ) {
343 ATH_MSG_ERROR("Second inversion of matrix CA failed with LAPACK status flag " << ierr);
344 return false;
345 }
346
347 // copy back to CC:
348 for( int ii=0; ii<Csize; ++ii ) {
349 for( int jj=ii; jj<Csize; ++jj ) {
350 CC(ii,jj) = CA->elemc(ii,jj);
351 }
352 }
353
354 // clear the disabled rows/collumns
355 if( !(alignTrack->refitD0()) ) for(int ii=0; ii<(Csize); ++ii){ CC(0,ii)=0.0; CC(ii,0)=0.0; }; // should do the trick.
356 if( !(alignTrack->refitZ0()) ) for(int ii=0; ii<(Csize); ++ii){ CC(1,ii)=0.0; CC(ii,1)=0.0; }; // should do the trick.
357 if( !(alignTrack->refitPhi()) ) for(int ii=0; ii<(Csize); ++ii){ CC(2,ii)=0.0; CC(ii,2)=0.0; }; // should do the trick.
358 if( !(alignTrack->refitTheta()) ) for(int ii=0; ii<(Csize); ++ii){ CC(3,ii)=0.0; CC(ii,3)=0.0; }; // should do the trick.
359 if( !(alignTrack->refitQovP()) ) for(int ii=0; ii<(Csize); ++ii){ CC(4,ii)=0.0; CC(ii,4)=0.0; }; // should do the trick.
360
361
362 }
363
364 //garbage collection:
365 delete CA;
366 }
367
368
369
370 int nMeas = H0->rows();
371 int nAtsos = alignTrack->nAlignTSOSMeas();
372 ATH_MSG_DEBUG("nMeas: "<<nMeas);
373
374 //CLHEP::HepSymMatrix HCH(nMeas,0);
375 Amg::MatrixX HCH(nAtsos,nAtsos);
376 HCH = CC.similarity( *H0 );
377
378 ATH_MSG_DEBUG("HCH ( "<<HCH.rows()<<" x "<<HCH.cols()<<" )");
379 ATH_MSG_DEBUG("HCH: "<<HCH);
380
381 //
382 // get indices of HCH matrix corresponding to alignTSOSs in alignTrack
383 const AlignTSOSCollection * alignTSOSCollection = alignTrack->alignTSOSCollection();
384
385 std::vector<int> matrixIndices(nMeas);
386
387 int imeas(-1);
388 for (const TrackStateOnSurface* tsos : *alignTrack->trackStateOnSurfaces()){
389
390 ATH_MSG_DEBUG("tsos: "<<tsos->dumpType());
391
392 // get tsos and make sure it is a RIO_OnTrack
393 if (tsos->type(TrackStateOnSurface::Outlier))
394 continue;
395
396 // RIO
397 if (!tsos->type(TrackStateOnSurface::Scatterer)) {
398 ATH_MSG_DEBUG("not scatterer, trying rio");
399
400 const MeasurementBase * mesb = tsos->measurementOnTrack();
401 const RIO_OnTrack * rio = dynamic_cast<const RIO_OnTrack *>(mesb);
402 const CompetingRIOsOnTrack * crio = dynamic_cast<const CompetingRIOsOnTrack *>(mesb);
403 if (!rio && crio)
404 rio=&crio->rioOnTrack(0);
405
406 if (rio==nullptr)
407 continue;
408
409 ++imeas;
410 matrixIndices[imeas]=-1;
411
412 Identifier tsosId = rio->identify();
413 ATH_MSG_DEBUG("have tsos with Id "<<tsosId);
414
415 // get matching alignTSOS and store track index in goodMatrixIndices
416 int iameas(0);
417 for (const AlignTSOS* atsos : *alignTSOSCollection) {
418
419 if (!atsos->isValid())
420 continue;
421
422 if (atsos->type(TrackStateOnSurface::Scatterer))
423 ATH_MSG_ERROR("can't use scatterers on AlignTrack yet for analytical derivatives!");
424
425 const RIO_OnTrack * atsos_rio = atsos->rio();
426 if (atsos_rio) {
427// ATH_MSG_DEBUG("tsosId / atsosId : "<<tsosId<<" / "<<atsos_rio->identify());
428
429 if (atsos_rio->identify()==tsosId) {
430 matrixIndices[imeas]=iameas;
431 ATH_MSG_DEBUG("matrixIndices["<<imeas<<"]="<<iameas);
432
433 // for Pixel we have two measurements
434 if (atsos->nResDim()>1)
435 {
436 imeas++;
437 iameas++;
438 matrixIndices[imeas]=iameas;
439 ATH_MSG_DEBUG("matrixIndices["<<imeas<<"]="<<iameas);
440 }
441 break;
442 }
443 // for Pixel we have two measurements
444 else if(atsos->nResDim()>1)
445 iameas++;
446 }
447 iameas++;
448 }
449
450 // even when the Pixel is not aligned we have to take into account
451 // that it has two measurements
452 if(matrixIndices[imeas]==-1 && m_measTypeIdHelper->defineType(mesb) == TrackState::Pixel) {
453 imeas++;
454 matrixIndices[imeas]=-1;
455 ATH_MSG_DEBUG("matrixIndices["<<imeas<<"]="<<matrixIndices[imeas]);
456 }
457
458 } // end tsos==rio
459
460 } // end loop over track tsos
461
462 // strip elements in the HCH matrix which don't correspond
463 // to AlignTSOS on alignTrack
464 ATH_MSG_DEBUG("Filling the Q matrix:");
465 for (int k=0;k<nMeas;k++) {
466
467 int iameas=matrixIndices[k];
468 if (iameas==-1)
469 continue;
470
471 for (int l=0;l<nMeas;l++) {
472 int jameas=matrixIndices[l];
473 if (jameas==-1)
474 continue;
475
476 Q(iameas,jameas) = HCH(k,l);
477
478 }
479 }
480
481 ATH_MSG_DEBUG("before check Q ( "<<Q.rows()<<" x "<<Q.cols()<<" )");
482 ATH_MSG_DEBUG("before check Q: "<<Q);
483
484 if(!checkValidity(Q)) {
485 ATH_MSG_DEBUG("Matrix Q = HCH is invalid, skipping the track");
486 return false;
487 }
488
489 return true;
490 }
#define ATH_MSG_ERROR(x)
Identifier identify() const
return the identifier -extends MeasurementBase
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ Scatterer
This represents a scattering point on the track, and so will contain TrackParameters and MaterialEffe...
struct color C
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
l
Printing final latex table to .tex output file.
DataVector< AlignTSOS > AlignTSOSCollection
Definition AlignTrack.h:37

◆ initialize()

StatusCode AnalyticalDerivCalcTool::initialize ( )
override

Definition at line 40 of file AnalyticalDerivCalcTool.cxx.

41 {
42 if (m_alignModuleTool.retrieve().isFailure()) {
43 ATH_MSG_FATAL("Could not get " << m_alignModuleTool);
44 return StatusCode::FAILURE;
45 }
46 ATH_MSG_INFO("Retrieved " << m_alignModuleTool);
47
48 if (detStore()->retrieve(m_idHelper, "AtlasID").isFailure()) {
49 ATH_MSG_FATAL("Could not get AtlasDetectorID helper");
50 return StatusCode::FAILURE;
51 }
52 m_measTypeIdHelper = new MeasurementTypeID(m_idHelper);
53
54 return StatusCode::SUCCESS;
55 }
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
const ServiceHandle< StoreGateSvc > & detStore() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

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

Retrieve interface ID.

Definition at line 84 of file IDerivCalcTool.h.

84 {
86 }
static const InterfaceID IID_TRKALIGNINTERFACES_IDerivCalcTool("IDerivCalcTool", 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 }

◆ setDerivatives()

bool AnalyticalDerivCalcTool::setDerivatives ( AlignTrack * alignTrack)
overridevirtual

sets analytical partial derivatives of residuals w.r.t alignment parameters for TSOS on alignTrack.

Implements Trk::IDerivCalcTool.

Definition at line 65 of file AnalyticalDerivCalcTool.cxx.

66 {
68 checkResidualType(alignTrack);
69
70 // create table of modules for checking whether the module
71 // is hit by the track or not
72 int nModules = m_alignModuleTool->alignModules1D()->size();
73 std::vector<bool> hitModules(nModules,false);
74
75 // loop over AlignTSOSCollection,
76 // find modules that are in the AlignModuleList,
77 std::vector<AlignModule *> alignModules;
78 AlignTSOSCollection::iterator atsosItr = alignTrack->firstAtsos();
79 for (; atsosItr != alignTrack->lastAtsos(); ++atsosItr) {
80 AlignModule * module=(*atsosItr)->module();
81 if (module)
82 ATH_MSG_DEBUG("have ATSOS for module "<<module->identify());
83 else
84 ATH_MSG_DEBUG("no module!");
85
86 if (!(*atsosItr)->isValid() || !module)
87 continue;
88
89 // if the module is not yet in the list for this track, add it
90 if(!hitModules[module->identifyHash()]) {
91 hitModules[module->identifyHash()] = true;
92 alignModules.push_back(module);
93 }
94 }
95
96 // Determine derivatives from shifting these modules
97 std::vector<AlignModuleDerivatives> * derivatives = new std::vector<AlignModuleDerivatives>;
98 std::vector<AlignModule *>::iterator moduleIt = alignModules.begin();
99 for ( ; moduleIt!=alignModules.end(); ++moduleIt) {
100 std::vector<Amg::VectorX> deriv_vec = getDerivatives(alignTrack,*moduleIt);
101 derivatives->push_back(make_pair(*moduleIt,deriv_vec));
102 }
103
104 // alignTrack takes care of deleting the derivatives
105 ATH_MSG_DEBUG("setting matrix derivatives");
106 alignTrack->setDerivatives(derivatives);
107
108 ATH_MSG_DEBUG("returning from setDerivatives");
109
110 return true;
111 }
void checkResidualType(const AlignTrack *alignTrack)
std::vector< Amg::VectorX > getDerivatives(AlignTrack *alignTrack, const AlignModule *module)

◆ setLogStream()

virtual void Trk::IDerivCalcTool::setLogStream ( std::ostream * os)
inlinevirtualinherited

sets the output stream for the logfile

Definition at line 71 of file IDerivCalcTool.h.

71{ m_logStream = os; }
std::ostream * m_logStream
logfile output stream

◆ setResidualCovMatrix()

bool AnalyticalDerivCalcTool::setResidualCovMatrix ( AlignTrack * alignTrack) const
overridevirtual

sets residual covariance matrix

Implements Trk::IDerivCalcTool.

Definition at line 114 of file AnalyticalDerivCalcTool.cxx.

115 {
116 static std::once_flag flag;
117 std::call_once(flag, [&]() {
118 if(m_logStream) {
119 *m_logStream<<"*************************************************************"<<std::endl;
120 *m_logStream<<"*************************************************************"<<std::endl;
121 *m_logStream<<"*** *****"<<std::endl;
122
124 *m_logStream<<"*** Running full LOCAL Chi2 method *****"<<std::endl;
125 else
126 *m_logStream<<"*** Running full GLOBAL Chi2 method *****"<<std::endl;
127
128 *m_logStream<<"*** using analytical derivatives *****"<<std::endl;
129
131 std::string resType = "HitOnly ";
133 resType = "Unbiased";
134 *m_logStream<<"*** with residual type: "<<resType<<" *****"<<std::endl;
135 }
136
137 *m_logStream<<"*** *****"<<std::endl;
138 *m_logStream<<"*************************************************************"<<std::endl;
139 }
140 });
141
142 // get inverse local error matrix of the track
143 const Amg::MatrixX * Vinv = alignTrack->localErrorMatrixInv();
144 if(!checkValidity(*Vinv)) {
145 ATH_MSG_WARNING("Inverse local error matrix is invalid, skipping the track");
146 return false;
147 }
148 ATH_MSG_DEBUG("V inverse (diagonal only):");
149 if (msgLvl(MSG::DEBUG)) {
150 for (int i=0;i<Vinv->rows();i++) msg()<<(*Vinv)(i,i)<<" ";
151 msg()<<endmsg;
152 }
153
154 // ========================
155 // setup local chi2 method
156 // ========================
157 if (m_useLocalSetting) {
158 ATH_MSG_DEBUG("setting Residual covariance matrix for local method");
159
160 // for local method we only need the Vinv
161 const Amg::MatrixX * Vinv = alignTrack->localErrorMatrixInv();
162 Amg::MatrixX * W = new Amg::MatrixX(*Vinv);
163
164 // if we want to ignore the real errors of measurements for a particular subretector
165 // (we should add something similar for Muon detectors)
167
169 ATH_MSG_DEBUG("Ignoring measured errors for Pixel clusters, using intrinsic errors");
171 ATH_MSG_DEBUG("Ignoring measured errors for SCT clusters, using intrinsic errors");
173 ATH_MSG_DEBUG("Ignoring measured errors for TRT clusters, using intrinsic errors");
174
175 int index(0);
176 AlignTSOSCollection::const_iterator itAtsos = alignTrack->firstAtsos();
177 AlignTSOSCollection::const_iterator itAtsos_end = alignTrack->lastAtsos();
178 for ( ; itAtsos != itAtsos_end; ++itAtsos) {
179 const AlignTSOS * atsos = *itAtsos;
180 if (!atsos->isValid())
181 continue;
182
183 if(m_useIntrinsicPixelErrors && atsos->measType() == Trk::TrackState::Pixel) {
184 (*W)(index,index) = 1./(0.05*0.05/12);
185 (*W)(index+1,index+1) = 1./(0.4*0.4/12);
186 }
187 else if(m_useIntrinsicSCTErrors && atsos->measType() == Trk::TrackState::SCT)
188 (*W)(index,index) = 1./(0.1*0.1/12);
189 else if(m_useIntrinsicTRTErrors && atsos->measType() == Trk::TrackState::TRT)
190 (*W)(index,index) = 1./(0.5*0.5/12);
191
192 index += atsos->nResDim();
193 }
194 }
195
196 ATH_MSG_DEBUG("setting local weight matrix W ( "<<W->rows()<<" x "<<W->cols()<<" ) (diagonal only):");
197 if (msgLvl(MSG::DEBUG)) {
198 for (int i=0;i<W->rows();i++) msg()<<(*W)(i,i)<<" ";
199 msg()<<endmsg;
200 }
201 alignTrack->setWeightMatrix(W);
202
203 Amg::MatrixX * W1st = new Amg::MatrixX(*W);
204 alignTrack->setWeightMatrixFirstDeriv(W1st);
205
206 return true;
207 }
208
209 // ========================
210 // setup global chi2 method
211 // ========================
212
213 // get the ingredients for calculating R = V - Q
214 const Amg::MatrixX * V = alignTrack->localErrorMatrix();
215 ATH_MSG_DEBUG("V ( "<<V->rows()<<" x "<<V->cols()<<" ) (diagonal only):");
216 if (msgLvl(MSG::DEBUG)) {
217 for (int i=0;i<V->rows();i++) msg()<<(*V)(i,i)<<" ";
218 msg()<<endmsg;
219 }
220
221 const int outputdim = alignTrack->nAlignTSOSMeas();
222
223 Amg::MatrixX Q(outputdim, outputdim); //symmetric matrix
224 if (!getTrkParamCovMatrix(alignTrack, Q))
225 return false;
226 ATH_MSG_DEBUG("Q ( "<<Q.rows()<<" x "<<Q.cols()<<" )");
227 ATH_MSG_DEBUG("Q: "<<Q);
228
229 // calculate R
230 const Amg::MatrixX R = (*V) - Q;
231 if (!checkValidity(R)) {
232 ATH_MSG_WARNING("Matrix R = V - HCH is invalid, skipping the track");
233 return false;
234 }
235 ATH_MSG_DEBUG("R ( "<<R.rows()<<" x "<<R.cols()<<" )");
236 ATH_MSG_DEBUG("R: "<<R);
237
238 // calculate weight matrix and set it
239 Amg::MatrixX * W = new Amg::MatrixX(outputdim,outputdim); //symmetric matrix
240 *W = ((*Vinv) * R * (*Vinv));
241
242 if (!checkValidity(*W)) {
243 ATH_MSG_DEBUG("Weight matrix is invalid, skipping the track");
244 delete W;
245 return false;
246 }
247 ATH_MSG_DEBUG("setting weight: "<<(*W));
248 alignTrack->setWeightMatrix(W);
249
250 // for 1st derivatives the weight matrix is just the V^-1
251 // it has been chacked above so no need to do it again
252 Amg::MatrixX * W1st = new Amg::MatrixX(*Vinv); //symmetric matrix
253 ATH_MSG_DEBUG("setting weight for 1st derivatives (diagonal only): ");
254 if (msgLvl(MSG::DEBUG)) {
255 for (int i=0;i<W1st->rows();i++) msg()<<(*W1st)(i,i)<<" ";
256 msg()<<endmsg;
257 }
258 alignTrack->setWeightMatrixFirstDeriv(W1st);
259
260 return true;
261 }
bool getTrkParamCovMatrix(const AlignTrack *alignTrack, Amg::MatrixX &HCH) const
bool flag
Definition master.py:29

◆ setSolveOption()

void Trk::IDerivCalcTool::setSolveOption ( int solveOption)
inlineinherited

solving option (see enum above)

Definition at line 57 of file IDerivCalcTool.h.

57{ m_solveOption=solveOption; }

◆ showStatistics()

void Trk::AnalyticalDerivCalcTool::showStatistics ( )
inlineoverridevirtual

not used yet

Implements Trk::IDerivCalcTool.

Definition at line 54 of file AnalyticalDerivCalcTool.h.

54{}

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

PublicToolHandle<IAlignModuleTool> Trk::AnalyticalDerivCalcTool::m_alignModuleTool
private
Initial value:
{
this, "AlignModuleTool", "InDet::InDetAlignModuleTool/InDetAlignModuleTool"}

Definition at line 61 of file AnalyticalDerivCalcTool.h.

61 {
62 this, "AlignModuleTool", "InDet::InDetAlignModuleTool/InDetAlignModuleTool"};

◆ m_derivatives

std::vector<std::pair<const AlignModule *, std::vector<Amg::VectorX> > > Trk::AnalyticalDerivCalcTool::m_derivatives
private

Definition at line 77 of file AnalyticalDerivCalcTool.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_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_idHelper

const AtlasDetectorID* Trk::AnalyticalDerivCalcTool::m_idHelper = nullptr
private

Definition at line 64 of file AnalyticalDerivCalcTool.h.

◆ m_logStream

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

logfile output stream

Definition at line 76 of file IDerivCalcTool.h.

◆ m_measTypeIdHelper

MeasurementTypeID* Trk::AnalyticalDerivCalcTool::m_measTypeIdHelper = nullptr
private

Definition at line 65 of file AnalyticalDerivCalcTool.h.

◆ m_residualType

int Trk::AnalyticalDerivCalcTool::m_residualType = Trk::AlignResidualType::HitOnly
private

residual type to be used in the calculations

Definition at line 92 of file AnalyticalDerivCalcTool.h.

◆ m_residualTypeSet

bool Trk::AnalyticalDerivCalcTool::m_residualTypeSet = false
private

do we have the residual type set?

Definition at line 93 of file AnalyticalDerivCalcTool.h.

◆ m_solveOption

int Trk::IDerivCalcTool::m_solveOption = 0
privateinherited

Definition at line 80 of file IDerivCalcTool.h.

◆ m_storeDerivatives

BooleanProperty Trk::AnalyticalDerivCalcTool::m_storeDerivatives
private
Initial value:
{this, "StoreDerivatives", false,
"store derivatives dr/da on AlignTSOS to be filled into ntuple"}

Definition at line 95 of file AnalyticalDerivCalcTool.h.

95 {this, "StoreDerivatives", false,
96 "store derivatives dr/da on AlignTSOS to be filled into ntuple"};

◆ m_useIntrinsicPixelErrors

BooleanProperty Trk::AnalyticalDerivCalcTool::m_useIntrinsicPixelErrors
private
Initial value:
{
this, "UseIntrinsicPixelError", false, "use intrinsic errors for Pixel"}

Definition at line 85 of file AnalyticalDerivCalcTool.h.

85 {
86 this, "UseIntrinsicPixelError", false, "use intrinsic errors for Pixel"};

◆ m_useIntrinsicSCTErrors

BooleanProperty Trk::AnalyticalDerivCalcTool::m_useIntrinsicSCTErrors
private
Initial value:
{
this, "UseIntrinsicSCTError", false, "use intrinsic errors for SCT"}

Definition at line 87 of file AnalyticalDerivCalcTool.h.

87 {
88 this, "UseIntrinsicSCTError", false, "use intrinsic errors for SCT"};

◆ m_useIntrinsicTRTErrors

BooleanProperty Trk::AnalyticalDerivCalcTool::m_useIntrinsicTRTErrors
private
Initial value:
{
this, "UseIntrinsicTRTError", false, "use intrinsic errors for TRT"}

Definition at line 89 of file AnalyticalDerivCalcTool.h.

89 {
90 this, "UseIntrinsicTRTError", false, "use intrinsic errors for TRT"};

◆ m_useLocalSetting

BooleanProperty Trk::AnalyticalDerivCalcTool::m_useLocalSetting
private
Initial value:
{this, "UseLocalSetting", false,
"use local setup for the covariance matrix of the track"}

Definition at line 79 of file AnalyticalDerivCalcTool.h.

79 {this, "UseLocalSetting", false,
80 "use local setup for the covariance matrix of the track"};

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