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