]>
Commit | Line | Data |
---|---|---|
f7336fa3 | 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$ | |
a819a5f7 | 18 | Revision 1.8 2001/05/07 08:06:44 cblume |
19 | Speedup of the code. Create only AliTRDcluster | |
20 | ||
3e1a3ad8 | 21 | Revision 1.7 2001/02/14 18:22:26 cblume |
22 | Change in the geometry of the padplane | |
23 | ||
71d9fa7b | 24 | Revision 1.6 2000/11/01 14:53:20 cblume |
25 | Merge with TRD-develop | |
26 | ||
793ff80c | 27 | Revision 1.1.4.6 2000/10/16 01:16:53 cblume |
28 | Changed timebin 0 to be the one closest to the readout | |
29 | ||
30 | Revision 1.1.4.5 2000/10/15 23:40:01 cblume | |
31 | Remove AliTRDconst | |
32 | ||
33 | Revision 1.1.4.4 2000/10/06 16:49:46 cblume | |
34 | Made Getters const | |
35 | ||
36 | Revision 1.1.4.3 2000/10/04 16:34:58 cblume | |
37 | Replace include files by forward declarations | |
38 | ||
39 | Revision 1.1.4.2 2000/09/22 14:49:49 cblume | |
40 | Adapted to tracking code | |
41 | ||
42 | Revision 1.5 2000/10/02 21:28:19 fca | |
43 | Removal of useless dependecies via forward declarations | |
44 | ||
45 | Revision 1.4 2000/06/08 18:32:58 cblume | |
46 | Make code compliant to coding conventions | |
47 | ||
48 | Revision 1.3 2000/06/07 16:27:01 cblume | |
49 | Try to remove compiler warnings on Sun and HP | |
50 | ||
51 | Revision 1.2 2000/05/08 16:17:27 cblume | |
52 | Merge TRD-develop | |
53 | ||
54 | Revision 1.1.4.1 2000/05/08 15:08:41 cblume | |
55 | Replace AliTRDcluster by AliTRDrecPoint | |
56 | ||
94de3818 | 57 | Revision 1.4 2000/06/08 18:32:58 cblume |
58 | Make code compliant to coding conventions | |
59 | ||
8230f242 | 60 | Revision 1.3 2000/06/07 16:27:01 cblume |
61 | Try to remove compiler warnings on Sun and HP | |
62 | ||
9d0b222b | 63 | Revision 1.2 2000/05/08 16:17:27 cblume |
64 | Merge TRD-develop | |
65 | ||
6f1e466d | 66 | Revision 1.1.4.1 2000/05/08 15:08:41 cblume |
67 | Replace AliTRDcluster by AliTRDrecPoint | |
68 | ||
69 | Revision 1.1 2000/02/28 18:58:33 cblume | |
70 | Add new TRD classes | |
71 | ||
f7336fa3 | 72 | */ |
73 | ||
74 | /////////////////////////////////////////////////////////////////////////////// | |
75 | // // | |
76 | // TRD cluster finder for the fast simulator. It takes the hits from the // | |
77 | // fast simulator (one hit per plane) and transforms them // | |
78 | // into cluster, by applying position smearing and merging // | |
79 | // of nearby cluster. The searing is done uniformly in z-direction // | |
80 | // over the length of a readout pad. In rphi-direction a Gaussian // | |
81 | // smearing is applied with a sigma given by fRphiSigma. // | |
82 | // Clusters are considered as overlapping when they are closer in // | |
83 | // rphi-direction than the value defined in fRphiDist. // | |
84 | // Use the macro fastClusterCreate.C to create the cluster. // | |
85 | // // | |
86 | /////////////////////////////////////////////////////////////////////////////// | |
87 | ||
88 | #include <TRandom.h> | |
94de3818 | 89 | #include <TTree.h> |
793ff80c | 90 | |
91 | #include "AliRun.h" | |
f7336fa3 | 92 | |
793ff80c | 93 | #include "AliTRD.h" |
f7336fa3 | 94 | #include "AliTRDclusterizerV0.h" |
793ff80c | 95 | #include "AliTRDhit.h" |
f7336fa3 | 96 | #include "AliTRDgeometry.h" |
97 | #include "AliTRDrecPoint.h" | |
98 | ||
99 | ClassImp(AliTRDclusterizerV0) | |
100 | ||
101 | //_____________________________________________________________________________ | |
102 | AliTRDclusterizerV0::AliTRDclusterizerV0():AliTRDclusterizer() | |
103 | { | |
104 | // | |
105 | // AliTRDclusterizerV0 default constructor | |
106 | // | |
107 | ||
108 | } | |
109 | ||
110 | //_____________________________________________________________________________ | |
111 | AliTRDclusterizerV0::AliTRDclusterizerV0(const Text_t* name, const Text_t* title) | |
112 | :AliTRDclusterizer(name,title) | |
113 | { | |
114 | // | |
115 | // AliTRDclusterizerV0 default constructor | |
116 | // | |
117 | ||
118 | Init(); | |
119 | ||
120 | } | |
121 | ||
122 | //_____________________________________________________________________________ | |
123 | AliTRDclusterizerV0::~AliTRDclusterizerV0() | |
124 | { | |
8230f242 | 125 | // |
126 | // AliTRDclusterizerV0 destructor | |
127 | // | |
f7336fa3 | 128 | |
129 | } | |
130 | ||
131 | //_____________________________________________________________________________ | |
132 | void AliTRDclusterizerV0::Init() | |
133 | { | |
134 | // | |
135 | // Initializes the cluster finder | |
136 | // | |
137 | ||
138 | // Position resolution in rphi-direction | |
139 | fRphiSigma = 0.02; | |
140 | // Minimum distance of non-overlapping cluster | |
141 | fRphiDist = 1.0; | |
142 | ||
143 | } | |
144 | ||
145 | //_____________________________________________________________________________ | |
793ff80c | 146 | Bool_t AliTRDclusterizerV0::MakeClusters() |
f7336fa3 | 147 | { |
148 | // | |
149 | // Generates the cluster | |
150 | // | |
151 | ||
3e1a3ad8 | 152 | if (fTRD->IsVersion() != 0) { |
f7336fa3 | 153 | printf("AliTRDclusterizerV0::MakeCluster -- "); |
154 | printf("TRD must be version 0 (fast simulator).\n"); | |
155 | return kFALSE; | |
156 | } | |
157 | ||
158 | // Get the geometry | |
3e1a3ad8 | 159 | AliTRDgeometry *geo = fTRD->GetGeometry(); |
f7336fa3 | 160 | |
161 | printf("AliTRDclusterizerV0::MakeCluster -- "); | |
162 | printf("Start creating cluster.\n"); | |
163 | ||
164 | Int_t nBytes = 0; | |
165 | ||
8230f242 | 166 | AliTRDhit *hit; |
f7336fa3 | 167 | |
168 | // Get the pointer to the hit tree | |
8230f242 | 169 | TTree *hitTree = gAlice->TreeH(); |
f7336fa3 | 170 | // Get the pointer to the reconstruction tree |
8230f242 | 171 | TTree *clusterTree = gAlice->TreeR(); |
f7336fa3 | 172 | |
8230f242 | 173 | TObjArray *chamberArray = new TObjArray(); |
f7336fa3 | 174 | |
175 | // Get the number of entries in the hit tree | |
176 | // (Number of primary particles creating a hit somewhere) | |
8230f242 | 177 | Int_t nTrack = (Int_t) hitTree->GetEntries(); |
f7336fa3 | 178 | |
179 | // Loop through all the chambers | |
793ff80c | 180 | for (Int_t icham = 0; icham < AliTRDgeometry::Ncham(); icham++) { |
181 | for (Int_t iplan = 0; iplan < AliTRDgeometry::Nplan(); iplan++) { | |
182 | for (Int_t isect = 0; isect < AliTRDgeometry::Nsect(); isect++) { | |
f7336fa3 | 183 | |
8230f242 | 184 | Int_t nColMax = geo->GetColMax(iplan); |
185 | Float_t row0 = geo->GetRow0(iplan,icham,isect); | |
186 | Float_t col0 = geo->GetCol0(iplan); | |
187 | Float_t time0 = geo->GetTime0(iplan); | |
f7336fa3 | 188 | |
71d9fa7b | 189 | Float_t rowPadSize = geo->GetRowPadSize(iplan,icham,isect); |
190 | Float_t colPadSize = geo->GetColPadSize(iplan); | |
8230f242 | 191 | Float_t timeBinSize = geo->GetTimeBinSize(); |
f7336fa3 | 192 | |
193 | // Loop through all entries in the tree | |
194 | for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) { | |
195 | ||
196 | gAlice->ResetHits(); | |
8230f242 | 197 | nBytes += hitTree->GetEvent(iTrack); |
f7336fa3 | 198 | |
199 | // Get the number of hits in the TRD created by this particle | |
3e1a3ad8 | 200 | Int_t nHit = fTRD->Hits()->GetEntriesFast(); |
f7336fa3 | 201 | |
202 | // Loop through the TRD hits | |
203 | for (Int_t iHit = 0; iHit < nHit; iHit++) { | |
204 | ||
3e1a3ad8 | 205 | if (!(hit = (AliTRDhit *) fTRD->Hits()->UncheckedAt(iHit))) |
f7336fa3 | 206 | continue; |
207 | ||
208 | Float_t pos[3]; | |
94de3818 | 209 | pos[0] = hit->X(); |
210 | pos[1] = hit->Y(); | |
211 | pos[2] = hit->Z(); | |
212 | Int_t track = hit->Track(); | |
8230f242 | 213 | Int_t detector = hit->GetDetector(); |
214 | Int_t plane = geo->GetPlane(detector); | |
215 | Int_t sector = geo->GetSector(detector); | |
216 | Int_t chamber = geo->GetChamber(detector); | |
f7336fa3 | 217 | |
218 | if ((sector != isect) || | |
219 | (plane != iplan) || | |
220 | (chamber != icham)) | |
221 | continue; | |
222 | ||
223 | // Rotate the sectors on top of each other | |
224 | Float_t rot[3]; | |
8230f242 | 225 | geo->Rotate(detector,pos,rot); |
f7336fa3 | 226 | |
6f1e466d | 227 | // Add this recPoint to the temporary array for this chamber |
8230f242 | 228 | AliTRDrecPoint *recPoint = new AliTRDrecPoint(); |
229 | recPoint->SetLocalRow(rot[2]); | |
230 | recPoint->SetLocalCol(rot[1]); | |
231 | recPoint->SetLocalTime(rot[0]); | |
232 | recPoint->SetEnergy(0); | |
233 | recPoint->SetDetector(detector); | |
234 | recPoint->AddDigit(track); | |
235 | chamberArray->Add(recPoint); | |
f7336fa3 | 236 | |
237 | } | |
238 | ||
239 | } | |
240 | ||
241 | // Loop through the temporary cluster-array | |
8230f242 | 242 | for (Int_t iClus1 = 0; iClus1 < chamberArray->GetEntries(); iClus1++) { |
f7336fa3 | 243 | |
8230f242 | 244 | AliTRDrecPoint *recPoint1 = (AliTRDrecPoint *) |
245 | chamberArray->UncheckedAt(iClus1); | |
246 | Float_t row1 = recPoint1->GetLocalRow(); | |
247 | Float_t col1 = recPoint1->GetLocalCol(); | |
248 | Float_t time1 = recPoint1->GetLocalTime(); | |
f7336fa3 | 249 | |
8230f242 | 250 | if (recPoint1->GetEnergy() < 0) continue; // Skip marked cluster |
f7336fa3 | 251 | |
8230f242 | 252 | const Int_t kNsave = 5; |
253 | Int_t idxSave[kNsave]; | |
f7336fa3 | 254 | Int_t iSave = 0; |
255 | ||
8230f242 | 256 | const Int_t kNsaveTrack = 3; |
257 | Int_t tracks[kNsaveTrack]; | |
258 | tracks[0] = recPoint1->GetDigit(0); | |
f7336fa3 | 259 | |
260 | // Check the other cluster to see, whether there are close ones | |
8230f242 | 261 | for (Int_t iClus2 = iClus1 + 1; iClus2 < chamberArray->GetEntries(); iClus2++) { |
6f1e466d | 262 | |
8230f242 | 263 | AliTRDrecPoint *recPoint2 = (AliTRDrecPoint *) |
264 | chamberArray->UncheckedAt(iClus2); | |
265 | Float_t row2 = recPoint2->GetLocalRow(); | |
266 | Float_t col2 = recPoint2->GetLocalCol(); | |
6f1e466d | 267 | |
268 | if ((TMath::Abs(row1 - row2) < rowPadSize) || | |
269 | (TMath::Abs(col1 - col2) < fRphiDist)) { | |
8230f242 | 270 | if (iSave == kNsave) { |
f7336fa3 | 271 | printf("AliTRDclusterizerV0::MakeCluster -- "); |
8230f242 | 272 | printf("Boundary error: iSave = %d, kNsave = %d.\n" |
273 | ,iSave,kNsave); | |
f7336fa3 | 274 | } |
6f1e466d | 275 | else { |
f7336fa3 | 276 | idxSave[iSave] = iClus2; |
6f1e466d | 277 | iSave++; |
8230f242 | 278 | if (iSave < kNsaveTrack) tracks[iSave] = recPoint2->GetDigit(0); |
f7336fa3 | 279 | } |
f7336fa3 | 280 | } |
281 | } | |
282 | ||
283 | // Merge close cluster | |
6f1e466d | 284 | Float_t rowMerge = row1; |
285 | Float_t colMerge = col1; | |
f7336fa3 | 286 | if (iSave) { |
287 | for (Int_t iMerge = 0; iMerge < iSave; iMerge++) { | |
8230f242 | 288 | AliTRDrecPoint *recPoint2 = |
289 | (AliTRDrecPoint *) chamberArray->UncheckedAt(idxSave[iMerge]); | |
290 | rowMerge += recPoint2->GetLocalRow(); | |
291 | colMerge += recPoint2->GetLocalCol(); | |
292 | recPoint2->SetEnergy(-1); // Mark merged cluster | |
f7336fa3 | 293 | } |
6f1e466d | 294 | rowMerge /= (iSave + 1); |
295 | colMerge /= (iSave + 1); | |
f7336fa3 | 296 | } |
297 | ||
298 | Float_t smear[3]; | |
299 | ||
6f1e466d | 300 | // The position smearing in row-direction (uniform over pad width) |
301 | Int_t row = (Int_t) ((rowMerge - row0) / rowPadSize); | |
f7336fa3 | 302 | smear[0] = (row + gRandom->Rndm()) * rowPadSize + row0; |
303 | ||
304 | // The position smearing in rphi-direction (Gaussian) | |
305 | smear[1] = 0; | |
306 | do | |
6f1e466d | 307 | smear[1] = gRandom->Gaus(colMerge,fRphiSigma); |
f7336fa3 | 308 | while ((smear[1] < col0 ) || |
309 | (smear[1] > col0 + nColMax * colPadSize)); | |
310 | ||
311 | // Time direction stays unchanged | |
6f1e466d | 312 | smear[2] = time1; |
313 | ||
314 | // Transform into local coordinates | |
315 | smear[0] = (Int_t) ((smear[0] - row0) / rowPadSize); | |
316 | smear[1] = (Int_t) ((smear[1] - col0) / colPadSize); | |
793ff80c | 317 | smear[2] = (Int_t) ((time0 - smear[2]) / timeBinSize); |
f7336fa3 | 318 | |
319 | // Add the smeared cluster to the output array | |
8230f242 | 320 | Int_t detector = recPoint1->GetDetector(); |
f7336fa3 | 321 | Int_t digits[3] = {0}; |
793ff80c | 322 | Int_t tr[9] = {-1}; |
a819a5f7 | 323 | fTRD->AddCluster(smear,digits,detector,0.0,tr,0,0); |
f7336fa3 | 324 | |
325 | } | |
326 | ||
327 | // Clear the temporary cluster-array and delete the cluster | |
8230f242 | 328 | chamberArray->Delete(); |
f7336fa3 | 329 | |
330 | } | |
331 | } | |
332 | } | |
333 | ||
334 | printf("AliTRDclusterizerV0::MakeCluster -- "); | |
3e1a3ad8 | 335 | printf("Found %d points.\n",fTRD->RecPoints()->GetEntries()); |
f7336fa3 | 336 | printf("AliTRDclusterizerV0::MakeCluster -- "); |
337 | printf("Fill the cluster tree.\n"); | |
8230f242 | 338 | clusterTree->Fill(); |
f7336fa3 | 339 | |
340 | return kTRUE; | |
341 | ||
342 | } |