1 /**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //____________________________________________________________________
20 // AliITSMultReconstructor - find clusters in the pixels (theta and
21 // phi) and tracklets.
23 // These can be used to extract charged particles multiplcicity from the ITS.
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.
30 // The parameter AssociationChoice allows to control if two clusters
31 // in layer 2 can be associated to the same cluster in layer 1 or not.
32 // (TRUE means double associations exluded; default = TRUE)
34 // Two methods return the number of traklets and the number of clusters
35 // in the first SPD layer (GetNTracklets GetNSingleClusters)
37 // -----------------------------------------------------------------
39 // NOTE: The cuts on phi and zeta depend on the interacting system (p-p
40 // or Pb-Pb). Please, check the file AliITSMultReconstructor.h and be
41 // sure that SetPhiWindow and SetZetaWindow are defined accordingly.
43 // Author : Tiziano Virgili
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()
49 // - fGeometry removed
50 // - number of fired chips on the two layers
51 // - option to avoid duplicates in the overlaps (fRemoveClustersFromOverlaps)
52 // - options and fiducial cuts via AliITSRecoParam
54 //____________________________________________________________________
56 #include <TClonesArray.h>
61 #include "AliITSMultReconstructor.h"
62 #include "AliITSReconstructor.h"
63 #include "AliITSsegmentationSPD.h"
64 #include "AliITSRecPoint.h"
65 #include "AliITSgeom.h"
68 //____________________________________________________________________
69 ClassImp(AliITSMultReconstructor)
72 //____________________________________________________________________
73 AliITSMultReconstructor::AliITSMultReconstructor():
77 fDetectorIndexClustersLay1(0),
78 fDetectorIndexClustersLay2(0),
79 fOverlapFlagClustersLay1(0),
80 fOverlapFlagClustersLay2(0),
88 fOnlyOneTrackletPerC2(0),
91 fRemoveClustersFromOverlaps(0),
96 fhClustersDThetaAcc(0),
97 fhClustersDZetaAcc(0),
99 fhClustersDThetaAll(0),
100 fhClustersDZetaAll(0),
101 fhDPhiVsDThetaAll(0),
102 fhDPhiVsDThetaAcc(0),
107 fhetaClustersLay1(0),
108 fhphiClustersLay1(0){
113 // Method to reconstruct the charged particles multiplicity with the
119 if(AliITSReconstructor::GetRecoParam()) {
120 SetOnlyOneTrackletPerC2(AliITSReconstructor::GetRecoParam()->GetTrackleterOnlyOneTrackletPerC2());
121 SetPhiWindow(AliITSReconstructor::GetRecoParam()->GetTrackleterPhiWindow());
122 SetZetaWindow(AliITSReconstructor::GetRecoParam()->GetTrackleterZetaWindow());
123 SetRemoveClustersFromOverlaps(AliITSReconstructor::GetRecoParam()->GetTrackleterRemoveClustersFromOverlaps());
124 SetPhiOverlapCut(AliITSReconstructor::GetRecoParam()->GetTrackleterPhiOverlapCut());
125 SetZetaOverlapCut(AliITSReconstructor::GetRecoParam()->GetTrackleterZetaOverlapCut());
127 SetOnlyOneTrackletPerC2();
130 SetRemoveClustersFromOverlaps();
136 fClustersLay1 = new Float_t*[300000];
137 fClustersLay2 = new Float_t*[300000];
138 fDetectorIndexClustersLay1 = new Int_t[300000];
139 fDetectorIndexClustersLay2 = new Int_t[300000];
140 fOverlapFlagClustersLay1 = new Bool_t[300000];
141 fOverlapFlagClustersLay2 = new Bool_t[300000];
142 fTracklets = new Float_t*[300000];
143 fSClusters = new Float_t*[300000];
144 fAssociationFlag = new Bool_t[300000];
146 for(Int_t i=0; i<300000; i++) {
147 fClustersLay1[i] = new Float_t[6];
148 fClustersLay2[i] = new Float_t[6];
149 fTracklets[i] = new Float_t[5];
150 fSClusters[i] = new Float_t[2];
151 fOverlapFlagClustersLay1[i] = kFALSE;
152 fOverlapFlagClustersLay2[i] = kFALSE;
153 fAssociationFlag[i] = kFALSE;
156 // definition of histograms
157 fhClustersDPhiAcc = new TH1F("dphiacc", "dphi", 100,0.,0.1);
158 fhClustersDPhiAcc->SetDirectory(0);
159 fhClustersDThetaAcc = new TH1F("dthetaacc","dtheta",100,-0.1,0.1);
160 fhClustersDThetaAcc->SetDirectory(0);
161 fhClustersDZetaAcc = new TH1F("dzetaacc","dzeta",100,-1.,1.);
162 fhClustersDZetaAcc->SetDirectory(0);
164 fhDPhiVsDZetaAcc = new TH2F("dphiVsDzetaacc","",100,-1.,1.,100,0.,0.1);
165 fhDPhiVsDZetaAcc->SetDirectory(0);
166 fhDPhiVsDThetaAcc = new TH2F("dphiVsDthetaAcc","",100,-0.1,0.1,100,0.,0.1);
167 fhDPhiVsDThetaAcc->SetDirectory(0);
169 fhClustersDPhiAll = new TH1F("dphiall", "dphi", 100,0.0,0.5);
170 fhClustersDPhiAll->SetDirectory(0);
171 fhClustersDThetaAll = new TH1F("dthetaall","dtheta",100,-0.5,0.5);
172 fhClustersDThetaAll->SetDirectory(0);
173 fhClustersDZetaAll = new TH1F("dzetaall","dzeta",100,-5.,5.);
174 fhClustersDZetaAll->SetDirectory(0);
176 fhDPhiVsDZetaAll = new TH2F("dphiVsDzetaall","",100,-5.,5.,100,0.,0.5);
177 fhDPhiVsDZetaAll->SetDirectory(0);
178 fhDPhiVsDThetaAll = new TH2F("dphiVsDthetaAll","",100,-0.5,0.5,100,0.,0.5);
179 fhDPhiVsDThetaAll->SetDirectory(0);
181 fhetaTracklets = new TH1F("etaTracklets", "eta", 100,-2.,2.);
182 fhetaTracklets->SetDirectory(0);
183 fhphiTracklets = new TH1F("phiTracklets", "phi", 100, 0., 2*TMath::Pi());
184 fhphiTracklets->SetDirectory(0);
185 fhetaClustersLay1 = new TH1F("etaClustersLay1", "etaCl1", 100,-2.,2.);
186 fhetaClustersLay1->SetDirectory(0);
187 fhphiClustersLay1 = new TH1F("phiClustersLay1", "phiCl1", 100, 0., 2*TMath::Pi());
188 fhphiClustersLay1->SetDirectory(0);
191 //______________________________________________________________________
192 AliITSMultReconstructor::AliITSMultReconstructor(const AliITSMultReconstructor &mr) : TObject(mr),
193 fClustersLay1(mr.fClustersLay1),
194 fClustersLay2(mr.fClustersLay2),
195 fDetectorIndexClustersLay1(mr.fDetectorIndexClustersLay1),
196 fDetectorIndexClustersLay2(mr.fDetectorIndexClustersLay2),
197 fOverlapFlagClustersLay1(mr.fOverlapFlagClustersLay1),
198 fOverlapFlagClustersLay2(mr.fOverlapFlagClustersLay2),
199 fTracklets(mr.fTracklets),
200 fSClusters(mr.fSClusters),
201 fAssociationFlag(mr.fAssociationFlag),
202 fNClustersLay1(mr.fNClustersLay1),
203 fNClustersLay2(mr.fNClustersLay2),
204 fNTracklets(mr.fNTracklets),
205 fNSingleCluster(mr.fNSingleCluster),
206 fOnlyOneTrackletPerC2(mr.fOnlyOneTrackletPerC2),
207 fPhiWindow(mr.fPhiWindow),
208 fZetaWindow(mr.fZetaWindow),
209 fRemoveClustersFromOverlaps(mr.fRemoveClustersFromOverlaps),
210 fPhiOverlapCut(mr.fPhiOverlapCut),
211 fZetaOverlapCut(mr.fZetaOverlapCut),
213 fhClustersDPhiAcc(mr.fhClustersDPhiAcc),
214 fhClustersDThetaAcc(mr.fhClustersDThetaAcc),
215 fhClustersDZetaAcc(mr.fhClustersDZetaAcc),
216 fhClustersDPhiAll(mr.fhClustersDPhiAll),
217 fhClustersDThetaAll(mr.fhClustersDThetaAll),
218 fhClustersDZetaAll(mr.fhClustersDZetaAll),
219 fhDPhiVsDThetaAll(mr.fhDPhiVsDThetaAll),
220 fhDPhiVsDThetaAcc(mr.fhDPhiVsDThetaAcc),
221 fhDPhiVsDZetaAll(mr.fhDPhiVsDZetaAll),
222 fhDPhiVsDZetaAcc(mr.fhDPhiVsDZetaAcc),
223 fhetaTracklets(mr.fhetaTracklets),
224 fhphiTracklets(mr.fhphiTracklets),
225 fhetaClustersLay1(mr.fhetaClustersLay1),
226 fhphiClustersLay1(mr.fhphiClustersLay1) {
231 //______________________________________________________________________
232 AliITSMultReconstructor& AliITSMultReconstructor::operator=(const AliITSMultReconstructor& mr){
233 // Assignment operator
234 this->~AliITSMultReconstructor();
235 new(this) AliITSMultReconstructor(mr);
239 //______________________________________________________________________
240 AliITSMultReconstructor::~AliITSMultReconstructor(){
244 delete fhClustersDPhiAcc;
245 delete fhClustersDThetaAcc;
246 delete fhClustersDZetaAcc;
247 delete fhClustersDPhiAll;
248 delete fhClustersDThetaAll;
249 delete fhClustersDZetaAll;
250 delete fhDPhiVsDThetaAll;
251 delete fhDPhiVsDThetaAcc;
252 delete fhDPhiVsDZetaAll;
253 delete fhDPhiVsDZetaAcc;
254 delete fhetaTracklets;
255 delete fhphiTracklets;
256 delete fhetaClustersLay1;
257 delete fhphiClustersLay1;
260 for(Int_t i=0; i<300000; i++) {
261 delete [] fClustersLay1[i];
262 delete [] fClustersLay2[i];
263 delete [] fTracklets[i];
264 delete [] fSClusters[i];
266 delete [] fClustersLay1;
267 delete [] fClustersLay2;
268 delete [] fDetectorIndexClustersLay1;
269 delete [] fDetectorIndexClustersLay2;
270 delete [] fOverlapFlagClustersLay1;
271 delete [] fOverlapFlagClustersLay2;
272 delete [] fTracklets;
273 delete [] fSClusters;
275 delete [] fAssociationFlag;
278 //____________________________________________________________________
280 AliITSMultReconstructor::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t* /* vtxRes*/) {
282 // - calls LoadClusterArray that finds the position of the clusters
284 // - convert the cluster coordinates to theta, phi (seen from the
285 // interaction vertex). The third coordinate is used for ....
286 // - makes an array of tracklets
288 // After this method has been called, the clusters of the two layers
289 // and the tracklets can be retrieved by calling the Get'er methods.
296 // loading the clusters
297 LoadClusterArrays(clusterTree);
299 // find the tracklets
300 AliDebug(1,"Looking for tracklets... ");
302 //###########################################################
303 // Loop on layer 1 : finding theta, phi and z
304 for (Int_t iC1=0; iC1<fNClustersLay1; iC1++) {
305 Float_t x = fClustersLay1[iC1][0] - vtx[0];
306 Float_t y = fClustersLay1[iC1][1] - vtx[1];
307 Float_t z = fClustersLay1[iC1][2] - vtx[2];
309 Float_t r = TMath::Sqrt(TMath::Power(x,2) +
313 fClustersLay1[iC1][0] = TMath::ACos(z/r); // Store Theta
314 fClustersLay1[iC1][1] = TMath::Pi() + TMath::ATan2(-y,-x); // Store Phi
315 fClustersLay1[iC1][2] = z/r; // Store scaled z
317 Float_t eta=fClustersLay1[iC1][0];
318 eta= TMath::Tan(eta/2.);
319 eta=-TMath::Log(eta);
320 fhetaClustersLay1->Fill(eta);
321 fhphiClustersLay1->Fill(fClustersLay1[iC1][1]);
325 // Loop on layer 2 : finding theta, phi and r
326 for (Int_t iC2=0; iC2<fNClustersLay2; iC2++) {
327 Float_t x = fClustersLay2[iC2][0] - vtx[0];
328 Float_t y = fClustersLay2[iC2][1] - vtx[1];
329 Float_t z = fClustersLay2[iC2][2] - vtx[2];
331 Float_t r = TMath::Sqrt(TMath::Power(x,2) +
335 fClustersLay2[iC2][0] = TMath::ACos(z/r); // Store Theta
336 fClustersLay2[iC2][1] = TMath::Pi() + TMath::ATan2(-y,-x); // Store Phi
337 fClustersLay2[iC2][2] = z; // Store z
339 // this only needs to be initialized for the fNClustersLay2 first associations
340 fAssociationFlag[iC2] = kFALSE;
343 //###########################################################
345 for (Int_t iC1=0; iC1<fNClustersLay1; iC1++) {
347 // reset of variables for multiple candidates
348 Int_t iC2WithBestDist = 0; // reset
349 Float_t distmin = 100.; // just to put a huge number!
350 Float_t dPhimin = 0.; // Used for histograms only!
351 Float_t dThetamin = 0.; // Used for histograms only!
352 Float_t dZetamin = 0.; // Used for histograms only!
354 if (fOverlapFlagClustersLay1[iC1]) continue;
357 for (Int_t iC2=0; iC2<fNClustersLay2; iC2++) {
358 if (fOverlapFlagClustersLay2[iC2]) continue;
359 // The following excludes double associations
360 if (!fAssociationFlag[iC2]) {
362 // find the difference in angles
363 Float_t dTheta = fClustersLay2[iC2][0] - fClustersLay1[iC1][0];
364 Float_t dPhi = TMath::Abs(fClustersLay2[iC2][1] - fClustersLay1[iC1][1]);
365 // take into account boundary condition
366 if (dPhi>TMath::Pi()) dPhi=2.*TMath::Pi()-dPhi;
368 // find the difference in z (between linear projection from layer 1
369 // and the actual point: Dzeta= z1/r1*r2 -z2)
370 Float_t r2 = fClustersLay2[iC2][2]/TMath::Cos(fClustersLay2[iC2][0]);
371 Float_t dZeta = fClustersLay1[iC1][2]*r2 - fClustersLay2[iC2][2];
374 fhClustersDPhiAll->Fill(dPhi);
375 fhClustersDThetaAll->Fill(dTheta);
376 fhClustersDZetaAll->Fill(dZeta);
377 fhDPhiVsDThetaAll->Fill(dTheta, dPhi);
378 fhDPhiVsDZetaAll->Fill(dZeta, dPhi);
380 // make "elliptical" cut in Phi and Zeta!
381 Float_t d = TMath::Sqrt(TMath::Power(dPhi/fPhiWindow,2) + TMath::Power(dZeta/fZetaWindow,2));
385 //look for the minimum distance: the minimum is in iC2WithBestDist
386 if (TMath::Sqrt(dZeta*dZeta+(r2*dPhi*r2*dPhi)) < distmin ) {
387 distmin=TMath::Sqrt(dZeta*dZeta + (r2*dPhi*r2*dPhi));
391 iC2WithBestDist = iC2;
394 } // end of loop over clusters in layer 2
396 if (distmin<100) { // This means that a cluster in layer 2 was found that mathes with iC1
399 fhClustersDPhiAcc->Fill(dPhimin);
400 fhClustersDThetaAcc->Fill(dThetamin);
401 fhClustersDZetaAcc->Fill(dZetamin);
402 fhDPhiVsDThetaAcc->Fill(dThetamin, dPhimin);
403 fhDPhiVsDZetaAcc->Fill(dZetamin, dPhimin);
406 if (fOnlyOneTrackletPerC2) fAssociationFlag[iC2WithBestDist] = kTRUE; // flag the association
408 // store the tracklet
410 // use the theta from the clusters in the first layer
411 fTracklets[fNTracklets][0] = fClustersLay1[iC1][0];
412 // use the phi from the clusters in the first layer
413 fTracklets[fNTracklets][1] = fClustersLay1[iC1][1];
414 // store the difference between phi1 and phi2
415 fTracklets[fNTracklets][2] = fClustersLay1[iC1][1] - fClustersLay2[iC2WithBestDist][1];
417 // define dphi in the range [0,pi] with proper sign (track charge correlated)
418 if (fTracklets[fNTracklets][2] > TMath::Pi())
419 fTracklets[fNTracklets][2] = fTracklets[fNTracklets][2]-2.*TMath::Pi();
420 if (fTracklets[fNTracklets][2] < -TMath::Pi())
421 fTracklets[fNTracklets][2] = fTracklets[fNTracklets][2]+2.*TMath::Pi();
424 // if equal label in both clusters found this label is assigned
425 // if no equal label can be found the first labels of the L1 AND L2 cluster are assigned
430 if ((Int_t) fClustersLay1[iC1][3+label1] != -2 && (Int_t) fClustersLay1[iC1][3+label1] == (Int_t) fClustersLay2[iC2WithBestDist][3+label2])
442 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));
443 fTracklets[fNTracklets][3] = fClustersLay1[iC1][3+label1];
444 fTracklets[fNTracklets][4] = fClustersLay2[iC2WithBestDist][3+label2];
448 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));
449 fTracklets[fNTracklets][3] = fClustersLay1[iC1][3];
450 fTracklets[fNTracklets][4] = fClustersLay2[iC2WithBestDist][3];
454 Float_t eta=fTracklets[fNTracklets][0];
455 eta= TMath::Tan(eta/2.);
456 eta=-TMath::Log(eta);
457 fhetaTracklets->Fill(eta);
458 fhphiTracklets->Fill(fTracklets[fNTracklets][1]);
461 AliDebug(1,Form(" Adding tracklet candidate %d ", fNTracklets));
462 AliDebug(1,Form(" Cl. %d of Layer 1 and %d of Layer 2", iC1,
466 if (fRemoveClustersFromOverlaps) FlagClustersInOverlapRegions (iC1,iC2WithBestDist);
470 // Delete the following else if you do not want to save Clusters!
472 else { // This means that the cluster has not been associated
476 fSClusters[fNSingleCluster][0] = fClustersLay1[iC1][0];
477 fSClusters[fNSingleCluster][1] = fClustersLay1[iC1][1];
478 AliDebug(1,Form(" Adding a single cluster %d (cluster %d of layer 1)",
479 fNSingleCluster, iC1));
483 } // end of loop over clusters in layer 1
485 AliDebug(1,Form("%d tracklets found", fNTracklets));
488 //____________________________________________________________________
490 AliITSMultReconstructor::LoadClusterArrays(TTree* itsClusterTree) {
492 // - gets the clusters from the cluster tree
493 // - convert them into global coordinates
494 // - store them in the internal arrays
495 // - count the number of cluster-fired chips
497 AliDebug(1,"Loading clusters and cluster-fired chips ...");
504 AliITSsegmentationSPD *seg = new AliITSsegmentationSPD();
506 TClonesArray* itsClusters = new TClonesArray("AliITSRecPoint");
507 TBranch* itsClusterBranch=itsClusterTree->GetBranch("ITSRecPoints");
509 itsClusterBranch->SetAddress(&itsClusters);
511 Int_t nItsSubs = (Int_t)itsClusterTree->GetEntries();
512 Float_t cluGlo[3]={0.,0.,0.};
514 // loop over the its subdetectors
515 for (Int_t iIts=0; iIts < nItsSubs; iIts++) {
517 if (!itsClusterTree->GetEvent(iIts))
520 Int_t nClusters = itsClusters->GetEntriesFast();
522 // number of clusters in each chip of the current module
523 Int_t nClustersInChip[5] = {0,0,0,0,0};
526 // loop over clusters
528 AliITSRecPoint* cluster = (AliITSRecPoint*)itsClusters->UncheckedAt(nClusters);
530 layer = cluster->GetLayer();
531 if (layer>1) continue;
533 cluster->GetGlobalXYZ(cluGlo);
534 Float_t x = cluGlo[0];
535 Float_t y = cluGlo[1];
536 Float_t z = cluGlo[2];
538 // find the chip for the current cluster
539 Float_t locz = cluster->GetDetLocalZ();
540 Int_t iChip = seg->GetChipFromLocal(0,locz);
541 nClustersInChip[iChip]++;
544 fClustersLay1[fNClustersLay1][0] = x;
545 fClustersLay1[fNClustersLay1][1] = y;
546 fClustersLay1[fNClustersLay1][2] = z;
548 fDetectorIndexClustersLay1[fNClustersLay1]=iIts;
550 for (Int_t i=0; i<3; i++)
551 fClustersLay1[fNClustersLay1][3+i] = cluster->GetLabel(i);
555 fClustersLay2[fNClustersLay2][0] = x;
556 fClustersLay2[fNClustersLay2][1] = y;
557 fClustersLay2[fNClustersLay2][2] = z;
559 fDetectorIndexClustersLay2[fNClustersLay2]=iIts;
561 for (Int_t i=0; i<3; i++)
562 fClustersLay2[fNClustersLay2][3+i] = cluster->GetLabel(i);
566 }// end of cluster loop
568 // get number of fired chips in the current module
570 for(Int_t ifChip=0; ifChip<5; ifChip++) {
571 if(nClustersInChip[ifChip] >= 1) fNFiredChips[layer]++;
574 } // end of its "subdetector" loop
577 itsClusters->Delete();
582 AliDebug(1,Form("(clusters in layer 1 : %d, layer 2: %d)",fNClustersLay1,fNClustersLay2));
583 AliDebug(1,Form("(cluster-fired chips in layer 1 : %d, layer 2: %d)",fNFiredChips[0],fNFiredChips[1]));
585 //____________________________________________________________________
587 AliITSMultReconstructor::LoadClusterFiredChips(TTree* itsClusterTree) {
589 // - gets the clusters from the cluster tree
590 // - counts the number of (cluster)fired chips
592 AliDebug(1,"Loading cluster-fired chips ...");
597 AliITSsegmentationSPD *seg = new AliITSsegmentationSPD();
599 TClonesArray* itsClusters = new TClonesArray("AliITSRecPoint");
600 TBranch* itsClusterBranch=itsClusterTree->GetBranch("ITSRecPoints");
602 itsClusterBranch->SetAddress(&itsClusters);
604 Int_t nItsSubs = (Int_t)itsClusterTree->GetEntries();
606 // loop over the its subdetectors
607 for (Int_t iIts=0; iIts < nItsSubs; iIts++) {
609 if (!itsClusterTree->GetEvent(iIts))
612 Int_t nClusters = itsClusters->GetEntriesFast();
614 // number of clusters in each chip of the current module
615 Int_t nClustersInChip[5] = {0,0,0,0,0};
618 // loop over clusters
620 AliITSRecPoint* cluster = (AliITSRecPoint*)itsClusters->UncheckedAt(nClusters);
622 layer = cluster->GetLayer();
623 if (layer>1) continue;
625 // find the chip for the current cluster
626 Float_t locz = cluster->GetDetLocalZ();
627 Int_t iChip = seg->GetChipFromLocal(0,locz);
628 nClustersInChip[iChip]++;
630 }// end of cluster loop
632 // get number of fired chips in the current module
634 for(Int_t ifChip=0; ifChip<5; ifChip++) {
635 if(nClustersInChip[ifChip] >= 1) fNFiredChips[layer]++;
638 } // end of its "subdetector" loop
641 itsClusters->Delete();
646 AliDebug(1,Form("(cluster-fired chips in layer 1 : %d, layer 2: %d)",fNFiredChips[0],fNFiredChips[1]));
648 //____________________________________________________________________
650 AliITSMultReconstructor::SaveHists() {
651 // This method save the histograms on the output file
652 // (only if fHistOn is TRUE).
657 fhClustersDPhiAll->Write();
658 fhClustersDThetaAll->Write();
659 fhClustersDZetaAll->Write();
660 fhDPhiVsDThetaAll->Write();
661 fhDPhiVsDZetaAll->Write();
663 fhClustersDPhiAcc->Write();
664 fhClustersDThetaAcc->Write();
665 fhClustersDZetaAcc->Write();
666 fhDPhiVsDThetaAcc->Write();
667 fhDPhiVsDZetaAcc->Write();
669 fhetaTracklets->Write();
670 fhphiTracklets->Write();
671 fhetaClustersLay1->Write();
672 fhphiClustersLay1->Write();
675 //____________________________________________________________________
677 AliITSMultReconstructor::FlagClustersInOverlapRegions (Int_t iC1, Int_t iC2WithBestDist) {
679 Float_t distClSameMod=0.;
680 Float_t distClSameModMin=0.;
682 Float_t meanRadiusLay1 = 3.99335; // average radius inner layer
683 Float_t meanRadiusLay2 = 7.37935; // average radius outer layer;
689 // Loop on inner layer clusters
690 for (Int_t iiC1=0; iiC1<fNClustersLay1; iiC1++) {
691 if (!fOverlapFlagClustersLay1[iiC1]) {
692 // only for adjacent modules
693 if ((TMath::Abs(fDetectorIndexClustersLay1[iC1]-fDetectorIndexClustersLay1[iiC1])==4)||
694 (TMath::Abs(fDetectorIndexClustersLay1[iC1]-fDetectorIndexClustersLay1[iiC1])==76)) {
695 Float_t dePhi=TMath::Abs(fClustersLay1[iiC1][1]-fClustersLay1[iC1][1]);
696 if (dePhi>TMath::Pi()) dePhi=2.*TMath::Pi()-dePhi;
698 zproj1=meanRadiusLay1/TMath::Tan(fClustersLay1[iC1][0]);
699 zproj2=meanRadiusLay1/TMath::Tan(fClustersLay1[iiC1][0]);
701 deZproj=TMath::Abs(zproj1-zproj2);
703 distClSameMod = TMath::Sqrt(TMath::Power(deZproj/fZetaOverlapCut,2)+TMath::Power(dePhi/fPhiOverlapCut,2));
704 if (distClSameMod<=1.) fOverlapFlagClustersLay1[iiC1]=kTRUE;
706 // if (distClSameMod<=1.) {
707 // if (distClSameModMin==0. || distClSameMod<distClSameModMin) {
708 // distClSameModMin=distClSameMod;
714 } // end adjacent modules
716 } // end Loop on inner layer clusters
718 // if (distClSameModMin!=0.) fOverlapFlagClustersLay1[iClOverlap]=kTRUE;
723 // Loop on outer layer clusters
724 for (Int_t iiC2=0; iiC2<fNClustersLay2; iiC2++) {
725 if (!fOverlapFlagClustersLay2[iiC2]) {
726 // only for adjacent modules
727 if ((TMath::Abs(fDetectorIndexClustersLay2[iC2WithBestDist]-fDetectorIndexClustersLay2[iiC2])==4) ||
728 (TMath::Abs(fDetectorIndexClustersLay2[iC2WithBestDist]-fDetectorIndexClustersLay2[iiC2])==156)) {
729 Float_t dePhi=TMath::Abs(fClustersLay2[iiC2][1]-fClustersLay2[iC2WithBestDist][1]);
730 if (dePhi>TMath::Pi()) dePhi=2.*TMath::Pi()-dePhi;
732 zproj1=meanRadiusLay2/TMath::Tan(fClustersLay2[iC2WithBestDist][0]);
733 zproj2=meanRadiusLay2/TMath::Tan(fClustersLay2[iiC2][0]);
735 deZproj=TMath::Abs(zproj1-zproj2);
736 distClSameMod = TMath::Sqrt(TMath::Power(deZproj/fZetaOverlapCut,2)+TMath::Power(dePhi/fPhiOverlapCut,2));
737 if (distClSameMod<=1.) fOverlapFlagClustersLay2[iiC2]=kTRUE;
739 // if (distClSameMod<=1.) {
740 // if (distClSameModMin==0. || distClSameMod<distClSameModMin) {
741 // distClSameModMin=distClSameMod;
746 } // end adjacent modules
748 } // end Loop on outer layer clusters
750 // if (distClSameModMin!=0.) fOverlapFlagClustersLay2[iClOverlap]=kTRUE;