BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
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
23CbmL1MCTrack::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()
40 , maxNStaMC(0)
41 , maxNSensorMC(0)
42 , maxNStaHits(0)
43 , nStations(0)
44 , nMCStations(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
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
94} // void CbmL1MCTrack::Init()
95
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
122{
123 CbmL1* L1 = CbmL1::Instance();
124 L1Algo* algo = L1->algo;
125
126 int nhits = StsHits.size();
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
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
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
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
221{
222 CbmL1* L1 = CbmL1::Instance();
223
224 bool f = 1;
225
226 // reject very slow tracks from analysis
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)
238 if (L1->fPerformance == 2)
239 isReconstructable = f & (nStations >= CbmL1Constants::MinNStations); // QA definition
240 if (L1->fPerformance == 1)
242
244 & (nHitContStations >= 3) & (L1->vMCPoints[Points[0]].iStation == 0);
246}; // bool CbmL1MCTrack::IsReconstructable()
friend F32vec4 fabs(const F32vec4 &a)
Definition P4_F32vec4.h:52
int iStation
Definition CbmL1.h:43
vector< CbmL1Track * > rTracks
void CalculateIsReconstructable()
void CalculateMaxNStaHits()
void CalculateMCCont()
friend class CbmL1
void CalculateMaxNStaMC()
vector< int > StsHits
bool isReconstructable
void CalculateHitCont()
vector< CbmL1Track * > tTracks
vector< int > Points
static CbmL1 * Instance()
reconstructed tracks
Definition CbmL1.h:59
vector< L1StsHit > vStsHits
Definition L1Algo.h:162
vector< unsigned char > vSFlag
Definition L1Algo.h:164
TStripI f
Definition L1StsHit.h:12
Double_t Px() const
Double_t Pz() const
Double_t Py() const
Double_t Z() const
Double_t Y() const
Double_t X() const
RVec< PromoteType< T > > sqrt(const RVec< T > &v)
const double MinNStations
const double MinRecoMom
Performance constants.
vector< int > hitIds