ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
Trk::ShiftingDerivCalcTool Class Reference

#include <ShiftingDerivCalcTool.h>

Inheritance diagram for Trk::ShiftingDerivCalcTool:
Collaboration diagram for Trk::ShiftingDerivCalcTool:

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

 ShiftingDerivCalcTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~ShiftingDerivCalcTool ()
 
StatusCode initialize ()
 
StatusCode finalize ()
 
bool setDerivatives (AlignTrack *track)
 sets derivatives of residuals w.r.t. More...
 
void showStatistics ()
 write statistics to log file More...
 
bool setResidualCovMatrix (AlignTrack *alignTrack) const
 sets residual covariance matrix More...
 
void setSolveOption (int solveOption)
 solving option (see enum above) More...
 
virtual void setLogStream (std::ostream *os)
 sets the output stream for the logfile More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Retrieve interface ID. More...
 

Protected Types

typedef std::vector< Amg::VectorXHitDerivative
 
typedef std::map< const TrackStateOnSurface *, HitDerivative * > DerivativeMap
 
typedef DerivativeMap::value_type DerivativePair
 

Protected Member Functions

Amg::VectorX getDerivatives (AlignTrack *alignTrack, int ipar, AlignPar *alignPar, Amg::VectorX &derivativeErr, bool &resetIPar, double &actualSecondDerivative)
 
void setChi2VAlignParam (const AlignTrack *alignTrack, const AlignModule *module, int nshifts=0)
 
void deleteChi2VAlignParam ()
 
double shiftSize (const AlignPar *alignPar) const
 
bool setUnshiftedResiduals (AlignTrack *alignTrack)
 
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Protected Attributes

std::ostream * m_logStream
 logfile output stream More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

const Trk::TrackbestPerigeeTrack (const Track *track) const
 
bool scanShifts (const AlignTrack *alignTrack, const std::vector< AlignModule * > &alignModules)
 
bool getAllDerivatives (AlignTrack *alignTrack, const AlignModule *alignModule, std::vector< Amg::VectorX > &deriv_vec, std::vector< Amg::VectorX > &derivErr_vec, std::vector< double > &actualsecderiv_vec, bool &resetIPar)
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ToolHandle< IGlobalTrackFitterm_trackFitterTool
 
ToolHandle< IGlobalTrackFitterm_SLTrackFitterTool
 
ToolHandle< IGlobalTrackFitterm_fitter
 
ToolHandle< IAlignResidualCalculatorm_residualCalculator
 
ToolHandle< IAlignModuleToolm_alignModuleTool
 
double m_traSize
 
double m_rotSize
 
bool m_runOutlierRemoval
 
ParticleHypothesis m_particleHypothesis
 
int m_particleNumber
 
DerivativeMap m_derivative_map
 
bool m_doFits
 
int m_nFits
 
bool m_doChi2VAlignParamMeasType
 
int m_nChamberShifts
 
bool m_doResidualPlots
 
int m_nIterations
 
Amg::VectorXm_unshiftedResiduals
 
Amg::VectorXm_unshiftedResErrors
 
std::vector< double ** > m_chi2VAlignParamVec
 track chi2[idof][ichambershift] More...
 
std::vector< double ** > m_chi2VAlignParamXVec
 chamber shift[idof][ichambershift] More...
 
double ** m_tmpChi2VAlignParam
 
double ** m_tmpChi2VAlignParamX
 
double *** m_tmpChi2VAlignParamMeasType
 
std::vector< double *** > m_chi2VAlignParamVecMeasType
 track chi2[idof][imeastype][ichambershift] More...
 
double m_unshiftedTrackChi2
 
double * m_unshiftedTrackChi2MeasType
 
double m_trackAlignParamCut
 cut on value of track alignment parameter, determined from fit of chi2 vs. More...
 
bool m_setMinIterations
 fit track with AlignModules shifted up and down in each extreme, find the number of iterations fitter uses to converge. More...
 
int m_maxIter
 reject track if exceed maximum number of iterations More...
 
int m_minIter
 set minimum number of iterations for first track fits More...
 
bool m_removeScatteringBeforeRefit
 flag to remove scattering before refitting track More...
 
int m_ntracksProcessed
 number tracks processed More...
 
int m_ntracksPassInitScan
 number tracks pass initial scan More...
 
int m_ntracksPassSetUnshiftedRes
 number tracks pass setting unshifted residuals More...
 
int m_ntracksPassDerivatives
 number tracks pass setting derivatives More...
 
int m_ntracksPassGetDeriv
 number tracks pass getting derivatives More...
 
int m_ntracksPassGetDerivSecPass
 number tracks pass 2nd pass of getting derivatives More...
 
int m_ntracksPassGetDerivLastPass
 number tracks pass 2nd pass of getting derivatives More...
 
int m_ntracksFailMaxIter
 
int m_ntracksFailTrackRefit
 
int m_ntracksFailAlignParamCut
 
int m_ntracksFailFinalAttempt
 
bool m_secPass
 
int m_solveOption = 0
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 47 of file ShiftingDerivCalcTool.h.

Member Typedef Documentation

◆ DerivativeMap

Definition at line 69 of file ShiftingDerivCalcTool.h.

◆ DerivativePair

typedef DerivativeMap::value_type Trk::ShiftingDerivCalcTool::DerivativePair
protected

Definition at line 70 of file ShiftingDerivCalcTool.h.

◆ HitDerivative

Definition at line 68 of file ShiftingDerivCalcTool.h.

◆ 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,
46  DIRECT_SOLVE_FAST = 4,
48  }; // this is also defined in TrkGlobAlign class

Constructor & Destructor Documentation

◆ ShiftingDerivCalcTool()

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

Definition at line 39 of file ShiftingDerivCalcTool.cxx.

44  , m_trackFitterTool("Trk::GlobalChi2Fitter/MCTBFitter")
45  , m_SLTrackFitterTool("Trk::GlobalChi2Fitter/MCTBSLFitter")
46  //,m_fitter?
47  , m_residualCalculator("Trk::AlignResidualCalculator/ResidualCalculator")
48  , m_alignModuleTool("Trk::AlignModuleTool/AlignModuleTool")
49  , m_traSize(.1)
50  , m_rotSize(.1)
51  , m_runOutlierRemoval(false)
53  , m_particleNumber(2)
55  , m_nIterations(0)
56  , m_unshiftedResiduals(nullptr)
57  , m_unshiftedResErrors(nullptr)
58  //m_chi2VAlignParamVec
59  //m_chi2VAlignParamXVec
60  , m_tmpChi2VAlignParam(nullptr)
61  , m_tmpChi2VAlignParamX(nullptr)
63  //m_chi2VAlignParamVecMeasType
66  //m_trackAlignParamCut
67  //m_setMinIterations
68  //m_maxIter
69  //m_minIter
70  //m_removeScatteringBeforeRefit
82  , m_secPass{}
83  {
84  declareInterface<IDerivCalcTool>(this);
85 
86  declareProperty("TrackFitterTool", m_trackFitterTool);
87  declareProperty("SLTrackFitterTool", m_SLTrackFitterTool);
88  declareProperty("TranslationSize", m_traSize);
89  declareProperty("RotationSize", m_rotSize);
90  declareProperty("RunOutlierRemoval", m_runOutlierRemoval);
91  declareProperty("ParticleNumber", m_particleNumber);
92  declareProperty("doChi2VChamberShiftsMeasType", m_doChi2VAlignParamMeasType = false);
93  declareProperty("doResidualFits", m_doFits = true);
94  declareProperty("NumberOfShifts", m_nFits=5);
95  declareProperty("ResidualCalculator", m_residualCalculator);
96  declareProperty("AlignModuleTool", m_alignModuleTool);
97  declareProperty("doResidualPlots", m_doResidualPlots=false);
98  declareProperty("TrackAlignParamCut", m_trackAlignParamCut=1e6);//.001
99  declareProperty("SetMinIterations", m_setMinIterations=false);
100  declareProperty("MaxIterations", m_maxIter=50);
101  declareProperty("MinIterations", m_minIter=10);
102 
103  declareProperty("RemoveScatteringBeforeRefit", m_removeScatteringBeforeRefit=false);
104 
105  m_logStream = nullptr;
106 
107  }

◆ ~ShiftingDerivCalcTool()

ShiftingDerivCalcTool::~ShiftingDerivCalcTool ( )
virtual

Definition at line 110 of file ShiftingDerivCalcTool.cxx.

111  {
114  }

Member Function Documentation

◆ bestPerigeeTrack()

const Trk::Track* Trk::ShiftingDerivCalcTool::bestPerigeeTrack ( const Track track) const
private

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ deleteChi2VAlignParam()

void ShiftingDerivCalcTool::deleteChi2VAlignParam ( )
protected

Definition at line 920 of file ShiftingDerivCalcTool.cxx.

921 {
922  for (int i=0;i<(int)m_chi2VAlignParamVec.size();i++) {
923  delete [] m_chi2VAlignParamVec[i]; m_chi2VAlignParamVec[i]=nullptr;
924  delete [] m_chi2VAlignParamXVec[i]; m_chi2VAlignParamXVec[i]=nullptr;
925  }
926  m_chi2VAlignParamVec.clear();
927  m_chi2VAlignParamXVec.clear();
928 
929  for (auto & i : m_chi2VAlignParamVecMeasType) {
930  delete [] i; i=nullptr;
931  }
933 }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

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

Definition at line 146 of file ShiftingDerivCalcTool.cxx.

147  {
148  ATH_MSG_INFO("number tracks processed: "<<m_ntracksProcessed<<
149  "\nnumber tracks passing initial scan: "<<m_ntracksPassInitScan<<
150  "\nnumber tracks passing setting unshifted residuals: "<< m_ntracksPassSetUnshiftedRes<<
151  "\nnumber tracks pass getting derivatives (1st pass): "<<m_ntracksPassGetDeriv<<
152  "\nnumber tracks pass getting derivatives (2nd pass): "<<m_ntracksPassGetDerivSecPass<<
153  "\nnumber tracks pass getting derivatives (3rd pass): "<<m_ntracksPassGetDerivLastPass<<
154  "\nnumber tracks pass setting derivatives: "<<m_ntracksPassDerivatives);
155  ATH_MSG_INFO("number tracks fail max iterations: "<<m_ntracksFailMaxIter<<
156  "\nnumber tracks fail track refit: "<<m_ntracksFailTrackRefit<<
157  "\nnumber tracks fail align param cut: "<<m_ntracksFailAlignParamCut<<
158  "\nnumber tracks fail final attempt: "<<m_ntracksFailFinalAttempt);
159 
160  return StatusCode::SUCCESS;
161  }

◆ getAllDerivatives()

bool ShiftingDerivCalcTool::getAllDerivatives ( AlignTrack alignTrack,
const AlignModule alignModule,
std::vector< Amg::VectorX > &  deriv_vec,
std::vector< Amg::VectorX > &  derivErr_vec,
std::vector< double > &  actualsecderiv_vec,
bool &  resetIPar 
)
private

Definition at line 936 of file ShiftingDerivCalcTool.cxx.

943 {
944  resetIPar=false;
945 
946  deriv_vec.clear();
947  derivErr_vec.clear();
948  actualsecderiv_vec.clear();
949 
950  setUnshiftedResiduals(alignTrack); // this will set the min number of iterations to the new value
951 
952  int ipar(0);
953  DataVector<AlignPar>* alignPars=m_alignModuleTool->getAlignPars(alignModule);
954  for (DataVector<AlignPar>::iterator it=alignPars->begin(); it!=alignPars->end(); ++it,ipar++) {
955  ATH_MSG_DEBUG("ipar: "<<ipar);
956  Amg::VectorX derivErr(alignTrack->nAlignTSOSMeas());
957  double actualSecondDeriv(0.);
958  const Amg::VectorX vec=getDerivatives(alignTrack,ipar,*it,derivErr,resetIPar,actualSecondDeriv);
959  ATH_MSG_DEBUG("vec size: "<<vec.rows());
960 
961  ATH_MSG_DEBUG("resetIPar="<<resetIPar);
962  if (resetIPar) continue; // continue with derivatives to find max iteration
963 
964  if (vec.rows()<1) return false; // derivatives won't be set for alignTrack because it's a bad track
965 
966  deriv_vec.push_back(vec);
967  derivErr_vec.push_back(derivErr);
968  actualsecderiv_vec.push_back(actualSecondDeriv);
969 
970  for (int i=0;i<m_nFits;i++) {
971  ATH_MSG_DEBUG("m_tmpChi2VAlignParam["<<ipar<<"]["
972  <<i<<"]="<<m_tmpChi2VAlignParam[ipar][i]);
973  }
974  }
975 
976  return true;
977 }

◆ getDerivatives()

Amg::VectorX ShiftingDerivCalcTool::getDerivatives ( AlignTrack alignTrack,
int  ipar,
AlignPar alignPar,
Amg::VectorX derivativeErr,
bool &  resetIPar,
double &  actualSecondDerivative 
)
protected

Definition at line 496 of file ShiftingDerivCalcTool.cxx.

502 {
503  const Trk::Track* trackForRefit =
504  (m_removeScatteringBeforeRefit) ? alignTrack->trackWithoutScattering():
505  dynamic_cast<const Trk::Track*>(alignTrack);
506 
507  ATH_MSG_DEBUG("m_nIterations: "<<m_nIterations);
508 
509  // gets derivatives of residuals w.r.t. a specific alignment parameter given by alignPar
510  if (!m_fitter)
511  ATH_MSG_ERROR("set m_fitter before calling getDerivatives (by calling setUnshiftedResiduals)");
512 
513  AlignModule* module=alignPar->alignModule();
514 
515  // set derivatives for 2 shifts up and 2 shifts down
516  const int NFITS = m_nFits;
517  const int NMEAS = alignTrack->nAlignTSOSMeas();
518  module->setNChamberShifts(m_nFits);
519 
520  ATH_MSG_DEBUG("NMEAS="<<NMEAS);
521  double** residuals=new double*[NFITS];
522  double** resErrors=new double*[NFITS];
523  double* chi2Array =new double[NFITS];
524  double* chi2ArrayX=new double[NFITS];
525 
528  m_tmpChi2VAlignParamMeasType[i][ipar] =new double[NFITS];
529  }
530 
531  for (int ifit=0;ifit<NFITS;ifit++) {
532  residuals[ifit]=new double[NMEAS];
533  resErrors[ifit]=new double[NMEAS];
534  }
535 
536  // set the values for the unshifted track
537  const int unshiftedTrackIndex = m_doFits ? (m_nFits-1)/2 : 1;
538  chi2Array [unshiftedTrackIndex] = m_unshiftedTrackChi2;
539  ATH_MSG_DEBUG("chi2Array["<<unshiftedTrackIndex<<"]="<<chi2Array[unshiftedTrackIndex]);
540  chi2ArrayX[unshiftedTrackIndex] = 0.;
542  for (int i=0;i<TrackState::NumberOfMeasurementTypes;i++) {
543  m_tmpChi2VAlignParamMeasType[i][ipar][unshiftedTrackIndex]=
545  ATH_MSG_DEBUG("chi2ArrayMeasType["<<i<<"]["<<unshiftedTrackIndex<<"]="<<m_unshiftedTrackChi2MeasType[i]);
546  }
547  }
548 
549 
550  // get shift size
551  double shiftsize=shiftSize(alignPar);
552 
553  IGlobalTrackFitter::AlignmentCache alignCache;
554 
555 
556  ATH_MSG_VERBOSE("doing refits");
557  for (int ifit=0;ifit<NFITS;ifit++) {
558 
559  ATH_MSG_VERBOSE("ifit="<<ifit);
560  int jfit=ifit;
561  if (ifit>unshiftedTrackIndex) {
562  jfit=NFITS-ifit+unshiftedTrackIndex;
563  }
564  if (m_doFits && ifit==unshiftedTrackIndex) {
565  for (int i=0;i<(int)m_unshiftedResiduals->rows();i++) {
566  residuals[ifit][i]=(*m_unshiftedResiduals)[i];
567  resErrors[ifit][i]=(*m_unshiftedResErrors)[i];
568  }
569  // change back in case it got changed on the other side of zero
570  shiftsize=shiftSize(alignPar);
571  continue;
572  }
573 
574  // shift module and fit track
575  double currentshift = 0.;
576  if(m_doFits)
577  currentshift = shiftsize * (double)(jfit-unshiftedTrackIndex);
578  else
579  currentshift = (ifit==0) ? -1.*shiftsize : shiftsize;
580 
581  ATH_MSG_DEBUG("current shift="<<currentshift<<" in getDerivatives");
582 
583  m_alignModuleTool->shiftModule(module,alignTrack,
584  alignPar->paramType(),currentshift);
585 
586 
587  ATH_MSG_VERBOSE("fitting after shift");
588  const Track* refittedTrack=m_fitter->alignmentFit(alignCache,
589  *trackForRefit,
591  if (m_setMinIterations && alignCache.m_iterationsOfLastFit>m_nIterations) {
592  m_nIterations=alignCache.m_iterationsOfLastFit;
593  if (m_nIterations>m_maxIter) {
594  ATH_MSG_DEBUG("exceeded max number of iterations");
595  m_alignModuleTool->restoreModule(module);
596  resetIPar=false;
597  ATH_MSG_DEBUG("resetIPar set to false");
598  delete [] residuals; delete [] resErrors;
599  delete [] chi2Array; delete [] chi2ArrayX;
600  ATH_MSG_DEBUG("fail max iter");
602  Amg::VectorX derivatives(1);
603  return derivatives;
604  }
605  ATH_MSG_DEBUG("increasing m_nIterations to "<<m_nIterations<<" (not changing in fit yet)");
606  resetIPar=true;
607  ATH_MSG_DEBUG("resetIPar set to true");
608  }
609 
610  // if resetIPar refit the rest of the tracks, but don't do anything with them until next pass
611  if (resetIPar) {
612  m_alignModuleTool->restoreModule(module);
613  continue;
614  }
615 
616  if (!refittedTrack) {
617  msg(MSG::WARNING) << "track refit failed for jfit "<<jfit <<endmsg;
618  delete [] residuals; delete [] resErrors;
619  delete [] chi2Array; delete [] chi2ArrayX;
620  m_alignModuleTool->restoreModule(module);
621  if (!resetIPar || m_secPass) {
623  }
624  ATH_MSG_DEBUG("fail track refit, resetIPar "<<resetIPar<<", secPass "<<m_secPass);
625  Amg::VectorX derivatives(1);
626  return derivatives;
627  }
628  else
629  ATH_MSG_VERBOSE("track refit successful");
630 
631  double chi2=refittedTrack->fitQuality()->chiSquared();
632 
633  ATH_MSG_VERBOSE("jfit = "<<jfit);
634  double localChi2=m_residualCalculator->setResiduals(alignTrack,refittedTrack);
635  ATH_MSG_DEBUG("localChi2/fittedChi2="<<localChi2<<"/"<<chi2);
636 
637  chi2ArrayX[jfit]= shiftsize * (double)(jfit-unshiftedTrackIndex);// / module->sigma(idof);
638  chi2Array[jfit]=localChi2;
639  ATH_MSG_DEBUG("chi2Array["<<jfit<<"]="<<chi2Array[jfit]);
641  for (int i=0;i<TrackState::NumberOfMeasurementTypes;i++) {
642  m_tmpChi2VAlignParamMeasType[i][ipar][jfit]= m_residualCalculator->chi2ForMeasType(i);
643  ATH_MSG_DEBUG("chi2ArrayMeasType["<<i<<"]["<<jfit<<"]="
644  <<m_tmpChi2VAlignParamMeasType[i][ipar][jfit]);
645  }
646  }
647 
648  ATH_MSG_DEBUG("positions["<<jfit<<"]="<<chi2ArrayX[jfit]);
649 
650  int imeas(0);
651  AlignTSOSCollection::const_iterator atsosItr=alignTrack->firstAtsos();
652  for (; atsosItr != alignTrack->lastAtsos(); ++atsosItr) {
653  if (!(*atsosItr)->isValid()) continue;
654  for (std::vector<Residual>::const_iterator itRes=(**atsosItr).firstResidual();
655  itRes!=(**atsosItr).lastResidual();++itRes,++imeas) {
656 
657  if (refittedTrack) {
658  residuals[jfit][imeas]=itRes->residual();
659  resErrors[jfit][imeas]=std::sqrt(itRes->errSq());
660  }
661  else {
662  residuals[jfit][imeas]=resErrors[jfit][imeas]=0.;
663  }
664  ATH_MSG_DEBUG("residuals["<<jfit<<"]["<<imeas<<"]="<<residuals[jfit][imeas]);
665  ATH_MSG_DEBUG("resErrors["<<jfit<<"]["<<imeas<<"]="<<resErrors[jfit][imeas]);
666  }
667  }
668 
669  delete refittedTrack; refittedTrack=nullptr;
670  ATH_MSG_VERBOSE("calling restoreModule");
671  m_alignModuleTool->restoreModule(module);
672  } // NFITS
673 
674  int iimeas(0);
675  AlignTSOSCollection::const_iterator aatsosItr=alignTrack->firstAtsos();
676  for (; aatsosItr != alignTrack->lastAtsos(); ++aatsosItr) {
677  if (!(*aatsosItr)->isValid()) continue;
678  for (std::vector<Residual>::const_iterator itRes=(**aatsosItr).firstResidual();
679  itRes!=(**aatsosItr).lastResidual();++itRes,++iimeas) {
680  for (int ifit=0;ifit<NFITS;ifit++) {
681  ATH_MSG_DEBUG("["<<ifit<<"]["<<iimeas<<"] res="<<residuals[ifit][iimeas]<<
682  ", resErr="<<resErrors[ifit][iimeas]);
683  }
684  }
685  }
686 
687  if (resetIPar) {
688  //resetIPar=false;
689  delete [] residuals; delete [] resErrors;
690  delete [] chi2Array; delete [] chi2ArrayX;
691  if (m_secPass) ATH_MSG_WARNING("failed second pass!");
692  ATH_MSG_DEBUG("returning to reset IPar");
693  Amg::VectorX derivatives;
694  return derivatives;
695  }
696 
697  // check chi2 vs. chamber pos to see if discontinuous
698  TGraph* gr = new TGraph(m_nFits,chi2ArrayX,chi2Array);
699  gr->Fit("pol2","QF");
700  TF1* fit=gr->GetFunction("pol2");
701  double chi2 =fit->GetChisquare()/double(m_nFits-3);
702  double slope=fit->GetParameter(1);
703  actualSecondDeriv=fit->GetParameter(2);
704  delete gr;
705 
706  ATH_MSG_DEBUG("discontinuity check: chi2="<<chi2);
707  alignTrack->setTrackAlignParamQuality(alignPar->paramType(),chi2);
708 
709  // EventInfo
710  if (chi2>1.e-6 || std::fabs(slope)<1.e-10) {
711  const xAOD::EventInfo* eventInfo;
712  StatusCode sc=evtStore()->retrieve(eventInfo);
713  if (sc.isFailure())
714  ATH_MSG_ERROR("Couldn't retrieve event info");
715  int run=eventInfo->runNumber();
716  int evt=eventInfo->eventNumber();
717  ATH_MSG_DEBUG("discontinuity check: chi2="<<chi2<<", run/evt "<<run<<"/"<<evt);
718  }
719 
720  //reset in case it got changed somewhere
721  shiftsize = shiftSize(alignPar);
722 
723  //-----------------------------------------//
724  //-- get derivatives from residuals --//
725  //-----------------------------------------//
726  ATH_MSG_VERBOSE("calculating residuals");
727  Amg::VectorX derivatives(alignTrack->nAlignTSOSMeas(),0);
728  ATH_MSG_DEBUG("created derivatives with "<<derivatives.rows()<<" rows");
729 
730  // if bad fit or first derivative close to zero, replace derivatives with zeros
731  if (chi2>m_trackAlignParamCut) {// || std::fabs(slope)<1.e-10 ) {
732  ATH_MSG_DEBUG("chi2/"<<m_nFits-3<<"="<<chi2);
733  delete [] residuals; delete [] resErrors;
734  delete [] chi2Array; delete [] chi2ArrayX;
735 
736  m_nIterations=alignCache.m_iterationsOfLastFit+5;
737  if (m_nIterations>m_maxIter) {
738  ATH_MSG_DEBUG("exceeded max number of iterations");
739  resetIPar=false;
740  }
741  ATH_MSG_DEBUG("increasing m_nIterations to "<<m_nIterations<<" (not changing in fit yet)");
742  resetIPar=true;
743  ATH_MSG_INFO("fail align param cut, secPass "<<m_secPass);
744  if (m_secPass) {
746  }
747  Amg::VectorX emptyDerivatives;
748  return emptyDerivatives;
749  }
750 
751  int imeas(0);
752  TCanvas* canv(nullptr);
753  std::vector<TGraph*> vecGraphs;
754  AlignTSOSCollection::const_iterator atsosItr=alignTrack->firstAtsos();
755  for (; atsosItr != alignTrack->lastAtsos(); ++atsosItr) {
756  if (!(*atsosItr)->isValid()) continue;
757  for (int idim=0;idim<(*atsosItr)->nResDim();idim++) {
758 
759  double* gr_x = new double[NFITS];
760  double* gr_y = new double[NFITS]; // residuals only have float precision if determined from ESD
761  int ngoodfits=0;
762  for (int ifit=0;ifit<NFITS;ifit++) {
763  double residual=residuals[ifit][imeas];
764  double resError=resErrors[ifit][imeas];
765  if (residual>-999.) {
766  gr_x[ngoodfits] =chi2ArrayX[ifit];
767  gr_y[ngoodfits] =residual/resError;
768  ngoodfits++;
769  }
770  }
771 
772  if (!m_doFits && ngoodfits==2) {
773  derivatives[imeas]=(residuals[1][imeas]-residuals[0][imeas])/(2.*shiftsize)*
774  resErrors[unshiftedTrackIndex][imeas];
775  }
776  else if (m_doFits && ngoodfits>3) {
777  TGraph* gr=new TGraph(ngoodfits,gr_x,gr_y);
778 
779  if (m_doResidualPlots)
780  gr->Fit("pol2","VF");
781  else
782  gr->Fit("pol2","QF");
783  TF1* fit=gr->GetFunction("pol2");
784 
785  //double derivRatio=fit->GetParameter(2)/fit->GetParameter(1);
786  ATH_MSG_DEBUG("deriv["<<imeas<<"]="<<fit->GetParameter(1)<<" +/- "<<fit->GetParError(1)
787  <<", chi2="<<fit->GetChisquare());
788  derivatives[imeas]=fit->GetParameter(1)*resErrors[unshiftedTrackIndex][imeas]; // first derivative at x=0
789  derivativeErr[imeas]=fit->GetParError(1)*resErrors[unshiftedTrackIndex][imeas];
790 
791 
792  // plot residuals vs. chamber position
793  if (m_doResidualPlots) {
794  if (!canv) canv=new TCanvas("resPlots","resPlots");
795  canv->cd();
796  gr->SetMarkerStyle(20);
797  gr->Draw("AP");
798 
799  gr->GetXaxis()->SetTitle("shift in chamber pos. from nominal (CLHEP::mm)");
800  gr->GetYaxis()->SetTitle("residual (CLHEP::mm)");
801 
802  TPaveText* pave=new TPaveText(.4,.65,.97,.92,"NDC");
803  pave->SetFillColor(0);
804  pave->SetBorderSize(1);
805  std::stringstream measType; measType<<"meas type: ";
806  if ((*atsosItr)->measType()==TrackState::MDT) measType<<" MDT";
807  else if ((*atsosItr)->measType()==TrackState::TGC) measType<<" TGC";
808  else if ((*atsosItr)->measType()==TrackState::RPC) measType<<" RPC";
809  else measType<<" undefined";
810 
811  pave->AddText(measType.str().c_str());
812 
813  std::stringstream firstderivtxt,secndderivtxt,aptxt,chi2txt;
814  firstderivtxt<<fit->GetParameter(1)<<" +/- "<<fit->GetParError(1);
815  secndderivtxt<<fit->GetParameter(2)<<" +/- "<<fit->GetParError(2);
816  aptxt <<"alignPar "<<alignPar->paramType()<<", RIO in "<<(*atsosItr)->identify();
817  chi2txt<<"chi2="<<fit->GetChisquare();
818 
819  pave->AddText(firstderivtxt.str().c_str());
820  pave->AddText(secndderivtxt.str().c_str());
821  pave->AddText(aptxt.str().c_str());
822  pave->AddText(chi2txt.str().c_str());
823  pave->Draw();
824 
825  std::stringstream canvName;
826  canvName<<"resPlots_ap"<<alignPar->paramType()<<"_measType"
827  <<(*atsosItr)->measType()<<"_"<<imeas<<".eps";
828  canv->Print(canvName.str().c_str());
829  canv->Clear();
830 
831  delete pave;
832  }
833  vecGraphs.push_back(gr);
834  }
835  else {
836  derivatives[imeas]=-999.;
837  derivativeErr[imeas]=-999.;
838  }
839 
840  delete [] gr_y;
841  delete [] gr_x;
842 
843  ++imeas;
844  }
845  }
846 
847  // delete TGraphs and TCanvas
848  for (auto & vecGraph : vecGraphs)
849  delete vecGraph;
850  delete canv;
851 
852  delete [] residuals;
853  delete [] resErrors;
854 
855  // set chi2 v alignparam
856  for (int ifit=0;ifit<NFITS;ifit++) {
857  m_tmpChi2VAlignParamX[ipar]=chi2ArrayX;
858  m_tmpChi2VAlignParam [ipar]=chi2Array;
859  }
860 
861  ATH_MSG_DEBUG("derivativeErr: "<<derivativeErr);
862  return derivatives;
863 }

◆ initialize()

StatusCode ShiftingDerivCalcTool::initialize ( )

Definition at line 117 of file ShiftingDerivCalcTool.cxx.

118  {
119 
120  msg(MSG::DEBUG) << "in ShiftingDerivCalcTool initialize()"<<endmsg;
121  ATH_CHECK(m_trackFitterTool.retrieve());
122  ATH_CHECK(m_SLTrackFitterTool.retrieve());
123  ATH_CHECK(m_residualCalculator.retrieve());
124  ATH_CHECK(m_alignModuleTool.retrieve());
125 
127  msg(MSG::INFO) << "ParticleNumber: " << m_particleNumber << endmsg;
128  msg(MSG::INFO) << "ParticleHypothesis: " << m_particleHypothesis << endmsg;
129 
130 
131  if(!m_doFits){
132  m_nFits = 2;
133  }
134 
138 
139  msg(MSG::INFO) << "doFits: " << m_doFits << endmsg;
140  msg(MSG::INFO) << "nFits: " << m_nFits << endmsg;
141 
142  return StatusCode::SUCCESS;
143  }

◆ 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  {
85  return IID_TRKALIGNINTERFACES_IDerivCalcTool;
86  }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ scanShifts()

bool ShiftingDerivCalcTool::scanShifts ( const AlignTrack alignTrack,
const std::vector< AlignModule * > &  alignModules 
)
private

Definition at line 164 of file ShiftingDerivCalcTool.cxx.

166  {
167  ATH_MSG_DEBUG("in scanShifts");
168 
169  const Trk::Track* trackForRefit =
170  (m_removeScatteringBeforeRefit) ? alignTrack->trackWithoutScattering():
171  dynamic_cast<const Trk::Track*>(alignTrack);
172 
173  // see whether straight track or not
174  m_fitter = alignTrack->isSLTrack() ?
176  ATH_MSG_DEBUG("refitting unshifted track with "<<m_fitter<<" (isSLTrack="
177  <<alignTrack->isSLTrack()<<")");
178 
179  ATH_MSG_DEBUG("setting minNIterations to "<<m_nIterations);
180 
181  // refit track
182 
183  IGlobalTrackFitter::AlignmentCache alignCache;
184  alignCache.m_minIterations = m_nIterations;
185  const Track* refittedTrack = m_fitter->alignmentFit(alignCache, *trackForRefit,
188  if (!refittedTrack) {
189  msg(MSG::WARNING) << "initial track refit failed" << endmsg;
190  return false;
191  }
192  else
193  ATH_MSG_DEBUG("initial track refit successful");
194 
195  m_nIterations = alignCache.m_iterationsOfLastFit;
196  if (m_nIterations>m_maxIter) {
197  ATH_MSG_DEBUG("exceeded maximum number of iterations");
198  return false;
199  }
200  ATH_MSG_DEBUG("initial nIterations: "<<m_nIterations);
201 
202  // loop over AlignModules
203  int imod(0);
204  for (std::vector<AlignModule*>::const_iterator moduleIt=alignModules.begin();
205  moduleIt!=alignModules.end(); ++moduleIt,imod++) {
206 
207  // loop over AlignPar
208  int ipar(0);
209  DataVector<AlignPar>* alignPars=m_alignModuleTool->getAlignPars(*moduleIt);
210  for (DataVector<AlignPar>::iterator alignParIt=alignPars->begin();
211  alignParIt!=alignPars->end(); ++alignParIt,ipar++) {
212 
213  for (int ishift=0;ishift<2;ishift++) {
214 
215  double shiftsize = shiftSize(*alignParIt);
216  if (ishift>0) shiftsize*=-1.;
217  m_alignModuleTool->shiftModule(*moduleIt,alignTrack,(**alignParIt).paramType(),shiftsize);
218  refittedTrack = (m_fitter->fit(Gaudi::Hive::currentContext(),
219  *trackForRefit,m_runOutlierRemoval,
221  m_alignModuleTool->restoreModule(*moduleIt);
222  if (!refittedTrack) {
223  msg(MSG::WARNING) << "track refit failed!"<<endmsg;
224  m_nIterations=0;
225  return false;
226  }
227 
228  int nIter=alignCache.m_iterationsOfLastFit;
229  ATH_MSG_DEBUG("nIter: "<<nIter);
230  if (nIter>m_maxIter) {
231  ATH_MSG_DEBUG("exceeded maximum number of iterations");
232  m_nIterations=0;
233  return false;
234  }
235 
236  if (nIter>m_nIterations) m_nIterations=nIter;
237  }
238  } // loop over AlignPar
239  } // loop over AlignModules
240 
241  ATH_MSG_DEBUG("done with scanShifts, m_nIterations="<<m_nIterations);
242  return true;
243  }

◆ setChi2VAlignParam()

void Trk::ShiftingDerivCalcTool::setChi2VAlignParam ( const AlignTrack alignTrack,
const AlignModule module,
int  nshifts = 0 
)
protected

◆ setDerivatives()

bool ShiftingDerivCalcTool::setDerivatives ( AlignTrack track)
virtual

sets derivatives of residuals w.r.t.

alignment parameters for hits on track.

Implements Trk::IDerivCalcTool.

Definition at line 328 of file ShiftingDerivCalcTool.cxx.

329 {
330  ATH_MSG_DEBUG("in ShiftingDerivCalcTool setDerivatives");
332 
333  // loop over AlignTSOSCollection,
334  // find modules that are in the AlignModuleList,
335  std::vector<AlignModule*> alignModules;
336  for (AlignTSOSCollection::iterator atsosItr=alignTrack->firstAtsos();
337  atsosItr != alignTrack->lastAtsos(); ++atsosItr) {
338 
339  ATH_MSG_VERBOSE("getting module");
340  AlignModule* module=(*atsosItr)->module();
341  if (module)
342  ATH_MSG_VERBOSE("have ATSOS for module "<<module->identify());
343  else
344  ATH_MSG_VERBOSE("no module!");
345 
346  if (!(*atsosItr)->isValid() || !module) continue;
347  if (find(alignModules.begin(),alignModules.end(),module) == alignModules.end())
348  alignModules.push_back(module);
349  }
350 
351  // find perigee of best track fit and use as starting perigee for all fits
353  if (m_setMinIterations && !scanShifts(alignTrack, alignModules)) {
354  return false;
355  };
356 
358 
359  // set unshifted residuals (this is done in AlignTrackDresser but redone here with track refit)
360  if (!setUnshiftedResiduals(alignTrack)) {
361  ATH_MSG_WARNING("problem with refitting track!");
362  return false;
363  };
364 
366 
367  // Determine derivatives from shifting these modules
368  std::vector<AlignModuleDerivatives> * derivatives = new std::vector<AlignModuleDerivatives>;
369  std::vector<AlignModuleDerivatives> * derivativeErr = new std::vector<AlignModuleDerivatives>;
370  std::vector<std::pair<AlignModule*, std::vector<double> > > * actualSecondDerivatives =
371  new std::vector<std::pair<AlignModule*, std::vector<double> > >;
373  for (auto *alignModule : alignModules) {
374 
375  ATH_MSG_DEBUG("finding derivatives for module "<<(*alignModule).identify());
376 
377  std::vector<Amg::VectorX> deriv_vec;
378  std::vector<Amg::VectorX> derivErr_vec;
379  std::vector<double> actualsecderiv_vec;
380 
381  // get alignPars and create arrays to store chi2 vs. align pars
382  DataVector<AlignPar>* alignPars=m_alignModuleTool->getAlignPars(alignModule);
383  const int nAlignPar = alignPars->size();
384  m_tmpChi2VAlignParam = new double*[nAlignPar];
385  m_tmpChi2VAlignParamX = new double*[nAlignPar];
389  m_tmpChi2VAlignParamMeasType[i] = new double*[nAlignPar];
390  }
391 
392 
393  // get derivatives and arrays of chi2 vs. align params
394  bool resetIPar=false;
395  std::vector<Amg::VectorX> tmpderiv_vec;
396  std::vector<Amg::VectorX> tmpderivErr_vec;
397  std::vector<double> tmpactualsecderiv_vec;
398  m_secPass=false;
399 
400  // first attempt with normal number of fitter iterations
401  bool success=getAllDerivatives(
402  alignTrack, alignModule,
403  tmpderiv_vec,tmpderivErr_vec,tmpactualsecderiv_vec,
404  resetIPar);
405  if (!success){
406  delete derivatives;
407  delete derivativeErr;
408  delete actualSecondDerivatives;
409  return false;
410  }
411 
413 
414  if (resetIPar) {
415  // second attempt with increased number of fitter iterations
416  m_secPass=true;
417  success=getAllDerivatives(alignTrack,alignModule,
418  tmpderiv_vec,tmpderivErr_vec,tmpactualsecderiv_vec,
419  resetIPar);
420  }
421 
422  if (!success){
423  delete derivatives;
424  delete derivativeErr;
425  delete actualSecondDerivatives;
426  return false;
427  }
428 
430 
431  if (resetIPar) {
432  // third and last attempt with number of fitter iterations set to maximum
434  success=getAllDerivatives(alignTrack,alignModule,
435  tmpderiv_vec,tmpderivErr_vec,tmpactualsecderiv_vec,
436  resetIPar);
437  }
438 
439  if (!success){
440  delete derivatives;
441  delete derivativeErr;
442  delete actualSecondDerivatives;
443  return false;
444  }
445 
446 
448 
449  if (success && !resetIPar) {
450  for (int i=0;i<(int)tmpderiv_vec.size();i++) {
451  deriv_vec.push_back(tmpderiv_vec[i]);
452  derivErr_vec.push_back(tmpderivErr_vec[i]);
453  actualsecderiv_vec.push_back(tmpactualsecderiv_vec[i]);
454  }
455  }
456  else{
457  delete derivatives;
458  delete derivativeErr;
459  delete actualSecondDerivatives;
460  return false;
461  }
462  // set the chi2 vs. align param arrays
463  ATH_MSG_DEBUG("setting chi2 vs. align param arrays");
466  (*alignModule).setChi2VAlignParamArray (m_tmpChi2VAlignParam);
467  (*alignModule).setChi2VAlignParamXArray(m_tmpChi2VAlignParamX);
468 
469  // arrays for measurement types
471  ATH_MSG_DEBUG("pushing back for measType");
474  (*alignModule).setChi2VAlignParamArrayMeasType(i,m_tmpChi2VAlignParamMeasType[i]);
475  }
476  ATH_MSG_DEBUG("done setting arrays");
477 
478  derivatives->push_back(make_pair(alignModule,deriv_vec));
479  derivativeErr->push_back(make_pair(alignModule,derivErr_vec));
480  actualSecondDerivatives->push_back(make_pair(alignModule,actualsecderiv_vec));
481  }
482 
484 
485  alignTrack->setDerivatives(derivatives);
486  alignTrack->setDerivativeErr(derivativeErr);
487  alignTrack->setActualSecondDerivatives(actualSecondDerivatives);
488 
489  // restore unshifted residuals in AlignTSOS
490  setUnshiftedResiduals(alignTrack);
491 
492  return true;
493 }

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

◆ setResidualCovMatrix()

bool ShiftingDerivCalcTool::setResidualCovMatrix ( AlignTrack alignTrack) const
virtual

sets residual covariance matrix

Implements Trk::IDerivCalcTool.

Definition at line 880 of file ShiftingDerivCalcTool.cxx.

881 {
882  Amg::MatrixX W(alignTrack->nAlignTSOSMeas(),alignTrack->nAlignTSOSMeas());
883 
884  if (alignTrack->localErrorMatrixInv()) {
885  ATH_MSG_ERROR("Need to assign this matrix correctly: ShiftingDerivCalcTool.cxx:888");
886  W = *(alignTrack->localErrorMatrixInv());
887  //W.assign(*(alignTrack->localErrorMatrixInv()));
888  } else{
889  return false;
890  }
891  ATH_MSG_DEBUG("W: "<<W);
892 
893  bool Wisvalid(true);
894  const double epsilon=1e-10;
895  for( int irow=0; irow<W.rows(); ++irow) {
896  Wisvalid = Wisvalid && W(irow,irow)>0;
897  if( !(W(irow,irow)>0) )
898  msg(MSG::WARNING) << "matrix invalid: " << W(irow,irow) << endmsg;
899 
900  for(int icol=0; icol<=irow; ++icol) {
901 
902  // this one must be true if everything else succeeded
903  double Wcorr = W(irow,icol)/sqrt(W(irow,irow)*W(icol,icol));
904  bool Wcorrisvalid = Wcorr+epsilon>=-1 && Wcorr-epsilon<=1;
905  Wisvalid = Wisvalid && Wcorrisvalid;
906  if( !Wcorrisvalid )
907  msg(MSG::WARNING) << "matrix corr invalid: " << Wcorr-1 << " " << Wcorr+1 << endmsg;
908  }
909  }
910 
911  if (Wisvalid)
912  alignTrack->setWeightMatrix(new Amg::MatrixX(W));
913 
914  alignTrack->setWeightMatrixFirstDeriv(new Amg::MatrixX(std::move(W)));
915 
916  return true;
917 }

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

◆ setUnshiftedResiduals()

bool ShiftingDerivCalcTool::setUnshiftedResiduals ( AlignTrack alignTrack)
protected

Definition at line 246 of file ShiftingDerivCalcTool.cxx.

247  {
248 
249  // see whether straight track or not
250  m_fitter = alignTrack->isSLTrack() ?
252  ATH_MSG_DEBUG("refitting unshifted track with "<<m_fitter<<" (isSLTrack="
253  <<alignTrack->isSLTrack()<<")");
254 
255  // refit track
256  ATH_MSG_DEBUG("\nsetting min number iterations to "<<m_nIterations);
257  IGlobalTrackFitter::AlignmentCache alignCache;
258  alignCache.m_minIterations = m_nIterations;
259 
260  const Trk::Track* trackForRefit =
261  (m_removeScatteringBeforeRefit) ? alignTrack->trackWithoutScattering():
262  dynamic_cast<const Trk::Track*>(alignTrack);
263  if (!trackForRefit) {
264  ATH_MSG_ERROR("no track for refit!");
265  return false;
266  }
267 
268  const Track* refittedTrack = m_fitter->alignmentFit( alignCache,
269  *trackForRefit,
272 
273  if (!refittedTrack) {
274  ATH_MSG_WARNING( "initial track refit failed" );
275  return false;
276  }
277  else
278  ATH_MSG_DEBUG("initial track refit successful");
279 
280  // dump local track chi2 for debugging
281  double localChi2=m_residualCalculator->setResiduals(alignTrack,refittedTrack);
282  msg()<<MSG::DEBUG<<"local Chi2(unshifted) in setChi2VAlignParam="<<localChi2<<endmsg;
283  m_unshiftedTrackChi2 = localChi2;
284  for (int i=0;i<TrackState::NumberOfMeasurementTypes;i++) {
285  ATH_MSG_DEBUG("getting chi2 for measType "<<i);
287  }
288  ATH_MSG_DEBUG("done");
289 
290  // create vector containing unshifted residuals and matrices containing errors
291  const int NMEAS=alignTrack->nAlignTSOSMeas();
292 
293  // unshiftedResiduals owned by AlignTrack
295 
296  // unshiftedResErrors owned by ShiftingDerivCalcTool
299 
300  // loop over atsos and determine residuals and errors
301  int imeas=0;
302  AlignTSOSCollection::const_iterator atsosItr=alignTrack->firstAtsos();
303  for (; atsosItr != alignTrack->lastAtsos(); ++atsosItr) {
304  if (!(**atsosItr).isValid()) continue;
305  for (std::vector<Residual>::const_iterator itRes=(**atsosItr).firstResidual();
306  itRes!=(**atsosItr).lastResidual();++itRes,++imeas) {
307  double residual = itRes->residual();
308  double errSq = itRes->errSq();
309  (*m_unshiftedResiduals)[imeas]=residual;
310  (*m_unshiftedResErrors)[imeas]=std::sqrt(errSq);
311  //ATH_MSG_DEBUG("weight: "<<1./errSq<<", unshiftedRes["<<imeas<<"]="
312  // <<(*m_unshiftedResiduals)[imeas]
313  // <<", resNorm="<<itRes->residualNorm());
314  }
315  }
316  if (imeas!=NMEAS) {
317  msg(MSG::ERROR)<<"problem with nmeas, imeas="<<imeas<<", NMEAS="<<NMEAS<<endmsg;
318  throw std::runtime_error("Error in ShiftingDerivCalcTool::setUnshiftedResiduals");
319  }
320  alignTrack->setResidualVector(m_unshiftedResiduals);
321 
322  delete refittedTrack; refittedTrack=nullptr;
323 
324  return true;
325  }

◆ shiftSize()

double ShiftingDerivCalcTool::shiftSize ( const AlignPar alignPar) const
protected

Definition at line 866 of file ShiftingDerivCalcTool.cxx.

866  {
867  bool rotation =
868  alignPar->paramType() == AlignModule::RotX ||
869  alignPar->paramType() == AlignModule::RotY ||
870  alignPar->paramType() == AlignModule::RotZ;
871 
872  double shift = rotation ? m_rotSize : m_traSize;
873 
874  //ok... this is kind of ugly.
875  double sigma=alignPar->sigma();
876  return shift * sigma;
877 }

◆ showStatistics()

void Trk::ShiftingDerivCalcTool::showStatistics ( )
inlinevirtual

write statistics to log file

Implements Trk::IDerivCalcTool.

Definition at line 60 of file ShiftingDerivCalcTool.h.

60 {}

◆ 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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_alignModuleTool

ToolHandle<IAlignModuleTool> Trk::ShiftingDerivCalcTool::m_alignModuleTool
private

Definition at line 107 of file ShiftingDerivCalcTool.h.

◆ m_chi2VAlignParamVec

std::vector<double**> Trk::ShiftingDerivCalcTool::m_chi2VAlignParamVec
private

track chi2[idof][ichambershift]

Definition at line 130 of file ShiftingDerivCalcTool.h.

◆ m_chi2VAlignParamVecMeasType

std::vector<double***> Trk::ShiftingDerivCalcTool::m_chi2VAlignParamVecMeasType
private

track chi2[idof][imeastype][ichambershift]

Definition at line 139 of file ShiftingDerivCalcTool.h.

◆ m_chi2VAlignParamXVec

std::vector<double**> Trk::ShiftingDerivCalcTool::m_chi2VAlignParamXVec
private

chamber shift[idof][ichambershift]

Definition at line 131 of file ShiftingDerivCalcTool.h.

◆ m_derivative_map

DerivativeMap Trk::ShiftingDerivCalcTool::m_derivative_map
private

Definition at line 117 of file ShiftingDerivCalcTool.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_doChi2VAlignParamMeasType

bool Trk::ShiftingDerivCalcTool::m_doChi2VAlignParamMeasType
private

Definition at line 121 of file ShiftingDerivCalcTool.h.

◆ m_doFits

bool Trk::ShiftingDerivCalcTool::m_doFits
private

Definition at line 119 of file ShiftingDerivCalcTool.h.

◆ m_doResidualPlots

bool Trk::ShiftingDerivCalcTool::m_doResidualPlots
private

Definition at line 123 of file ShiftingDerivCalcTool.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_fitter

ToolHandle<IGlobalTrackFitter> Trk::ShiftingDerivCalcTool::m_fitter
private

Definition at line 101 of file ShiftingDerivCalcTool.h.

◆ m_logStream

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

logfile output stream

Definition at line 76 of file IDerivCalcTool.h.

◆ m_maxIter

int Trk::ShiftingDerivCalcTool::m_maxIter
private

reject track if exceed maximum number of iterations

Definition at line 148 of file ShiftingDerivCalcTool.h.

◆ m_minIter

int Trk::ShiftingDerivCalcTool::m_minIter
private

set minimum number of iterations for first track fits

Definition at line 150 of file ShiftingDerivCalcTool.h.

◆ m_nChamberShifts

int Trk::ShiftingDerivCalcTool::m_nChamberShifts
private

Definition at line 122 of file ShiftingDerivCalcTool.h.

◆ m_nFits

int Trk::ShiftingDerivCalcTool::m_nFits
private

Definition at line 120 of file ShiftingDerivCalcTool.h.

◆ m_nIterations

int Trk::ShiftingDerivCalcTool::m_nIterations
private

Definition at line 124 of file ShiftingDerivCalcTool.h.

◆ m_ntracksFailAlignParamCut

int Trk::ShiftingDerivCalcTool::m_ntracksFailAlignParamCut
private

Definition at line 163 of file ShiftingDerivCalcTool.h.

◆ m_ntracksFailFinalAttempt

int Trk::ShiftingDerivCalcTool::m_ntracksFailFinalAttempt
private

Definition at line 164 of file ShiftingDerivCalcTool.h.

◆ m_ntracksFailMaxIter

int Trk::ShiftingDerivCalcTool::m_ntracksFailMaxIter
private

Definition at line 161 of file ShiftingDerivCalcTool.h.

◆ m_ntracksFailTrackRefit

int Trk::ShiftingDerivCalcTool::m_ntracksFailTrackRefit
private

Definition at line 162 of file ShiftingDerivCalcTool.h.

◆ m_ntracksPassDerivatives

int Trk::ShiftingDerivCalcTool::m_ntracksPassDerivatives
private

number tracks pass setting derivatives

Definition at line 157 of file ShiftingDerivCalcTool.h.

◆ m_ntracksPassGetDeriv

int Trk::ShiftingDerivCalcTool::m_ntracksPassGetDeriv
private

number tracks pass getting derivatives

Definition at line 158 of file ShiftingDerivCalcTool.h.

◆ m_ntracksPassGetDerivLastPass

int Trk::ShiftingDerivCalcTool::m_ntracksPassGetDerivLastPass
private

number tracks pass 2nd pass of getting derivatives

Definition at line 160 of file ShiftingDerivCalcTool.h.

◆ m_ntracksPassGetDerivSecPass

int Trk::ShiftingDerivCalcTool::m_ntracksPassGetDerivSecPass
private

number tracks pass 2nd pass of getting derivatives

Definition at line 159 of file ShiftingDerivCalcTool.h.

◆ m_ntracksPassInitScan

int Trk::ShiftingDerivCalcTool::m_ntracksPassInitScan
private

number tracks pass initial scan

Definition at line 155 of file ShiftingDerivCalcTool.h.

◆ m_ntracksPassSetUnshiftedRes

int Trk::ShiftingDerivCalcTool::m_ntracksPassSetUnshiftedRes
private

number tracks pass setting unshifted residuals

Definition at line 156 of file ShiftingDerivCalcTool.h.

◆ m_ntracksProcessed

int Trk::ShiftingDerivCalcTool::m_ntracksProcessed
private

number tracks processed

Definition at line 154 of file ShiftingDerivCalcTool.h.

◆ m_particleHypothesis

ParticleHypothesis Trk::ShiftingDerivCalcTool::m_particleHypothesis
private

Definition at line 113 of file ShiftingDerivCalcTool.h.

◆ m_particleNumber

int Trk::ShiftingDerivCalcTool::m_particleNumber
private

Definition at line 115 of file ShiftingDerivCalcTool.h.

◆ m_removeScatteringBeforeRefit

bool Trk::ShiftingDerivCalcTool::m_removeScatteringBeforeRefit
private

flag to remove scattering before refitting track

Definition at line 152 of file ShiftingDerivCalcTool.h.

◆ m_residualCalculator

ToolHandle<IAlignResidualCalculator> Trk::ShiftingDerivCalcTool::m_residualCalculator
private

Definition at line 106 of file ShiftingDerivCalcTool.h.

◆ m_rotSize

double Trk::ShiftingDerivCalcTool::m_rotSize
private

Definition at line 110 of file ShiftingDerivCalcTool.h.

◆ m_runOutlierRemoval

bool Trk::ShiftingDerivCalcTool::m_runOutlierRemoval
private

Definition at line 112 of file ShiftingDerivCalcTool.h.

◆ m_secPass

bool Trk::ShiftingDerivCalcTool::m_secPass
private

Definition at line 166 of file ShiftingDerivCalcTool.h.

◆ m_setMinIterations

bool Trk::ShiftingDerivCalcTool::m_setMinIterations
private

fit track with AlignModules shifted up and down in each extreme, find the number of iterations fitter uses to converge.

Set this number for all subsequent track refits.

Definition at line 146 of file ShiftingDerivCalcTool.h.

◆ m_SLTrackFitterTool

ToolHandle<IGlobalTrackFitter> Trk::ShiftingDerivCalcTool::m_SLTrackFitterTool
private

Definition at line 100 of file ShiftingDerivCalcTool.h.

◆ m_solveOption

int Trk::IDerivCalcTool::m_solveOption = 0
privateinherited

Definition at line 80 of file IDerivCalcTool.h.

◆ m_tmpChi2VAlignParam

double** Trk::ShiftingDerivCalcTool::m_tmpChi2VAlignParam
private

Definition at line 133 of file ShiftingDerivCalcTool.h.

◆ m_tmpChi2VAlignParamMeasType

double*** Trk::ShiftingDerivCalcTool::m_tmpChi2VAlignParamMeasType
private

Definition at line 135 of file ShiftingDerivCalcTool.h.

◆ m_tmpChi2VAlignParamX

double** Trk::ShiftingDerivCalcTool::m_tmpChi2VAlignParamX
private

Definition at line 134 of file ShiftingDerivCalcTool.h.

◆ m_trackAlignParamCut

double Trk::ShiftingDerivCalcTool::m_trackAlignParamCut
private

cut on value of track alignment parameter, determined from fit of chi2 vs.

align parameters to a quadratic

Definition at line 144 of file ShiftingDerivCalcTool.h.

◆ m_trackFitterTool

ToolHandle<IGlobalTrackFitter> Trk::ShiftingDerivCalcTool::m_trackFitterTool
private

Definition at line 99 of file ShiftingDerivCalcTool.h.

◆ m_traSize

double Trk::ShiftingDerivCalcTool::m_traSize
private

Definition at line 109 of file ShiftingDerivCalcTool.h.

◆ m_unshiftedResErrors

Amg::VectorX* Trk::ShiftingDerivCalcTool::m_unshiftedResErrors
private

Definition at line 127 of file ShiftingDerivCalcTool.h.

◆ m_unshiftedResiduals

Amg::VectorX* Trk::ShiftingDerivCalcTool::m_unshiftedResiduals
private

Definition at line 126 of file ShiftingDerivCalcTool.h.

◆ m_unshiftedTrackChi2

double Trk::ShiftingDerivCalcTool::m_unshiftedTrackChi2
private

Definition at line 141 of file ShiftingDerivCalcTool.h.

◆ m_unshiftedTrackChi2MeasType

double* Trk::ShiftingDerivCalcTool::m_unshiftedTrackChi2MeasType
private

Definition at line 142 of file ShiftingDerivCalcTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
Trk::ShiftingDerivCalcTool::m_alignModuleTool
ToolHandle< IAlignModuleTool > m_alignModuleTool
Definition: ShiftingDerivCalcTool.h:107
Trk::ShiftingDerivCalcTool::m_chi2VAlignParamVec
std::vector< double ** > m_chi2VAlignParamVec
track chi2[idof][ichambershift]
Definition: ShiftingDerivCalcTool.h:130
Trk::ShiftingDerivCalcTool::m_ntracksPassGetDeriv
int m_ntracksPassGetDeriv
number tracks pass getting derivatives
Definition: ShiftingDerivCalcTool.h:158
Trk::TrackState::RPC
@ RPC
Definition: TrackStateDefs.h:33
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:32
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
Trk::ShiftingDerivCalcTool::m_nIterations
int m_nIterations
Definition: ShiftingDerivCalcTool.h:124
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Trk::ShiftingDerivCalcTool::m_chi2VAlignParamXVec
std::vector< double ** > m_chi2VAlignParamXVec
chamber shift[idof][ichambershift]
Definition: ShiftingDerivCalcTool.h:131
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
Trk::ShiftingDerivCalcTool::m_ntracksPassGetDerivSecPass
int m_ntracksPassGetDerivSecPass
number tracks pass 2nd pass of getting derivatives
Definition: ShiftingDerivCalcTool.h:159
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
DataVector::iterator
DataModel_detail::iterator< DataVector > iterator
Standard iterator.
Definition: DataVector.h:841
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
DataVector::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition: DataVector.h:837
ClusterSeg::residual
@ residual
Definition: ClusterNtuple.h:20
JetTiledMap::W
@ W
Definition: TiledEtaPhiMap.h:44
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::IDerivCalcTool::m_logStream
std::ostream * m_logStream
logfile output stream
Definition: IDerivCalcTool.h:76
Trk::TrackState::MDT
@ MDT
Definition: TrackStateDefs.h:31
Trk::ShiftingDerivCalcTool::scanShifts
bool scanShifts(const AlignTrack *alignTrack, const std::vector< AlignModule * > &alignModules)
Definition: ShiftingDerivCalcTool.cxx:164
skel.it
it
Definition: skel.GENtoEVGEN.py:423
Trk::ShiftingDerivCalcTool::m_traSize
double m_traSize
Definition: ShiftingDerivCalcTool.h:109
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
Trk::ShiftingDerivCalcTool::m_tmpChi2VAlignParamX
double ** m_tmpChi2VAlignParamX
Definition: ShiftingDerivCalcTool.h:134
Trk::IDerivCalcTool::DIRECT_SOLVE_CLUSTER
@ DIRECT_SOLVE_CLUSTER
computation of alignment parameters from SCALAPAK already solved matrix
Definition: IDerivCalcTool.h:47
Trk::ShiftingDerivCalcTool::m_ntracksProcessed
int m_ntracksProcessed
number tracks processed
Definition: ShiftingDerivCalcTool.h:154
Trk::IDerivCalcTool::NONE
@ NONE
not solve in any case (to be used when ipc)
Definition: IDerivCalcTool.h:42
Trk::ShiftingDerivCalcTool::m_ntracksFailMaxIter
int m_ntracksFailMaxIter
Definition: ShiftingDerivCalcTool.h:161
Trk::ShiftingDerivCalcTool::m_ntracksFailAlignParamCut
int m_ntracksFailAlignParamCut
Definition: ShiftingDerivCalcTool.h:163
gr
#define gr
Trk::ShiftingDerivCalcTool::m_unshiftedResiduals
Amg::VectorX * m_unshiftedResiduals
Definition: ShiftingDerivCalcTool.h:126
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
Trk::TrackState::TGC
@ TGC
Definition: TrackStateDefs.h:34
Trk::IDerivCalcTool::m_solveOption
int m_solveOption
Definition: IDerivCalcTool.h:80
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::IDerivCalcTool::SOLVE_FAST
@ SOLVE_FAST
Fast (Eigen method) solving after data accumulation.
Definition: IDerivCalcTool.h:44
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Trk::ShiftingDerivCalcTool::m_particleHypothesis
ParticleHypothesis m_particleHypothesis
Definition: ShiftingDerivCalcTool.h:113
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
atlasStyleMacro.icol
int icol
Definition: atlasStyleMacro.py:13
Trk::ShiftingDerivCalcTool::m_ntracksPassSetUnshiftedRes
int m_ntracksPassSetUnshiftedRes
number tracks pass setting unshifted residuals
Definition: ShiftingDerivCalcTool.h:156
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Trk::ShiftingDerivCalcTool::m_ntracksFailFinalAttempt
int m_ntracksFailFinalAttempt
Definition: ShiftingDerivCalcTool.h:164
Trk::ShiftingDerivCalcTool::m_chi2VAlignParamVecMeasType
std::vector< double *** > m_chi2VAlignParamVecMeasType
track chi2[idof][imeastype][ichambershift]
Definition: ShiftingDerivCalcTool.h:139
AlignModule
AlignModule is a grouping of TrkDetElementBase objects, grouped according to the type of alignment,...
python.PyAthena.module
module
Definition: PyAthena.py:134
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
Trk::IDerivCalcTool::SOLVE
@ SOLVE
solving after data accumulation (LAPACK)
Definition: IDerivCalcTool.h:43
Trk::ShiftingDerivCalcTool::m_nChamberShifts
int m_nChamberShifts
Definition: ShiftingDerivCalcTool.h:122
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
Trk::ShiftingDerivCalcTool::m_ntracksPassGetDerivLastPass
int m_ntracksPassGetDerivLastPass
number tracks pass 2nd pass of getting derivatives
Definition: ShiftingDerivCalcTool.h:160
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::rotation
rotation
Definition: TrackSurface_v1.cxx:15
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Trk::ShiftingDerivCalcTool::m_trackAlignParamCut
double m_trackAlignParamCut
cut on value of track alignment parameter, determined from fit of chi2 vs.
Definition: ShiftingDerivCalcTool.h:144
Trk::AlignModule::RotX
@ RotX
Definition: AlignModule.h:54
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::IDerivCalcTool::DIRECT_SOLVE
@ DIRECT_SOLVE
direct solving (LAPACK), already available matrix & vector
Definition: IDerivCalcTool.h:45
run
Definition: run.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
Trk::ShiftingDerivCalcTool::getAllDerivatives
bool getAllDerivatives(AlignTrack *alignTrack, const AlignModule *alignModule, std::vector< Amg::VectorX > &deriv_vec, std::vector< Amg::VectorX > &derivErr_vec, std::vector< double > &actualsecderiv_vec, bool &resetIPar)
Definition: ShiftingDerivCalcTool.cxx:936
Trk::ShiftingDerivCalcTool::m_secPass
bool m_secPass
Definition: ShiftingDerivCalcTool.h:166
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
Trk::ShiftingDerivCalcTool::getDerivatives
Amg::VectorX getDerivatives(AlignTrack *alignTrack, int ipar, AlignPar *alignPar, Amg::VectorX &derivativeErr, bool &resetIPar, double &actualSecondDerivative)
Definition: ShiftingDerivCalcTool.cxx:496
Trk::IDerivCalcTool::DIRECT_SOLVE_FAST
@ DIRECT_SOLVE_FAST
direct Fast (Eigen method) solving, already available matrix & vector
Definition: IDerivCalcTool.h:46
DataVector< AlignPar >
Trk::ShiftingDerivCalcTool::m_tmpChi2VAlignParam
double ** m_tmpChi2VAlignParam
Definition: ShiftingDerivCalcTool.h:133
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
MuonValidation_CreateResolutionProfiles.fit
def fit(h, emin, emax)
Definition: MuonValidation_CreateResolutionProfiles.py:69
Trk::ShiftingDerivCalcTool::m_ntracksPassDerivatives
int m_ntracksPassDerivatives
number tracks pass setting derivatives
Definition: ShiftingDerivCalcTool.h:157
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
python.EventInfoMgtInit.release
release
Definition: EventInfoMgtInit.py:24
Trk::ShiftingDerivCalcTool::m_doFits
bool m_doFits
Definition: ShiftingDerivCalcTool.h:119
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Trk::ShiftingDerivCalcTool::m_minIter
int m_minIter
set minimum number of iterations for first track fits
Definition: ShiftingDerivCalcTool.h:150
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
Trk::ShiftingDerivCalcTool::shiftSize
double shiftSize(const AlignPar *alignPar) const
Definition: ShiftingDerivCalcTool.cxx:866
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
Trk::ShiftingDerivCalcTool::deleteChi2VAlignParam
void deleteChi2VAlignParam()
Definition: ShiftingDerivCalcTool.cxx:920
Trk::ShiftingDerivCalcTool::m_nFits
int m_nFits
Definition: ShiftingDerivCalcTool.h:120
Trk::ShiftingDerivCalcTool::m_ntracksPassInitScan
int m_ntracksPassInitScan
number tracks pass initial scan
Definition: ShiftingDerivCalcTool.h:155
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
Trk::ShiftingDerivCalcTool::m_rotSize
double m_rotSize
Definition: ShiftingDerivCalcTool.h:110
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::AlignModule::RotY
@ RotY
Definition: AlignModule.h:54
Trk::ShiftingDerivCalcTool::m_particleNumber
int m_particleNumber
Definition: ShiftingDerivCalcTool.h:115
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::ShiftingDerivCalcTool::m_unshiftedTrackChi2MeasType
double * m_unshiftedTrackChi2MeasType
Definition: ShiftingDerivCalcTool.h:142
Trk::ShiftingDerivCalcTool::m_residualCalculator
ToolHandle< IAlignResidualCalculator > m_residualCalculator
Definition: ShiftingDerivCalcTool.h:106
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
Trk::ShiftingDerivCalcTool::setUnshiftedResiduals
bool setUnshiftedResiduals(AlignTrack *alignTrack)
Definition: ShiftingDerivCalcTool.cxx:246
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
Trk::ShiftingDerivCalcTool::m_setMinIterations
bool m_setMinIterations
fit track with AlignModules shifted up and down in each extreme, find the number of iterations fitter...
Definition: ShiftingDerivCalcTool.h:146
LArG4AODNtuplePlotter.canv
canv
Definition: LArG4AODNtuplePlotter.py:170
Trk::ShiftingDerivCalcTool::m_trackFitterTool
ToolHandle< IGlobalTrackFitter > m_trackFitterTool
Definition: ShiftingDerivCalcTool.h:99
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
Trk::ShiftingDerivCalcTool::m_fitter
ToolHandle< IGlobalTrackFitter > m_fitter
Definition: ShiftingDerivCalcTool.h:101
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
Trk::ShiftingDerivCalcTool::m_unshiftedResErrors
Amg::VectorX * m_unshiftedResErrors
Definition: ShiftingDerivCalcTool.h:127
Trk::ShiftingDerivCalcTool::m_doChi2VAlignParamMeasType
bool m_doChi2VAlignParamMeasType
Definition: ShiftingDerivCalcTool.h:121
Trk::AlignModule::RotZ
@ RotZ
Definition: AlignModule.h:54
Trk::ShiftingDerivCalcTool::m_ntracksFailTrackRefit
int m_ntracksFailTrackRefit
Definition: ShiftingDerivCalcTool.h:162
Trk::ShiftingDerivCalcTool::m_SLTrackFitterTool
ToolHandle< IGlobalTrackFitter > m_SLTrackFitterTool
Definition: ShiftingDerivCalcTool.h:100
Trk::ShiftingDerivCalcTool::m_runOutlierRemoval
bool m_runOutlierRemoval
Definition: ShiftingDerivCalcTool.h:112
Trk::ShiftingDerivCalcTool::m_unshiftedTrackChi2
double m_unshiftedTrackChi2
Definition: ShiftingDerivCalcTool.h:141
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trk::ShiftingDerivCalcTool::m_doResidualPlots
bool m_doResidualPlots
Definition: ShiftingDerivCalcTool.h:123
Trk::ShiftingDerivCalcTool::m_removeScatteringBeforeRefit
bool m_removeScatteringBeforeRefit
flag to remove scattering before refitting track
Definition: ShiftingDerivCalcTool.h:152
Trk::ShiftingDerivCalcTool::m_tmpChi2VAlignParamMeasType
double *** m_tmpChi2VAlignParamMeasType
Definition: ShiftingDerivCalcTool.h:135
Trk::TrackState::NumberOfMeasurementTypes
@ NumberOfMeasurementTypes
Definition: TrackStateDefs.h:43
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
Trk::ShiftingDerivCalcTool::m_maxIter
int m_maxIter
reject track if exceed maximum number of iterations
Definition: ShiftingDerivCalcTool.h:148