1 /**************************************************************************
2 * Copyright(c) 1998-2003, 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 **************************************************************************/
16 //////////////////////////////////////////////////////////////////////////
17 // Class used to simplify some operations with clusters. //
18 // -Function FillArray fills an array wich contains, for each //
19 // ITS module, an array with the indices of all the clusters detected //
20 // by the module. The indices correspond to the cluster indices in class//
21 // AliITSlayer of AliITStrackerV2. //
22 // This function is used in AliITStrackerSA::FindTracks. //
23 // -Function FillArrayLabel fills an array wich contains, for each //
24 // particle label, and for each layer, the information on clusters: //
25 // 0 if there is no cluster, 1 if there is a cluster with this label. //
26 // This function is used to define trackable tracks. //
27 ///////////////////////////////////////////////////////////////////////////
30 #include "AliITSclusterTable.h"
31 #include "AliITSclusterV2.h"
32 #include "AliITSgeom.h"
33 #include "AliITStrackerSA.h"
35 #include<TClonesArray.h>
37 ClassImp(AliITSclusterTable)
39 //__________________________________________________________
40 AliITSclusterTable::AliITSclusterTable(){
41 // Default constructor
49 //__________________________________________________________
50 AliITSclusterTable::AliITSclusterTable(AliITSgeom* geom, AliITStrackerSA* tracker) {
51 // Standard constructor
53 Int_t nm = geom->GetIndexMax();
55 for(Int_t i=0;i<nm;i++){fNCl[i]=0;}
61 //______________________________________________________________________
62 AliITSclusterTable::AliITSclusterTable(const AliITSclusterTable &tab) :
65 // Copies are not allowed. The method is protected to avoid misuse.
66 Error("AliITSclusterTable","Copy constructor not allowed\n");
69 //______________________________________________________________________
70 AliITSclusterTable& AliITSclusterTable::operator=(const
71 AliITSclusterTable& /* tab */){
72 // Assignment operator
73 // Assignment is not allowed. The method is protected to avoid misuse.
74 Error("= operator","Assignment operator not allowed\n");
78 //__________________________________________________________
79 AliITSclusterTable::~AliITSclusterTable(){
81 Int_t nm = fGeom->GetIndexMax();
83 for (Int_t i=0; i<nm; i++){
89 for (Int_t i=0; i<nm; i++){
94 if (fLbl)delete [] fLbl;
95 if (fNCl)delete [] fNCl;
98 //__________________________________________________________
100 void AliITSclusterTable::FillArray(TTree* clusterTree,Int_t evnumber){
103 Int_t nm = fGeom->GetIndexMax();
104 fDet = new TArrayI*[nm];
105 fTracker->SetEventNumber(evnumber);
106 fTracker->LoadClusters(clusterTree);
108 TArrayI** vect = new TArrayI*[fGeom->GetNlayers()];
110 Int_t * firstmod = new Int_t[fGeom->GetNlayers()+1];
111 firstmod[fGeom->GetNlayers()]=fGeom->GetIndexMax(); // upper limit
112 for(Int_t nlayer=0;nlayer<fGeom->GetNlayers();nlayer++){
113 firstmod[nlayer] = fGeom->GetModuleIndex(nlayer+1,1,1);
114 Int_t ncl = fTracker->GetNumberOfClustersLayer(nlayer);
115 vect[nlayer]=new TArrayI(ncl);
116 for(Int_t j=0;j<ncl;j++){
117 AliITSclusterV2* cl = fTracker->GetClusterLayer(nlayer,j);
118 vect[nlayer]->AddAt(cl->GetDetectorIndex()+firstmod[nlayer],j);
122 TBranch *brancht=(TBranch*)clusterTree->GetBranch("Clusters");
123 if(!brancht) Warning("FillArray","No cluster branch");
124 TClonesArray* clus = new TClonesArray("AliITSclusterV2",10000);
125 brancht->SetAddress(&clus);
128 for(Int_t mod=0;mod<nm;mod++){
130 clusterTree->GetEvent(mod);
131 Int_t ncl = clus->GetEntries();
132 fDet[mod] = new TArrayI(ncl);
134 Int_t nlr = FindIndex(fGeom->GetNlayers(),firstmod,mod);
136 Fatal("FillArray","Wrong module number %d . Limits: %d , %d",mod,firstmod[0],firstmod[fGeom->GetNlayers()+1]);
140 for(Int_t n=0;n<vect[nlr]->GetSize();n++){
141 Int_t mm=vect[nlr]->At(n);
142 if(mm==mod) {fDet[mod]->AddAt(n,nc); nc+=1; }
148 fTracker->UnloadClusters();
150 for(Int_t n=0;n<fGeom->GetNlayers();n++)delete vect[n];
155 //_________________________________________________________________
156 void AliITSclusterTable::FillArrayLabel(Int_t numberofparticles,TTree* clusterTree,Int_t evnumber){
160 fLbl = new TArrayI*[numberofparticles];
161 fTracker->SetEventNumber(evnumber);
162 fTracker->LoadClusters(clusterTree);
163 const Int_t knm =fGeom->GetNlayers();
164 for(Int_t nlab=0;nlab<numberofparticles;nlab++){
165 fLbl[nlab] = new TArrayI(knm);
166 Int_t * nn = new Int_t[knm];
167 for(Int_t i=0;i<knm;i++)nn[i]=0;
168 for(Int_t nlayer=0;nlayer<knm;nlayer++){
169 Int_t ncl = fTracker->GetNumberOfClustersLayer(nlayer);
171 AliITSclusterV2* cl = fTracker->GetClusterLayer(nlayer,ncl);
172 if(cl->IsUsed()==1) continue;
173 if(cl->GetLabel(0)==nlab || cl->GetLabel(1)==nlab || cl->GetLabel(2)==nlab){
179 fLbl[nlab]->AddAt(nn[nlayer],nlayer);
184 fTracker->UnloadClusters();
187 //_______________________________________________________________
188 Int_t AliITSclusterTable::ThisParticleIsTrackable(Int_t label,Int_t numberofpoints){
190 //Returns 1 if particle with label "label" is trackable.
193 for(Int_t i=0;i<fGeom->GetNlayers();i++){
194 Int_t ncl = fLbl[label]->At(i);
197 if(nb>=numberofpoints) return 1;
202 //_______________________________________________________________
203 Int_t AliITSclusterTable::FindIndex(Int_t ndim, Int_t *ptr, Int_t value){
204 // ptr[ndim+1] is an array of integers
205 // ndim is its dimension minus 1
206 // value is a number such as: ptr[0]<=value < ptr[ndim]
207 // if ptr[i]<=value<ptr[i+1] the index i is returned; -1 if out of bounds
209 for(Int_t k=0;k<ndim;k++){
210 if(value>=ptr[k] && value <ptr[k+1]){