ATLAS Offline Software
VKalGetImpact.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Header include
8 #include "TrkVKalVrtCore/cfImp.h"
9 //-------------------------------------------------
10 //
11 #include<iostream>
12 
13 
14 //
15 //__________________________________________________________________________
16 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
17 
18 
19 namespace Trk{
20 
22  const Amg::Vector3D& Vertex,
23  const long int Charge,
24  std::vector<double>& Impact,
25  std::vector<double>& ImpactError) const
26  {
27  State state;
28  initState (state);
29  return VKalGetImpact (InpPerigee, Vertex, Charge, Impact, ImpactError, state);
30  }
31 
33  const Amg::Vector3D& Vertex,
34  const long int Charge,
35  std::vector<double>& Impact,
36  std::vector<double>& ImpactError,
37  IVKalState& istate) const
38  {
39  assert(dynamic_cast<State*> (&istate)!=nullptr);
40  State& state = static_cast<State&> (istate);
41 
42  //
43  //------ Variables and arrays needed for fitting kernel
44  //
45  double SIGNIF=0.;
46  std::vector<const Trk::Perigee*> InpPerigeeList;
47  InpPerigeeList.push_back(InpPerigee);
48 
49  //
50  //------ extract information about selected tracks
51  //
52  int ntrk=0;
53  StatusCode sc = CvtPerigee(InpPerigeeList, ntrk, state);
54  if(sc.isFailure() || ntrk != 1) { //Something is wrong in conversion
55  Impact.assign(5,1.e10);
56  ImpactError.assign(3,1.e20);
57  return 1.e10;
58  }
59  long int vkCharge = state.m_ich[0];
60  if(Charge==0) vkCharge=0;
61 
62  //
63  // Target vertex in ref.frame defined by track themself
64  //
65  double VrtInp[3]={Vertex.x()-state.m_refFrameX,
66  Vertex.y()-state.m_refFrameY,
67  Vertex.z()-state.m_refFrameZ};
68  double VrtCov[6]={0.,0.,0.,0.,0.,0.};
69 
70  Impact.resize(5);
71  ImpactError.resize(3);
72  Trk::cfimp(0, vkCharge, 0,
73  &state.m_apar[0][0], &state.m_awgt[0][0],
74  &VrtInp[0], &VrtCov[0],
75  Impact.data(), ImpactError.data(),
76  &SIGNIF, &state.m_vkalFitControl);
77 
78  return SIGNIF;
79  }
80 
81 
82  double TrkVKalVrtFitter::VKalGetImpact(const xAOD::TrackParticle* InpTrk,const Amg::Vector3D& Vertex,const long int Charge,
83  std::vector<double>& Impact, std::vector<double>& ImpactError) const
84  {
85  State state;
86  initState (state);
87  return VKalGetImpact (InpTrk, Vertex, Charge, Impact, ImpactError, state);
88  }
89 
90 
91  double TrkVKalVrtFitter::VKalGetImpact(const xAOD::TrackParticle* InpTrk,const Amg::Vector3D& Vertex,const long int Charge,
92  std::vector<double>& Impact, std::vector<double>& ImpactError,
93  IVKalState& istate) const
94  {
95  assert(dynamic_cast<State*> (&istate)!=nullptr);
96  State& state = static_cast<State&> (istate);
97 //
98 //------ Variables and arrays needed for fitting kernel
99 //
100  double SIGNIF=0.;
101 
102  std::vector<const xAOD::TrackParticle*> InpTrkList(1,InpTrk);
103 //
104 
105 //
106 //------ extract information about selected tracks
107 //
108  int ntrk=0;
109  StatusCode sc = CvtTrackParticle(InpTrkList,ntrk,state);
110  if(sc.isFailure() || ntrk != 1 ) { //Something is wrong in conversion
111  Impact.assign(5,1.e10);
112  ImpactError.assign(3,1.e20);
113  return 1.e10;
114  }
115  if(std::abs(Vertex.z())>m_IDsizeZ || Vertex.perp()>m_IDsizeR){ // Crazy user request
116  Impact.assign(5,1.e10);
117  ImpactError.assign(3,1.e20);
118  return 1.e10;
119  }
120  long int vkCharge=state.m_ich[0];
121  if(Charge==0)vkCharge=0;
122 //
123 // Target vertex in ref.frame defined by track itself
124 //
125  double VrtInp[3]={Vertex.x() -state.m_refFrameX, Vertex.y() -state.m_refFrameY, Vertex.z() -state.m_refFrameZ};
126  double VrtCov[6]={0.,0.,0.,0.,0.,0.};
127 //
128 //
129  Impact.resize(5); ImpactError.resize(3);
130  Trk::cfimp( 0, vkCharge, 0, &state.m_apar[0][0], &state.m_awgt[0][0], &VrtInp[0], &VrtCov[0], Impact.data(), ImpactError.data(), &SIGNIF, &state.m_vkalFitControl);
131 
132  return SIGNIF;
133 
134  }
135 
136 
137 }
138 
Trk::TrkVKalVrtFitter::State
Definition: TrkVKalVrtFitter.h:382
Trk::Vertex
Definition: Tracking/TrkEvent/VxVertex/VxVertex/Vertex.h:26
Trk::TrkVKalVrtFitter::State::m_refFrameZ
double m_refFrameZ
Definition: TrkVKalVrtFitter.h:390
Trk::TrkVKalVrtFitter::initState
void initState(const EventContext &ctx, State &state) const
Definition: TrkVKalVrtFitter.cxx:223
Trk::TrkVKalVrtFitter::State::m_refFrameX
double m_refFrameX
Definition: TrkVKalVrtFitter.h:388
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
Trk::TrkVKalVrtFitter::VKalGetImpact
virtual double VKalGetImpact(const xAOD::TrackParticle *, const Amg::Vector3D &Vertex, const long int Charge, dvect &Impact, dvect &ImpactError, IVKalState &istate) const override final
Definition: VKalGetImpact.cxx:91
Trk::TrkVKalVrtFitter::CvtPerigee
StatusCode CvtPerigee(const std::vector< const Perigee * > &list, int &ntrk, State &state) const
Definition: CvtPerigee.cxx:25
Trk::cfimp
void cfimp(long int TrkID, long int ich, int IFL, double *par, const double *err, double *vrt, double *vcov, double *rimp, double *rcov, double *sign, VKalVrtControlBase *FitCONTROL)
Definition: cfImp.cxx:43
Trk::TrkVKalVrtFitter::State::m_vkalFitControl
VKalVrtControl m_vkalFitControl
Definition: TrkVKalVrtFitter.h:402
TrkVKalVrtFitter.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Trk::TrkVKalVrtFitter::m_IDsizeR
SimpleProperty< double > m_IDsizeR
Definition: TrkVKalVrtFitter.h:326
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::TrkVKalVrtFitter::State::m_awgt
double m_awgt[NTrMaxVFit][15]
Definition: TrkVKalVrtFitter.h:397
Trk::TrkVKalVrtFitter::m_IDsizeZ
SimpleProperty< double > m_IDsizeZ
Definition: TrkVKalVrtFitter.h:327
TrkVKalVrtCore.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::TrkVKalVrtFitter::State::m_ich
long int m_ich[NTrMaxVFit]
Definition: TrkVKalVrtFitter.h:398
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::TrkVKalVrtFitter::State::m_refFrameY
double m_refFrameY
Definition: TrkVKalVrtFitter.h:389
Trk::IVKalState
Definition: IVKalState.h:21
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
Trk::TrkVKalVrtFitter::CvtTrackParticle
StatusCode CvtTrackParticle(std::span< const xAOD::TrackParticle *const > list, int &ntrk, State &state) const
Definition: CvtTrackParticle.cxx:27
Trk::TrkVKalVrtFitter::State::m_apar
double m_apar[NTrMaxVFit][5]
Definition: TrkVKalVrtFitter.h:396
cfImp.h