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
25CbmKFTrErrMCPoints::CbmKFTrErrMCPoints() : StsArray(), MvdArray(), TofArray(), StsHitsArray(), MvdHitsArray() {}
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 for (int iMvd = 0; iMvd < GetNMvdPoints(); ++iMvd) {
36 iStations.push_back(GetMvdPoint(iMvd)->GetStationNr() - 1);
37 // std::cout << GetMvdPoint(iMvd)->GetStationNr() << " " << GetMvdPoint(iMvd)->GetZ() << std::endl;
38 }
39 for (int iSts = 0; iSts < GetNStsPoints(); ++iSts) {
40 int stNumber = -1;
41 for (int iSt = 0; iSt < 8; iSt++) {
42 if (TMath::Abs(zStation[iSt] - GetStsPoint(iSts)->GetZ()) < 2.5) {
43 stNumber = iSt;
44 }
45 }
46 if (stNumber >= 0) {
47 iStations.push_back(stNumber + CbmKF::Instance()->GetNMvdStations());
48 }
49 }
50
51 std::sort(iStations.begin(), iStations.end());
52
53 int nMaxConsStations = 1;
54 int nConsStations = 1;
55 if (iStations.size() == 0) {
56 return 0;
57 }
58 int iPrevSt = iStations[0];
59 for (unsigned int iP = 1; iP < iStations.size(); iP++) {
60 if ((iStations[iP] - iPrevSt) == 1) {
61 nConsStations++;
62 iPrevSt = iStations[iP];
63 }
64 else if ((iStations[iP] - iPrevSt) > 1) {
65 if (nConsStations > nMaxConsStations) nMaxConsStations = nConsStations;
66 nConsStations = 1;
67 iPrevSt = iStations[iP];
68 }
69 }
70 if (nConsStations > nMaxConsStations) {
71 nMaxConsStations = nConsStations;
72 }
73
74 return nMaxConsStations;
75}
76
78{
79 if ((GetNMvdHits() + GetNStsHits()) < 1) {
80 return 0;
81 }
82 // TODO get station number of the point using methods of the point class!
83 vector<int> iStations;
84 for (int iMvd = 0; iMvd < GetNMvdHits(); ++iMvd) {
85 iStations.push_back(GetMvdHit(iMvd)->GetStationNr() - 1);
86 // std::cout << GetMvdHit(iMvd)->GetStationNr() << " " << GetMvdHit(iMvd)->GetZ() << std::endl;
87 }
88 for (int iSts = 0; iSts < GetNStsHits(); ++iSts) {
89 iStations.push_back(CbmStsSetup::Instance()->GetStationNumber(GetStsHit(iSts)->GetAddress()) - 1
90 + CbmKF::Instance()->GetNMvdStations());
91 }
92
93 std::sort(iStations.begin(), iStations.end());
94
95 int nMaxConsStations = 1;
96 int nConsStations = 1;
97 int iPrevSt = iStations[0];
98 for (unsigned int iP = 1; iP < iStations.size(); iP++) {
99 if ((iStations[iP] - iPrevSt) == 1) {
100 nConsStations++;
101 iPrevSt = iStations[iP];
102 }
103 else if ((iStations[iP] - iPrevSt) > 1) {
104 if (nConsStations > nMaxConsStations) {
105 nMaxConsStations = nConsStations;
106 }
107 nConsStations = 1;
108 iPrevSt = iStations[iP];
109 }
110 }
111 if (nConsStations > nMaxConsStations) {
112 nMaxConsStations = nConsStations;
113 }
114
115 return nMaxConsStations;
116}
117
119{
120 if ((GetNMvdHits() + GetNStsHits()) < 1) {
121 return 0;
122 }
123 // TODO get station number of the point using methods of the point class!
124 vector<int> iStations;
125 for (int iMvd = 0; iMvd < GetNMvdHits(); ++iMvd) {
126 iStations.push_back(GetMvdHit(iMvd)->GetStationNr() - 1);
127 // std::cout << GetMvdHit(iMvd)->GetStationNr() << " " << GetMvdHit(iMvd)->GetZ() << std::endl;
128 }
129 for (int iSts = 0; iSts < GetNStsHits(); ++iSts) {
130 iStations.push_back(CbmStsSetup::Instance()->GetStationNumber(GetStsHit(iSts)->GetAddress()) - 1
131 + CbmKF::Instance()->GetNMvdStations());
132 }
133 std::sort(iStations.begin(), iStations.end());
134
135 int nStations = 1;
136 int iPrevSt = iStations[0];
137 for (unsigned int iP = 1; iP < iStations.size(); iP++) {
138 if ((iStations[iP] - iPrevSt) >= 1) {
139 nStations++;
140 iPrevSt = iStations[iP];
141 }
142 }
143
144 return nStations;
145}
146
148{
149 if ((GetNMvdPoints() + GetNStsPoints()) < 1) {
150 return 0;
151 }
152 // TODO get station number of the point using methods of the point class!
153 float zStation[8] = {30., 40., 50., 60., 70., 80., 90., 100.};
154 vector<int> iStations;
155 for (int iMvd = 0; iMvd < GetNMvdPoints(); ++iMvd) {
156 iStations.push_back(GetMvdPoint(iMvd)->GetStationNr() - 1);
157 // std::cout << GetMvdPoint(iMvd)->GetStationNr() << " " << GetMvdPoint(iMvd)->GetZ() << std::endl;
158 }
159 for (int iSts = 0; iSts < GetNStsPoints(); ++iSts) {
160 int stNumber = -1;
161 for (int iSt = 0; iSt < 8; iSt++) {
162 if (TMath::Abs(zStation[iSt] - GetStsPoint(iSts)->GetZ()) < 2.5) {
163 stNumber = iSt;
164 }
165 }
166 if (stNumber >= 0) {
167 iStations.push_back(stNumber + CbmKF::Instance()->GetNMvdStations());
168 }
169 }
170
171 std::sort(iStations.begin(), iStations.end());
172
173 int nMaxMCPointsOnStation = 1;
174 int nMCPointsOnStation = 1;
175 if (iStations.size() == 0) {
176 return 0;
177 }
178 int iPrevSt = iStations[0];
179 for (unsigned int iP = 1; iP < iStations.size(); iP++) {
180 if ((iStations[iP] - iPrevSt) == 0) {
181 nMCPointsOnStation++;
182 iPrevSt = iStations[iP];
183 }
184 else {
185 if (nMCPointsOnStation > nMaxMCPointsOnStation) {
186 nMaxMCPointsOnStation = nMCPointsOnStation;
187 }
188 nMCPointsOnStation = 1;
189 iPrevSt = iStations[iP];
190 }
191 }
192
193 return nMaxMCPointsOnStation;
194}
195
196Bool_t CbmKFTrErrMCPoints::IsReconstructable(CbmMCTrack* mcTr, int MinNStations, int PerformanceMode, float MinRecoMom)
197{
198 Bool_t f = 1;
199
200 // reject very slow tracks from analysis
201 f &= (mcTr->GetP() > MinRecoMom);
202 // detected at least in 4 stations
203 if (PerformanceMode == 3) {
204 f &= (GetNConsMCStations() >= MinNStations); // L1-MC
205 }
206 if (PerformanceMode == 2) {
207 f &= (GetNHitStations() >= MinNStations); // QA definition
208 }
209 if (PerformanceMode == 1) {
210 f &= (GetNConsHitStations() >= MinNStations); // L1 definition
211 }
212
213 // maximul 4 layers for a station.
214 f &= (GetNMaxMCPointsOnStation() <= 4);
215
216 return f;
217}
ClassImp(CbmKFTrErrMCPoints)
CbmStsPoint * GetStsPoint(Int_t i)
CbmStsHit * GetStsHit(Int_t i)
Bool_t IsReconstructable(CbmMCTrack *mcTr, int MinNStations, int PerformanceMode, float MinRecoMom)
CbmMvdPoint * GetMvdPoint(Int_t i)
CbmMvdHit * GetMvdHit(Int_t i)
static CbmKF * Instance()
Definition CbmKF.h:40
double GetP() const
Definition CbmMCTrack.h:98
static CbmStsSetup * Instance()