BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
CbmL1MCTrack.cxx
Go to the documentation of this file.
1
/*
2
*====================================================================
3
*
4
* CBM Level 1 Reconstruction
5
*
6
* Authors: I.Kisel, S.Gorbunov
7
*
8
* e-mail : ikisel@kip.uni-heidelberg.de
9
*
10
*====================================================================
11
*
12
* L1 Monte Carlo information
13
*
14
*====================================================================
15
*/
16
17
#include "
CbmL1MCTrack.h
"
18
19
#include "
CbmL1.h
"
20
#include "
CbmL1Constants.h
"
21
#include "
L1Algo/L1Algo.h
"
22
23
CbmL1MCTrack::CbmL1MCTrack
(
double
mass_,
double
q_,
TVector3
vr,
TLorentzVector
vp,
int
_ID,
int
_mother_ID,
int
_pdg)
24
:
mass
(mass_)
25
,
q
(q_)
26
,
p
(0)
27
,
x
(0)
28
,
y
(0)
29
,
z
(0)
30
,
px
(0)
31
,
py
(0)
32
,
pz
(0)
33
,
ID
(_ID)
34
,
mother_ID
(_mother_ID)
35
,
pdg
(_pdg)
36
,
Points
()
37
,
StsHits
()
38
,
nMCContStations
(0)
39
,
nHitContStations
(0)
40
,
maxNStaMC
(0)
41
,
maxNSensorMC
(0)
42
,
maxNStaHits
(0)
43
,
nStations
(0)
44
,
nMCStations
(0)
45
,
isReconstructable
(0)
46
,
isAdditional
()
47
,
rTracks
()
48
,
tTracks
()
49
{
50
x
= vr.
X
();
51
y
= vr.
Y
();
52
z
= vr.
Z
();
53
px
= vp.
Px
();
54
py
= vp.
Py
();
55
pz
= vp.
Pz
();
56
p
=
sqrt
(
fabs
(
px
*
px
+
py
*
py
+
pz
*
pz
));
57
};
58
59
// CbmL1MCTrack::CbmL1MCTrack(TmpMCPoints &mcPoint, TVector3 vr, TLorentzVector vp, int ID, int mother_ID):
60
// ID(_ID), mother_ID(_mother_ID)
61
// {
62
// mass = mcPoint->mass;
63
// q = mcPoint->q;
64
// pdg = mcPoint->pdg;
65
//
66
// x = vr.X();
67
// y = vr.Y();
68
// z = vr.Z();
69
// px = vp.Px();
70
// py = vp.Py();
71
// pz = vp.Pz();
72
// p = sqrt( fabs(px*px + py*py + pz*pz ));
73
// };
74
75
void
CbmL1MCTrack::Init
()
76
{
77
CbmL1
* L1 =
CbmL1::Instance
();
78
// get stsHits
79
StsHits
.clear();
80
for
(
unsigned
int
iP = 0; iP <
Points
.size(); iP++) {
81
CbmL1MCPoint
* point = &(L1->vMCPoints[
Points
[iP]]);
82
for
(
unsigned
int
iH = 0; iH < point->
hitIds
.size(); iH++) {
83
const
int
iih = point->
hitIds
[iH];
84
if
(std::find(
StsHits
.begin(),
StsHits
.end(), iih) ==
StsHits
.end())
85
StsHits
.push_back(iih);
86
}
87
}
88
89
CalculateMCCont
();
90
CalculateHitCont
();
91
CalculateMaxNStaMC
();
92
CalculateMaxNStaHits
();
93
CalculateIsReconstructable
();
94
}
// void CbmL1MCTrack::Init()
95
96
void
CbmL1MCTrack::CalculateMCCont
()
97
{
98
CbmL1
* L1 =
CbmL1::Instance
();
99
100
int
nPoints =
Points
.size();
101
nMCContStations
= 0;
102
int
istaold = -1, ncont = 0;
103
for
(
int
ih = 0; ih < nPoints; ih++) {
104
CbmL1MCPoint
& h = L1->vMCPoints[
Points
[ih]];
105
int
ista = h.
iStation
;
106
if
(ista - istaold == 1)
107
ncont++;
108
else
if
(ista - istaold > 1) {
109
if
(
nMCContStations
< ncont)
110
nMCContStations
= ncont;
111
ncont = 1;
112
}
113
if
(ista <= istaold)
114
continue
;
// backward direction
115
istaold = ista;
116
}
117
if
(
nMCContStations
< ncont)
118
nMCContStations
= ncont;
119
};
// void CbmL1MCTrack::CalculateMCCont()
120
121
void
CbmL1MCTrack::CalculateHitCont
()
122
{
123
CbmL1
* L1 =
CbmL1::Instance
();
124
L1Algo
* algo = L1->algo;
125
126
int
nhits =
StsHits
.size();
127
nHitContStations
= 0;
128
int
istaold = -1, ncont = 0;
129
for
(
int
ih = 0; ih < nhits; ih++) {
130
int
jh =
StsHits
[ih];
131
L1StsHit
& h = algo->
vStsHits
[jh];
132
int
ista = algo->
vSFlag
[h.
f
] / 4;
133
if
(ista - istaold == 1)
134
ncont++;
135
else
if
(ista - istaold > 1) {
136
if
(
nHitContStations
< ncont)
137
nHitContStations
= ncont;
138
ncont = 1;
139
}
140
141
if
(!(ista >= istaold)) {
// tracks going in backward direction are not reconstructable
142
nHitContStations
= 0;
143
return
;
144
}
145
if
(ista == istaold)
146
continue
;
// backward direction
147
istaold = ista;
148
}
149
if
(
nHitContStations
< ncont)
150
nHitContStations
= ncont;
151
};
// void CbmL1MCTrack::CalculateHitCont()
152
153
void
CbmL1MCTrack::CalculateMaxNStaHits
()
154
{
155
CbmL1
* L1 =
CbmL1::Instance
();
156
157
maxNStaHits
= 0;
158
nStations
= 0;
159
int
lastSta = -1;
160
int
cur_maxNStaHits = 0;
161
for
(
unsigned
int
iH = 0; iH <
StsHits
.size(); iH++) {
162
CbmL1HitStore
& sh = L1->vHitStore[
StsHits
[iH]];
163
if
(sh.
iStation
== lastSta) {
164
cur_maxNStaHits++;
165
}
else
{
// new station
166
if
(!(sh.
iStation
> lastSta)) {
// tracks going in backward direction are not reconstructable
167
maxNStaHits
= 0;
168
return
;
169
}
170
if
(cur_maxNStaHits >
maxNStaHits
)
171
maxNStaHits
= cur_maxNStaHits;
172
cur_maxNStaHits = 1;
173
lastSta = sh.
iStation
;
174
nStations
++;
175
}
176
};
177
if
(cur_maxNStaHits >
maxNStaHits
)
178
maxNStaHits
= cur_maxNStaHits;
179
// cout << pdg << " " << p << " " << StsHits.size() << " > " << maxNStaHits << endl;
180
};
// void CbmL1MCTrack::CalculateHitCont()
181
182
void
CbmL1MCTrack::CalculateMaxNStaMC
()
183
{
184
CbmL1
* L1 =
CbmL1::Instance
();
185
186
maxNStaMC
= 0;
187
maxNSensorMC
= 0;
188
nMCStations
= 0;
189
int
lastSta = -1;
190
float
lastz = -1;
191
int
cur_maxNStaMC = 0, cur_maxNSensorMC = 0;
192
for
(
unsigned
int
iH = 0; iH <
Points
.size(); iH++) {
193
CbmL1MCPoint
& mcP = L1->vMCPoints[
Points
[iH]];
194
if
(mcP.
iStation
== lastSta)
195
cur_maxNStaMC++;
196
else
{
// new station
197
if
(cur_maxNStaMC >
maxNStaMC
)
198
maxNStaMC
= cur_maxNStaMC;
199
cur_maxNStaMC = 1;
200
lastSta = mcP.
iStation
;
201
nMCStations
++;
202
}
203
204
if
(mcP.
z
== lastz)
// TODO: works incorrect because of different z
205
cur_maxNSensorMC++;
206
else
{
// new z
207
if
(cur_maxNSensorMC >
maxNSensorMC
)
208
maxNSensorMC
= cur_maxNSensorMC;
209
cur_maxNSensorMC = 1;
210
lastz = mcP.
z
;
211
}
212
};
213
if
(cur_maxNStaMC >
maxNStaMC
)
214
maxNStaMC
= cur_maxNStaMC;
215
if
(cur_maxNSensorMC >
maxNSensorMC
)
216
maxNSensorMC
= cur_maxNSensorMC;
217
// cout << pdg << " " << p << " " << Points.size() << " > " << maxNStaMC << " " << maxNSensorMC << endl;
218
};
// void CbmL1MCTrack::CalculateMaxNStaMC()
219
220
void
CbmL1MCTrack::CalculateIsReconstructable
()
221
{
222
CbmL1
* L1 =
CbmL1::Instance
();
223
224
bool
f = 1;
225
226
// reject very slow tracks from analysis
227
f &= (
p
>
CbmL1Constants::MinRecoMom
);
228
// detected at least in 4 stations
229
// f &= (nMCContStations >= 4);
230
231
// maximul 4 layers for a station.
232
// f &= (maxNStaHits <= 4);
233
f &= (
maxNStaMC
<= 4);
234
// f &= (maxNSensorMC <= 1);
235
236
if
(L1->fPerformance == 3)
237
isReconstructable
= f & (
nMCContStations
>=
CbmL1Constants::MinNStations
);
// L1-MC
238
if
(L1->fPerformance == 2)
239
isReconstructable
= f & (
nStations
>=
CbmL1Constants::MinNStations
);
// QA definition
240
if
(L1->fPerformance == 1)
241
isReconstructable
= f & (
nHitContStations
>=
CbmL1Constants::MinNStations
);
// L1 definition
242
243
isAdditional
= f & (
nHitContStations
==
nStations
) & (
nMCContStations
==
nStations
) & (
nMCStations
==
nStations
)
244
& (
nHitContStations
>= 3) & (L1->vMCPoints[
Points
[0]].iStation == 0);
245
isAdditional
&= !
isReconstructable
;
246
};
// bool CbmL1MCTrack::IsReconstructable()
CbmL1Constants.h
L1Algo.h
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition
P4_F32vec4.h:52
CbmL1HitStore
Definition
CbmL1.h:40
CbmL1HitStore::iStation
int iStation
Definition
CbmL1.h:43
CbmL1MCTrack::rTracks
vector< CbmL1Track * > rTracks
Definition
CbmL1MCTrack.h:133
CbmL1MCTrack::CalculateIsReconstructable
void CalculateIsReconstructable()
Definition
CbmL1MCTrack.cxx:220
CbmL1MCTrack::maxNStaHits
int maxNStaHits
Definition
CbmL1MCTrack.h:118
CbmL1MCTrack::px
double px
Definition
CbmL1MCTrack.h:33
CbmL1MCTrack::nMCContStations
int nMCContStations
Definition
CbmL1MCTrack.h:114
CbmL1MCTrack::mass
double mass
Definition
CbmL1MCTrack.h:33
CbmL1MCTrack::isAdditional
bool isAdditional
Definition
CbmL1MCTrack.h:124
CbmL1MCTrack::nHitContStations
int nHitContStations
Definition
CbmL1MCTrack.h:115
CbmL1MCTrack::CalculateMaxNStaHits
void CalculateMaxNStaHits()
Definition
CbmL1MCTrack.cxx:153
CbmL1MCTrack::p
double p
Definition
CbmL1MCTrack.h:33
CbmL1MCTrack::pdg
int pdg
Definition
CbmL1MCTrack.h:34
CbmL1MCTrack::pz
double pz
Definition
CbmL1MCTrack.h:33
CbmL1MCTrack::maxNSensorMC
int maxNSensorMC
Definition
CbmL1MCTrack.h:117
CbmL1MCTrack::CalculateMCCont
void CalculateMCCont()
Definition
CbmL1MCTrack.cxx:96
CbmL1MCTrack::z
double z
Definition
CbmL1MCTrack.h:33
CbmL1MCTrack::CbmL1
friend class CbmL1
Definition
CbmL1MCTrack.h:111
CbmL1MCTrack::x
double x
Definition
CbmL1MCTrack.h:33
CbmL1MCTrack::nStations
int nStations
Definition
CbmL1MCTrack.h:120
CbmL1MCTrack::py
double py
Definition
CbmL1MCTrack.h:33
CbmL1MCTrack::maxNStaMC
int maxNStaMC
Definition
CbmL1MCTrack.h:116
CbmL1MCTrack::CalculateMaxNStaMC
void CalculateMaxNStaMC()
Definition
CbmL1MCTrack.cxx:182
CbmL1MCTrack::StsHits
vector< int > StsHits
Definition
CbmL1MCTrack.h:36
CbmL1MCTrack::ID
int ID
Definition
CbmL1MCTrack.h:34
CbmL1MCTrack::nMCStations
int nMCStations
Definition
CbmL1MCTrack.h:121
CbmL1MCTrack::isReconstructable
bool isReconstructable
Definition
CbmL1MCTrack.h:123
CbmL1MCTrack::q
double q
Definition
CbmL1MCTrack.h:33
CbmL1MCTrack::Init
void Init()
Definition
CbmL1MCTrack.cxx:75
CbmL1MCTrack::y
double y
Definition
CbmL1MCTrack.h:33
CbmL1MCTrack::CalculateHitCont
void CalculateHitCont()
Definition
CbmL1MCTrack.cxx:121
CbmL1MCTrack::tTracks
vector< CbmL1Track * > tTracks
Definition
CbmL1MCTrack.h:135
CbmL1MCTrack::Points
vector< int > Points
Definition
CbmL1MCTrack.h:35
CbmL1MCTrack::CbmL1MCTrack
CbmL1MCTrack()
Definition
CbmL1MCTrack.h:38
CbmL1MCTrack::mother_ID
int mother_ID
Definition
CbmL1MCTrack.h:34
CbmL1::Instance
static CbmL1 * Instance()
reconstructed tracks
Definition
CbmL1.h:59
L1Algo
Definition
L1Algo.h:61
L1Algo::vStsHits
vector< L1StsHit > vStsHits
Definition
L1Algo.h:162
L1Algo::vSFlag
vector< unsigned char > vSFlag
Definition
L1Algo.h:164
L1StsHit
Definition
L1StsHit.h:10
L1StsHit::f
TStripI f
Definition
L1StsHit.h:12
TLorentzVector
TLorentzVector::Px
Double_t Px() const
TLorentzVector::Pz
Double_t Pz() const
TLorentzVector::Py
Double_t Py() const
TVector3
TVector3::Z
Double_t Z() const
TVector3::Y
Double_t Y() const
TVector3::X
Double_t X() const
sqrt
RVec< PromoteType< T > > sqrt(const RVec< T > &v)
CbmL1Constants::MinNStations
const double MinNStations
Definition
CbmL1Constants.h:10
CbmL1Constants::MinRecoMom
const double MinRecoMom
Performance constants.
Definition
CbmL1Constants.h:7
CbmL1MCTrack.h
CbmL1.h
CbmL1MCPoint
Definition
CbmL1MCPoint.h:24
CbmL1MCPoint::iStation
int iStation
Definition
CbmL1MCPoint.h:60
CbmL1MCPoint::hitIds
vector< int > hitIds
Definition
CbmL1MCPoint.h:73
CbmL1MCPoint::z
double z
Definition
CbmL1MCPoint.h:55
reconstruction
cat
CbmL1MCTrack.cxx
Generated on
for BmnRoot by
1.17.0