ATLAS Offline Software
Loading...
Searching...
No Matches
SetFitOptions.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Header include
8
9//-------------------------------------------------
10#include<iostream>
11
12
13namespace Trk{
14//
15// Option setting for VKalVrt core via state.m_vkalFitControl object
16//
17
19 {
20 state.m_FitStatus = 0; // Drop all previous fit results
21 state.m_globalFirstHit = nullptr;
23
24 //Set input particle masses
25 for(int it=0; it<NTRK; it++){
26 if( it<(int)state.m_MassInputParticles.size() ) {
27 state.m_vkalFitControl.vk_forcft.wm[it] = (double)(state.m_MassInputParticles[it]);
28 }
30 }
31 // Set reference vertex for different pointing constraints
32 if(state.m_VertexForConstraint.size() >= 3){
36 }else {for( int i=0; i<3; i++) state.m_vkalFitControl.vk_forcft.vrt[i] = 0.; }
37 // Set covariance matrix for reference vertex
38 if(state.m_CovVrtForConstraint.size() >= 6){
39 for( int i=0; i<6; i++) { state.m_vkalFitControl.vk_forcft.covvrt[i] = (double)(state.m_CovVrtForConstraint[i]); }
40 }else{ for( int i=0; i<6; i++) { state.m_vkalFitControl.vk_forcft.covvrt[i] = 0.; } }
41
42 // Add global mass constraint if present
44 // Add partial mass constraints if present
45 if(!state.m_partMassCnst.empty()) {
46 for(int ic=0; ic<(int)state.m_partMassCnst.size(); ic++){
48 }
49 }
50 // Set general configuration parameters
55 state.m_parPlaneCnst[2],state.m_parPlaneCnst[3]);
64
67
70
71 }
72
73/*
74 void TrkVKalVrtFitter::initCnstList()
75 {
76//--- Mass constraint is restored here
77 if( m_massForConstraint>0. || m_PartMassCnst.size()>0 ) vksetUseMassCnst();
78 if( m_useAprioriVertex ) vksetUseAprioriVrt();
79 if( m_useThetaCnst ) vksetUseThetaCnst();
80 if( m_usePhiCnst ) vksetUsePhiCnst();
81 if( m_usePointingCnst ) vksetUsePointingCnst(1);
82 if( m_useZPointingCnst) vksetUsePointingCnst(2);
83 if( m_usePassNear) vksetUsePassNear(1);
84 if( m_usePassWithTrkErr) vksetUsePassNear(2);
85 }
86*/
87//Old logics. Left here for reference to compare with previous releases of VKalVrt
88//
90 {
91 assert(dynamic_cast<State*> (&istate)!=nullptr);
92 State& state = static_cast<State&> (istate);
93 if(TYPE>0)msg(MSG::DEBUG)<< "ConstraintType is changed at execution stage. New type="<<TYPE<< endmsg;
94 if(TYPE<0)TYPE=0;
95 if(TYPE>14)TYPE=0;
96 if( TYPE == 2) state.m_usePointingCnst = true;
97 if( TYPE == 3) state.m_useZPointingCnst = true;
98 if( TYPE == 4) state.m_usePointingCnst = true;
99 if( TYPE == 5) state.m_useZPointingCnst = true;
100 if( TYPE == 6) state.m_useAprioriVertex = true;
101 if( TYPE == 7) state.m_usePassWithTrkErr = true;
102 if( TYPE == 8) state.m_usePassWithTrkErr = true;
103 if( TYPE == 9) state.m_usePassNear = true;
104 if( TYPE == 10) state.m_usePassNear = true;
105 if( TYPE == 11) state.m_usePhiCnst = true;
106 if( TYPE == 12) { state.m_usePhiCnst = true; state.m_useThetaCnst = true;}
107 if( TYPE == 13) { state.m_usePhiCnst = true; state.m_usePassNear = true;}
108 if( TYPE == 14) { state.m_usePhiCnst = true; state.m_useThetaCnst = true; state.m_usePassNear = true;}
109 }
110
111//
112// Define finctions for on-the-fly fitter configuration
113//
114//
115 void TrkVKalVrtFitter::setApproximateVertex(double X,double Y,double Z,
116 IVKalState& istate) const
117 {
118 assert(dynamic_cast<State*> (&istate)!=nullptr);
119 State& state = static_cast<State&> (istate);
120 state.m_ApproximateVertex.assign ({X, Y, Z});
121 }
122
123 void TrkVKalVrtFitter::setRobustness(int IROB, IVKalState& istate) const
124 { if(IROB>0)msg(MSG::DEBUG)<< "Robustness is changed at execution stage "<<m_Robustness<<"=>"<<IROB<< endmsg;
125 assert(dynamic_cast<State*> (&istate)!=nullptr);
126 State& state = static_cast<State&> (istate);
127 state.m_Robustness = IROB;
128 if(state.m_Robustness<0)state.m_Robustness=0;
129 if(state.m_Robustness>7)state.m_Robustness=0;
130 }
131
133 { if(Scale!=m_RobustScale)msg(MSG::DEBUG)<< "Robust Scale is changed at execution stage "<<m_RobustScale<<"=>"<<Scale<< endmsg;
134 assert(dynamic_cast<State*> (&istate)!=nullptr);
135 State& state = static_cast<State&> (istate);
136 state.m_RobustScale = Scale;
137 if(state.m_RobustScale<0.01) state.m_RobustScale=1.;
138 if(state.m_RobustScale>100.) state.m_RobustScale=1.;
139 }
140
142 IVKalState& istate) const
143 {
144 assert(dynamic_cast<State*> (&istate)!=nullptr);
145 State& state = static_cast<State&> (istate);
146 state.m_massForConstraint = MASS;
147 }
148
150 std::span<const int> TrkIndex,
151 IVKalState& istate) const
152 {
153 assert(dynamic_cast<State*> (&istate)!=nullptr);
154 State& state = static_cast<State&> (istate);
155 state.m_partMassCnst.push_back(MASS);
156 state.m_partMassCnstTrk.emplace_back(TrkIndex.begin(), TrkIndex.end());
157 }
158
160 IVKalState& istate) const
161 {
162 assert(dynamic_cast<State*> (&istate)!=nullptr);
163 State& state = static_cast<State&> (istate);
164 state.m_VertexForConstraint.assign ({Vrt.position().x(),
165 Vrt.position().y(),
166 Vrt.position().z()});
167
168 state.m_CovVrtForConstraint.assign ({
169 Vrt.covariancePosition()(Trk::x,Trk::x),
170 Vrt.covariancePosition()(Trk::x,Trk::y),
171 Vrt.covariancePosition()(Trk::y,Trk::y),
172 Vrt.covariancePosition()(Trk::x,Trk::z),
173 Vrt.covariancePosition()(Trk::y,Trk::z),
174 Vrt.covariancePosition()(Trk::z,Trk::z)});
175 }
176
177 void TrkVKalVrtFitter::setVertexForConstraint(double X,double Y,double Z,
178 IVKalState& istate) const
179 {
180 assert(dynamic_cast<State*> (&istate)!=nullptr);
181 State& state = static_cast<State&> (istate);
182 state.m_VertexForConstraint.assign ({X, Y, Z});
183 }
184
185 void TrkVKalVrtFitter::setCovVrtForConstraint(double XX,double XY,double YY,
186 double XZ,double YZ,double ZZ,
187 IVKalState& istate) const
188 {
189 assert(dynamic_cast<State*> (&istate)!=nullptr);
190 State& state = static_cast<State&> (istate);
191 state.m_CovVrtForConstraint.assign ({XX, XY, YY, XZ, YZ, ZZ});
192 }
193
194 void TrkVKalVrtFitter::setMassInputParticles( const std::vector<double>& mass,
195 IVKalState& istate) const
196 {
197 assert(dynamic_cast<State*> (&istate)!=nullptr);
198 State& state = static_cast<State&> (istate);
199 state.m_MassInputParticles = mass;
200 for (double& m : state.m_MassInputParticles) {
201 m = std::abs(m);
202 }
203 }
204
205} //end of namespace
#define endmsg
#define TYPE(CODE, TYP, IOTYP)
std::vector< double > m_partMassCnst
std::vector< double > m_MassInputParticles
std::vector< double > m_ApproximateVertex
std::vector< double > m_VertexForConstraint
std::vector< double > m_CovVrtForConstraint
std::vector< std::vector< int > > m_partMassCnstTrk
const TrackParameters * m_globalFirstHit
void VKalVrtConfigureFitterCore(int NTRK, State &state) const
virtual void setMassInputParticles(const std::vector< double > &, IVKalState &istate) const override final
virtual void setCnstType(int, IVKalState &istate) const override final
virtual void setCovVrtForConstraint(double XX, double XY, double YY, double XZ, double YZ, double ZZ, IVKalState &istate) const override final
virtual void setVertexForConstraint(const xAOD::Vertex &, IVKalState &istate) const override final
Gaudi::Property< int > m_IterationNumber
Gaudi::Property< double > m_RobustScale
Gaudi::Property< int > m_Robustness
Gaudi::Property< bool > m_firstMeasuredRadiusLimit
virtual void setApproximateVertex(double X, double Y, double Z, IVKalState &istate) const override final
virtual void setMassForConstraint(double Mass, IVKalState &istate) const override final
Gaudi::Property< double > m_IterationPrecision
Gaudi::Property< bool > m_firstMeasuredPointLimit
virtual void setRobustness(int, IVKalState &istate) const override final
virtual void setRobustScale(double, IVKalState &istate) const override final
void setIterationPrec(double Prec)
void setMassCnstData(int Ntrk, double Mass)
void setRobustScale(double Scale)
void setUsePlaneCnst(double a, double b, double c, double d)
void setUseRadiusCnst(double R, double RefP[2])
const Amg::Vector3D & position() const
Returns the 3-pos.
void Scale(TH1 *h, double d=1)
constexpr double chargedPionMassInMeV
the mass of the charged pion (in MeV)
Ensure that the ATLAS eigen extensions are properly loaded.
@ x
Definition ParamDefs.h:55
@ z
global position (cartesian)
Definition ParamDefs.h:57
@ y
Definition ParamDefs.h:56
Vertex_v1 Vertex
Define the latest version of the vertex class.
double covvrt[6]
Definition ForCFT.h:45
double wm[vkalNTrkM]
Definition ForCFT.h:27
double vrt[3]
Definition ForCFT.h:45
MsgStream & msg
Definition testRead.cxx:32