]>
Commit | Line | Data |
---|---|---|
7ca4655f | 1 | /************************************************************************** |
eefb3acc | 2 | * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * |
7ca4655f | 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 | /* $Id$ */ | |
17 | ||
ac903f1b | 18 | //____________________________________________________________________ |
19 | // | |
20 | // AliITSMultReconstructor - find clusters in the pixels (theta and | |
21 | // phi) and tracklets. | |
22 | // | |
23 | // These can be used to extract charged particles multiplcicity from the ITS. | |
24 | // | |
25 | // A tracklet consist of two ITS clusters, one in the first pixel | |
26 | // layer and one in the second. The clusters are associates if the | |
27 | // differencies in Phi (azimuth) and Zeta (longitudinal) are inside | |
28 | // a fiducial volume. In case of multiple candidates it is selected the | |
29 | // candidate with minimum distance in Phi. | |
de4c520e | 30 | // The parameter AssociationChoice allows to control if two clusters |
ac903f1b | 31 | // in layer 2 can be associated to the same cluster in layer 1 or not. |
02a95988 | 32 | // (TRUE means double associations exluded; default = TRUE) |
ac903f1b | 33 | // |
968e8539 | 34 | // Two methods return the number of traklets and the number of clusters |
35 | // in the first SPD layer (GetNTracklets GetNSingleClusters) | |
36 | // | |
ac903f1b | 37 | // ----------------------------------------------------------------- |
38 | // | |
02a95988 | 39 | // NOTE: The cuts on phi and zeta depend on the interacting system (p-p |
3ef75756 | 40 | // or Pb-Pb). Please, check the file AliITSMultReconstructor.h and be |
41 | // sure that SetPhiWindow and SetZetaWindow are defined accordingly. | |
ac903f1b | 42 | // |
968e8539 | 43 | // Author : Tiziano Virgili |
3ef75756 | 44 | // |
f606f16a | 45 | // Recent updates (D. Elia, INFN Bari): |
46 | // - multiple association forbidden (fOnlyOneTrackletPerC2 = kTRUE) | |
47 | // - phi definition changed to ALICE convention (0,2*TMath::pi()) | |
48 | // - cluster coordinates taken with GetGlobalXYZ() | |
9b373e9a | 49 | // - fGeometry removed |
50 | // - number of fired chips on the two layers | |
ac903f1b | 51 | // |
52 | //____________________________________________________________________ | |
53 | ||
7ca4655f | 54 | #include <TClonesArray.h> |
55 | #include <TH1F.h> | |
56 | #include <TH2F.h> | |
57 | #include <TTree.h> | |
ac903f1b | 58 | |
7ca4655f | 59 | #include "AliITSMultReconstructor.h" |
9b373e9a | 60 | #include "AliITSsegmentationSPD.h" |
b51872de | 61 | #include "AliITSRecPoint.h" |
ac903f1b | 62 | #include "AliITSgeom.h" |
63 | #include "AliLog.h" | |
64 | ||
65 | //____________________________________________________________________ | |
0762f3a8 | 66 | ClassImp(AliITSMultReconstructor) |
ac903f1b | 67 | |
3ef75756 | 68 | |
ac903f1b | 69 | //____________________________________________________________________ |
7537d03c | 70 | AliITSMultReconstructor::AliITSMultReconstructor(): |
7537d03c | 71 | fClustersLay1(0), |
72 | fClustersLay2(0), | |
73 | fTracklets(0), | |
968e8539 | 74 | fSClusters(0), |
7537d03c | 75 | fAssociationFlag(0), |
76 | fNClustersLay1(0), | |
77 | fNClustersLay2(0), | |
78 | fNTracklets(0), | |
968e8539 | 79 | fNSingleCluster(0), |
7537d03c | 80 | fPhiWindow(0), |
81 | fZetaWindow(0), | |
82 | fOnlyOneTrackletPerC2(0), | |
83 | fHistOn(0), | |
84 | fhClustersDPhiAcc(0), | |
85 | fhClustersDThetaAcc(0), | |
86 | fhClustersDZetaAcc(0), | |
87 | fhClustersDPhiAll(0), | |
88 | fhClustersDThetaAll(0), | |
89 | fhClustersDZetaAll(0), | |
90 | fhDPhiVsDThetaAll(0), | |
91 | fhDPhiVsDThetaAcc(0), | |
92 | fhDPhiVsDZetaAll(0), | |
93 | fhDPhiVsDZetaAcc(0), | |
94 | fhetaTracklets(0), | |
95 | fhphiTracklets(0), | |
96 | fhetaClustersLay1(0), | |
97 | fhphiClustersLay1(0){ | |
9b373e9a | 98 | |
99 | fNFiredChips[0] = 0; | |
100 | fNFiredChips[1] = 0; | |
101 | ||
3ef75756 | 102 | // Method to reconstruct the charged particles multiplicity with the |
103 | // SPD (tracklets). | |
ac903f1b | 104 | |
ac903f1b | 105 | |
106 | SetHistOn(); | |
107 | SetPhiWindow(); | |
108 | SetZetaWindow(); | |
109 | SetOnlyOneTrackletPerC2(); | |
110 | ||
111 | fClustersLay1 = new Float_t*[300000]; | |
112 | fClustersLay2 = new Float_t*[300000]; | |
113 | fTracklets = new Float_t*[300000]; | |
968e8539 | 114 | fSClusters = new Float_t*[300000]; |
ac903f1b | 115 | fAssociationFlag = new Bool_t[300000]; |
116 | ||
117 | for(Int_t i=0; i<300000; i++) { | |
de4c520e | 118 | fClustersLay1[i] = new Float_t[6]; |
119 | fClustersLay2[i] = new Float_t[6]; | |
0939e22a | 120 | fTracklets[i] = new Float_t[5]; |
968e8539 | 121 | fSClusters[i] = new Float_t[2]; |
ac903f1b | 122 | fAssociationFlag[i] = kFALSE; |
123 | } | |
124 | ||
125 | // definition of histograms | |
02a95988 | 126 | fhClustersDPhiAcc = new TH1F("dphiacc", "dphi", 100,0.,0.1); |
ddced3c8 | 127 | fhClustersDPhiAcc->SetDirectory(0); |
128 | fhClustersDThetaAcc = new TH1F("dthetaacc","dtheta",100,-0.1,0.1); | |
129 | fhClustersDThetaAcc->SetDirectory(0); | |
130 | fhClustersDZetaAcc = new TH1F("dzetaacc","dzeta",100,-1.,1.); | |
131 | fhClustersDZetaAcc->SetDirectory(0); | |
132 | ||
02a95988 | 133 | fhDPhiVsDZetaAcc = new TH2F("dphiVsDzetaacc","",100,-1.,1.,100,0.,0.1); |
ddced3c8 | 134 | fhDPhiVsDZetaAcc->SetDirectory(0); |
02a95988 | 135 | fhDPhiVsDThetaAcc = new TH2F("dphiVsDthetaAcc","",100,-0.1,0.1,100,0.,0.1); |
ac903f1b | 136 | fhDPhiVsDThetaAcc->SetDirectory(0); |
137 | ||
02a95988 | 138 | fhClustersDPhiAll = new TH1F("dphiall", "dphi", 100,0.0,0.5); |
ddced3c8 | 139 | fhClustersDPhiAll->SetDirectory(0); |
140 | fhClustersDThetaAll = new TH1F("dthetaall","dtheta",100,-0.5,0.5); | |
141 | fhClustersDThetaAll->SetDirectory(0); | |
142 | fhClustersDZetaAll = new TH1F("dzetaall","dzeta",100,-5.,5.); | |
143 | fhClustersDZetaAll->SetDirectory(0); | |
144 | ||
02a95988 | 145 | fhDPhiVsDZetaAll = new TH2F("dphiVsDzetaall","",100,-5.,5.,100,0.,0.5); |
ddced3c8 | 146 | fhDPhiVsDZetaAll->SetDirectory(0); |
02a95988 | 147 | fhDPhiVsDThetaAll = new TH2F("dphiVsDthetaAll","",100,-0.5,0.5,100,0.,0.5); |
ddced3c8 | 148 | fhDPhiVsDThetaAll->SetDirectory(0); |
149 | ||
150 | fhetaTracklets = new TH1F("etaTracklets", "eta", 100,-2.,2.); | |
96c2c35d | 151 | fhetaTracklets->SetDirectory(0); |
f606f16a | 152 | fhphiTracklets = new TH1F("phiTracklets", "phi", 100, 0., 2*TMath::Pi()); |
96c2c35d | 153 | fhphiTracklets->SetDirectory(0); |
ddced3c8 | 154 | fhetaClustersLay1 = new TH1F("etaClustersLay1", "etaCl1", 100,-2.,2.); |
96c2c35d | 155 | fhetaClustersLay1->SetDirectory(0); |
f606f16a | 156 | fhphiClustersLay1 = new TH1F("phiClustersLay1", "phiCl1", 100, 0., 2*TMath::Pi()); |
96c2c35d | 157 | fhphiClustersLay1->SetDirectory(0); |
ac903f1b | 158 | } |
ddced3c8 | 159 | |
3ef75756 | 160 | //______________________________________________________________________ |
7537d03c | 161 | AliITSMultReconstructor::AliITSMultReconstructor(const AliITSMultReconstructor &mr) : TObject(mr), |
7537d03c | 162 | fClustersLay1(mr.fClustersLay1), |
163 | fClustersLay2(mr.fClustersLay2), | |
164 | fTracklets(mr.fTracklets), | |
968e8539 | 165 | fSClusters(mr.fSClusters), |
7537d03c | 166 | fAssociationFlag(mr.fAssociationFlag), |
167 | fNClustersLay1(mr.fNClustersLay1), | |
168 | fNClustersLay2(mr.fNClustersLay2), | |
169 | fNTracklets(mr.fNTracklets), | |
968e8539 | 170 | fNSingleCluster(mr.fNSingleCluster), |
7537d03c | 171 | fPhiWindow(mr.fPhiWindow), |
172 | fZetaWindow(mr.fZetaWindow), | |
173 | fOnlyOneTrackletPerC2(mr.fOnlyOneTrackletPerC2), | |
174 | fHistOn(mr.fHistOn), | |
175 | fhClustersDPhiAcc(mr.fhClustersDPhiAcc), | |
176 | fhClustersDThetaAcc(mr.fhClustersDThetaAcc), | |
177 | fhClustersDZetaAcc(mr.fhClustersDZetaAcc), | |
178 | fhClustersDPhiAll(mr.fhClustersDPhiAll), | |
179 | fhClustersDThetaAll(mr.fhClustersDThetaAll), | |
180 | fhClustersDZetaAll(mr.fhClustersDZetaAll), | |
181 | fhDPhiVsDThetaAll(mr.fhDPhiVsDThetaAll), | |
182 | fhDPhiVsDThetaAcc(mr.fhDPhiVsDThetaAcc), | |
183 | fhDPhiVsDZetaAll(mr.fhDPhiVsDZetaAll), | |
184 | fhDPhiVsDZetaAcc(mr.fhDPhiVsDZetaAcc), | |
185 | fhetaTracklets(mr.fhetaTracklets), | |
186 | fhphiTracklets(mr.fhphiTracklets), | |
187 | fhetaClustersLay1(mr.fhetaClustersLay1), | |
188 | fhphiClustersLay1(mr.fhphiClustersLay1) { | |
3ef75756 | 189 | // Copy constructor |
7537d03c | 190 | |
3ef75756 | 191 | } |
192 | ||
193 | //______________________________________________________________________ | |
7537d03c | 194 | AliITSMultReconstructor& AliITSMultReconstructor::operator=(const AliITSMultReconstructor& mr){ |
3ef75756 | 195 | // Assignment operator |
7537d03c | 196 | this->~AliITSMultReconstructor(); |
197 | new(this) AliITSMultReconstructor(mr); | |
3ef75756 | 198 | return *this; |
199 | } | |
200 | ||
201 | //______________________________________________________________________ | |
202 | AliITSMultReconstructor::~AliITSMultReconstructor(){ | |
203 | // Destructor | |
1ba5b31c | 204 | |
205 | // delete histograms | |
206 | delete fhClustersDPhiAcc; | |
207 | delete fhClustersDThetaAcc; | |
208 | delete fhClustersDZetaAcc; | |
209 | delete fhClustersDPhiAll; | |
210 | delete fhClustersDThetaAll; | |
211 | delete fhClustersDZetaAll; | |
212 | delete fhDPhiVsDThetaAll; | |
213 | delete fhDPhiVsDThetaAcc; | |
214 | delete fhDPhiVsDZetaAll; | |
215 | delete fhDPhiVsDZetaAcc; | |
216 | delete fhetaTracklets; | |
217 | delete fhphiTracklets; | |
218 | delete fhetaClustersLay1; | |
219 | delete fhphiClustersLay1; | |
220 | ||
221 | // delete arrays | |
222 | for(Int_t i=0; i<300000; i++) { | |
223 | delete [] fClustersLay1[i]; | |
224 | delete [] fClustersLay2[i]; | |
225 | delete [] fTracklets[i]; | |
968e8539 | 226 | delete [] fSClusters[i]; |
ddced3c8 | 227 | } |
1ba5b31c | 228 | delete [] fClustersLay1; |
229 | delete [] fClustersLay2; | |
230 | delete [] fTracklets; | |
968e8539 | 231 | delete [] fSClusters; |
1ba5b31c | 232 | |
233 | delete [] fAssociationFlag; | |
ddced3c8 | 234 | } |
ac903f1b | 235 | |
236 | //____________________________________________________________________ | |
237 | void | |
238 | AliITSMultReconstructor::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t* /* vtxRes*/) { | |
239 | // | |
240 | // - calls LoadClusterArray that finds the position of the clusters | |
241 | // (in global coord) | |
242 | // - convert the cluster coordinates to theta, phi (seen from the | |
243 | // interaction vertex). The third coordinate is used for .... | |
244 | // - makes an array of tracklets | |
245 | // | |
246 | // After this method has been called, the clusters of the two layers | |
247 | // and the tracklets can be retrieved by calling the Get'er methods. | |
248 | ||
ac903f1b | 249 | // reset counters |
250 | fNClustersLay1 = 0; | |
251 | fNClustersLay2 = 0; | |
252 | fNTracklets = 0; | |
968e8539 | 253 | fNSingleCluster = 0; |
ac903f1b | 254 | // loading the clusters |
255 | LoadClusterArrays(clusterTree); | |
3ef75756 | 256 | |
ac903f1b | 257 | // find the tracklets |
258 | AliDebug(1,"Looking for tracklets... "); | |
259 | ||
260 | //########################################################### | |
261 | // Loop on layer 1 : finding theta, phi and z | |
262 | for (Int_t iC1=0; iC1<fNClustersLay1; iC1++) { | |
263 | Float_t x = fClustersLay1[iC1][0] - vtx[0]; | |
264 | Float_t y = fClustersLay1[iC1][1] - vtx[1]; | |
265 | Float_t z = fClustersLay1[iC1][2] - vtx[2]; | |
ddced3c8 | 266 | |
ac903f1b | 267 | Float_t r = TMath::Sqrt(TMath::Power(x,2) + |
268 | TMath::Power(y,2) + | |
269 | TMath::Power(z,2)); | |
270 | ||
eefb3acc | 271 | fClustersLay1[iC1][0] = TMath::ACos(z/r); // Store Theta |
272 | fClustersLay1[iC1][1] = TMath::Pi() + TMath::ATan2(-y,-x); // Store Phi | |
273 | fClustersLay1[iC1][2] = z/r; // Store scaled z | |
ddced3c8 | 274 | if (fHistOn) { |
275 | Float_t eta=fClustersLay1[iC1][0]; | |
276 | eta= TMath::Tan(eta/2.); | |
277 | eta=-TMath::Log(eta); | |
278 | fhetaClustersLay1->Fill(eta); | |
de4c520e | 279 | fhphiClustersLay1->Fill(fClustersLay1[iC1][1]); |
ddced3c8 | 280 | } |
96c2c35d | 281 | } |
ac903f1b | 282 | |
283 | // Loop on layer 2 : finding theta, phi and r | |
284 | for (Int_t iC2=0; iC2<fNClustersLay2; iC2++) { | |
285 | Float_t x = fClustersLay2[iC2][0] - vtx[0]; | |
286 | Float_t y = fClustersLay2[iC2][1] - vtx[1]; | |
287 | Float_t z = fClustersLay2[iC2][2] - vtx[2]; | |
ddced3c8 | 288 | |
ac903f1b | 289 | Float_t r = TMath::Sqrt(TMath::Power(x,2) + |
290 | TMath::Power(y,2) + | |
291 | TMath::Power(z,2)); | |
292 | ||
eefb3acc | 293 | fClustersLay2[iC2][0] = TMath::ACos(z/r); // Store Theta |
294 | fClustersLay2[iC2][1] = TMath::Pi() + TMath::ATan2(-y,-x); // Store Phi | |
295 | fClustersLay2[iC2][2] = z; // Store z | |
ac903f1b | 296 | |
ddced3c8 | 297 | // this only needs to be initialized for the fNClustersLay2 first associations |
ac903f1b | 298 | fAssociationFlag[iC2] = kFALSE; |
299 | } | |
300 | ||
301 | //########################################################### | |
302 | // Loop on layer 1 | |
303 | for (Int_t iC1=0; iC1<fNClustersLay1; iC1++) { | |
304 | ||
305 | // reset of variables for multiple candidates | |
ddced3c8 | 306 | Int_t iC2WithBestDist = 0; // reset |
3ef75756 | 307 | Float_t distmin = 100.; // just to put a huge number! |
ddced3c8 | 308 | Float_t dPhimin = 0.; // Used for histograms only! |
309 | Float_t dThetamin = 0.; // Used for histograms only! | |
310 | Float_t dZetamin = 0.; // Used for histograms only! | |
ac903f1b | 311 | |
312 | // Loop on layer 2 | |
313 | for (Int_t iC2=0; iC2<fNClustersLay2; iC2++) { | |
314 | ||
315 | // The following excludes double associations | |
316 | if (!fAssociationFlag[iC2]) { | |
317 | ||
318 | // find the difference in angles | |
319 | Float_t dTheta = fClustersLay2[iC2][0] - fClustersLay1[iC1][0]; | |
02a95988 | 320 | Float_t dPhi = TMath::Abs(fClustersLay2[iC2][1] - fClustersLay1[iC1][1]); |
321 | // take into account boundary condition | |
322 | if (dPhi>TMath::Pi()) dPhi=2.*TMath::Pi()-dPhi; | |
323 | ||
ac903f1b | 324 | // find the difference in z (between linear projection from layer 1 |
325 | // and the actual point: Dzeta= z1/r1*r2 -z2) | |
ddced3c8 | 326 | Float_t r2 = fClustersLay2[iC2][2]/TMath::Cos(fClustersLay2[iC2][0]); |
de4c520e | 327 | Float_t dZeta = fClustersLay1[iC1][2]*r2 - fClustersLay2[iC2][2]; |
ddced3c8 | 328 | |
329 | if (fHistOn) { | |
330 | fhClustersDPhiAll->Fill(dPhi); | |
331 | fhClustersDThetaAll->Fill(dTheta); | |
332 | fhClustersDZetaAll->Fill(dZeta); | |
ac903f1b | 333 | fhDPhiVsDThetaAll->Fill(dTheta, dPhi); |
ddced3c8 | 334 | fhDPhiVsDZetaAll->Fill(dZeta, dPhi); |
ac903f1b | 335 | } |
336 | // make "elliptical" cut in Phi and Zeta! | |
337 | Float_t d = TMath::Sqrt(TMath::Power(dPhi/fPhiWindow,2) + TMath::Power(dZeta/fZetaWindow,2)); | |
3ef75756 | 338 | |
ac903f1b | 339 | if (d>1) continue; |
340 | ||
ddced3c8 | 341 | //look for the minimum distance: the minimum is in iC2WithBestDist |
3ef75756 | 342 | if (TMath::Sqrt(dZeta*dZeta+(r2*dPhi*r2*dPhi)) < distmin ) { |
343 | distmin=TMath::Sqrt(dZeta*dZeta + (r2*dPhi*r2*dPhi)); | |
ddced3c8 | 344 | dPhimin = dPhi; |
345 | dThetamin = dTheta; | |
346 | dZetamin = dZeta; | |
347 | iC2WithBestDist = iC2; | |
ac903f1b | 348 | } |
349 | } | |
350 | } // end of loop over clusters in layer 2 | |
351 | ||
3ef75756 | 352 | if (distmin<100) { // This means that a cluster in layer 2 was found that mathes with iC1 |
353 | ||
354 | if (fHistOn) { | |
de4c520e | 355 | fhClustersDPhiAcc->Fill(dPhimin); |
3ef75756 | 356 | fhClustersDThetaAcc->Fill(dThetamin); |
357 | fhClustersDZetaAcc->Fill(dZetamin); | |
358 | fhDPhiVsDThetaAcc->Fill(dThetamin, dPhimin); | |
359 | fhDPhiVsDZetaAcc->Fill(dZetamin, dPhimin); | |
360 | } | |
ac903f1b | 361 | |
ddced3c8 | 362 | if (fOnlyOneTrackletPerC2) fAssociationFlag[iC2WithBestDist] = kTRUE; // flag the association |
ac903f1b | 363 | |
364 | // store the tracklet | |
365 | ||
de4c520e | 366 | // use the theta from the clusters in the first layer |
ddced3c8 | 367 | fTracklets[fNTracklets][0] = fClustersLay1[iC1][0]; |
de4c520e | 368 | // use the phi from the clusters in the first layer |
ac903f1b | 369 | fTracklets[fNTracklets][1] = fClustersLay1[iC1][1]; |
35e2e4eb | 370 | // store the difference between phi1 and phi2 |
de4c520e | 371 | fTracklets[fNTracklets][2] = fClustersLay1[iC1][1] - fClustersLay2[iC2WithBestDist][1]; |
372 | ||
35e2e4eb | 373 | // define dphi in the range [0,pi] with proper sign (track charge correlated) |
374 | if (fTracklets[fNTracklets][2] > TMath::Pi()) | |
375 | fTracklets[fNTracklets][2] = fTracklets[fNTracklets][2]-2.*TMath::Pi(); | |
376 | if (fTracklets[fNTracklets][2] < -TMath::Pi()) | |
377 | fTracklets[fNTracklets][2] = fTracklets[fNTracklets][2]+2.*TMath::Pi(); | |
378 | ||
de4c520e | 379 | // find label |
0939e22a | 380 | // if equal label in both clusters found this label is assigned |
381 | // if no equal label can be found the first labels of the L1 AND L2 cluster are assigned | |
de4c520e | 382 | Int_t label1 = 0; |
383 | Int_t label2 = 0; | |
384 | while (label2 < 3) | |
385 | { | |
386 | if ((Int_t) fClustersLay1[iC1][3+label1] != -2 && (Int_t) fClustersLay1[iC1][3+label1] == (Int_t) fClustersLay2[iC2WithBestDist][3+label2]) | |
387 | break; | |
de4c520e | 388 | label1++; |
389 | if (label1 == 3) | |
390 | { | |
391 | label1 = 0; | |
392 | label2++; | |
393 | } | |
394 | } | |
395 | ||
396 | if (label2 < 3) | |
397 | { | |
398 | AliDebug(AliLog::kDebug, Form("Found label %d == %d for tracklet candidate %d\n", (Int_t) fClustersLay1[iC1][3+label1], (Int_t) fClustersLay2[iC2WithBestDist][3+label2], fNTracklets)); | |
399 | fTracklets[fNTracklets][3] = fClustersLay1[iC1][3+label1]; | |
0939e22a | 400 | fTracklets[fNTracklets][4] = fClustersLay2[iC2WithBestDist][3+label2]; |
de4c520e | 401 | } |
402 | else | |
403 | { | |
404 | AliDebug(AliLog::kDebug, Form("Did not find label %d %d %d %d %d %d for tracklet candidate %d\n", (Int_t) fClustersLay1[iC1][3], (Int_t) fClustersLay1[iC1][4], (Int_t) fClustersLay1[iC1][5], (Int_t) fClustersLay2[iC2WithBestDist][3], (Int_t) fClustersLay2[iC2WithBestDist][4], (Int_t) fClustersLay2[iC2WithBestDist][5], fNTracklets)); | |
0939e22a | 405 | fTracklets[fNTracklets][3] = fClustersLay1[iC1][3]; |
406 | fTracklets[fNTracklets][4] = fClustersLay2[iC2WithBestDist][3]; | |
de4c520e | 407 | } |
408 | ||
3ef75756 | 409 | if (fHistOn) { |
410 | Float_t eta=fTracklets[fNTracklets][0]; | |
411 | eta= TMath::Tan(eta/2.); | |
412 | eta=-TMath::Log(eta); | |
413 | fhetaTracklets->Fill(eta); | |
414 | fhphiTracklets->Fill(fTracklets[fNTracklets][1]); | |
415 | } | |
ac903f1b | 416 | |
3ef75756 | 417 | AliDebug(1,Form(" Adding tracklet candidate %d ", fNTracklets)); |
418 | AliDebug(1,Form(" Cl. %d of Layer 1 and %d of Layer 2", iC1, | |
419 | iC2WithBestDist)); | |
420 | fNTracklets++; | |
ac903f1b | 421 | } |
3ef75756 | 422 | |
423 | // Delete the following else if you do not want to save Clusters! | |
424 | ||
de4c520e | 425 | else { // This means that the cluster has not been associated |
3ef75756 | 426 | |
427 | // store the cluster | |
428 | ||
968e8539 | 429 | fSClusters[fNSingleCluster][0] = fClustersLay1[iC1][0]; |
430 | fSClusters[fNSingleCluster][1] = fClustersLay1[iC1][1]; | |
de4c520e | 431 | AliDebug(1,Form(" Adding a single cluster %d (cluster %d of layer 1)", |
968e8539 | 432 | fNSingleCluster, iC1)); |
433 | fNSingleCluster++; | |
3ef75756 | 434 | } |
435 | ||
ac903f1b | 436 | } // end of loop over clusters in layer 1 |
437 | ||
438 | AliDebug(1,Form("%d tracklets found", fNTracklets)); | |
439 | } | |
440 | ||
441 | //____________________________________________________________________ | |
442 | void | |
443 | AliITSMultReconstructor::LoadClusterArrays(TTree* itsClusterTree) { | |
444 | // This method | |
445 | // - gets the clusters from the cluster tree | |
446 | // - convert them into global coordinates | |
447 | // - store them in the internal arrays | |
9b373e9a | 448 | // - count the number of cluster-fired chips |
ac903f1b | 449 | |
9b373e9a | 450 | AliDebug(1,"Loading clusters and cluster-fired chips ..."); |
ac903f1b | 451 | |
452 | fNClustersLay1 = 0; | |
453 | fNClustersLay2 = 0; | |
9b373e9a | 454 | fNFiredChips[0] = 0; |
455 | fNFiredChips[1] = 0; | |
ac903f1b | 456 | |
9b373e9a | 457 | AliITSsegmentationSPD *seg = new AliITSsegmentationSPD(); |
458 | ||
b51872de | 459 | TClonesArray* itsClusters = new TClonesArray("AliITSRecPoint"); |
460 | TBranch* itsClusterBranch=itsClusterTree->GetBranch("ITSRecPoints"); | |
ddced3c8 | 461 | |
ac903f1b | 462 | itsClusterBranch->SetAddress(&itsClusters); |
ddced3c8 | 463 | |
ac903f1b | 464 | Int_t nItsSubs = (Int_t)itsClusterTree->GetEntries(); |
f606f16a | 465 | Float_t cluGlo[3]={0.,0.,0.}; |
ddced3c8 | 466 | |
ac903f1b | 467 | // loop over the its subdetectors |
468 | for (Int_t iIts=0; iIts < nItsSubs; iIts++) { | |
469 | ||
470 | if (!itsClusterTree->GetEvent(iIts)) | |
471 | continue; | |
472 | ||
473 | Int_t nClusters = itsClusters->GetEntriesFast(); | |
9b373e9a | 474 | |
475 | // number of clusters in each chip of the current module | |
476 | Int_t nClustersInChip[5] = {0,0,0,0,0}; | |
477 | Int_t layer = 0; | |
ac903f1b | 478 | |
ac903f1b | 479 | // loop over clusters |
480 | while(nClusters--) { | |
de4c520e | 481 | AliITSRecPoint* cluster = (AliITSRecPoint*)itsClusters->UncheckedAt(nClusters); |
ac903f1b | 482 | |
9b373e9a | 483 | layer = cluster->GetLayer(); |
484 | if (layer>1) continue; | |
ac903f1b | 485 | |
f606f16a | 486 | cluster->GetGlobalXYZ(cluGlo); |
487 | Float_t x = cluGlo[0]; | |
488 | Float_t y = cluGlo[1]; | |
489 | Float_t z = cluGlo[2]; | |
9b373e9a | 490 | |
491 | // find the chip for the current cluster | |
492 | Float_t locz = cluster->GetDetLocalZ(); | |
493 | Int_t iChip = seg->GetChipFromLocal(0,locz); | |
494 | nClustersInChip[iChip]++; | |
ac903f1b | 495 | |
9b373e9a | 496 | if (layer==0) { |
ac903f1b | 497 | fClustersLay1[fNClustersLay1][0] = x; |
498 | fClustersLay1[fNClustersLay1][1] = y; | |
499 | fClustersLay1[fNClustersLay1][2] = z; | |
de4c520e | 500 | for (Int_t i=0; i<3; i++) |
501 | fClustersLay1[fNClustersLay1][3+i] = cluster->GetLabel(i); | |
ac903f1b | 502 | fNClustersLay1++; |
503 | } | |
9b373e9a | 504 | if (layer==1) { |
ac903f1b | 505 | fClustersLay2[fNClustersLay2][0] = x; |
506 | fClustersLay2[fNClustersLay2][1] = y; | |
507 | fClustersLay2[fNClustersLay2][2] = z; | |
de4c520e | 508 | for (Int_t i=0; i<3; i++) |
509 | fClustersLay2[fNClustersLay2][3+i] = cluster->GetLabel(i); | |
ac903f1b | 510 | fNClustersLay2++; |
511 | } | |
512 | ||
513 | }// end of cluster loop | |
9b373e9a | 514 | |
515 | // get number of fired chips in the current module | |
516 | if(layer<2) | |
517 | for(Int_t ifChip=0; ifChip<5; ifChip++) { | |
518 | if(nClustersInChip[ifChip] >= 1) fNFiredChips[layer]++; | |
519 | } | |
520 | ||
ac903f1b | 521 | } // end of its "subdetector" loop |
9b373e9a | 522 | |
cedf398d | 523 | if (itsClusters) { |
524 | itsClusters->Delete(); | |
525 | delete itsClusters; | |
9b373e9a | 526 | delete seg; |
cedf398d | 527 | itsClusters = 0; |
528 | } | |
ac903f1b | 529 | AliDebug(1,Form("(clusters in layer 1 : %d, layer 2: %d)",fNClustersLay1,fNClustersLay2)); |
9b373e9a | 530 | AliDebug(1,Form("(cluster-fired chips in layer 1 : %d, layer 2: %d)",fNFiredChips[0],fNFiredChips[1])); |
531 | } | |
532 | //____________________________________________________________________ | |
533 | void | |
534 | AliITSMultReconstructor::LoadClusterFiredChips(TTree* itsClusterTree) { | |
535 | // This method | |
536 | // - gets the clusters from the cluster tree | |
537 | // - counts the number of (cluster)fired chips | |
538 | ||
539 | AliDebug(1,"Loading cluster-fired chips ..."); | |
540 | ||
541 | fNFiredChips[0] = 0; | |
542 | fNFiredChips[1] = 0; | |
543 | ||
544 | AliITSsegmentationSPD *seg = new AliITSsegmentationSPD(); | |
545 | ||
546 | TClonesArray* itsClusters = new TClonesArray("AliITSRecPoint"); | |
547 | TBranch* itsClusterBranch=itsClusterTree->GetBranch("ITSRecPoints"); | |
548 | ||
549 | itsClusterBranch->SetAddress(&itsClusters); | |
550 | ||
551 | Int_t nItsSubs = (Int_t)itsClusterTree->GetEntries(); | |
552 | ||
553 | // loop over the its subdetectors | |
554 | for (Int_t iIts=0; iIts < nItsSubs; iIts++) { | |
555 | ||
556 | if (!itsClusterTree->GetEvent(iIts)) | |
557 | continue; | |
558 | ||
559 | Int_t nClusters = itsClusters->GetEntriesFast(); | |
560 | ||
561 | // number of clusters in each chip of the current module | |
562 | Int_t nClustersInChip[5] = {0,0,0,0,0}; | |
563 | Int_t layer = 0; | |
564 | ||
565 | // loop over clusters | |
566 | while(nClusters--) { | |
567 | AliITSRecPoint* cluster = (AliITSRecPoint*)itsClusters->UncheckedAt(nClusters); | |
568 | ||
569 | layer = cluster->GetLayer(); | |
570 | if (layer>1) continue; | |
571 | ||
572 | // find the chip for the current cluster | |
573 | Float_t locz = cluster->GetDetLocalZ(); | |
574 | Int_t iChip = seg->GetChipFromLocal(0,locz); | |
575 | nClustersInChip[iChip]++; | |
576 | ||
577 | }// end of cluster loop | |
578 | ||
579 | // get number of fired chips in the current module | |
580 | if(layer<2) | |
581 | for(Int_t ifChip=0; ifChip<5; ifChip++) { | |
582 | if(nClustersInChip[ifChip] >= 1) fNFiredChips[layer]++; | |
583 | } | |
584 | ||
585 | } // end of its "subdetector" loop | |
586 | ||
587 | if (itsClusters) { | |
588 | itsClusters->Delete(); | |
589 | delete itsClusters; | |
590 | delete seg; | |
591 | itsClusters = 0; | |
592 | } | |
593 | AliDebug(1,Form("(cluster-fired chips in layer 1 : %d, layer 2: %d)",fNFiredChips[0],fNFiredChips[1])); | |
ac903f1b | 594 | } |
595 | //____________________________________________________________________ | |
596 | void | |
597 | AliITSMultReconstructor::SaveHists() { | |
3ef75756 | 598 | // This method save the histograms on the output file |
599 | // (only if fHistOn is TRUE). | |
ac903f1b | 600 | |
601 | if (!fHistOn) | |
602 | return; | |
603 | ||
ddced3c8 | 604 | fhClustersDPhiAll->Write(); |
605 | fhClustersDThetaAll->Write(); | |
606 | fhClustersDZetaAll->Write(); | |
ac903f1b | 607 | fhDPhiVsDThetaAll->Write(); |
ddced3c8 | 608 | fhDPhiVsDZetaAll->Write(); |
609 | ||
610 | fhClustersDPhiAcc->Write(); | |
611 | fhClustersDThetaAcc->Write(); | |
612 | fhClustersDZetaAcc->Write(); | |
ac903f1b | 613 | fhDPhiVsDThetaAcc->Write(); |
ddced3c8 | 614 | fhDPhiVsDZetaAcc->Write(); |
615 | ||
616 | fhetaTracklets->Write(); | |
617 | fhphiTracklets->Write(); | |
618 | fhetaClustersLay1->Write(); | |
619 | fhphiClustersLay1->Write(); | |
ac903f1b | 620 | } |