ATLAS Offline Software
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 #include<iostream>
10 
11 
12 namespace Trk{
13 //
14 // Option setting for VKalVrt core via state.m_vkalFitControl object
15 //
16 
18  {
19  state.m_FitStatus = 0; // Drop all previous fit results
21 
22  //Set input particle masses
23  for(int it=0; it<NTRK; it++){
24  if( it<(int)state.m_MassInputParticles.size() ) {
26  }
27  else { state.m_vkalFitControl.vk_forcft.wm[it]=(double)(139.5702); }
28  }
29  // Set reference vertex for different pointing constraints
30  if(state.m_VertexForConstraint.size() >= 3){
34  }else {for( int i=0; i<3; i++) state.m_vkalFitControl.vk_forcft.vrt[i] = 0.; }
35  // Set covariance matrix for reference vertex
36  if(state.m_CovVrtForConstraint.size() >= 6){
37  for( int i=0; i<6; i++) { state.m_vkalFitControl.vk_forcft.covvrt[i] = (double)(state.m_CovVrtForConstraint[i]); }
38  }else{ for( int i=0; i<6; i++) { state.m_vkalFitControl.vk_forcft.covvrt[i] = 0.; } }
39 
40  // Add global mass constraint if present
42  // Add partial mass constraints if present
43  if(!state.m_partMassCnst.empty()) {
44  for(int ic=0; ic<(int)state.m_partMassCnst.size(); ic++){
46  }
47  }
48  // Set general configuration parameters
51  state.m_vkalFitControl.setUsePlaneCnst(0.,0.,0.,0.);
59 
61 
64  }
65 
66 /*
67  void TrkVKalVrtFitter::initCnstList()
68  {
69 //--- Mass constraint is restored here
70  if( m_massForConstraint>0. || m_PartMassCnst.size()>0 ) vksetUseMassCnst();
71  if( m_useAprioriVertex ) vksetUseAprioriVrt();
72  if( m_useThetaCnst ) vksetUseThetaCnst();
73  if( m_usePhiCnst ) vksetUsePhiCnst();
74  if( m_usePointingCnst ) vksetUsePointingCnst(1);
75  if( m_useZPointingCnst) vksetUsePointingCnst(2);
76  if( m_usePassNear) vksetUsePassNear(1);
77  if( m_usePassWithTrkErr) vksetUsePassNear(2);
78  }
79 */
80 //Old logics. Left here for reference to compare with previous releases of VKalVrt
81 //
83  {
84  assert(dynamic_cast<State*> (&istate)!=nullptr);
85  State& state = static_cast<State&> (istate);
86  if(TYPE>0)msg(MSG::DEBUG)<< "ConstraintType is changed at execution stage. New type="<<TYPE<< endmsg;
87  if(TYPE<0)TYPE=0;
88  if(TYPE>14)TYPE=0;
89  if( TYPE == 2) state.m_usePointingCnst = true;
90  if( TYPE == 3) state.m_useZPointingCnst = true;
91  if( TYPE == 4) state.m_usePointingCnst = true;
92  if( TYPE == 5) state.m_useZPointingCnst = true;
93  if( TYPE == 6) state.m_useAprioriVertex = true;
94  if( TYPE == 7) state.m_usePassWithTrkErr = true;
95  if( TYPE == 8) state.m_usePassWithTrkErr = true;
96  if( TYPE == 9) state.m_usePassNear = true;
97  if( TYPE == 10) state.m_usePassNear = true;
98  if( TYPE == 11) state.m_usePhiCnst = true;
99  if( TYPE == 12) { state.m_usePhiCnst = true; state.m_useThetaCnst = true;}
100  if( TYPE == 13) { state.m_usePhiCnst = true; state.m_usePassNear = true;}
101  if( TYPE == 14) { state.m_usePhiCnst = true; state.m_useThetaCnst = true; state.m_usePassNear = true;}
102  }
103 
104 //
105 // Define finctions for on-the-fly fitter configuration
106 //
107 //
108  void TrkVKalVrtFitter::setApproximateVertex(double X,double Y,double Z,
109  IVKalState& istate) const
110  {
111  assert(dynamic_cast<State*> (&istate)!=nullptr);
112  State& state = static_cast<State&> (istate);
113  state.m_ApproximateVertex.assign ({X, Y, Z});
114  }
115 
116  void TrkVKalVrtFitter::setRobustness(int IROB, IVKalState& istate) const
117  { if(IROB>0)msg(MSG::DEBUG)<< "Robustness is changed at execution stage "<<m_Robustness<<"=>"<<IROB<< endmsg;
118  assert(dynamic_cast<State*> (&istate)!=nullptr);
119  State& state = static_cast<State&> (istate);
120  state.m_Robustness = IROB;
121  if(state.m_Robustness<0)state.m_Robustness=0;
122  if(state.m_Robustness>7)state.m_Robustness=0;
123  }
124 
126  { if(Scale!=m_RobustScale)msg(MSG::DEBUG)<< "Robust Scale is changed at execution stage "<<m_RobustScale<<"=>"<<Scale<< endmsg;
127  assert(dynamic_cast<State*> (&istate)!=nullptr);
128  State& state = static_cast<State&> (istate);
129  state.m_RobustScale = Scale;
130  if(state.m_RobustScale<0.01) state.m_RobustScale=1.;
131  if(state.m_RobustScale>100.) state.m_RobustScale=1.;
132  }
133 
135  IVKalState& istate) const
136  {
137  assert(dynamic_cast<State*> (&istate)!=nullptr);
138  State& state = static_cast<State&> (istate);
139  state.m_massForConstraint = MASS;
140  }
141 
143  std::span<const int> TrkIndex,
144  IVKalState& istate) const
145  {
146  assert(dynamic_cast<State*> (&istate)!=nullptr);
147  State& state = static_cast<State&> (istate);
148  state.m_partMassCnst.push_back(MASS);
149  state.m_partMassCnstTrk.emplace_back(TrkIndex.begin(), TrkIndex.end());
150  }
151 
153  IVKalState& istate) const
154  {
155  assert(dynamic_cast<State*> (&istate)!=nullptr);
156  State& state = static_cast<State&> (istate);
157  state.m_VertexForConstraint.assign ({Vrt.position().x(),
158  Vrt.position().y(),
159  Vrt.position().z()});
160 
161  state.m_CovVrtForConstraint.assign ({
162  Vrt.covariancePosition()(Trk::x,Trk::x),
163  Vrt.covariancePosition()(Trk::x,Trk::y),
164  Vrt.covariancePosition()(Trk::y,Trk::y),
165  Vrt.covariancePosition()(Trk::x,Trk::z),
166  Vrt.covariancePosition()(Trk::y,Trk::z),
167  Vrt.covariancePosition()(Trk::z,Trk::z)});
168  }
169 
170  void TrkVKalVrtFitter::setVertexForConstraint(double X,double Y,double Z,
171  IVKalState& istate) const
172  {
173  assert(dynamic_cast<State*> (&istate)!=nullptr);
174  State& state = static_cast<State&> (istate);
175  state.m_VertexForConstraint.assign ({X, Y, Z});
176  }
177 
178  void TrkVKalVrtFitter::setCovVrtForConstraint(double XX,double XY,double YY,
179  double XZ,double YZ,double ZZ,
180  IVKalState& istate) const
181  {
182  assert(dynamic_cast<State*> (&istate)!=nullptr);
183  State& state = static_cast<State&> (istate);
184  state.m_CovVrtForConstraint.assign ({XX, XY, YY, XZ, YZ, ZZ});
185  }
186 
187  void TrkVKalVrtFitter::setMassInputParticles( const std::vector<double>& mass,
188  IVKalState& istate) const
189  {
190  assert(dynamic_cast<State*> (&istate)!=nullptr);
191  State& state = static_cast<State&> (istate);
192  state.m_MassInputParticles = mass;
193  for (double& m : state.m_MassInputParticles) {
194  m = std::abs(m);
195  }
196  }
197 
198 } //end of namespace
Trk::TrkVKalVrtFitter::State
Definition: TrkVKalVrtFitter.h:382
Trk::y
@ y
Definition: ParamDefs.h:56
Trk::VKalVrtControl::setUsePlaneCnst
void setUsePlaneCnst(double a, double b, double c, double d)
Definition: TrkVKalVrtCoreBase.cxx:298
Trk::TrkVKalVrtFitter::State::m_useZPointingCnst
bool m_useZPointingCnst
Definition: TrkVKalVrtFitter.h:426
Trk::TrkVKalVrtFitter::m_IterationPrecision
SimpleProperty< double > m_IterationPrecision
Definition: TrkVKalVrtFitter.h:325
Trk::TrkVKalVrtFitter::State::m_refFrameZ
double m_refFrameZ
Definition: TrkVKalVrtFitter.h:390
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trk::VKalVrtControl::setUsePassNear
void setUsePassNear(int)
Definition: TrkVKalVrtCoreBase.cxx:306
Trk::TrkVKalVrtFitter::setVertexForConstraint
virtual void setVertexForConstraint(const xAOD::Vertex &, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:152
Trk::TrkVKalVrtFitter::setCovVrtForConstraint
virtual void setCovVrtForConstraint(double XX, double XY, double YY, double XZ, double YZ, double ZZ, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:178
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:57
Trk::TrkVKalVrtFitter::State::m_refFrameX
double m_refFrameX
Definition: TrkVKalVrtFitter.h:388
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
Trk::TrkVKalVrtFitter::setRobustness
virtual void setRobustness(int, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:116
Trk::TrkVKalVrtFitter::State::m_partMassCnstTrk
std::vector< std::vector< int > > m_partMassCnstTrk
Definition: TrkVKalVrtFitter.h:435
Trk::VKalVrtControl::setIterationPrec
void setIterationPrec(double Prec)
Definition: TrkVKalVrtCoreBase.cxx:255
skel.it
it
Definition: skel.GENtoEVGEN.py:396
Trk::VKalVrtControl::setRobustScale
void setRobustScale(double Scale)
Definition: TrkVKalVrtCoreBase.cxx:262
Trk::VKalVrtControl::setUsePointingCnst
void setUsePointingCnst(int)
Definition: TrkVKalVrtCoreBase.cxx:305
Trk::VKalVrtControl::setUseThetaCnst
void setUseThetaCnst()
Definition: TrkVKalVrtCoreBase.cxx:303
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
Trk::TrkVKalVrtFitter::m_RobustScale
SimpleProperty< double > m_RobustScale
Definition: TrkVKalVrtFitter.h:321
Trk::TrkVKalVrtFitter::State::m_FitStatus
int m_FitStatus
Definition: TrkVKalVrtFitter.h:410
Trk::TrkVKalVrtFitter::State::m_partMassCnst
std::vector< double > m_partMassCnst
Definition: TrkVKalVrtFitter.h:434
Trk::TrkVKalVrtFitter::State::m_vkalFitControl
VKalVrtControl m_vkalFitControl
Definition: TrkVKalVrtFitter.h:402
TrkVKalVrtFitter.h
Trk::TrkVKalVrtFitter::m_Robustness
SimpleProperty< int > m_Robustness
Definition: TrkVKalVrtFitter.h:320
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
Trk::ForCFT
Definition: ForCFT.h:13
Trk::ForCFT::vrt
double vrt[3]
Definition: ForCFT.h:39
Trk::TrkVKalVrtFitter::setMassForConstraint
virtual void setMassForConstraint(double Mass, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:134
Trk::TrkVKalVrtFitter::State::m_useThetaCnst
bool m_useThetaCnst
Definition: TrkVKalVrtFitter.h:423
Trk::VKalVrtControl::setUseAprioriVrt
void setUseAprioriVrt()
Definition: TrkVKalVrtCoreBase.cxx:304
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::TrkVKalVrtFitter::setApproximateVertex
virtual void setApproximateVertex(double X, double Y, double Z, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:108
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Trk::TrkVKalVrtFitter::setCnstType
virtual void setCnstType(int, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:82
TrkVKalVrtCore.h
Trk::TrkVKalVrtFitter::State::m_useAprioriVertex
bool m_useAprioriVertex
Definition: TrkVKalVrtFitter.h:422
Trk::VKalVrtControl::setRobustness
void setRobustness(int Rob)
Definition: TrkVKalVrtCoreBase.cxx:269
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
Scale
void Scale(TH1 *h, double d=1)
Definition: comparitor.cxx:76
Trk::TrkVKalVrtFitter::State::m_MassInputParticles
std::vector< double > m_MassInputParticles
Definition: TrkVKalVrtFitter.h:438
Trk::TrkVKalVrtFitter::State::m_frozenVersionForBTagging
bool m_frozenVersionForBTagging
Definition: TrkVKalVrtFitter.h:429
Trk::TrkVKalVrtFitter::State::m_usePhiCnst
bool m_usePhiCnst
Definition: TrkVKalVrtFitter.h:424
Trk::ForCFT::covvrt
double covvrt[6]
Definition: ForCFT.h:39
Trk::VKalVrtControl::setIterationNum
void setIterationNum(int Iter)
Definition: TrkVKalVrtCoreBase.cxx:248
grepfile.ic
int ic
Definition: grepfile.py:33
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
TYPE
#define TYPE(CODE, TYP, IOTYP)
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::ForCFT::wm
double wm[vkalNTrkM]
Definition: ForCFT.h:26
Trk::VKalVrtControl::m_frozenVersionForBTagging
bool m_frozenVersionForBTagging
Definition: TrkVKalVrtCore.h:92
Trk::VKalVrtControl::setMassCnstData
void setMassCnstData(int Ntrk, double Mass)
Definition: TrkVKalVrtCoreBase.cxx:275
Trk::TrkVKalVrtFitter::State::m_usePassNear
bool m_usePassNear
Definition: TrkVKalVrtFitter.h:427
Trk::VKalVrtControl::setUsePhiCnst
void setUsePhiCnst()
Definition: TrkVKalVrtCoreBase.cxx:297
Trk::TrkVKalVrtFitter::State::m_refFrameY
double m_refFrameY
Definition: TrkVKalVrtFitter.h:389
Trk::TrkVKalVrtFitter::State::m_Robustness
int m_Robustness
Definition: TrkVKalVrtFitter.h:436
Trk::TrkVKalVrtFitter::State::m_usePassWithTrkErr
bool m_usePassWithTrkErr
Definition: TrkVKalVrtFitter.h:428
Trk::TrkVKalVrtFitter::setRobustScale
virtual void setRobustScale(double, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:125
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
Trk::IVKalState
Definition: IVKalState.h:21
Trk::TrkVKalVrtFitter::m_IterationNumber
SimpleProperty< int > m_IterationNumber
Definition: TrkVKalVrtFitter.h:324
Trk::TrkVKalVrtFitter::State::m_ApproximateVertex
std::vector< double > m_ApproximateVertex
Definition: TrkVKalVrtFitter.h:420
DEBUG
#define DEBUG
Definition: page_access.h:11
Trk::TrkVKalVrtFitter::VKalVrtConfigureFitterCore
void VKalVrtConfigureFitterCore(int NTRK, State &state) const
Definition: SetFitOptions.cxx:17
Trk::TrkVKalVrtFitter::State::m_massForConstraint
double m_massForConstraint
Definition: TrkVKalVrtFitter.h:433
Trk::x
@ x
Definition: ParamDefs.h:55
Trk::VKalVrtControl::vk_forcft
ForCFT vk_forcft
Definition: TrkVKalVrtCore.h:91
Trk::TrkVKalVrtFitter::State::m_CovVrtForConstraint
std::vector< double > m_CovVrtForConstraint
Definition: TrkVKalVrtFitter.h:432
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Trk::TrkVKalVrtFitter::setMassInputParticles
virtual void setMassInputParticles(const std::vector< double > &, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:187
Trk::TrkVKalVrtFitter::State::m_usePointingCnst
bool m_usePointingCnst
Definition: TrkVKalVrtFitter.h:425
Trk::TrkVKalVrtFitter::State::m_VertexForConstraint
std::vector< double > m_VertexForConstraint
Definition: TrkVKalVrtFitter.h:431
Trk::TrkVKalVrtFitter::State::m_RobustScale
double m_RobustScale
Definition: TrkVKalVrtFitter.h:437