]>
Commit | Line | Data |
---|---|---|
46d29e70 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log$ | |
0a29d0f1 | 18 | Revision 1.4 2001/05/07 08:08:05 cblume |
19 | Update of TRD code | |
20 | ||
a2b90f83 | 21 | Revision 1.3 2000/12/08 16:07:02 cblume |
22 | Update of the tracking by Sergei | |
23 | ||
bbf92647 | 24 | Revision 1.2 2000/10/06 16:49:46 cblume |
25 | Made Getters const | |
26 | ||
46d29e70 | 27 | Revision 1.1.2.1 2000/09/22 14:47:52 cblume |
28 | Add the tracking code | |
29 | ||
30 | */ | |
0a29d0f1 | 31 | |
32 | /////////////////////////////////////////////////////////////////////////////// | |
33 | // // | |
34 | // TRD cluster // | |
35 | // // | |
36 | /////////////////////////////////////////////////////////////////////////////// | |
46d29e70 | 37 | |
38 | #include "AliTRDcluster.h" | |
46d29e70 | 39 | #include "AliTRDrecPoint.h" |
40 | ||
46d29e70 | 41 | ClassImp(AliTRDcluster) |
42 | ||
43 | //_____________________________________________________________________________ | |
a2b90f83 | 44 | AliTRDcluster::AliTRDcluster() |
45 | { | |
46 | // | |
47 | // Default constructor | |
48 | // | |
49 | ||
50 | fDetector = 0; | |
51 | fTimeBin = 0; | |
52 | fTracks[0] = 0; | |
53 | fTracks[1] = 0; | |
54 | fTracks[2] = 0; | |
55 | fY = 0; | |
56 | fZ = 0; | |
57 | fQ = 0; | |
58 | fSigmaY2 = 0; | |
59 | fSigmaZ2 = 0; | |
46d29e70 | 60 | |
46d29e70 | 61 | } |
62 | ||
63 | //_____________________________________________________________________________ | |
a2b90f83 | 64 | AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p) |
46d29e70 | 65 | { |
66 | // | |
a2b90f83 | 67 | // Constructor from AliTRDrecPoint |
46d29e70 | 68 | // |
69 | ||
a2b90f83 | 70 | fDetector = p.GetDetector(); |
71 | fTimeBin = p.GetLocalTimeBin(); | |
46d29e70 | 72 | |
a2b90f83 | 73 | fTracks[0] = p.GetTrackIndex(0); |
74 | fTracks[1] = p.GetTrackIndex(1); | |
75 | fTracks[2] = p.GetTrackIndex(2); | |
46d29e70 | 76 | |
a2b90f83 | 77 | fQ = p.GetEnergy(); |
46d29e70 | 78 | |
a2b90f83 | 79 | fY = p.GetY(); |
80 | fZ = p.GetZ(); | |
81 | fSigmaY2 = p.GetSigmaY2(); | |
82 | fSigmaZ2 = p.GetSigmaZ2(); | |
46d29e70 | 83 | |
bbf92647 | 84 | fSigmaY2 = 0.2; |
85 | fSigmaZ2 = 5.; | |
86 | ||
87 | } | |
88 | ||
89 | //_____________________________________________________________________________ | |
a2b90f83 | 90 | AliTRDcluster::AliTRDcluster(const AliTRDcluster &c) |
bbf92647 | 91 | { |
92 | // | |
93 | // Copy constructor | |
94 | // | |
95 | ||
a2b90f83 | 96 | ((AliTRDcluster &) c).Copy(*this); |
97 | ||
98 | } | |
99 | ||
100 | //_____________________________________________________________________________ | |
101 | AliTRDcluster::~AliTRDcluster() | |
102 | { | |
103 | // | |
104 | // AliTRDcluster destructor | |
105 | // | |
106 | ||
107 | } | |
108 | ||
109 | //_____________________________________________________________________________ | |
110 | AliTRDcluster &AliTRDcluster::operator=(const AliTRDcluster &c) | |
111 | { | |
112 | // | |
113 | // Assignment operator | |
114 | // | |
115 | ||
116 | if (this != &c) ((AliTRDcluster &) c).Copy(*this); | |
117 | return *this; | |
118 | ||
119 | } | |
120 | ||
121 | //_____________________________________________________________________________ | |
122 | void AliTRDcluster::Copy(TObject &c) | |
123 | { | |
124 | // | |
125 | // Copy function | |
126 | // | |
127 | ||
128 | ((AliTRDcluster &) c).fDetector = fDetector; | |
129 | ((AliTRDcluster &) c).fTimeBin = fTimeBin; | |
bbf92647 | 130 | |
a2b90f83 | 131 | ((AliTRDcluster &) c).fTracks[0] = fTracks[0]; |
132 | ((AliTRDcluster &) c).fTracks[1] = fTracks[1]; | |
133 | ((AliTRDcluster &) c).fTracks[2] = fTracks[2]; | |
bbf92647 | 134 | |
a2b90f83 | 135 | ((AliTRDcluster &) c).fQ = fQ; |
136 | ||
137 | ((AliTRDcluster &) c).fY = fY; | |
138 | ((AliTRDcluster &) c).fZ = fZ; | |
139 | ((AliTRDcluster &) c).fSigmaY2 = fSigmaY2; | |
140 | ((AliTRDcluster &) c).fSigmaZ2 = fSigmaZ2; | |
141 | ||
142 | } | |
143 | ||
144 | ||
145 | //_____________________________________________________________________________ | |
146 | void AliTRDcluster::AddTrackIndex(Int_t *track) | |
147 | { | |
148 | // | |
149 | // Adds track index. Currently assumed that track is an array of | |
150 | // size 9, and up to 3 track indexes are stored in fTracks[3]. | |
151 | // Indexes are sorted according to: | |
152 | // 1) index of max number of appearances is stored first | |
153 | // 2) if two or more indexes appear equal number of times, the lowest | |
154 | // ones are stored first; | |
155 | // | |
bbf92647 | 156 | |
0a29d0f1 | 157 | const Int_t kSize = 9; |
a2b90f83 | 158 | |
0a29d0f1 | 159 | Int_t entries[kSize][2], i, j, index; |
a2b90f83 | 160 | |
0a29d0f1 | 161 | Bool_t indexAdded; |
a2b90f83 | 162 | |
0a29d0f1 | 163 | for (i=0; i<kSize; i++) { |
a2b90f83 | 164 | entries[i][0]=-1; |
165 | entries[i][1]=0; | |
166 | } | |
167 | ||
0a29d0f1 | 168 | for (Int_t k=0; k<kSize; k++) { |
a2b90f83 | 169 | index=track[k]; |
0a29d0f1 | 170 | indexAdded=kFALSE; |
171 | j=0; | |
a2b90f83 | 172 | if (index >= 0) { |
0a29d0f1 | 173 | while ( (!indexAdded) && ( j < kSize ) ) { |
a2b90f83 | 174 | if ((entries[j][0]==index) || (entries[j][1]==0)) { |
175 | entries[j][0]=index; | |
176 | entries[j][1]=entries[j][1]+1; | |
0a29d0f1 | 177 | indexAdded=kTRUE; |
a2b90f83 | 178 | } |
179 | j++; | |
180 | } | |
181 | } | |
182 | } | |
183 | ||
184 | // sort by number of appearances and index value | |
185 | Int_t swap=1, tmp0, tmp1; | |
186 | while ( swap > 0) { | |
187 | swap=0; | |
0a29d0f1 | 188 | for(i=0; i<(kSize-1); i++) { |
a2b90f83 | 189 | if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) { |
190 | if ((entries[i][1] < entries[i+1][1]) || | |
191 | ((entries[i][1] == entries[i+1][1]) && | |
192 | (entries[i][0] > entries[i+1][0]))) { | |
193 | tmp0=entries[i][0]; | |
194 | tmp1=entries[i][1]; | |
195 | entries[i][0]=entries[i+1][0]; | |
196 | entries[i][1]=entries[i+1][1]; | |
197 | entries[i+1][0]=tmp0; | |
198 | entries[i+1][1]=tmp1; | |
199 | swap++; | |
200 | } | |
201 | } | |
202 | } | |
203 | } | |
204 | ||
205 | // set track indexes | |
206 | for(i=0; i<3; i++) { | |
207 | fTracks[i] = entries[i][0]; | |
208 | } | |
209 | ||
210 | return; | |
46d29e70 | 211 | |
212 | } | |
213 |