]>
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$ | |
b9d0a01d | 18 | Revision 1.4.10.2 2002/07/24 10:09:30 alibrary |
19 | Updating VirtualMC | |
20 | ||
21 | Revision 1.6 2002/06/12 09:54:35 cblume | |
22 | Update of tracking code provided by Sergei | |
23 | ||
0a29d0f1 | 24 | Revision 1.4 2001/05/07 08:08:05 cblume |
25 | Update of TRD code | |
26 | ||
a2b90f83 | 27 | Revision 1.3 2000/12/08 16:07:02 cblume |
28 | Update of the tracking by Sergei | |
29 | ||
bbf92647 | 30 | Revision 1.2 2000/10/06 16:49:46 cblume |
31 | Made Getters const | |
32 | ||
46d29e70 | 33 | Revision 1.1.2.1 2000/09/22 14:47:52 cblume |
34 | Add the tracking code | |
35 | ||
36 | */ | |
37 | ||
38 | #include "AliTRDcluster.h" | |
5443e65e | 39 | #include "AliTRDgeometry.h" |
46d29e70 | 40 | #include "AliTRDrecPoint.h" |
41 | ||
46d29e70 | 42 | ClassImp(AliTRDcluster) |
43 | ||
46d29e70 | 44 | |
45 | //_____________________________________________________________________________ | |
5443e65e | 46 | AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p):AliCluster() |
46d29e70 | 47 | { |
48 | // | |
a2b90f83 | 49 | // Constructor from AliTRDrecPoint |
46d29e70 | 50 | // |
51 | ||
a2b90f83 | 52 | fDetector = p.GetDetector(); |
53 | fTimeBin = p.GetLocalTimeBin(); | |
46d29e70 | 54 | |
a2b90f83 | 55 | fTracks[0] = p.GetTrackIndex(0); |
56 | fTracks[1] = p.GetTrackIndex(1); | |
57 | fTracks[2] = p.GetTrackIndex(2); | |
46d29e70 | 58 | |
a2b90f83 | 59 | fQ = p.GetEnergy(); |
46d29e70 | 60 | |
a2b90f83 | 61 | fY = p.GetY(); |
62 | fZ = p.GetZ(); | |
63 | fSigmaY2 = p.GetSigmaY2(); | |
64 | fSigmaZ2 = p.GetSigmaZ2(); | |
46d29e70 | 65 | |
bbf92647 | 66 | fSigmaY2 = 0.2; |
67 | fSigmaZ2 = 5.; | |
68 | ||
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 | |
5443e65e | 82 | fY = c.GetY(); |
83 | fZ = c.GetZ(); | |
84 | fSigmaY2 = c.GetSigmaY2(); | |
85 | fSigmaZ2 = c.GetSigmaZ2(); | |
a2b90f83 | 86 | |
5443e65e | 87 | fDetector = c.GetDetector(); |
88 | fTimeBin = c.GetLocalTimeBin(); | |
89 | fQ = c.GetQ(); | |
a2b90f83 | 90 | |
91 | } | |
92 | ||
a2b90f83 | 93 | //_____________________________________________________________________________ |
94 | void AliTRDcluster::AddTrackIndex(Int_t *track) | |
95 | { | |
96 | // | |
97 | // Adds track index. Currently assumed that track is an array of | |
98 | // size 9, and up to 3 track indexes are stored in fTracks[3]. | |
99 | // Indexes are sorted according to: | |
100 | // 1) index of max number of appearances is stored first | |
101 | // 2) if two or more indexes appear equal number of times, the lowest | |
102 | // ones are stored first; | |
103 | // | |
bbf92647 | 104 | |
5443e65e | 105 | const Int_t size = 9; |
a2b90f83 | 106 | |
5443e65e | 107 | Int_t entries[size][2], i, j, index; |
a2b90f83 | 108 | |
5443e65e | 109 | Bool_t index_added; |
a2b90f83 | 110 | |
5443e65e | 111 | for (i=0; i<size; i++) { |
a2b90f83 | 112 | entries[i][0]=-1; |
113 | entries[i][1]=0; | |
5443e65e | 114 | } |
a2b90f83 | 115 | |
5443e65e | 116 | for (Int_t k=0; k<size; k++) { |
a2b90f83 | 117 | index=track[k]; |
5443e65e | 118 | index_added=kFALSE; j=0; |
a2b90f83 | 119 | if (index >= 0) { |
5443e65e | 120 | while ( (!index_added) && ( j < size ) ) { |
a2b90f83 | 121 | if ((entries[j][0]==index) || (entries[j][1]==0)) { |
122 | entries[j][0]=index; | |
123 | entries[j][1]=entries[j][1]+1; | |
5443e65e | 124 | index_added=kTRUE; |
a2b90f83 | 125 | } |
126 | j++; | |
127 | } | |
128 | } | |
5443e65e | 129 | } |
a2b90f83 | 130 | |
131 | // sort by number of appearances and index value | |
132 | Int_t swap=1, tmp0, tmp1; | |
133 | while ( swap > 0) { | |
134 | swap=0; | |
5443e65e | 135 | for(i=0; i<(size-1); i++) { |
a2b90f83 | 136 | if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) { |
137 | if ((entries[i][1] < entries[i+1][1]) || | |
138 | ((entries[i][1] == entries[i+1][1]) && | |
139 | (entries[i][0] > entries[i+1][0]))) { | |
140 | tmp0=entries[i][0]; | |
141 | tmp1=entries[i][1]; | |
142 | entries[i][0]=entries[i+1][0]; | |
143 | entries[i][1]=entries[i+1][1]; | |
144 | entries[i+1][0]=tmp0; | |
145 | entries[i+1][1]=tmp1; | |
146 | swap++; | |
147 | } | |
148 | } | |
149 | } | |
5443e65e | 150 | } |
a2b90f83 | 151 | |
152 | // set track indexes | |
5443e65e | 153 | for(i=0; i<3; i++) SetLabel(entries[i][0],i); |
a2b90f83 | 154 | |
155 | return; | |
46d29e70 | 156 | |
5443e65e | 157 | } |
46d29e70 | 158 |