CbmRoot
Loading...
Searching...
No Matches
CbmKFTrErrMCPoints.cxx
Go to the documentation of this file.
1/* Copyright (C) 2011-2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Maksym Zyzak [committer] */
4
5/*
6 *====================================================================
7 *
8 * KF Fit performance
9 *
10 *====================================================================
11 */
12#include "CbmKFTrErrMCPoints.h"
13
14#include "CbmKF.h"
15#include "CbmMCTrack.h"
16#include "CbmStsAddress.h"
17#include "CbmStsSetup.h"
18
19#include <algorithm>
20
21using std::vector;
22
24
26
28{
29 if ((GetNMvdPoints() + GetNStsPoints()) < 1) {
30 return 0;
31 }
32 // TODO get station number of the point using methods of the point class!
33 float zStation[8] = {30., 40., 50., 60., 70., 80., 90., 100.};
34 vector<int> iStations;
35 // SZh 03.09.2025: Is this code used somewhere?
36 // GetMvdPoint(iMvd)->GetStationNr() do not return station ID, but sensor ID,
37 // so this iStations makes no sense in context of tracking.
38 for (int iMvd = 0; iMvd < GetNMvdPoints(); ++iMvd) {
39 iStations.push_back(GetMvdPoint(iMvd)->GetSensorNr() - 1);
40 // std::cout << GetMvdPoint(iMvd)->GetStationNr() << " " << GetMvdPoint(iMvd)->GetZ() << std::endl;
41 }
42 for (int iSts = 0; iSts < GetNStsPoints(); ++iSts) {
43 int stNumber = -1;
44 for (int iSt = 0; iSt < 8; iSt++) {
45 if (TMath::Abs(zStation[iSt] - GetStsPoint(iSts)->GetZ()) < 2.5) {
46 stNumber = iSt;
47 }
48 }
49 if (stNumber >= 0) {
50 iStations.push_back(stNumber + CbmKF::Instance()->GetNMvdStations());
51 }
52 }
53
54 std::sort(iStations.begin(), iStations.end());
55
56 int nMaxConsStations = 1;
57 int nConsStations = 1;
58 if (iStations.size() == 0) {
59 return 0;
60 }
61 int iPrevSt = iStations[0];
62 for (unsigned int iP = 1; iP < iStations.size(); iP++) {
63 if ((iStations[iP] - iPrevSt) == 1) {
64 nConsStations++;
65 iPrevSt = iStations[iP];
66 }
67 else if ((iStations[iP] - iPrevSt) > 1) {
68 if (nConsStations > nMaxConsStations) nMaxConsStations = nConsStations;
69 nConsStations = 1;
70 iPrevSt = iStations[iP];
71 }
72 }
73 if (nConsStations > nMaxConsStations) {
74 nMaxConsStations = nConsStations;
75 }
76
77 return nMaxConsStations;
78}
79
81{
82 if ((GetNMvdHits() + GetNStsHits()) < 1) {
83 return 0;
84 }
85 // TODO get station number of the point using methods of the point class!
86 vector<int> iStations;
87 for (int iMvd = 0; iMvd < GetNMvdHits(); ++iMvd) {
88 iStations.push_back(GetMvdHit(iMvd)->GetStationNr() - 1);
89 // std::cout << GetMvdHit(iMvd)->GetStationNr() << " " << GetMvdHit(iMvd)->GetZ() << std::endl;
90 }
91 for (int iSts = 0; iSts < GetNStsHits(); ++iSts) {
92 iStations.push_back(CbmStsSetup::Instance()->GetStationNumber(GetStsHit(iSts)->GetAddress()) - 1
93 + CbmKF::Instance()->GetNMvdStations());
94 }
95
96 std::sort(iStations.begin(), iStations.end());
97
98 int nMaxConsStations = 1;
99 int nConsStations = 1;
100 int iPrevSt = iStations[0];
101 for (unsigned int iP = 1; iP < iStations.size(); iP++) {
102 if ((iStations[iP] - iPrevSt) == 1) {
103 nConsStations++;
104 iPrevSt = iStations[iP];
105 }
106 else if ((iStations[iP] - iPrevSt) > 1) {
107 if (nConsStations > nMaxConsStations) {
108 nMaxConsStations = nConsStations;
109 }
110 nConsStations = 1;
111 iPrevSt = iStations[iP];
112 }
113 }
114 if (nConsStations > nMaxConsStations) {
115 nMaxConsStations = nConsStations;
116 }
117
118 return nMaxConsStations;
119}
120
122{
123 if ((GetNMvdHits() + GetNStsHits()) < 1) {
124 return 0;
125 }
126 // TODO get station number of the point using methods of the point class!
127 vector<int> iStations;
128 for (int iMvd = 0; iMvd < GetNMvdHits(); ++iMvd) {
129 iStations.push_back(GetMvdHit(iMvd)->GetStationNr() - 1);
130 // std::cout << GetMvdHit(iMvd)->GetStationNr() << " " << GetMvdHit(iMvd)->GetZ() << std::endl;
131 }
132 for (int iSts = 0; iSts < GetNStsHits(); ++iSts) {
133 iStations.push_back(CbmStsSetup::Instance()->GetStationNumber(GetStsHit(iSts)->GetAddress()) - 1
134 + CbmKF::Instance()->GetNMvdStations());
135 }
136 std::sort(iStations.begin(), iStations.end());
137
138 int nStations = 1;
139 int iPrevSt = iStations[0];
140 for (unsigned int iP = 1; iP < iStations.size(); iP++) {
141 if ((iStations[iP] - iPrevSt) >= 1) {
142 nStations++;
143 iPrevSt = iStations[iP];
144 }
145 }
146
147 return nStations;
148}
149
151{
152 if ((GetNMvdPoints() + GetNStsPoints()) < 1) {
153 return 0;
154 }
155 // TODO get station number of the point using methods of the point class!
156 float zStation[8] = {30., 40., 50., 60., 70., 80., 90., 100.};
157 vector<int> iStations;
158 for (int iMvd = 0; iMvd < GetNMvdPoints(); ++iMvd) {
159 // SZh 03.09.2025: Is this code used somewhere?
160 // GetMvdPoint(iMvd)->GetStationNr() do not return station ID, but sensor ID,
161 // so this iStations makes no sense in context of tracking.
162 iStations.push_back(GetMvdPoint(iMvd)->GetSensorNr() - 1);
163 // std::cout << GetMvdPoint(iMvd)->GetStationNr() << " " << GetMvdPoint(iMvd)->GetZ() << std::endl;
164 }
165 for (int iSts = 0; iSts < GetNStsPoints(); ++iSts) {
166 int stNumber = -1;
167 for (int iSt = 0; iSt < 8; iSt++) {
168 if (TMath::Abs(zStation[iSt] - GetStsPoint(iSts)->GetZ()) < 2.5) {
169 stNumber = iSt;
170 }
171 }
172 if (stNumber >= 0) {
173 iStations.push_back(stNumber + CbmKF::Instance()->GetNMvdStations());
174 }
175 }
176
177 std::sort(iStations.begin(), iStations.end());
178
179 int nMaxMCPointsOnStation = 1;
180 int nMCPointsOnStation = 1;
181 if (iStations.size() == 0) {
182 return 0;
183 }
184 int iPrevSt = iStations[0];
185 for (unsigned int iP = 1; iP < iStations.size(); iP++) {
186 if ((iStations[iP] - iPrevSt) == 0) {
187 nMCPointsOnStation++;
188 iPrevSt = iStations[iP];
189 }
190 else {
191 if (nMCPointsOnStation > nMaxMCPointsOnStation) {
192 nMaxMCPointsOnStation = nMCPointsOnStation;
193 }
194 nMCPointsOnStation = 1;
195 iPrevSt = iStations[iP];
196 }
197 }
198
199 return nMaxMCPointsOnStation;
200}
201
202Bool_t CbmKFTrErrMCPoints::IsReconstructable(CbmMCTrack* mcTr, int MinNStations, int PerformanceMode, float MinRecoMom)
203{
204 Bool_t f = 1;
205
206 // reject very slow tracks from analysis
207 f &= (mcTr->GetP() > MinRecoMom);
208 // detected at least in 4 stations
209 if (PerformanceMode == 3) {
210 f &= (GetNConsMCStations() >= MinNStations); // L1-MC
211 }
212 if (PerformanceMode == 2) {
213 f &= (GetNHitStations() >= MinNStations); // QA definition
214 }
215 if (PerformanceMode == 1) {
216 f &= (GetNConsHitStations() >= MinNStations); // L1 definition
217 }
218
219 // maximul 4 layers for a station.
220 f &= (GetNMaxMCPointsOnStation() <= 4);
221
222 return f;
223}
ClassImp(CbmKFTrErrMCPoints)
bool Bool_t
CbmStsPoint * GetStsPoint(Int_t i)
std::vector< CbmMvdHit * > MvdHitsArray
std::vector< CbmTofPoint * > TofArray
std::vector< CbmMvdPoint * > MvdArray
CbmStsHit * GetStsHit(Int_t i)
std::vector< CbmStsPoint * > StsArray
Bool_t IsReconstructable(CbmMCTrack *mcTr, int MinNStations, int PerformanceMode, float MinRecoMom)
std::vector< CbmStsHit * > StsHitsArray
CbmMvdPoint * GetMvdPoint(Int_t i)
CbmMvdHit * GetMvdHit(Int_t i)
static CbmKF * Instance()
Definition CbmKF.h:40
double GetP() const
Definition CbmMCTrack.h:97
static CbmStsSetup * Instance()