ATLAS Offline Software
Tracking
TrkVertexFitter
TrkVKalVrtCore
src
PrCFit.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
#include "
TrkVKalVrtCore/CommonPars.h
"
6
#include "
TrkVKalVrtCore/ForCFT.h
"
7
#include "
TruthUtils/ParticleConstants.h
"
8
#include <cmath>
9
#include <iostream>
10
11
namespace
Trk
{
12
13
14
/*------------------------------------------------------------------------------*/
15
/* Package for vertex fit with constraints */
16
/* Minimal calling sequence: */
17
/* .......................... */
18
/* call PRCFIT(ntrk,wm,bmag,vrt,vrte,irob): setting values for cnsts */
19
/* call SetMassCnst(bmag,vrt,vrte,irob): setting values for cnsts */
20
/* call CFPEST(ntrk,xyz0,ich,apar,par0) : primary estimation of Theta, */
21
/* : phi,1/r if they are not known*/
22
/* call CFIT(iflag,ifcovv0,ntrk,ich,xyz0,par0,apar,awgt, : fit itself */
23
/* @ xyzfit,parfs,ptot,covf,chi2,chi2tr,ierr) */
24
/* if(ierr.ne.0) goto 9999 */
25
/* ........................... */
26
/* call FITERM(ntrk,errmtx) : full error matrix in symmetric */
27
/* : form ( if needed) */
28
/* ........................... */
29
/* WARNING 1: For using tracks with charge=0 they should have */
30
/* par(5) = MAG*0.002998/pt and correct definition */
31
/* of weight matrix ( or at least weight(15)=1./err**2) */
32
/* WARNING 2: Magnetic field in ATLAS for use in fit is 2.084 ( centre ) */
33
/* WARNING 3: Perigee parameters inside package DOESN'T coinside with */
34
/* those in XKALMAN. See conversion code in GetTrkPar and */
35
/* CnvErrMtx subroutines. (Will be changed in future...) */
36
/* Other useful subroutines (see comments inside code): */
37
/* XYZTRP : track conversion (X,Y,Z,PX,PY,PZ) --> (eps,z,theta,phi,1/r) */
38
/* CFIMP : track impact parameters calculation */
39
/* CFNEWP : propagate track to new vertex */
40
/* CFERPR : propagate track error matrix to new vertex */
41
/* STPCNV : track momentum from track (theta,phi,1/r) at vertex */
42
/*------------------------------------------------------------------------------*/
43
44
void
ForCFT::prcfit
(
long
int
ntrk,
double
*wm,
const
double
*wmfit,
double
bmag,
const
double
*vrt,
const
double
*vrte) noexcept
45
{
46
long
int
i__1;
47
double
summ;
48
49
50
/*------------------------------------------------------------------------------*/
51
/* SETTING OF INITIAL PARAMETERS FOR C-FIT */
52
/* (DEPENDING ON TYPE OF FIT) */
53
/* INPUT: */
54
/* NTRK : number of tracks */
55
/* WM(JTK) : track masses ( if negative - track doesn't */
56
/* : participate in mass constraint ) */
57
/* WMFIT : masses for mass constraints */
58
/* VRT(3) : point for directional constraint */
59
/* (usually primary vertex) */
60
/* VRTE(6) : error matrix for VRT ( for IFLAG=6) */
61
/* BMAG : magnetic field (in Tesla) */
62
/* Magnetic field is obligatory , other parameters MUST be set */
63
/* when used in constraints */
64
/* General mass constraint for all tracks is set in PRCFIT through WMFIT */
65
/* if WMFIT > Sum_of_track_masses */
66
/* Any number of additional mass constraints can be set up with */
67
/* SetMassCnst(NCnstTrk,IndexTrk,WMCNST) where */
68
/* INPUT: */
69
/* NCnstTrk :track number of track subset for cnst.*/
70
/* IndexTrk(NCnstTrk) :index of each track from subset in */
71
/* :general track set for vertex fit. */
72
/* WmCnst :Mass for given constraint */
73
/* Author: V.Kostioukhine (1995 ,2004,2005) */
74
/* */
75
/* All functions here must be called AFTER(!!!) prcfit. */
76
/* */
77
/*------------------------------------------------------------------------------*/
78
79
this->localbmag = bmag;
80
this->nmcnst = 0;
81
for
(
int
i
=0;
i
<8; ++
i
) this->wmfit[
i
] = -10000.;
82
summ = 0.;
83
i__1 = ntrk<
vkalNTrkM
? ntrk:
vkalNTrkM
;
84
for
(
int
i
=0;
i
<i__1; ++
i
) {
85
this->wm[
i
] = std::abs(wm[
i
]);
86
summ += wm[
i
];
87
}
88
if
((*wmfit) > summ) {
89
/* Set general mass constraint based on ALL tracks */
90
this->nmcnst = 1;
91
for
(
int
i
= 0;
i
<
vkalNTrkM
; ++
i
) {
92
indtrkmc[0][
i
] = 0;
93
if
(
i
< ntrk) {indtrkmc[0][
i
] = 1;}
94
}
95
this->wmfit[0] = (*wmfit);
96
}
97
98
this->vrt[0] = vrt[0];
99
this->vrt[1] = vrt[1];
100
this->vrt[2] = vrt[2];
101
this->covvrt[0] = vrte[0];
102
this->covvrt[1] = vrte[1];
103
this->covvrt[2] = vrte[2];
104
this->covvrt[3] = vrte[3];
105
this->covvrt[4] = vrte[4];
106
this->covvrt[5] = vrte[5];
107
this->irob = 0;
108
this->IterationNumber = 50;
109
this->IterationPrecision = 1.e-3;
110
for
(
int
i
= 0;
i
<
vkalNTrkM
; ++
i
) this->robres[
i
]=1.;
//Safety
111
//
112
// Reset all constraints
113
//
114
this->useMassCnst = 0;
115
this->usePhiCnst = 0;
116
this->useThetaCnst = 0;
117
this->useAprioriVrt = 0;
118
this->usePointingCnst = 0;
119
this->usePassNear = 0;
120
//forcft_1.usePlaneCnst = 0; //Used only on demand=> must NOT be reset here!!!
121
}
122
123
ForCFT::ForCFT
() noexcept{
124
nmcnst
=0;
125
useMassCnst
=0;
usePhiCnst
=0;
useThetaCnst
=0;
usePointingCnst
=0;
usePlaneCnst
=0;
126
useAprioriVrt
=0;
usePassNear
=0;
127
Ap
=
Bp
=
Dp
=
Cp
=
RC
=0.;
128
IterationNumber
= 50;
129
IterationPrecision
=1.e-3;
130
RobustScale
= 1.;
irob
=0;
131
for
(
int
ic
=0;
ic
<
vkalMaxNMassCnst
; ++
ic
)
wmfit
[
ic
] = -10000.;
132
for
(
int
it
=0;
it
<
vkalNTrkM
; ++
it
) {
133
wm
[
it
] =
ParticleConstants::chargedPionMassInMeV
;
134
robres
[
it
] = 1.;
135
for
(
int
ic
=0;
ic
<
vkalMaxNMassCnst
;
ic
++)
indtrkmc
[
ic
][
it
]=0;
136
}
137
localbmag
=1.997;
// Safety: standard magnetic field in ID
138
}
139
140
141
void
ForCFT::vksetIterationNum
(
long
int
Iter) noexcept
142
{
143
if
(Iter<3) Iter=3;
144
if
(Iter>100) Iter=100;
145
IterationNumber = Iter;
146
}
147
148
void
ForCFT::vksetIterationPrec
(
double
Prec) noexcept
149
{
150
if
(Prec<1.
e
-5) Prec=1.e-5;
151
if
(Prec>1.
e
-1) Prec=1.e-1;
152
IterationPrecision = Prec;
153
}
154
155
void
ForCFT::vksetRobustScale
(
double
Scale
) noexcept
156
{
157
if
(
Scale
<0.01)
Scale
=0.01;
158
if
(
Scale
>100.)
Scale
=100.;
159
RobustScale =
Scale
;
160
}
161
162
void
ForCFT::vksetRobustness
(
long
int
Rob) noexcept
163
{
164
if
(Rob<0) Rob=0;
165
if
(Rob>7) Rob=7;
166
irob = Rob;
167
}
168
169
void
ForCFT::vksetUseMassCnst
() noexcept {
useMassCnst
= 1;}
170
void
ForCFT::vksetUsePhiCnst
() noexcept {
usePhiCnst
= 1;}
171
void
ForCFT::vksetUsePlaneCnst
(
double
a
,
double
b
,
double
c
,
double
d
) noexcept {
172
if
(
a
+
b
+
c
+
d
== 0.){ usePlaneCnst = 0;
173
}
else
{ usePlaneCnst = 1; }
174
Ap =
a
; Bp =
b
; Cp =
c
; Dp =
d
;
175
}
176
177
178
179
void
ForCFT::setmasscnst_
(
long
int
ncnsttrk,
long
int
*indextrk,
double
wmcnst) noexcept
180
{
181
if
(indextrk==
nullptr
)
return
;
//Protection! Track indices start from 1 (not 0)!
182
--indextrk;
183
184
++nmcnst;
185
if
(nmcnst > 8) return ;
186
for
(
int
i
= 0;
i
<
vkalNTrkM
; ++
i
) {
187
indtrkmc[nmcnst-1][
i
] = 0;
188
}
189
for
(
int
i
= 0;
i
< ncnsttrk; ++
i
) {
190
if
(indextrk[
i
] > 0 && indextrk[
i
] <
vkalNTrkM
) {
191
indtrkmc[nmcnst-1][indextrk[
i
]] = 1;
192
}
193
}
194
wmfit[nmcnst - 1] = wmcnst;
195
}
196
197
}
/* End of namespace */
AllowedVariables::e
e
Definition:
AsgElectronSelectorTool.cxx:37
CommonPars.h
Trk::ForCFT::useThetaCnst
int useThetaCnst
Definition:
ForCFT.h:17
Trk::ForCFT::vksetRobustScale
void vksetRobustScale(double Scale) noexcept
Definition:
PrCFit.cxx:155
Trk::ForCFT::vksetRobustness
void vksetRobustness(long int Rob) noexcept
Definition:
PrCFit.cxx:162
hist_file_dump.d
d
Definition:
hist_file_dump.py:142
Trk::ForCFT::ForCFT
ForCFT() noexcept
Definition:
PrCFit.cxx:123
skel.it
it
Definition:
skel.GENtoEVGEN.py:407
Trk::ForCFT::vksetUseMassCnst
void vksetUseMassCnst() noexcept
Definition:
PrCFit.cxx:169
Trk::ForCFT::RC
double RC
Definition:
ForCFT.h:35
Trk::ForCFT::Cp
double Cp
Definition:
ForCFT.h:33
Trk::ForCFT::vksetIterationPrec
void vksetIterationPrec(double Prec) noexcept
Definition:
PrCFit.cxx:148
Trk::ForCFT::setmasscnst_
void setmasscnst_(long int ncnsttrk, long int *indextrk, double wmcnst) noexcept
Definition:
PrCFit.cxx:179
ParticleConstants::PDG2011::chargedPionMassInMeV
constexpr double chargedPionMassInMeV
the mass of the charged pion (in MeV)
Definition:
ParticleConstants.h:41
Trk::ForCFT::usePassNear
int usePassNear
Definition:
ForCFT.h:20
Trk::ForCFT::indtrkmc
int indtrkmc[vkalMaxNMassCnst][vkalNTrkM]
Definition:
ForCFT.h:52
ParticleConstants.h
lumiFormat.i
int i
Definition:
lumiFormat.py:85
Trk::ForCFT::RobustScale
double RobustScale
Definition:
ForCFT.h:50
Trk::ForCFT::vksetUsePhiCnst
void vksetUsePhiCnst() noexcept
Definition:
PrCFit.cxx:170
Trk::ForCFT::useAprioriVrt
int useAprioriVrt
Definition:
ForCFT.h:19
Trk::ForCFT::IterationPrecision
double IterationPrecision
Definition:
ForCFT.h:54
Scale
void Scale(TH1 *h, double d=1)
Definition:
comparitor.cxx:79
Trk::ForCFT::usePhiCnst
int usePhiCnst
Definition:
ForCFT.h:16
Trk::ForCFT::usePlaneCnst
int usePlaneCnst
Definition:
ForCFT.h:21
grepfile.ic
int ic
Definition:
grepfile.py:33
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition:
FakeTrackBuilder.h:9
Trk::ForCFT::wm
double wm[vkalNTrkM]
Definition:
ForCFT.h:27
plotBeamSpotMon.b
b
Definition:
plotBeamSpotMon.py:76
Trk::ForCFT::Dp
double Dp
Definition:
ForCFT.h:34
Trk::ForCFT::Ap
double Ap
Definition:
ForCFT.h:31
vkalNTrkM
#define vkalNTrkM
Definition:
CommonPars.h:22
Trk::ForCFT::prcfit
void prcfit(long int ntrk, double *wm, const double *wmfit, double bmag, const double *vrt, const double *vrte) noexcept
Definition:
PrCFit.cxx:44
Trk::ForCFT::wmfit
double wmfit[vkalMaxNMassCnst]
Definition:
ForCFT.h:28
Trk::ForCFT::localbmag
double localbmag
Definition:
ForCFT.h:29
a
TList * a
Definition:
liststreamerinfos.cxx:10
Trk::ForCFT::vksetIterationNum
void vksetIterationNum(long int Iter) noexcept
Definition:
PrCFit.cxx:141
Trk::ForCFT::irob
int irob
Definition:
ForCFT.h:49
vkalMaxNMassCnst
#define vkalMaxNMassCnst
Definition:
CommonPars.h:27
Trk::ForCFT::IterationNumber
int IterationNumber
Definition:
ForCFT.h:53
Trk::ForCFT::nmcnst
int nmcnst
Definition:
ForCFT.h:26
Trk::ForCFT::Bp
double Bp
Definition:
ForCFT.h:32
python.compressB64.c
def c
Definition:
compressB64.py:93
ForCFT.h
Trk::ForCFT::vksetUsePlaneCnst
void vksetUsePlaneCnst(double a, double b, double c, double d) noexcept
Definition:
PrCFit.cxx:171
Trk::ForCFT::robres
double robres[vkalNTrkM]
Definition:
ForCFT.h:51
Trk::ForCFT::useMassCnst
int useMassCnst
Definition:
ForCFT.h:15
Trk::ForCFT::usePointingCnst
int usePointingCnst
Definition:
ForCFT.h:18
Generated on Mon Sep 1 2025 21:17:24 for ATLAS Offline Software by
1.8.18