Project
Loading...
Searching...
No Matches
TrackMCStudyTypes.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13
14namespace o2::trackstudy
15{
16
18
19// get longest number of clusters on consecutive layers
21{
22 if (nITSCl < 2) {
23 return nITSCl;
24 }
25 int longest = 0, current = 0;
26 for (int i = 0; i < 7; i++) {
27 if (pattITSCl & (0x1 << i)) {
28 if (++current > longest) {
29 longest = current;
30 }
31 } else {
32 current = 0;
33 }
34 }
35 return longest;
36}
37
38// check how many clusters ITS-TPC afterburner could see (consecutively occupied layers starting from the last one)
40{
41 int ncl = 0;
42 if (nITSCl) {
43 for (int i = 6; i > 2; i--) {
44 if (pattITSCl & (0x1 << i)) {
45 ncl++;
46 } else {
47 break;
48 }
49 }
50 }
51 return ncl;
52}
53
54// lowest ITS layer with cluster
56{
57 if (nITSCl) {
58 for (int i = 0; i < 7; i++) {
59 if (pattITSCl & (0x1 << i)) {
60 return i;
61 }
62 }
63 }
64 return -1;
65}
66
67// highest ITS layer with cluster
69{
70 if (nITSCl) {
71 for (int i = 7; i--;) {
72 if (pattITSCl & (0x1 << i)) {
73 return i;
74 }
75 }
76 }
77 return -1;
78}
79
81{
83 int ntri = 0;
84 while (ntri < 2) {
85 int sector0 = o2::math_utils::angle2Sector(t.getAlpha());
86 if (!t.propagateParamTo(x, b)) {
87 t.invalidate();
88 break;
89 }
90 int sector = o2::math_utils::angle2Sector(t.getPhiPos());
91 float alpha = o2::math_utils::sector2Angle(sector);
92 if (!t.rotateParam(alpha)) {
93 t.invalidate();
94 break;
95 }
96 if (sector != sector0) {
97 ntri++;
98 continue;
99 }
100 break;
101 }
102 // printf("%s ->\n%s <-\n",track.asString().c_str(), t.asString().c_str());
103 return t;
104}
105
106float MCTrackInfo::getTrackParTPCPar(int i, float b, float x) const
107{
108 auto t = getTrackParTPC(b, x);
109 return t.isValid() ? t.getParam(i) : -999.;
110}
111
112float MCTrackInfo::getTrackParTPCPhiSec(float b, float x) const
113{
114 auto t = getTrackParTPC(b, x);
115 return t.isValid() ? std::atan2(t.getY(), t.getX()) : -999.;
116}
117
119{
120 int n = -1, ncl = 0;
121 int ntr = recTracks.size();
122 for (int i = 0; i < ntr; i++) {
123 if (recTracks[i].nClTPC > ncl) {
124 ncl = recTracks[i].nClTPC;
125 n = i;
126 }
127 }
128 return n;
129}
130
132{
133 int n = 0;
134 for (auto& t : recTracks) {
135 if (t.nClTPC > 0) {
136 n++;
137 }
138 }
139 return n;
140}
141
142} // namespace o2::trackstudy
int32_t i
GLdouble n
Definition glcorearb.h:1982
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
GLint GLenum GLint x
Definition glcorearb.h:403
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
int angle2Sector(float phi)
Definition Utils.h:183
float sector2Angle(int sect)
Definition Utils.h:193
o2::track::TrackPar getTrackParTPC(float b, float x=90) const
float getTrackParTPCPar(int i, float b, float x=90) const
float getTrackParTPCPhiSec(float b, float x=90) const
std::vector< RecTrack > recTracks