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
22
23 //Set input particle masses
24 for(int it=0; it<NTRK; it++){
25 if( it<(int)state.m_MassInputParticles.size() ) {
26 state.m_vkalFitControl.vk_forcft.wm[it] = (double)(state.m_MassInputParticles[it]);
27 }
29 }
30 // Set reference vertex for different pointing constraints
31 if(state.m_VertexForConstraint.size() >= 3){
35 }else {for( int i=0; i<3; i++) state.m_vkalFitControl.vk_forcft.vrt[i] = 0.; }
36 // Set covariance matrix for reference vertex
37 if(state.m_CovVrtForConstraint.size() >= 6){
38 for( int i=0; i<6; i++) { state.m_vkalFitControl.vk_forcft.covvrt[i] = (double)(state.m_CovVrtForConstraint[i]); }
39 }else{ for( int i=0; i<6; i++) { state.m_vkalFitControl.vk_forcft.covvrt[i] = 0.; } }
40
41 // Add global mass constraint if present
43 // Add partial mass constraints if present
44 if(!state.m_partMassCnst.empty()) {
45 for(int ic=0; ic<(int)state.m_partMassCnst.size(); ic++){
47 }
48 }
49 // Set general configuration parameters
54 state.m_parPlaneCnst[2],state.m_parPlaneCnst[3]);
63
66
69
70 }
71
72/*
73 void TrkVKalVrtFitter::initCnstList()
74 {
75//--- Mass constraint is restored here
76 if( m_massForConstraint>0. || m_PartMassCnst.size()>0 ) vksetUseMassCnst();
77 if( m_useAprioriVertex ) vksetUseAprioriVrt();
78 if( m_useThetaCnst ) vksetUseThetaCnst();
79 if( m_usePhiCnst ) vksetUsePhiCnst();
80 if( m_usePointingCnst ) vksetUsePointingCnst(1);
81 if( m_useZPointingCnst) vksetUsePointingCnst(2);
82 if( m_usePassNear) vksetUsePassNear(1);
83 if( m_usePassWithTrkErr) vksetUsePassNear(2);
84 }
85*/
86//Old logics. Left here for reference to compare with previous releases of VKalVrt
87//
89 {
90 assert(dynamic_cast<State*> (&istate)!=nullptr);
91 State& state = static_cast<State&> (istate);
92 if(TYPE>0)msg(MSG::DEBUG)<< "ConstraintType is changed at execution stage. New type="<<TYPE<< endmsg;
93 if(TYPE<0)TYPE=0;
94 if(TYPE>14)TYPE=0;
95 if( TYPE == 2) state.m_usePointingCnst = true;
96 if( TYPE == 3) state.m_useZPointingCnst = true;
97 if( TYPE == 4) state.m_usePointingCnst = true;
98 if( TYPE == 5) state.m_useZPointingCnst = true;
99 if( TYPE == 6) state.m_useAprioriVertex = true;
100 if( TYPE == 7) state.m_usePassWithTrkErr = true;
101 if( TYPE == 8) state.m_usePassWithTrkErr = true;
102 if( TYPE == 9) state.m_usePassNear = true;
103 if( TYPE == 10) state.m_usePassNear = true;
104 if( TYPE == 11) state.m_usePhiCnst = true;
105 if( TYPE == 12) { state.m_usePhiCnst = true; state.m_useThetaCnst = true;}
106 if( TYPE == 13) { state.m_usePhiCnst = true; state.m_usePassNear = true;}
107 if( TYPE == 14) { state.m_usePhiCnst = true; state.m_useThetaCnst = true; state.m_usePassNear = true;}
108 }
109
110//
111// Define finctions for on-the-fly fitter configuration
112//
113//
114 void TrkVKalVrtFitter::setApproximateVertex(double X,double Y,double Z,
115 IVKalState& istate) const
116 {
117 assert(dynamic_cast<State*> (&istate)!=nullptr);
118 State& state = static_cast<State&> (istate);
119 state.m_ApproximateVertex.assign ({X, Y, Z});
120 }
121
122 void TrkVKalVrtFitter::setRobustness(int IROB, IVKalState& istate) const
123 { if(IROB>0)msg(MSG::DEBUG)<< "Robustness is changed at execution stage "<<m_Robustness<<"=>"<<IROB<< endmsg;
124 assert(dynamic_cast<State*> (&istate)!=nullptr);
125 State& state = static_cast<State&> (istate);
126 state.m_Robustness = IROB;
127 if(state.m_Robustness<0)state.m_Robustness=0;
128 if(state.m_Robustness>7)state.m_Robustness=0;
129 }
130
132 { if(Scale!=m_RobustScale)msg(MSG::DEBUG)<< "Robust Scale is changed at execution stage "<<m_RobustScale<<"=>"<<Scale<< endmsg;
133 assert(dynamic_cast<State*> (&istate)!=nullptr);
134 State& state = static_cast<State&> (istate);
135 state.m_RobustScale = Scale;
136 if(state.m_RobustScale<0.01) state.m_RobustScale=1.;
137 if(state.m_RobustScale>100.) state.m_RobustScale=1.;
138 }
139
141 IVKalState& istate) const
142 {
143 assert(dynamic_cast<State*> (&istate)!=nullptr);
144 State& state = static_cast<State&> (istate);
145 state.m_massForConstraint = MASS;
146 }
147
149 std::span<const int> TrkIndex,
150 IVKalState& istate) const
151 {
152 assert(dynamic_cast<State*> (&istate)!=nullptr);
153 State& state = static_cast<State&> (istate);
154 state.m_partMassCnst.push_back(MASS);
155 state.m_partMassCnstTrk.emplace_back(TrkIndex.begin(), TrkIndex.end());
156 }
157
159 IVKalState& istate) const
160 {
161 assert(dynamic_cast<State*> (&istate)!=nullptr);
162 State& state = static_cast<State&> (istate);
163 state.m_VertexForConstraint.assign ({Vrt.position().x(),
164 Vrt.position().y(),
165 Vrt.position().z()});
166
167 state.m_CovVrtForConstraint.assign ({
168 Vrt.covariancePosition()(Trk::x,Trk::x),
169 Vrt.covariancePosition()(Trk::x,Trk::y),
170 Vrt.covariancePosition()(Trk::y,Trk::y),
171 Vrt.covariancePosition()(Trk::x,Trk::z),
172 Vrt.covariancePosition()(Trk::y,Trk::z),
173 Vrt.covariancePosition()(Trk::z,Trk::z)});
174 }
175
176 void TrkVKalVrtFitter::setVertexForConstraint(double X,double Y,double Z,
177 IVKalState& istate) const
178 {
179 assert(dynamic_cast<State*> (&istate)!=nullptr);
180 State& state = static_cast<State&> (istate);
181 state.m_VertexForConstraint.assign ({X, Y, Z});
182 }
183
184 void TrkVKalVrtFitter::setCovVrtForConstraint(double XX,double XY,double YY,
185 double XZ,double YZ,double ZZ,
186 IVKalState& istate) const
187 {
188 assert(dynamic_cast<State*> (&istate)!=nullptr);
189 State& state = static_cast<State&> (istate);
190 state.m_CovVrtForConstraint.assign ({XX, XY, YY, XZ, YZ, ZZ});
191 }
192
193 void TrkVKalVrtFitter::setMassInputParticles( const std::vector<double>& mass,
194 IVKalState& istate) const
195 {
196 assert(dynamic_cast<State*> (&istate)!=nullptr);
197 State& state = static_cast<State&> (istate);
198 state.m_MassInputParticles = mass;
199 for (double& m : state.m_MassInputParticles) {
200 m = std::abs(m);
201 }
202 }
203
204} //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
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