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 32 of file AnalyticalDerivCalcTool.cxx.

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

Member Function Documentation

◆ checkResidualType()

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

Definition at line 816 of file AnalyticalDerivCalcTool.cxx.

817 {
818 // get first AlignTSOS of the AlignTrack
819 // this assumes that for unbiased or DCA residuals the scatterers
820 // and energy deposits are not included in the AlignTSOSSollection
821 const AlignTSOS * atsos = *(alignTrack->firstAtsos());
822
823 // get residual type of the first residual
824 m_residualType = atsos->firstResidual()->residualType();
825 ATH_MSG_DEBUG("setting residualType to "<<m_residualType);
826
827 m_residualTypeSet = true;
828 }
#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 509 of file AnalyticalDerivCalcTool.cxx.

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

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

◆ 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 551 of file AnalyticalDerivCalcTool.cxx.

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

494 {
495 int index(0);
496 AlignTSOSCollection::const_iterator itAtsos=alignTrack->firstAtsos();
497 for (; itAtsos != alignTrack->lastAtsos(); ++itAtsos) {
498
499 std::vector<Residual>::const_iterator itRes=(**itAtsos).firstResidual();
500 for (; itRes!=(**itAtsos).lastResidual(); ++itRes,index++) {
501
502 V(index,index) = itRes->errSq();
503 }
504 }
505 return checkValidity(V);
506 }
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 265 of file AnalyticalDerivCalcTool.cxx.

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

42 {
43 if (m_alignModuleTool.retrieve().isFailure()) {
44 ATH_MSG_FATAL("Could not get " << m_alignModuleTool);
45 return StatusCode::FAILURE;
46 }
47 ATH_MSG_INFO("Retrieved " << m_alignModuleTool);
48
49 if (detStore()->retrieve(m_idHelper, "AtlasID").isFailure()) {
50 ATH_MSG_FATAL("Could not get AtlasDetectorID helper");
51 return StatusCode::FAILURE;
52 }
53 m_measTypeIdHelper = new MeasurementTypeID(m_idHelper);
54
55 return StatusCode::SUCCESS;
56 }
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
const ServiceHandle< StoreGateSvc > & detStore() 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 & 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 66 of file AnalyticalDerivCalcTool.cxx.

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

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

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