]>
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 | ||
88cb7938 | 16 | /* $Id$ */ |
b9d0a01d | 17 | |
88cb7938 | 18 | |
19 | /////////////////////////////////////////////////////////////////////////////// | |
20 | // // | |
21 | // TRD cluster // | |
22 | // // | |
23 | /////////////////////////////////////////////////////////////////////////////// | |
46d29e70 | 24 | |
25 | #include "AliTRDcluster.h" | |
46d29e70 | 26 | #include "AliTRDrecPoint.h" |
27 | ||
46d29e70 | 28 | ClassImp(AliTRDcluster) |
bdb68f8c | 29 | |
30 | ||
31 | //___________________________________________________________________________ | |
32 | ||
33 | AliTRDcluster::AliTRDcluster() : AliCluster() { | |
34 | // | |
35 | // default constructor | |
36 | // | |
37 | fQ=0; | |
38 | fTimeBin=0; | |
39 | fDetector=0; | |
40 | fNPads=0; | |
aa504dc7 | 41 | fX =0; |
bdb68f8c | 42 | for (Int_t i = 0;i<7; i++) fSignals[i]=0; |
43 | } | |
46d29e70 | 44 | //_____________________________________________________________________________ |
5443e65e | 45 | AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p):AliCluster() |
46d29e70 | 46 | { |
47 | // | |
a2b90f83 | 48 | // Constructor from AliTRDrecPoint |
46d29e70 | 49 | // |
50 | ||
a2b90f83 | 51 | fDetector = p.GetDetector(); |
52 | fTimeBin = p.GetLocalTimeBin(); | |
46d29e70 | 53 | |
a2b90f83 | 54 | fTracks[0] = p.GetTrackIndex(0); |
55 | fTracks[1] = p.GetTrackIndex(1); | |
56 | fTracks[2] = p.GetTrackIndex(2); | |
46d29e70 | 57 | |
a2b90f83 | 58 | fQ = p.GetEnergy(); |
46d29e70 | 59 | |
a2b90f83 | 60 | fY = p.GetY(); |
61 | fZ = p.GetZ(); | |
62 | fSigmaY2 = p.GetSigmaY2(); | |
63 | fSigmaZ2 = p.GetSigmaZ2(); | |
46d29e70 | 64 | |
bbf92647 | 65 | fSigmaY2 = 0.2; |
66 | fSigmaZ2 = 5.; | |
4f1c04d3 | 67 | fNPads =0; |
54d12e2f | 68 | fCenter = 0; |
bbf92647 | 69 | } |
70 | ||
71 | //_____________________________________________________________________________ | |
5443e65e | 72 | AliTRDcluster::AliTRDcluster(const AliTRDcluster &c):AliCluster() |
bbf92647 | 73 | { |
74 | // | |
75 | // Copy constructor | |
76 | // | |
77 | ||
5443e65e | 78 | fTracks[0] = c.GetLabel(0); |
79 | fTracks[1] = c.GetLabel(1); | |
80 | fTracks[2] = c.GetLabel(2); | |
a2b90f83 | 81 | |
3551db50 | 82 | fX = c.GetX(); |
5443e65e | 83 | fY = c.GetY(); |
84 | fZ = c.GetZ(); | |
85 | fSigmaY2 = c.GetSigmaY2(); | |
86 | fSigmaZ2 = c.GetSigmaZ2(); | |
a2b90f83 | 87 | |
5443e65e | 88 | fDetector = c.GetDetector(); |
89 | fTimeBin = c.GetLocalTimeBin(); | |
90 | fQ = c.GetQ(); | |
4f1c04d3 | 91 | fNPads = c.fNPads; |
54d12e2f | 92 | fCenter = c.fCenter; |
bdb68f8c | 93 | for (Int_t i=0;i<7;i++) fSignals[i] = c.fSignals[i]; |
a2b90f83 | 94 | } |
95 | ||
a2b90f83 | 96 | //_____________________________________________________________________________ |
97 | void AliTRDcluster::AddTrackIndex(Int_t *track) | |
98 | { | |
99 | // | |
100 | // Adds track index. Currently assumed that track is an array of | |
101 | // size 9, and up to 3 track indexes are stored in fTracks[3]. | |
102 | // Indexes are sorted according to: | |
103 | // 1) index of max number of appearances is stored first | |
104 | // 2) if two or more indexes appear equal number of times, the lowest | |
105 | // ones are stored first; | |
106 | // | |
bbf92647 | 107 | |
88cb7938 | 108 | const Int_t kSize = 9; |
a2b90f83 | 109 | |
88cb7938 | 110 | Int_t entries[kSize][2], i, j, index; |
a2b90f83 | 111 | |
88cb7938 | 112 | Bool_t indexAdded; |
a2b90f83 | 113 | |
88cb7938 | 114 | for (i=0; i<kSize; i++) { |
a2b90f83 | 115 | entries[i][0]=-1; |
116 | entries[i][1]=0; | |
5443e65e | 117 | } |
a2b90f83 | 118 | |
88cb7938 | 119 | for (Int_t k=0; k<kSize; k++) { |
a2b90f83 | 120 | index=track[k]; |
88cb7938 | 121 | indexAdded=kFALSE; |
122 | j=0; | |
a2b90f83 | 123 | if (index >= 0) { |
88cb7938 | 124 | while ( (!indexAdded) && ( j < kSize ) ) { |
a2b90f83 | 125 | if ((entries[j][0]==index) || (entries[j][1]==0)) { |
126 | entries[j][0]=index; | |
127 | entries[j][1]=entries[j][1]+1; | |
88cb7938 | 128 | indexAdded=kTRUE; |
a2b90f83 | 129 | } |
130 | j++; | |
131 | } | |
132 | } | |
5443e65e | 133 | } |
a2b90f83 | 134 | |
135 | // sort by number of appearances and index value | |
136 | Int_t swap=1, tmp0, tmp1; | |
137 | while ( swap > 0) { | |
138 | swap=0; | |
88cb7938 | 139 | for(i=0; i<(kSize-1); i++) { |
a2b90f83 | 140 | if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) { |
141 | if ((entries[i][1] < entries[i+1][1]) || | |
142 | ((entries[i][1] == entries[i+1][1]) && | |
143 | (entries[i][0] > entries[i+1][0]))) { | |
144 | tmp0=entries[i][0]; | |
145 | tmp1=entries[i][1]; | |
146 | entries[i][0]=entries[i+1][0]; | |
147 | entries[i][1]=entries[i+1][1]; | |
148 | entries[i+1][0]=tmp0; | |
149 | entries[i+1][1]=tmp1; | |
150 | swap++; | |
151 | } | |
152 | } | |
153 | } | |
5443e65e | 154 | } |
a2b90f83 | 155 | |
156 | // set track indexes | |
5443e65e | 157 | for(i=0; i<3; i++) SetLabel(entries[i][0],i); |
a2b90f83 | 158 | |
159 | return; | |
46d29e70 | 160 | |
5443e65e | 161 | } |
46d29e70 | 162 | |
bdb68f8c | 163 | void AliTRDcluster::SetSignals(Short_t*signals){ |
164 | // | |
165 | // write signals in the cluster | |
166 | // | |
167 | for (Int_t i = 0;i<7;i++) fSignals[i]=signals[i]; | |
168 | } | |
169 | ||
170 | Float_t AliTRDcluster::GetSumS() const | |
171 | { | |
172 | // | |
173 | // return total charge in non unfolded cluster | |
174 | // | |
175 | Float_t sum=0; | |
176 | for (Int_t i = 0;i<7;i++) sum+=fSignals[i]; | |
177 | return sum; | |
178 | } | |
179 | Float_t AliTRDcluster::GetCenterS() const | |
180 | { | |
181 | // | |
182 | // | |
183 | // | |
184 | Float_t sum=0; | |
185 | Float_t sum2=0; | |
186 | for (Int_t i = 0;i<7;i++) { | |
187 | sum+=fSignals[i]; | |
188 | sum2+=i*fSignals[i]; | |
189 | } | |
190 | if (sum>0) return sum2/sum-2; | |
191 | return 0; | |
192 | ||
193 | } |