ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::InDetBeamSpotVertex Class Reference

A concrete implementation of IInDetBeamSpotTool, using primary vertex information to determine the position of the beamspot using a chi2 and/or log-likelihood method. More...

#include <InDetBeamSpotVertex.h>

Inheritance diagram for InDet::InDetBeamSpotVertex:
Collaboration diagram for InDet::InDetBeamSpotVertex:

Public Types

enum  FitStatus { unsolved =0 , problems , failed , successful }
 Internally used enum for fit status. More...
enum  FitID {
  trackChi2 =1 , trackChi2Widths =2 , vertexLL =3 , vertexChi2 =4 ,
  RooFitLL = 6 , unknown = 99
}
 Beamspot determination type. More...

Public Member Functions

 InDetBeamSpotVertex (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~InDetBeamSpotVertex ()
 InDetBeamSpotVertex (const InDetBeamSpotVertex &rhs)
virtual StatusCode initialize ()
 Standard initialize.
virtual StatusCode finalize ()
 Standard finalize.
virtual FitStatus fit (std::vector< BeamSpot::VrtHolder > &)
 Attempt a to find a solution of the beamspot.
virtual FitID getFitID () const
 A unique ID for the specific fit type.
IInDetBeamSpotToolClone ()
double getX (double z) const
double getY (double z) const
double getZ () const
double getErrX (double z) const
double getErrY (double z) const
double getErrZ () const
double getSigmaX (double) const
double getSigmaY (double) const
double getSigmaZ () const
double getErrSigmaX (double) const
double getErrSigmaY (double) const
double getErrSigmaZ () const
double getTiltX () const
double getTiltY () const
double getErrTiltX () const
double getErrTiltY () const
double getRhoXY () const
double getK () const
double getErrRhoXY () const
double getErrK () const
double getSigmaXY (double z) const
double getErrSigmaXY (double z) const
CLHEP::HepSymMatrix getCov (double z) const
const CLHEP::HepVector & getLLpos () const
const CLHEP::HepSymMatrix & getLLcov () const
virtual std::map< std::string, double > getCovMap () const
virtual std::map< std::string, double > getParamMap () const
void clear ()
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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

bool solveChi2 ()
bool solveLL (bool printOut=false)
bool applyOutlierRemoval ()
int setInitialPars (TMinuit *minuit)
int setParsFromChi2 (TMinuit *minuit)
bool setOutput (TMinuit *minuit)
bool successfulFit (TMinuit *, std::pair< int, std::string > &)
void doFit2 (TMinuit *, bool printOut=false)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

CLHEP::HepVector m_x
CLHEP::HepSymMatrix m_cov
double m_z
double m_zErr
CLHEP::HepVector m_p
CLHEP::HepSymMatrix m_V
double m_zSolved
double m_zErrSolved
const int m_NPARS
CLHEP::HepVector m_pLL
CLHEP::HepSymMatrix m_VLL
long m_vertexCount
bool m_useLL
bool m_getLLres
std::vector< BeamSpot::VrtHolderm_vertexData
double m_init_x
double m_init_y
double m_init_z
double m_init_sx
double m_init_sy
double m_init_sz
double m_init_ax
double m_init_ay
double m_init_k
double m_init_rhoxy
double m_init_min_x
double m_init_min_y
double m_init_min_z
double m_init_min_sx
double m_init_min_sy
double m_init_min_sz
double m_init_min_ax
double m_init_min_ay
double m_init_min_k
double m_init_min_rhoxy
double m_init_max_x
double m_init_max_y
double m_init_max_z
double m_init_max_sx
double m_init_max_sy
double m_init_max_sz
double m_init_max_ax
double m_init_max_ay
double m_init_max_k
double m_init_max_rhoxy
int m_minuit_maxIter
double m_def_x0
double m_def_y0
double m_def_z
double m_def_ax
double m_def_ay
double m_def_sx
double m_def_sy
double m_def_sz
double m_sigTr
double m_maxVtxErTr
double m_widthFail
double m_rhoFail
int m_singleIterationMax
bool m_truncatedRMS
float m_fractionRMS
bool m_setInitialRMS
FitStatus m_fitStatus
double m_outlierChi2Tr
int m_maxOutlierLoops
bool m_doFitSanityCheck
bool m_doChi2OutlierRemoval
double m_kMaxFail
double m_kMinFail
double m_minVtxProb
bool m_fixInputK
bool m_useLLNorm
bool m_fixWidth
int m_nUsed
std::atomic< int > m_rCount {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

A concrete implementation of IInDetBeamSpotTool, using primary vertex information to determine the position of the beamspot using a chi2 and/or log-likelihood method.

Abstract class for all beamspot determination algorithms.

Any class for finding the position of the beamspot needs to derive itself from this class.

Definition at line 32 of file InDetBeamSpotVertex.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

◆ FitID

Beamspot determination type.

Enumerator
trackChi2 
trackChi2Widths 
vertexLL 
vertexChi2 
RooFitLL 
unknown 

Definition at line 51 of file IInDetBeamSpotTool.h.

◆ FitStatus

Internally used enum for fit status.

Useful for quick checks.

Enumerator
unsolved 
problems 
failed 
successful 

Definition at line 49 of file IInDetBeamSpotTool.h.

Constructor & Destructor Documentation

◆ InDetBeamSpotVertex() [1/2]

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

Definition at line 39 of file InDetBeamSpotVertex.cxx.

41 :
42 AthAlgTool(type,name,parent),
43 m_x(4),m_cov(4,0),m_z(0.),m_zErr(0.),
44 m_p(4), m_V(4,0),
45 m_zSolved(0.), m_zErrSolved(0.),
47 m_vertexCount(0),m_getLLres(false),
49
50{
51 declareInterface<IInDetBeamSpotTool>(this);
52 declareProperty("UseLikelihood",m_useLL = true);
53
54 //Fit initial parameter setup
55 declareProperty("InitParX", m_init_x =0.0);
56 declareProperty("InitParY", m_init_y =0.0);
57 declareProperty("InitParZ", m_init_z =0.0);
58 declareProperty("InitParAx", m_init_ax=0.0);
59 declareProperty("InitParAy", m_init_ay=0.0);
60 declareProperty("InitParSigmaX", m_init_sx=0.01);
61 declareProperty("InitParSigmaY", m_init_sy=0.01);
62 declareProperty("InitParSigmaZ", m_init_sz=56.0);
63 declareProperty("InitParK", m_init_k =1.0);
64 declareProperty("InitParRhoXY", m_init_rhoxy=0.0);
65 declareProperty("MinuitMaxIterations", m_minuit_maxIter=2000);
66 declareProperty("InitParMinX", m_init_min_x =0.0);
67 declareProperty("InitParMinY", m_init_min_y =0.0);
68 declareProperty("InitParMinZ", m_init_min_z =0.0);
69 declareProperty("InitParMinAx", m_init_min_ax=0.0);
70 declareProperty("InitParMinAy", m_init_min_ay=0.0);
71 declareProperty("InitParMinSigmaX", m_init_min_sx=0.0001);
72 declareProperty("InitParMinSigmaY", m_init_min_sy=0.0001);
73
74 declareProperty("InitParMinSigmaZ", m_init_min_sz=0.0);
75 declareProperty("InitParMinK", m_init_min_k =0);
76 declareProperty("InitParMinRhoXY", m_init_min_rhoxy=-1.0);
77
78 declareProperty("InitParMaxX", m_init_max_x =0.0);
79 declareProperty("InitParMaxY", m_init_max_y =0.0);
80 declareProperty("InitParMaxZ", m_init_max_z =0.0);
81 declareProperty("InitParMaxAx", m_init_max_ax=0.0);
82 declareProperty("InitParMaxAy", m_init_max_ay=0.0);
83 declareProperty("InitParMaxSigmaX", m_init_max_sx=2.0);
84 declareProperty("InitParMaxSigmaY", m_init_max_sy=2.0);
85 declareProperty("InitParMaxSigmaZ", m_init_max_sz=3000.);
86 declareProperty("InitParMaxK", m_init_max_k =10.);
87 declareProperty("InitParMaxRhoXY", m_init_max_rhoxy=1.0);
88
89 declareProperty("DefaultX0", m_def_x0=0.0);
90 declareProperty("DefaultY0", m_def_y0=0.0);
91 declareProperty("DefaultZ", m_def_z=0.0);
92 declareProperty("DefaultTiltX", m_def_ax=0.0);
93 declareProperty("DefaultTiltY", m_def_ay=0.0);
94 //these are used when returning a chi2 value
95 declareProperty("DefaultSigmaX", m_def_sx=0.0);
96 declareProperty("DefaultSigmaY", m_def_sy=0.0);
97 declareProperty("DefaultSigmaZ", m_def_sz=0.0);
98
99
100 // selections
101 declareProperty("MaxSigmaTr", m_sigTr=20.);
102 declareProperty("MaxVtxErrTr", m_maxVtxErTr=100.); // in mm
103 declareProperty("OutlierChi2Tr", m_outlierChi2Tr=20.);
104 declareProperty("MaxOutlierLoops",m_maxOutlierLoops = 30);
105 declareProperty("OutlierMaxRejection",m_singleIterationMax=30);
106 declareProperty("OutlierWidthFail", m_widthFail=5.1e-3); // in mm
107 declareProperty("OutlierRhoFail", m_rhoFail=0.8);
108
109 declareProperty("OutlierKFailMin", m_kMinFail = 0);
110 declareProperty("OutlierKFailMax", m_kMaxFail = 9.9);
111
112 declareProperty("DoFitSanityCheck", m_doFitSanityCheck=true);
113 declareProperty("DoChi2OnlyOutlierRemoval",m_doChi2OutlierRemoval=false);
114 // declareProperty( "MinVertexProb", m_minVtxProb=0.001); // min prob(chi2,ndf)
115
116 declareProperty( "FixParK" , m_fixInputK = false);
117 declareProperty( "UseLLNorm" , m_useLLNorm = false);
118 declareProperty( "FixWidth", m_fixWidth = false);
119
120 declareProperty("TruncatedRMS", m_truncatedRMS = true);
121 declareProperty("RMSFraction", m_fractionRMS = 0.95);
122 declareProperty("SetInitialRMS", m_setInitialRMS = false);
123
124}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~InDetBeamSpotVertex()

virtual InDet::InDetBeamSpotVertex::~InDetBeamSpotVertex ( )
inlinevirtual

Definition at line 40 of file InDetBeamSpotVertex.h.

40{}

◆ InDetBeamSpotVertex() [2/2]

InDetBeamSpotVertex::InDetBeamSpotVertex ( const InDetBeamSpotVertex & rhs)

Definition at line 126 of file InDetBeamSpotVertex.cxx.

126 :
127 IInDetBeamSpotTool(rhs),
128 AthAlgTool(rhs.type(), rhs.name(), rhs.parent()),
129 m_x(4),m_cov(4,0),m_z(0.),m_zErr(0.),
130 m_p(4), m_V(4,0),
131 m_zSolved(0.), m_zErrSolved(0.),
132 m_NPARS(10), m_pLL(m_NPARS,0),m_VLL(m_NPARS,0),
133 m_vertexCount(0),m_getLLres(false),
135{
136 m_useLL = rhs.m_useLL;
137 m_init_x = rhs.m_init_x;
138 m_init_y = rhs.m_init_y;
139 m_useLL = rhs.m_useLL;
140
141 m_init_x = rhs.m_init_x;
142 m_init_y = rhs.m_init_y;
143 m_init_z = rhs.m_init_z;
144 m_init_sx = rhs.m_init_sx;
145 m_init_sy = rhs.m_init_sy;
146 m_init_sz = rhs.m_init_sz;
147 m_init_ax = rhs.m_init_ax;
148 m_init_ay = rhs.m_init_ay;
149 m_init_k = rhs.m_init_k;
151
162
173
174 m_def_x0 = rhs.m_def_x0;
175 m_def_y0 = rhs.m_def_y0;
176 m_def_z = rhs.m_def_z;
177 m_def_ax = rhs.m_def_ax;
178 m_def_ay = rhs.m_def_ay;
179 m_def_sx = rhs.m_def_sx;
180 m_def_sy = rhs.m_def_sy;
181 m_def_sz = rhs.m_def_sz;
182
183 m_sigTr = rhs.m_sigTr;
185
186
188
193 m_rhoFail = rhs.m_rhoFail;
196
199
203
208}

Member Function Documentation

◆ applyOutlierRemoval()

bool InDetBeamSpotVertex::applyOutlierRemoval ( )
private

Definition at line 511 of file InDetBeamSpotVertex.cxx.

511 {
512 ATH_MSG_DEBUG( "In Outlier removal" );
513 // apply selection using results of a chi2 fit (eg. displacement)
514 if (!m_vertexData.size()) {
515 ATH_MSG_INFO( "No vertices found" );
516 return false;
517 }
518
519
520 // determine simple means
521 double meanx(0.),meany(0.), meanz(0.);
522 double meanxSqr(0.),meanySqr(0.), meanzSqr(0.);
523 double rmsX(0.),rmsY(0.), rmsZ(0.);
524
525 // for use in median determination
526 std::vector<double> vx,vy,vz;
527
528 int count(0);
529 for ( std::vector< BeamSpot::VrtHolder >::iterator it =
530 m_vertexData.begin();
531 it != m_vertexData.end(); ++it) {
532 if (!it->valid) continue;
533
534 if (!m_truncatedRMS) {
535 meanx += it->x;
536 meanxSqr += (it->x)*(it->x);
537 meany += it->y;
538 meanySqr += (it->y)*(it->y);
539 meanz += it->z;
540 meanzSqr += (it->z)*(it->z);
541
542 ++count;
543 }
544
545 vx.push_back(it->x);
546 vy.push_back(it->y);
547 vz.push_back(it->z);
548 }
549
550 // sort the vectors
551 std::sort(vx.begin(),vx.end());
552 std::sort(vy.begin(),vy.end());
553 std::sort(vz.begin(),vz.end());
554
555 // get the median values -- don't worry about extrapolating betweeen even sized entries
556 double medianx = (vx.size() > 1 ? vx.at(vx.size()/2) : 0.);
557 double mediany = (vy.size() > 1 ? vy.at(vy.size()/2) : 0.);
558 double medianz = (vz.size() > 1 ? vz.at(vz.size()/2) : 0.);
559
560 ATH_MSG_DEBUG( "Median: x: " << medianx
561 << " y: " << mediany
562 << " z: " << medianz );
563
564 if (m_truncatedRMS) {
565
566 ATH_MSG_DEBUG( "Truncating RMS ... " );
567 // Only use the fraction (95%) of tracks closest to the median position to determin the RMS
568 int nvtx(vx.size());
569 std::sort(vx.begin(), vx.end(), SortDistToMedian(medianx));
570 vx.erase(vx.begin()+int(m_fractionRMS*nvtx), vx.end());
571
572 std::sort(vy.begin(), vy.end(), SortDistToMedian(mediany));
573 vy.erase(vy.begin()+int(m_fractionRMS*nvtx), vy.end());
574
575 std::sort(vz.begin(), vz.end(), SortDistToMedian(medianz));
576 vz.erase(vz.begin()+int(m_fractionRMS*nvtx), vz.end());
577
578 ATH_MSG_DEBUG( "... using " << int(m_fractionRMS*nvtx) << " from " << nvtx << " vertices" );
579
580 for (unsigned int ivtx(0); ivtx < vx.size(); ++ivtx) {
581 double x = vx.at(ivtx);
582 double y = vy.at(ivtx);
583 double z = vz.at(ivtx);
584
585 meanx += x;
586 meanxSqr += x*x;
587 meany += y;
588 meanySqr += y*y;
589 meanz += z;
590 meanzSqr += z*z;
591
592 ++count;
593 }
594 }
595
596 if (count) {
597 meanx /= count;
598 meanxSqr /=count;
599 rmsX = std::sqrt( std::abs(meanxSqr - meanx*meanx));
600 meany /= count;
601 meanySqr /=count;
602 rmsY = std::sqrt( std::abs(meanySqr - meany*meany));
603 meanz /=count;
604 meanzSqr /=count;
605 rmsZ = std::sqrt( std::abs(meanzSqr - meanz*meanz));
606 }
607
608 if(m_setInitialRMS){
609 rmsX = m_init_sx;
610 rmsY = m_init_sy;
611 // should we include z here too??
612
613 ATH_MSG_DEBUG( "Setting RMS in x to " << rmsX );
614 ATH_MSG_DEBUG( "Setting RMS in y to " << rmsY );
615
616 }
617
618 ATH_MSG_DEBUG( "mean, RMS; x: " << meanx << " " << rmsX
619 << " " << ", y: " << meany << " " << rmsY << ", z: " << meanz << " " << rmsZ );
620
621
622 // varivables to hold the new chi2 and weighted z-mean values
623 CLHEP::HepVector chi2Pos(4);
624 CLHEP::HepSymMatrix chi2Cov(4);
625 double zpos(0), zerr(0);
626
627
628 // use simple mean and RMS to eliminate any vertices too far from centroid
629 // also redetermine a new chi2 value, based on passed vertices
630 long failCount(0);
631 for ( std::vector< BeamSpot::VrtHolder >::iterator it =
632 m_vertexData.begin();
633 it != m_vertexData.end(); ++it) {
634 if (!it->valid) continue;
635 int fail=0;
636
637 if ( std::abs( medianx - it->x ) > m_sigTr *rmsX) fail += 4;
638 if ( std::abs( mediany - it->y ) > m_sigTr *rmsY) fail += 8;
639 if ( std::abs( medianz - it->z ) > 10*rmsZ) fail += 16;
640
641
642 if ( (medianx - it->x)*(medianx-it->x)/rmsX/rmsX + (mediany-it->y)*(mediany-it->y)/rmsY/rmsY > m_sigTr*m_sigTr) {
643 ATH_MSG_DEBUG( "Vertex info: extended past radial extent: sig."
644 << sqrt((medianx - it->x)*(medianx-it->x)/rmsX/rmsX + (mediany-it->y)*(mediany-it->y)/rmsY/rmsY) << " > "
645 << sqrt( m_sigTr*m_sigTr ) << "." );
646 fail += 128;
647 }
648
649 //and in Z?
650
651 if (fail) { // TBD only allow failed vertices here to be removed on every nth iteration (to aid stability)
652 ATH_MSG_DEBUG( "Vertex reject from simple mean; reason: " << fail << " : x,y,z: "
653 << it->x << " " << it->y << " " << it->z
654 << " , sigma(x,y,z): " << sqrt(it->vxx) << " " << sqrt(it->vyy)
655 << " " << sqrt(it->vzz)
656 );
657
658 it->valid = false;
659 ++failCount;
660 } else {
661 // still valid, so add into chi2
662
663 chi2Pos(1) += it->x * it->vxx + it->y*it->vxy;
664 chi2Pos(2) += it->x*it->vxx*it->z + it->y*it->vxy*it->z;
665 chi2Pos(3) += it->y*it->vyy + it->x*it->vxy;
666 chi2Pos(4) += it->y*it->vyy*it->z + it->x*it->vxy*it->z;
667
668
669 chi2Cov.fast(1,1) += it->vxx;
670 chi2Cov.fast(2,1) += it->vxx*it->z;
671 chi2Cov.fast(2,2) += it->vxx*it->z*it->z;
672 chi2Cov.fast(3,1) += it->vxy;
673 chi2Cov.fast(3,2) += it->vxy*it->z;
674 chi2Cov.fast(3,3) += it->vyy;
675 chi2Cov.fast(4,1) += it->vxy*it->z;
676 chi2Cov.fast(4,2) += it->vxy*it->z*it->z;
677 chi2Cov.fast(4,3) += it->vyy*it->z;
678 chi2Cov.fast(4,4) += it->vyy*it->z*it->z;
679
680 zpos += it->z/it->vzz; //weighted
681 zerr += 1./it->vzz;
682 }// end of valid vertex
683
684 }// for
685 ATH_MSG_DEBUG( "Removed: " << failCount << " vertices from simple mean,RMS." );
686
687
688 // update the new global chi2 - need to do this after the invert has been successful though !!!
689 m_cov = chi2Cov;
690 m_x = chi2Pos;
691 m_z = zpos;
692 m_zErr =zerr;
693 // attempt to solve the new chi2 solution
694 int invFail(0);
695 chi2Cov.invert(invFail);
696 chi2Pos = chi2Cov*chi2Pos;
697 zpos = zpos / zerr;
698 zerr = 1./std::sqrt(zerr);
699
700
701
702
703 // make comparisons of old chi2, new mean and new chi2 values
704 if (msgLvl(MSG::DEBUG) ) {
705 ATH_MSG_DEBUG( "Mean position: x,y,z " << meanx << " " << meany << " " << meanz );
706 ATH_MSG_DEBUG( " RMS: x,y,z " << rmsX << " " << rmsY << " " << rmsZ );
707
708 ATH_MSG_DEBUG( "Original chi2:" << m_p << "\n" << m_V << "\n" << m_zSolved << " " << m_zErrSolved );
709
710 ATH_MSG_DEBUG( "New chi2:" << chi2Pos << "\n" << chi2Cov << "\n" << zpos << " " << zerr );
711
712 } // debug statement
713
714 m_V = chi2Cov;
715 m_p = chi2Pos;
716 m_zSolved = zpos;
717 m_zErrSolved = zerr;
718
719
720
721
722 //Dubious - !!! TBD: move this into the general LL solve area and do it properly!
723
724 m_init_sz = rmsZ;
725
726 // perform LL fit?
727 bool llSolve(false);
728 m_getLLres = false;
729 if (m_useLL) {
730 llSolve = solveLL();
731 m_getLLres = llSolve; // allow the log-likelihood accessor values to returned, if sucessful
732 }
733
734 if ( llSolve and m_rCount > 0 ) {
735 ATH_MSG_INFO( "Log-Likelihood fit converged in outlier removal. Exiting outlier removal." );
736 return true;
737 }
738
739 CLHEP::HepSymMatrix bsCov(2); // for individual chi2 values
740 double xbar = 0.;
741 double ybar = 0.;
742 double ax = 0.;
743 double ay = 0.;
744
745
746
747 if ( llSolve == false || getSigmaX(0.) < m_widthFail || getSigmaY(0.) < m_widthFail || std::abs(getRhoXY()) > m_rhoFail ) {
748 // ll solution not used, or not trusted
749 // set a wide solution
750 m_getLLres = false;
751 ATH_MSG_INFO( ": removeOutliers: LL fit not use/converged/trusted - " <<
752 "using chi2 for mean and simple RMS for width values " );
753 ATH_MSG_DEBUG( llSolve << " " << getSigmaX(0.) << " " << getSigmaY(0.) << " " << getRhoXY() );
754 xbar = getX(0.);
755 ybar = getY(0.);
756 ax = getTiltX();
757 ay = getTiltY();
758
759 bsCov(1,1) = rmsX*rmsX;
760 bsCov(2,2) = rmsY*rmsY;
761 bsCov(2,1) = 0.;
762
763 } else { // ll fit succeeded
764 xbar = getX(0.);
765 ybar = getY(0.);
766 ax = getTiltX();
767 ay = getTiltY();
768
769
770 bsCov(1,1) = getSigmaX(0.)*getSigmaX(0.);
771 bsCov(2,2) = getSigmaY(0.)*getSigmaY(0.);
772 bsCov(2,1) = getSigmaX(0.)*getSigmaY(0.) * getRhoXY();
773
774 } //
775
776 // loop over all vertices and populate a map with the chi2 values of the vertices
777 std::multimap<double, BeamSpot::VrtHolder*> chi2map;
778 int fail(0);
779 long fCount(0);
780 for ( std::vector< BeamSpot::VrtHolder >::iterator it = m_vertexData.begin();
781 it != m_vertexData.end(); ++it) {
782 if ( !it->valid) continue; // ignore vertices set to invalid
783 fail = 0; // reset the fail value variable
784
785 // selections
786 if ( std::abs(it->x - (xbar + it->z*ax)) > m_sigTr * rmsX) fail += 1;
787 if ( std::abs(it->y - (ybar + it->z*ay)) > m_sigTr * rmsY) fail += 2;
788
789 if ( it->vxx > m_maxVtxErTr*m_maxVtxErTr || it->vyy > m_maxVtxErTr*m_maxVtxErTr) fail += 4;
790
791 if ( std::abs(it->z - meanz) > m_sigTr * rmsZ) fail += 8;
792
793 // add all other selections above here:
794 double increaseChi2(0);
795 if (fail) {
796 increaseChi2 = fail * 1e5;
797 }
798
799
800 // chi2 value in transversve plane
801 CLHEP::HepSymMatrix b(2);
802 // TEST TBD !!!
803
804 b(1,1) = it->vxx + bsCov(1,1);
805 b(2,2) = it->vyy + bsCov(2,2);
806 b(2,1) = it->vxy + bsCov(2,1);
807
808 int failInv =0;
809 b.invert(failInv);
810 if (failInv) continue;
811 double ch = (it->x - (xbar + it->z*ax)) * b(1,1) * (it->x - (xbar + it->z*ax))
812 + (it->y - (ybar + it->z*ay)) * b(2,2) * (it->y - (ybar + it->z*ay))
813 + 2*(it->x - (xbar + it->z*ax)) *b(2,1) * (it->y - (ybar + it->z*ay));
814
815 //if (ch > m_outlierChi2Tr ) fail += 128; fail is never used after this
816
817 // if vertex fails selection based on [1,2,4] add a large artificial chi2 value to make sure is removed.
818 ch += increaseChi2;
819
820 chi2map.insert(std::make_pair(ch, &(*it))); // add to list
821
822 } // end for
823
824 // from the map remove the largest chi2 values, up to some maximum number of vertices
825 fCount = 0;
826 for (std::multimap<double, BeamSpot::VrtHolder*>::reverse_iterator vit = chi2map.rbegin(); vit != chi2map.rend(); ++vit) {
827 if ( !vit->second) continue; // no valid pointer ...
828 if ( !vit->second->valid) continue; // ignore vertices set to invalid - shouldn't happen here though
829 if ( fCount >= m_singleIterationMax && m_singleIterationMax != -1) {
830 ATH_MSG_DEBUG( " removeOutlier: Reached max number of vertex rejections for this iteration.\n"
831 << "\tNeed to recalculate mean positions." );
832 break;
833 } // if reached max iterations for this round
834
835 ATH_MSG_VERBOSE( "Vertex chi2: " << vit->first );
836
837
838
839 if ( vit->first < m_outlierChi2Tr ) {
840 if (msgLvl(MSG::DEBUG)) {
841 ATH_MSG_DEBUG( " No more 'bad' vertices found in this iteration." );
842 if (fCount == 0) {
843 ATH_MSG_DEBUG( " No futher vertices removed - moving to final iteration" );
844 } else {
845 ATH_MSG_DEBUG( " Moving to next iteration of outlier removal." );
846 }
847 }
848 break;
849 } // if
850
851 // any vertex that is found here should be removed
852 ++fCount;
853 vit->second->valid = false;
854 // vit->second->outlierRemoved = true;
855 ATH_MSG_DEBUG( "Vertex rejected; chi2: " << vit->first <<". pos(x,y,z): "
856 << vit->second->x << " " << vit->second->y << " " << vit->second->z
857 << " , sigma(x,y,z): " << sqrt(vit->second->vxx) << " " << sqrt(vit->second->vyy)
858 << " " << sqrt(vit->second->vzz)
859 );
860
861 } // for
862
863 // if no vertices removed and ll fit still fails, then we continue to have a problem ...
864 if (fCount == 0 && m_useLL && !llSolve && m_rCount !=0 ) { // if first iteration, we have another iteration later.
865 ATH_MSG_WARNING( "No vertices removed and fit still fails - most likely final result will fail" );
866
867 // this is our 'last-ditch approach'. Split the collection of vertices into two 'random' sets and solve for each.
868 // if both successful, then compare (and be a little confused). If only one, compare to chi2 and take if ok.
869 // if none, then really have to give up. No valid solution possible.
870
871 // m_vertexData // key holder.
872 // copy the original values
873 std::vector< BeamSpot::VrtHolder > vertexTemp(m_vertexData);
874 // muddle up the original
875 std::random_device rng;
876 std::mt19937 urng(rng());
877 std::shuffle(m_vertexData.begin(), m_vertexData.end(), urng);
878 // divide the sample into two
879 std::vector< BeamSpot::VrtHolder > vertex1,vertex2;
880 std::copy(m_vertexData.begin() + m_vertexData.size()/2, m_vertexData.end(), back_inserter(vertex2)) ;
881 std::copy(m_vertexData.begin(), m_vertexData.begin() + m_vertexData.size()/2, back_inserter(vertex1)) ;
882
883 bool goodFit1(false), goodFit2(false);
884
885 ATH_MSG_DEBUG( "Attempting fit with vextex half: 1");
886 m_vertexData = vertex1;
887 llSolve = solveLL();
888 m_getLLres = true;
889 ATH_MSG_WARNING( "Fit using \"vertex1\" " << ( llSolve ? "Successful": "Failed") );
890 if (llSolve) {
891 goodFit1 = true;
892
893
894 ATH_MSG_DEBUG( "x: " << getX(0) << " +- " << getErrX(0) );
895 ATH_MSG_DEBUG( "y: " << getY(0) << " +- " << getErrY(0) );
896 ATH_MSG_DEBUG( "z: " << getZ() << " +- " << getErrZ() );
897 ATH_MSG_DEBUG( "sx: " << getSigmaX(0) << " +- " << getErrSigmaX(0) );
898 ATH_MSG_DEBUG( "sy: " << getSigmaY(0) << " +- " << getErrSigmaY(0) );
899 ATH_MSG_DEBUG( "sz: " << getSigmaZ() << " +- " << getErrSigmaZ() );
900 ATH_MSG_DEBUG( "ax: " << getTiltX() << " +- " << getErrTiltX() );
901 ATH_MSG_DEBUG( "ay: " << getTiltY() << " +- " << getErrTiltY() );
902 ATH_MSG_DEBUG( "sxy:" << getSigmaXY(0) << " +- " << getErrSigmaXY(0) );
903 ATH_MSG_DEBUG( "rh: " << getRhoXY() << " +- " << getErrRhoXY() );
904 ATH_MSG_DEBUG( "k: " << getK() << " +- " << getErrK() );
905
906
907 } // good fit
908
909 ATH_MSG_DEBUG( "Attempting fit with vextex half: 2");
910 m_vertexData = vertex2;
911 llSolve = solveLL();
912 m_getLLres = true;
913 ATH_MSG_WARNING( "Fit using \"vertex2\" " << ( llSolve ? "Successful": "Failed") );
914 if (llSolve) {
915 goodFit2 = true;
916
917 ATH_MSG_DEBUG( "x: " << getX(0) << " +- " << getErrX(0) );
918 ATH_MSG_DEBUG( "y: " << getY(0) << " +- " << getErrY(0) );
919 ATH_MSG_DEBUG( "z: " << getZ() << " +- " << getErrZ() );
920 ATH_MSG_DEBUG( "sx: " << getSigmaX(0) << " +- " << getErrSigmaX(0) );
921 ATH_MSG_DEBUG( "sy: " << getSigmaY(0) << " +- " << getErrSigmaY(0) );
922 ATH_MSG_DEBUG( "sz: " << getSigmaZ() << " +- " << getErrSigmaZ() );
923 ATH_MSG_DEBUG( "ax: " << getTiltX() << " +- " << getErrTiltX() );
924 ATH_MSG_DEBUG( "ay: " << getTiltY() << " +- " << getErrTiltY() );
925 ATH_MSG_DEBUG( "sxy:" << getSigmaXY(0) << " +- " << getErrSigmaXY(0) );
926 ATH_MSG_DEBUG( "rh: " << getRhoXY() << " +- " << getErrRhoXY() );
927 ATH_MSG_DEBUG( "k: " << getK() << " +- " << getErrK() );
928
929
930 }
931
932 // what now ? ...
933 ATH_MSG_WARNING( "Fit was " << ( goodFit2 || goodFit1 ? "Successful ": "Unsuccessful ")
934 <<" using a subset of the available vertices" );
935 if (( goodFit2 || goodFit1) )
936 ATH_MSG_WARNING( "Using these subset data for final result!!! " );
937 ATH_MSG_WARNING( "FIT HALFVERTX" );
938
939 if (goodFit1) {
940 m_vertexData = vertex1;
941 } else if (goodFit2) {
942 m_vertexData = vertex2;
943 } else {
944 m_vertexData = vertexTemp; // give up and go home...
945 }
946
947 } // last solution
948
949
950
951 // recursive mode
952 ATH_MSG_DEBUG( " Recursive debug: Loop: " << m_rCount << ". Number of failed vertices: " << fCount );
953
954 ++m_rCount;
955 if ( fCount > 0 || ( fCount == 0 && m_rCount == 1 && !llSolve)) { // if failed vertices or, no failed, first iteration, and no succesful fit
957 ATH_MSG_WARNING( "OutlierRemoval: Reached maximum number of recursive loops: " << m_rCount
958 << ". No more iterations performed." );
959 } else {
960 ATH_MSG_DEBUG( "OutlierRemoval: Entering recursive loop: " << m_rCount );
962 } // if entering loop
963 } // if fails > 0
964 --m_rCount;
965 return true;
966} // outlier removal
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define y
#define x
#define z
bool msgLvl(const MSG::Level lvl) const
double getErrX(double z) const
double getSigmaY(double) const
double getErrY(double z) const
double getSigmaX(double) const
double getX(double z) const
bool solveLL(bool printOut=false)
double getSigmaXY(double z) const
double getErrSigmaY(double) const
double getErrSigmaXY(double z) const
double getErrSigmaX(double) const
double getY(double z) const
std::vector< BeamSpot::VrtHolder > m_vertexData
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
uint32_t rng()
Definition FillerAlg.cxx:40
fail(message)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void shuffle(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, UniformRandom &g)
Specialization of shuffle for DataVector/List.

◆ clear()

void InDetBeamSpotVertex::clear ( )

Definition at line 222 of file InDetBeamSpotVertex.cxx.

222 {
223 //reset the data information;
224
225 m_x *= 0.;
226 m_p *= 0.;
227
228 m_cov *= 0.;
229 m_V *= 0.;
230 m_z=0.;
231 m_zErr =0.;
232 m_zSolved =0.;
233 m_zErrSolved =0.;
234
235 m_vertexCount =0;
237
238 m_vertexData.clear();
239
240 m_nUsed = 0;
241}

◆ Clone()

IInDetBeamSpotTool * InDet::InDetBeamSpotVertex::Clone ( )
inlinevirtual

Implements InDet::IInDetBeamSpotTool.

Definition at line 50 of file InDetBeamSpotVertex.h.

50{return new InDetBeamSpotVertex(*this);}
InDetBeamSpotVertex(const std::string &type, const std::string &name, const IInterface *parent)

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

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

◆ doFit2()

void InDetBeamSpotVertex::doFit2 ( TMinuit * minuit,
bool printOut = false )
private

Definition at line 1100 of file InDetBeamSpotVertex.cxx.

1100 {
1101 //second attempt to fit in a controlled way.
1102 //reset initial values
1103 setParsFromChi2(minuit);
1104
1105 //fix k, and rho,
1106 minuit->FixParameter(6);
1107 minuit->FixParameter(7);
1108
1109 //fix x0,y0,ax,ay
1110 minuit->FixParameter(0);
1111 minuit->FixParameter(1);
1112 minuit->FixParameter(2);
1113 minuit->FixParameter(3);
1114
1115 if(m_fixWidth){
1116 minuit->FixParameter(4);
1117 minuit->FixParameter(5);
1118 }
1119
1120 minuit->Migrad();
1121 minuit->Migrad();
1122 //release k,rho
1123 if ( !m_fixInputK){
1124 minuit->Release(7);
1125 minuit->Migrad();
1126 }
1127
1128 if(!m_fixWidth){
1129 minuit->Release(6);
1130 minuit->Migrad();
1131 }
1132
1133 minuit->Release(0);
1134 minuit->Release(1);
1135 minuit->Release(2);
1136 minuit->Release(3);
1137 minuit->Migrad();
1138 if(printOut) minuit->SetPrintLevel(0);
1139 minuit->Migrad();
1140 //look at fit status from calling function
1141}
int setParsFromChi2(TMinuit *minuit)

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

Standard finalize.

Will attempt a solution if not already done

Implements InDet::IInDetBeamSpotTool.

Definition at line 215 of file InDetBeamSpotVertex.cxx.

215 {
216 ATH_MSG_DEBUG( "In finalize" );
217 clear(); // clear the data;
218
219 return StatusCode::SUCCESS;
220}

◆ fit()

InDetBeamSpotVertex::FitStatus InDetBeamSpotVertex::fit ( std::vector< BeamSpot::VrtHolder > & )
virtual

Attempt a to find a solution of the beamspot.

Implements InDet::IInDetBeamSpotTool.

Definition at line 243 of file InDetBeamSpotVertex.cxx.

243 {
244 //get solution from current data;
245 //Note, even if doing LL, use the chi2 information
247 m_vertexCount = vtxData.size();
248
249
250 bool chi2Result = solveChi2();
251 m_getLLres = false;
252 bool llResult = false;
253 if (m_useLL) {
254 applyOutlierRemoval(); // Apply a final selection
255 m_getLLres = true; //set system to use these results
256 llResult = solveLL();
257 if (!llResult) {
258 ATH_MSG_WARNING( "Log-likelihood fit failed: Reverting to chi2 solution" );
259 m_getLLres = false;
260 chi2Result = solveChi2(); //unfortunately need to resolve, to set correct fit parameters
261 }
262 }
263
264 if (m_useLL) {
265 m_getLLres = true; //set system to use these results
266 bool printOut = true;
267 llResult = solveLL(printOut);
268 if (!llResult) {
269 ATH_MSG_WARNING( "Log-likelihood fit failed: Reverting to chi2 solution" );
270 m_getLLres = false;
271 chi2Result = solveChi2(); //unfortunately need to resolve, to set correct fit parameters
272 }
273 } // if use LL
274
275
276
277 if (m_getLLres)
278 m_fitStatus = (llResult ? successful : failed);
279 else
280 m_fitStatus = (chi2Result ? successful : failed);
281 m_nUsed+=std::count_if(m_vertexData.begin(),m_vertexData.end(),[](const BeamSpot::VrtHolder & v){return v.valid;});
282
283 //display results
284 ATH_MSG_INFO( "Fit result was: " << ( m_fitStatus == successful ? "Successful" : "Failure")
285 << " using Vertex " << (m_getLLres ? "Log-likelihood":"Chi2") << " method" );
286 ATH_MSG_INFO( "Number of vertices: " << m_vertexCount );
287 ATH_MSG_INFO( "x(z=0) = " << getX(0.) << " +- " << getErrX(0) );
288 ATH_MSG_INFO( "y(z=0) = " << getY(0.) << " +- " << getErrY(0) );
289 ATH_MSG_INFO( "z = " << getZ() << " +- " << getErrZ() );
290 double z = getZ();
291 ATH_MSG_INFO( "x(z) = " << getX(z) << " +- " << getErrX(z) );
292 ATH_MSG_INFO( "y(z) = " << getY(z) << " +- " << getErrY(z) );
293
294 ATH_MSG_INFO( "TiltX = " << getTiltX() << " +- " << getErrTiltX() );
295 ATH_MSG_INFO( "TiltY = " << getTiltY() << " +- " << getErrTiltY() );
296
297 ATH_MSG_INFO( "SigmaX(z=0) = " << getSigmaX(0.) << " +- " << getErrSigmaX(0.) );
298 ATH_MSG_INFO( "SigmaY(z=0) = " << getSigmaY(0.) << " +- " << getErrSigmaY(0.) );
299 ATH_MSG_INFO( "SigmaZ = " << getSigmaZ() << " +- " << getErrSigmaZ() );
300
301 ATH_MSG_INFO( "rhoXY = " << getRhoXY() << " +- " << getErrRhoXY() );
302 ATH_MSG_INFO( "K = " << getK() << " +- " << getErrK() );
303
304 return m_fitStatus;
305}
vtxData
Definition fitman.py:512

◆ getCov()

CLHEP::HepSymMatrix InDetBeamSpotVertex::getCov ( double z) const

Definition at line 308 of file InDetBeamSpotVertex.cxx.

308 { //x(z),y(z),tiltx,tilty
309 CLHEP::HepSymMatrix c(4,0);
310
311 if ( m_getLLres ) {
312 //maximum likelihood
313 c(1,1) = m_VLL(1,1) + 2*z*m_VLL(3,1) + z*z*m_VLL(3,3);
314 c(2,2) = m_VLL(2,2) + 2*z*m_VLL(4,2) + z*z*m_VLL(4,4);
315 c(3,3) = m_VLL(3,3);
316 c(4,4) = m_VLL(4,4);
317
318 c(2,1) = m_VLL(2,1) + z*m_VLL(2,3) + z*m_VLL(4,1)+z*z*m_VLL(4,3);
319 c(3,1) = m_VLL(3,1) + z*m_VLL(3,3);
320 c(4,1) = m_VLL(4,1) + z*m_VLL(3,4);
321
322 c(3,2) = m_VLL(2,3) + z*m_VLL(4,3);
323 c(4,2) = m_VLL(4,2) + z*m_VLL(4,4);
324
325 c(4,3) = m_VLL(4,3);
326
327 } else {
328 //chi2
329 c(1,1) = m_V(1,1) + 2*z*m_V(2,1) + z*z*m_V(2,2);
330 c(2,2) = m_V(3,3) + 2*z*m_V(4,3) + z*z*m_V(4,4);
331 c(3,3) = m_V(2,2);
332 c(4,4) = m_V(4,4);
333
334 c(2,1) = m_V(3,1) + z*m_V(3,2) + z*m_V(4,1)+z*z*m_V(4,2);
335 c(3,1) = m_V(2,1) + z*m_V(2,2);
336 c(4,1) = m_V(4,1) + z*m_V(4,2);
337
338 c(3,2) = m_V(3,2) + z*m_V(4,2);
339 c(4,2) = m_V(4,3) + z*m_V(4,4);
340
341 c(4,3) = m_V(4,2);
342
343 }
344
345 return c;
346}

◆ getCovMap()

std::map< std::string, double > InDetBeamSpotVertex::getCovMap ( ) const
virtual

Implements InDet::IInDetBeamSpotTool.

Definition at line 1144 of file InDetBeamSpotVertex.cxx.

1144 {
1145
1146 //Note: all the off-diagonal elements are errors calculated at (0,0,0).
1147 //While the diagonal elements are calculated at the z centroid
1148 //In practice, this should make little difference, but it is important to note for now.
1149
1150 std::map<std::string,double> covMap;
1151 std::vector<double> covVector;
1152 covVector.resize(55);
1153
1154 //This is the method that was used before to put the covariance matrix in the required order
1155 //We don't want to mess with this, because no one knows the original order
1156
1157 int map[] = {1,2,9,3,4,5,6,10,7,8};
1158 if(m_fixInputK){
1159 int map2[] = {1,2,8,3,4,5,6,9,7,10};
1160 for(int i=0; i < 10; ++i){
1161 map[i] = map2[i];
1162 }
1163 } else if (m_fixWidth) {
1164 int map2[] = {1,2,6,3,4,8,9,7,10,5};
1165 for(int i=0; i < 10; ++i){
1166 map[i] = map2[i];
1167 }
1168 }
1169
1170 int temp = 0;
1171 for (int i=0;i<10;++i) {
1172 for (int j=i;j<10;++j) {
1173 if( m_fixInputK && (i == 9 || j ==9 )){
1174 covVector[temp++] = 0;
1175 } else if ( m_fixWidth && ( i == 5 || i == 6 || i == 8 || j == 5 || j == 6 || j == 8 ) ){
1176 covVector[temp++] = 0;
1177 }else{
1178 covVector[temp++] = m_VLL( map[i], map[j] );
1179 }
1180 }
1181 }
1182
1183 //This array is in the order required from the original ntuple format
1184
1185 const std::string keyArr[] = {"posXErr","covXY","covXZ","covXTiltX","covXTiltY","covXSx","covXSy","covXSz","covXRhoXY","covXk",
1186 "posYErr","covYZ","covYTiltX","covYTiltY","covYSx","covYSy","covYSz","covYRhoXY","covYk",
1187 "posZErr","covZTiltX","covZTiltY","covZSx","covZSy","covZSz","covZRhoXY","covZk",
1188 "tiltXErr","covTiltXTiltY","covTiltXSx","covTiltXSy","covTiltXSz","covTiltXRhoXY","covTiltXk",
1189 "tiltYErr","covTiltYSx","covTiltYSy","covTiltYSz","covTiltYRhoXY","covTiltYk",
1190 "sigmaXErr","covSxSy","covSxSz","covSxRhoXY","covSxk",
1191 "sigmaYErr","covSySz","covSyRhoXY","covSyk",
1192 "sigmaZErr","covSzRhoXY","covSzk",
1193 "rhoXYErr","covRhoXYk",
1194 "kErr"};
1195
1196
1197 //Now that everything should be in the right order, it's simple to set the covariance matrix map correctly:
1198
1199
1200 for(int i = 0; i < 55; i++){
1201 covMap[keyArr[i]] = covVector[i];
1202 //std::cout << keyArr[i] << " " << covVector[i] << std::endl;
1203 //covMap[keyArr2[i]]= covVector[i];
1204 }
1205
1206 covMap[ keyArr[0] ] = sqrt(covVector[0]);
1207 covMap[ keyArr[10] ] = sqrt(covVector[10]);
1208 covMap[ keyArr[19] ] = sqrt(covVector[19]);
1209 covMap[ keyArr[27] ] = sqrt(covVector[27]);
1210 covMap[ keyArr[34] ] = sqrt(covVector[34]);
1211 covMap[ keyArr[40] ] = sqrt(covVector[40]);
1212 covMap[ keyArr[45] ] = sqrt(covVector[45]);
1213 covMap[ keyArr[49] ] = sqrt(covVector[49]);
1214 covMap[ keyArr[52] ] = sqrt(covVector[52]);
1215 covMap[ keyArr[54] ] = sqrt(covVector[54]);
1216
1217
1218 //The errors on these 5 parameters were calculated at (0,0,0). This is how we convert them to be
1219 //at the centroid
1220
1221 double z = getZ();
1222 CLHEP::HepSymMatrix covc = getCov(z);
1223
1224 covMap["posXErr"] = sqrt( covc(1,1) ); //xcxc
1225 covMap["posYErr"] = sqrt( covc(2,2) ); //ycyc
1226 covMap["tiltXErr"] = sqrt( covc(3,3) ); //axcaxc
1227 covMap["tiltYErr"] = sqrt( covc(4,4) ); //aycayc
1228 covMap["sigmaXErr"] = sqrt( getErrSigmaX(z)*getErrSigmaX(z) ); //sxcsxc
1229 covMap["sigmaYErr"] = sqrt( getErrSigmaY(z)*getErrSigmaY(z) ); //sycsyc
1230
1231 return covMap;
1232
1233
1234}
CLHEP::HepSymMatrix getCov(double z) const

◆ getErrK()

double InDet::InDetBeamSpotVertex::getErrK ( ) const
inline

Definition at line 95 of file InDetBeamSpotVertex.h.

95{ return (m_getLLres ? (m_fixInputK ? 0. : sqrt(m_VLL(8,8)) ) : 0.);}

◆ getErrRhoXY()

double InDet::InDetBeamSpotVertex::getErrRhoXY ( ) const
inline

Definition at line 94 of file InDetBeamSpotVertex.h.

94{ return (m_getLLres ? sqrt(m_VLL(7,7)) : 0.);}

◆ getErrSigmaX()

double InDet::InDetBeamSpotVertex::getErrSigmaX ( double ) const
inline

Definition at line 75 of file InDetBeamSpotVertex.h.

75 {
76 return (m_getLLres ? sqrt(m_VLL(5,5)) :0.);}

◆ getErrSigmaXY()

double InDet::InDetBeamSpotVertex::getErrSigmaXY ( double z) const
inline

Definition at line 99 of file InDetBeamSpotVertex.h.

99 {
100 // Error proporagtion multiplied thorughout by sigmaXY to remove denominator -> safer against zeros
101
102 double rhoXY = getRhoXY();
103 double sigmaX = getSigmaX(z);
104 double sigmaY = getSigmaY(z);
105
106 double errRhoXY = getErrRhoXY();
107 double errSigmaX = getErrSigmaX(z);
108 double errSigmaY = getErrSigmaY(z);
109
110 double errSigmaXY = sqrt((errRhoXY*errRhoXY) * (sigmaX*sigmaX) * (sigmaY*sigmaY) +
111 (rhoXY*rhoXY) * (errSigmaX*errSigmaX) * (sigmaY*sigmaY) +
112 (rhoXY*rhoXY) * (sigmaX*sigmaX) * (errSigmaY*errSigmaY));
113 return errSigmaXY;
114 }

◆ getErrSigmaY()

double InDet::InDetBeamSpotVertex::getErrSigmaY ( double ) const
inline

Definition at line 77 of file InDetBeamSpotVertex.h.

77 {
78 return (m_getLLres ? sqrt(m_VLL(6,6)) :0.);}

◆ getErrSigmaZ()

double InDet::InDetBeamSpotVertex::getErrSigmaZ ( ) const
inline

Definition at line 79 of file InDetBeamSpotVertex.h.

79 {
80 return (m_getLLres ? (m_fixInputK ? sqrt(m_VLL(9,9)) : sqrt(m_VLL(10,10))) :0.);}

◆ getErrTiltX()

double InDet::InDetBeamSpotVertex::getErrTiltX ( ) const
inline

Definition at line 86 of file InDetBeamSpotVertex.h.

86 {
87 return (m_getLLres ? sqrt(m_VLL(3,3)):sqrt( m_V(2,2)));}

◆ getErrTiltY()

double InDet::InDetBeamSpotVertex::getErrTiltY ( ) const
inline

Definition at line 88 of file InDetBeamSpotVertex.h.

88 {
89 return (m_getLLres ? sqrt(m_VLL(4,4)):sqrt( m_V(4,4)));}

◆ getErrX()

double InDet::InDetBeamSpotVertex::getErrX ( double z) const
inline

Definition at line 58 of file InDetBeamSpotVertex.h.

58 {
59 return (m_getLLres ? sqrt(m_VLL(1,1) + 2*z*m_VLL(3,1) + z*z*m_VLL(3,3)):
60 sqrt(m_V(1,1) + 2*z*m_V(2,1) + z*z*m_V(2,2)));
61 }

◆ getErrY()

double InDet::InDetBeamSpotVertex::getErrY ( double z) const
inline

Definition at line 62 of file InDetBeamSpotVertex.h.

62 {
63 return (m_getLLres ? sqrt(m_VLL(2,2) + 2*z*m_VLL(4,2) + z*z*m_VLL(4,4)):
64 sqrt(m_V(3,3) + 2*z*m_V(4,3) + z*z*m_V(4,4)) );
65 }

◆ getErrZ()

double InDet::InDetBeamSpotVertex::getErrZ ( ) const
inline

Definition at line 66 of file InDetBeamSpotVertex.h.

66 {
67 return (m_getLLres ? (m_fixInputK ? sqrt(m_VLL(8,8)) : sqrt(m_VLL(9,9))):m_zErrSolved);} // defined as centroid of beam

◆ getFitID()

virtual FitID InDet::InDetBeamSpotVertex::getFitID ( ) const
inlinevirtual

A unique ID for the specific fit type.

Implements InDet::IInDetBeamSpotTool.

Definition at line 49 of file InDetBeamSpotVertex.h.

49{ return (m_getLLres ? vertexLL : vertexChi2 );}

◆ getK()

double InDet::InDetBeamSpotVertex::getK ( ) const
inline

Definition at line 93 of file InDetBeamSpotVertex.h.

93{ return (m_getLLres ? m_pLL(8) : 0.);}

◆ getLLcov()

const CLHEP::HepSymMatrix & InDet::InDetBeamSpotVertex::getLLcov ( ) const
inline

Definition at line 118 of file InDetBeamSpotVertex.h.

118{ return m_VLL;}

◆ getLLpos()

const CLHEP::HepVector & InDet::InDetBeamSpotVertex::getLLpos ( ) const
inline

Definition at line 117 of file InDetBeamSpotVertex.h.

117{ return m_pLL;}

◆ getParamMap()

std::map< std::string, double > InDetBeamSpotVertex::getParamMap ( ) const
virtual

Implements InDet::IInDetBeamSpotTool.

Definition at line 1235 of file InDetBeamSpotVertex.cxx.

1235 {
1236 double z = getZ();
1237
1238 std::map<std::string,double> paramMap;
1239 paramMap["tiltX"] = (m_getLLres ? m_pLL(3) : m_p(2));
1240 paramMap["tiltY"] = (m_getLLres ? m_pLL(4) : m_p(4));
1241 paramMap["k"] = (m_getLLres ? m_pLL(8) : 0.);
1242 paramMap["posX"] = (m_getLLres ? m_pLL(1) + m_pLL(3)*z : m_p(1) + m_p(2)*z);
1243 paramMap["posY"] = (m_getLLres ? m_pLL(2) + m_pLL(4)*z : m_p(3) + m_p(4)*z);
1244 paramMap["posZ"] = (m_getLLres ? m_pLL(9) : m_zSolved);
1245 paramMap["sigmaX"] = (m_getLLres ? m_pLL(5) : m_def_sx);
1246 paramMap["sigmaY"] = (m_getLLres ? m_pLL(6) : m_def_sy);
1247 paramMap["sigmaZ"] = (m_getLLres ? m_pLL(10) : m_def_sz);
1248 paramMap["rhoXY"] = (m_getLLres ? m_pLL(7) : 0.);
1249 paramMap["nUsed"] = m_nUsed;
1250
1251 return paramMap;
1252}

◆ getRhoXY()

double InDet::InDetBeamSpotVertex::getRhoXY ( ) const
inline

Definition at line 92 of file InDetBeamSpotVertex.h.

92{ return (m_getLLres ? m_pLL(7) : 0.);}

◆ getSigmaX()

double InDet::InDetBeamSpotVertex::getSigmaX ( double ) const
inline

Definition at line 69 of file InDetBeamSpotVertex.h.

69 {
70 return (m_getLLres ? m_pLL(5) : m_def_sx);}

◆ getSigmaXY()

double InDet::InDetBeamSpotVertex::getSigmaXY ( double z) const
inline

Definition at line 97 of file InDetBeamSpotVertex.h.

97{return getRhoXY()*getSigmaX(z)*getSigmaY(z);}

◆ getSigmaY()

double InDet::InDetBeamSpotVertex::getSigmaY ( double ) const
inline

Definition at line 71 of file InDetBeamSpotVertex.h.

71 {
72 return (m_getLLres ? m_pLL(6) : m_def_sy);}

◆ getSigmaZ()

double InDet::InDetBeamSpotVertex::getSigmaZ ( ) const
inline

Definition at line 73 of file InDetBeamSpotVertex.h.

73 {
74 return (m_getLLres ? m_pLL(10) : m_def_sz);}

◆ getTiltX()

double InDet::InDetBeamSpotVertex::getTiltX ( ) const
inline

Definition at line 82 of file InDetBeamSpotVertex.h.

82 {
83 return (m_getLLres ? m_pLL(3) :m_p(2));}

◆ getTiltY()

double InDet::InDetBeamSpotVertex::getTiltY ( ) const
inline

Definition at line 84 of file InDetBeamSpotVertex.h.

84 {
85 return (m_getLLres ? m_pLL(4) :m_p(4));}

◆ getX()

double InDet::InDetBeamSpotVertex::getX ( double z) const
inline

Definition at line 52 of file InDetBeamSpotVertex.h.

52 {
53 return (m_getLLres ? m_pLL(1) + m_pLL(3)*z : m_p(1) + m_p(2)*z);}

◆ getY()

double InDet::InDetBeamSpotVertex::getY ( double z) const
inline

Definition at line 54 of file InDetBeamSpotVertex.h.

54 {
55 return (m_getLLres ? m_pLL(2) + m_pLL(4)*z : m_p(3) + m_p(4)*z);}

◆ getZ()

double InDet::InDetBeamSpotVertex::getZ ( ) const
inline

Definition at line 57 of file InDetBeamSpotVertex.h.

57{ return (m_getLLres ? m_pLL(9):m_zSolved);}

◆ initialize()

StatusCode InDetBeamSpotVertex::initialize ( )
virtual

Standard initialize.

Implements InDet::IInDetBeamSpotTool.

Definition at line 210 of file InDetBeamSpotVertex.cxx.

210 {
211 ATH_MSG_DEBUG( "In initialize" );
212 return StatusCode::SUCCESS;
213}

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & InDet::IInDetBeamSpotTool::interfaceID ( )
inlinestaticinherited

Retrieve interface ID.

Definition at line 53 of file IInDetBeamSpotTool.h.

53{ return IID_IInDetBeamSpotTool; }
static const InterfaceID IID_IInDetBeamSpotTool("IInDetBeamSpotTool", 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 }

◆ setInitialPars()

int InDetBeamSpotVertex::setInitialPars ( TMinuit * minuit)
private

Definition at line 456 of file InDetBeamSpotVertex.cxx.

456 {
457 int errFlag;
458 //Set initial Parameters
459 minuit->mnparm(0,"X0",m_init_x ,1e-5,m_init_min_x,m_init_max_x, errFlag);
460 minuit->mnparm(1,"Y0",m_init_y ,1e-5,m_init_min_y,m_init_max_y, errFlag);
461 minuit->mnparm(2,"Ax",m_init_ax ,1e-6,m_init_min_ax,m_init_max_ax, errFlag);
462 minuit->mnparm(3,"Ay",m_init_ay ,1e-6,m_init_min_ay,m_init_max_ay, errFlag);
463 minuit->mnparm(4,"#sigma(x)",m_init_sx, 1e-5,m_init_min_sx,m_init_max_sx, errFlag);
464 minuit->mnparm(5,"#sigma(y)",m_init_sy, 1e-5,m_init_min_sy,m_init_max_sy, errFlag);
465 minuit->mnparm(6,"#rhoxy",m_init_rhoxy,1e-5,m_init_min_rhoxy,m_init_max_rhoxy, errFlag);
466 minuit->mnparm(7,"k",m_init_k, 1e-5,m_init_min_k,m_init_max_k, errFlag);
467 minuit->mnparm(8,"z0",m_init_z, 1e-3,m_init_min_z,m_init_max_z, errFlag);
468 minuit->mnparm(9,"#sigma(z)",m_init_sz, 1e-3,m_init_min_sz,m_init_max_sz, errFlag);
469
470 minuit->SetMaxIterations(m_minuit_maxIter);
471
472 return errFlag;
473}

◆ setOutput()

bool InDetBeamSpotVertex::setOutput ( TMinuit * minuit)
private

Definition at line 415 of file InDetBeamSpotVertex.cxx.

415 {
416 //set the LL fitted parameters to the output.
417 //output
418 double t;
419 for (int i =0; i<m_NPARS; ++i) {
420 minuit->GetParameter(i, m_pLL(i+1) ,t);
421 }//for
422
423 double * cov = new double[m_NPARS*m_NPARS];
424 minuit->mnemat(cov,m_NPARS);
425 for (int i =0; i<m_NPARS; ++i) {
426 for ( int j=i; j<m_NPARS; ++j) {
427 m_VLL(i+1,j+1) = cov[ i*m_NPARS + j];
428 }//for j
429 }//for i
430 delete[] cov;
431
432 return true;
433}

◆ setParsFromChi2()

int InDetBeamSpotVertex::setParsFromChi2 ( TMinuit * minuit)
private

Definition at line 437 of file InDetBeamSpotVertex.cxx.

437 {
438 // use results of a chi2 fit to override some initial paramters
439 int errFlag;
440 minuit->mnparm(0,"X0",m_p(1) ,1e-5,m_init_min_x,m_init_max_x, errFlag);
441 minuit->mnparm(1,"Y0",m_p(3) ,1e-5,m_init_min_y,m_init_max_y, errFlag);
442 minuit->mnparm(2,"Ax",m_p(2) ,1e-6,m_init_min_ax,m_init_max_ax, errFlag);
443 minuit->mnparm(3,"Ay",m_p(4) ,1e-6,m_init_min_ay,m_init_max_ay, errFlag);
444 minuit->mnparm(4,"#sigma(x)",m_init_sx, 1e-5,m_init_min_sx,m_init_max_sx, errFlag);
445 minuit->mnparm(5,"#sigma(y)",m_init_sy, 1e-5,m_init_min_sy,m_init_max_sy, errFlag);
446 minuit->mnparm(6,"#rhoxy",m_init_rhoxy,1e-5,m_init_min_rhoxy,m_init_max_rhoxy, errFlag);
447 minuit->mnparm(7,"k",m_init_k, 1e-5,m_init_min_k,m_init_max_k, errFlag);
448 minuit->mnparm(8,"z0",m_zSolved, 1e-3,m_init_min_z,m_init_max_z, errFlag);
449 minuit->mnparm(9,"#sigma(z)",m_init_sz, 1e-3,m_init_min_sz,m_init_max_sz, errFlag);
450
451 minuit->SetMaxIterations(m_minuit_maxIter);
452
453 return errFlag;
454}

◆ solveChi2()

bool InDetBeamSpotVertex::solveChi2 ( )
private

Definition at line 475 of file InDetBeamSpotVertex.cxx.

475 {
476 ATH_MSG_DEBUG( "Attempting to solve " );
477
478 //calulate a solution for the current set of data
479 if (m_vertexCount == 0) {
480 ATH_MSG_DEBUG( "No vertices stored for solve" );
482 return false;
483 }
484
485
486 //invert matrix
487 int fail;
488 m_V = m_cov;
489 ATH_MSG_DEBUG( "Matrix prior to inversion\n" << m_V);
490
491 m_V.invert(fail); //replaces the matrix with inverse
492 if (fail != 0) {
493 return false;
494 }
495 ATH_MSG_DEBUG( "Matrix post inversion\n" << m_V);
496
497
498 m_p = m_V*m_x; // calculate parameter estimates
499 m_zSolved = m_z / m_zErr; // weighted
500 m_zErrSolved = 1./std::sqrt(m_zErr);
501
502
503 ATH_MSG_DEBUG( "Fit solved succesfully from " << m_vertexCount << " vertices");
504 ATH_MSG_DEBUG( "Chi2 Solution:\n"<<m_p <<"\n" << "Covariance: \n" << m_V );
505
506 return true;
507}

◆ solveLL()

bool InDetBeamSpotVertex::solveLL ( bool printOut = false)
private

Definition at line 349 of file InDetBeamSpotVertex.cxx.

349 {
350 ATH_MSG_DEBUG( "In solveLL" );
351
352 TMinuit * minuit = new TMinuit(m_NPARS);
353 //setInitialPars( minuit);
354
355 //Set Minuit output level
356 if (msg().level() < MSG::DEBUG) {
357 printOut = true;
358 minuit->SetPrintLevel(1);
359 } else if (msg().level() == MSG::DEBUG) {
360 printOut = true;
361 minuit->SetPrintLevel(0);
362 } else {
363 minuit->SetPrintLevel(-1);
364 }
365
366 setParsFromChi2(minuit);
367
368 minuit->SetErrorDef(0.5); // for Log-Likeihood: 0.5
369
370 int errFlag =0;
371 //SET STRategy for calculating second derivs.
372 double arglist[1];
373 arglist[0] = 2;
374 minuit->mnexcm("SET STR",arglist,1,errFlag);
375
376 std::lock_guard<std::mutex> lock(BeamSpot::mutex); // To protect global BeamSpot::vertexData
377 // Insert the likelihood function
378 // need to make the data accessible to it
379 BeamSpot::vertexData = &m_vertexData;
380 if ( !m_useLLNorm)
381 minuit->SetFCN(BeamSpot::myFCN_LLsolver);
382 else {
383 minuit->SetFCN(BeamSpot::myFCN_LLsolverNorm);
384 }
385
386 std::pair<int, std::string> status; // fit status
387 //standard fit
388 bool goodFit = false;
389
390 //tried this approach - we want to succeed, so if fail, try another approach
391 if (!goodFit) {
392 doFit2(minuit,printOut);
393 successfulFit(minuit, status);
394 if ( status.first == 3 && ( status.second == "SUCCESSFUL" ||
395 status.second == "CONVERGED " ||
396 status.second == "CONVERGED") ){
397 goodFit = true;
398 } else {
399 goodFit = false;
400 }
401 }
402
403 if (goodFit){
404 ATH_MSG_INFO( "Successful fit" );
405 setOutput( minuit);
406 } else {
407 ATH_MSG_DEBUG( "No LL fit convergence" );
408 }
409
410 delete minuit;
411
412 return goodFit;
413}
MsgStream & msg() const
void doFit2(TMinuit *, bool printOut=false)
bool successfulFit(TMinuit *, std::pair< int, std::string > &)
void myFCN_LLsolverNorm(Int_t &, Double_t *, Double_t &, Double_t *, Int_t)
void myFCN_LLsolver(Int_t &, Double_t *, Double_t &, Double_t *, Int_t)
status
Definition merge.py:16

◆ successfulFit()

bool InDetBeamSpotVertex::successfulFit ( TMinuit * minuit,
std::pair< int, std::string > & status )
private

Definition at line 969 of file InDetBeamSpotVertex.cxx.

970 {
971 if (!minuit) return false;
972 //This should be called directly after the fit
973 std::string sRes = minuit->fCstatu.Data();
974
975 Double_t fmin, fedm, errdef;
976 Int_t npari,nparx,istat;
977 minuit->mnstat(fmin, fedm, errdef,npari,nparx,istat);
978
979 ATH_MSG_DEBUG( "Fit reports status: " << istat << " and " << sRes );
980
981 status.first = istat;
982 status.second = sRes;
983
984 bool sanityPassed(true);
985 if ( m_doFitSanityCheck) {
986 double x(0), ex(0);
987 minuit->GetParameter(6,x,ex); // rhoxy
988 if ( std::abs(x) > m_rhoFail){
989 sanityPassed = false;
990 ATH_MSG_DEBUG( "Fit Failed with rhoxy: " << x << " > " << m_rhoFail );
991 }
992 minuit->GetParameter(4,x,ex); // sigma x
993 if ( std::abs(x) < m_widthFail ){
994 sanityPassed = false;
995 ATH_MSG_DEBUG( "Fit Failed with sigmaX:" << x << " > " << m_widthFail );
996 }
997 minuit->GetParameter(5,x,ex); // sigma y
998 if ( std::abs(x) < m_widthFail ){
999 sanityPassed = false;
1000 ATH_MSG_DEBUG( "Fit Failed with sigmaY: " << x << " > " <<m_widthFail );
1001 }
1002
1003 minuit->GetParameter(7,x,ex); // k
1004 if ( std::abs(x) < m_kMinFail || std::abs(x) > m_kMaxFail ){
1005 sanityPassed = false;
1006 ATH_MSG_DEBUG( "Fit Failed with k: " << x << " > " << m_kMaxFail
1007 << ", or " << x << " < " << m_kMinFail );
1008 }
1009
1010
1011
1012 } // sanity check
1013 if (!sanityPassed) {
1014 status.first = 99;
1015 status.second = "FAILED BEAMSPOT SANITY CHECK";
1016 }
1017 ATH_MSG_DEBUG( "Fit " << ( sanityPassed ? "Passed": "Failed") << " sanity check: " );
1018
1019 if ( istat != 3) return false;
1020
1021
1022 return true;
1023}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_cov

CLHEP::HepSymMatrix InDet::InDetBeamSpotVertex::m_cov
private

Definition at line 126 of file InDetBeamSpotVertex.h.

◆ m_def_ax

double InDet::InDetBeamSpotVertex::m_def_ax
private

Definition at line 164 of file InDetBeamSpotVertex.h.

◆ m_def_ay

double InDet::InDetBeamSpotVertex::m_def_ay
private

Definition at line 164 of file InDetBeamSpotVertex.h.

◆ m_def_sx

double InDet::InDetBeamSpotVertex::m_def_sx
private

Definition at line 164 of file InDetBeamSpotVertex.h.

◆ m_def_sy

double InDet::InDetBeamSpotVertex::m_def_sy
private

Definition at line 164 of file InDetBeamSpotVertex.h.

◆ m_def_sz

double InDet::InDetBeamSpotVertex::m_def_sz
private

Definition at line 164 of file InDetBeamSpotVertex.h.

◆ m_def_x0

double InDet::InDetBeamSpotVertex::m_def_x0
private

Definition at line 164 of file InDetBeamSpotVertex.h.

◆ m_def_y0

double InDet::InDetBeamSpotVertex::m_def_y0
private

Definition at line 164 of file InDetBeamSpotVertex.h.

◆ m_def_z

double InDet::InDetBeamSpotVertex::m_def_z
private

Definition at line 164 of file InDetBeamSpotVertex.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_doChi2OutlierRemoval

bool InDet::InDetBeamSpotVertex::m_doChi2OutlierRemoval
private

Definition at line 193 of file InDetBeamSpotVertex.h.

◆ m_doFitSanityCheck

bool InDet::InDetBeamSpotVertex::m_doFitSanityCheck
private

Definition at line 192 of file InDetBeamSpotVertex.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_fitStatus

FitStatus InDet::InDetBeamSpotVertex::m_fitStatus
private

Definition at line 176 of file InDetBeamSpotVertex.h.

◆ m_fixInputK

bool InDet::InDetBeamSpotVertex::m_fixInputK
private

Definition at line 197 of file InDetBeamSpotVertex.h.

◆ m_fixWidth

bool InDet::InDetBeamSpotVertex::m_fixWidth
private

Definition at line 199 of file InDetBeamSpotVertex.h.

◆ m_fractionRMS

float InDet::InDetBeamSpotVertex::m_fractionRMS
private

Definition at line 173 of file InDetBeamSpotVertex.h.

◆ m_getLLres

bool InDet::InDetBeamSpotVertex::m_getLLres
private

Definition at line 144 of file InDetBeamSpotVertex.h.

◆ m_init_ax

double InDet::InDetBeamSpotVertex::m_init_ax
private

Definition at line 154 of file InDetBeamSpotVertex.h.

◆ m_init_ay

double InDet::InDetBeamSpotVertex::m_init_ay
private

Definition at line 154 of file InDetBeamSpotVertex.h.

◆ m_init_k

double InDet::InDetBeamSpotVertex::m_init_k
private

Definition at line 154 of file InDetBeamSpotVertex.h.

◆ m_init_max_ax

double InDet::InDetBeamSpotVertex::m_init_max_ax
private

Definition at line 160 of file InDetBeamSpotVertex.h.

◆ m_init_max_ay

double InDet::InDetBeamSpotVertex::m_init_max_ay
private

Definition at line 160 of file InDetBeamSpotVertex.h.

◆ m_init_max_k

double InDet::InDetBeamSpotVertex::m_init_max_k
private

Definition at line 160 of file InDetBeamSpotVertex.h.

◆ m_init_max_rhoxy

double InDet::InDetBeamSpotVertex::m_init_max_rhoxy
private

Definition at line 160 of file InDetBeamSpotVertex.h.

◆ m_init_max_sx

double InDet::InDetBeamSpotVertex::m_init_max_sx
private

Definition at line 159 of file InDetBeamSpotVertex.h.

◆ m_init_max_sy

double InDet::InDetBeamSpotVertex::m_init_max_sy
private

Definition at line 159 of file InDetBeamSpotVertex.h.

◆ m_init_max_sz

double InDet::InDetBeamSpotVertex::m_init_max_sz
private

Definition at line 159 of file InDetBeamSpotVertex.h.

◆ m_init_max_x

double InDet::InDetBeamSpotVertex::m_init_max_x
private

Definition at line 159 of file InDetBeamSpotVertex.h.

◆ m_init_max_y

double InDet::InDetBeamSpotVertex::m_init_max_y
private

Definition at line 159 of file InDetBeamSpotVertex.h.

◆ m_init_max_z

double InDet::InDetBeamSpotVertex::m_init_max_z
private

Definition at line 159 of file InDetBeamSpotVertex.h.

◆ m_init_min_ax

double InDet::InDetBeamSpotVertex::m_init_min_ax
private

Definition at line 157 of file InDetBeamSpotVertex.h.

◆ m_init_min_ay

double InDet::InDetBeamSpotVertex::m_init_min_ay
private

Definition at line 157 of file InDetBeamSpotVertex.h.

◆ m_init_min_k

double InDet::InDetBeamSpotVertex::m_init_min_k
private

Definition at line 157 of file InDetBeamSpotVertex.h.

◆ m_init_min_rhoxy

double InDet::InDetBeamSpotVertex::m_init_min_rhoxy
private

Definition at line 157 of file InDetBeamSpotVertex.h.

◆ m_init_min_sx

double InDet::InDetBeamSpotVertex::m_init_min_sx
private

Definition at line 156 of file InDetBeamSpotVertex.h.

◆ m_init_min_sy

double InDet::InDetBeamSpotVertex::m_init_min_sy
private

Definition at line 156 of file InDetBeamSpotVertex.h.

◆ m_init_min_sz

double InDet::InDetBeamSpotVertex::m_init_min_sz
private

Definition at line 156 of file InDetBeamSpotVertex.h.

◆ m_init_min_x

double InDet::InDetBeamSpotVertex::m_init_min_x
private

Definition at line 156 of file InDetBeamSpotVertex.h.

◆ m_init_min_y

double InDet::InDetBeamSpotVertex::m_init_min_y
private

Definition at line 156 of file InDetBeamSpotVertex.h.

◆ m_init_min_z

double InDet::InDetBeamSpotVertex::m_init_min_z
private

Definition at line 156 of file InDetBeamSpotVertex.h.

◆ m_init_rhoxy

double InDet::InDetBeamSpotVertex::m_init_rhoxy
private

Definition at line 154 of file InDetBeamSpotVertex.h.

◆ m_init_sx

double InDet::InDetBeamSpotVertex::m_init_sx
private

Definition at line 153 of file InDetBeamSpotVertex.h.

◆ m_init_sy

double InDet::InDetBeamSpotVertex::m_init_sy
private

Definition at line 153 of file InDetBeamSpotVertex.h.

◆ m_init_sz

double InDet::InDetBeamSpotVertex::m_init_sz
private

Definition at line 153 of file InDetBeamSpotVertex.h.

◆ m_init_x

double InDet::InDetBeamSpotVertex::m_init_x
private

Definition at line 153 of file InDetBeamSpotVertex.h.

◆ m_init_y

double InDet::InDetBeamSpotVertex::m_init_y
private

Definition at line 153 of file InDetBeamSpotVertex.h.

◆ m_init_z

double InDet::InDetBeamSpotVertex::m_init_z
private

Definition at line 153 of file InDetBeamSpotVertex.h.

◆ m_kMaxFail

double InDet::InDetBeamSpotVertex::m_kMaxFail
private

Definition at line 194 of file InDetBeamSpotVertex.h.

◆ m_kMinFail

double InDet::InDetBeamSpotVertex::m_kMinFail
private

Definition at line 194 of file InDetBeamSpotVertex.h.

◆ m_maxOutlierLoops

int InDet::InDetBeamSpotVertex::m_maxOutlierLoops
private

Definition at line 181 of file InDetBeamSpotVertex.h.

◆ m_maxVtxErTr

double InDet::InDetBeamSpotVertex::m_maxVtxErTr
private

Definition at line 168 of file InDetBeamSpotVertex.h.

◆ m_minuit_maxIter

int InDet::InDetBeamSpotVertex::m_minuit_maxIter
private

Definition at line 162 of file InDetBeamSpotVertex.h.

◆ m_minVtxProb

double InDet::InDetBeamSpotVertex::m_minVtxProb
private

Definition at line 195 of file InDetBeamSpotVertex.h.

◆ m_NPARS

const int InDet::InDetBeamSpotVertex::m_NPARS
private

Definition at line 135 of file InDetBeamSpotVertex.h.

◆ m_nUsed

int InDet::InDetBeamSpotVertex::m_nUsed
private

Definition at line 201 of file InDetBeamSpotVertex.h.

◆ m_outlierChi2Tr

double InDet::InDetBeamSpotVertex::m_outlierChi2Tr
private

Definition at line 180 of file InDetBeamSpotVertex.h.

◆ m_p

CLHEP::HepVector InDet::InDetBeamSpotVertex::m_p
private

Definition at line 130 of file InDetBeamSpotVertex.h.

◆ m_pLL

CLHEP::HepVector InDet::InDetBeamSpotVertex::m_pLL
private

Definition at line 136 of file InDetBeamSpotVertex.h.

◆ m_rCount

std::atomic<int> InDet::InDetBeamSpotVertex::m_rCount {0}
mutableprivate

Definition at line 203 of file InDetBeamSpotVertex.h.

203{0}; // counter used for recussive mode

◆ m_rhoFail

double InDet::InDetBeamSpotVertex::m_rhoFail
private

Definition at line 170 of file InDetBeamSpotVertex.h.

◆ m_setInitialRMS

bool InDet::InDetBeamSpotVertex::m_setInitialRMS
private

Definition at line 174 of file InDetBeamSpotVertex.h.

◆ m_sigTr

double InDet::InDetBeamSpotVertex::m_sigTr
private

Definition at line 167 of file InDetBeamSpotVertex.h.

◆ m_singleIterationMax

int InDet::InDetBeamSpotVertex::m_singleIterationMax
private

Definition at line 171 of file InDetBeamSpotVertex.h.

◆ m_truncatedRMS

bool InDet::InDetBeamSpotVertex::m_truncatedRMS
private

Definition at line 172 of file InDetBeamSpotVertex.h.

◆ m_useLL

bool InDet::InDetBeamSpotVertex::m_useLL
private

Definition at line 143 of file InDetBeamSpotVertex.h.

◆ m_useLLNorm

bool InDet::InDetBeamSpotVertex::m_useLLNorm
private

Definition at line 198 of file InDetBeamSpotVertex.h.

◆ m_V

CLHEP::HepSymMatrix InDet::InDetBeamSpotVertex::m_V
private

Definition at line 131 of file InDetBeamSpotVertex.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexCount

long InDet::InDetBeamSpotVertex::m_vertexCount
private

Definition at line 139 of file InDetBeamSpotVertex.h.

◆ m_vertexData

std::vector< BeamSpot::VrtHolder > InDet::InDetBeamSpotVertex::m_vertexData
private

Definition at line 145 of file InDetBeamSpotVertex.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_VLL

CLHEP::HepSymMatrix InDet::InDetBeamSpotVertex::m_VLL
private

Definition at line 137 of file InDetBeamSpotVertex.h.

◆ m_widthFail

double InDet::InDetBeamSpotVertex::m_widthFail
private

Definition at line 169 of file InDetBeamSpotVertex.h.

◆ m_x

CLHEP::HepVector InDet::InDetBeamSpotVertex::m_x
private

Definition at line 125 of file InDetBeamSpotVertex.h.

◆ m_z

double InDet::InDetBeamSpotVertex::m_z
private

Definition at line 127 of file InDetBeamSpotVertex.h.

◆ m_zErr

double InDet::InDetBeamSpotVertex::m_zErr
private

Definition at line 127 of file InDetBeamSpotVertex.h.

◆ m_zErrSolved

double InDet::InDetBeamSpotVertex::m_zErrSolved
private

Definition at line 132 of file InDetBeamSpotVertex.h.

◆ m_zSolved

double InDet::InDetBeamSpotVertex::m_zSolved
private

Definition at line 132 of file InDetBeamSpotVertex.h.


The documentation for this class was generated from the following files: