Changes to be able to access reference data files via Alien, in a similar way as...
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinder.h
CommitLineData
b0f5e3fc 1#ifndef ALIITSCLUSTERFINDER_H
2#define ALIITSCLUSTERFINDER_H
9de0700b 3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id$ */
b0f5e3fc 8
9////////////////////////////////////////////////
e8189707 10// ITS Cluster Finder Class //
04366a57 11// //
12// //
b0f5e3fc 13////////////////////////////////////////////////
14
e8189707 15#include <TObject.h>
16#include <TClonesArray.h>
17
18class AliITSMap;
19class AliITSresponse;
20class AliITSsegmentation;
21class AliITSRawCluster;
8ca6a9a5 22class AliITSdigit;
9355b256 23class AliITSRecPoint;
7d62fb64 24class AliITSDetTypeRec;
5d2c2f86 25class AliRawReader;
b0f5e3fc 26
9de0700b 27//----------------------------------------------------------------------
28class AliITSClusterFinder :public TObject{
aacedc3e 29 public:
28a570fd 30 AliITSClusterFinder(); // Default constructor
aacedc3e 31 // Standard Constructor
8ba39da9 32 AliITSClusterFinder(AliITSDetTypeRec* dettyp);
33 AliITSClusterFinder(AliITSDetTypeRec* dettyp,TClonesArray *digits);// Standard+ Constructor
28a570fd 34 virtual ~AliITSClusterFinder(); // Destructor
9de0700b 35 //
aacedc3e 36 // Do the Reconstruction.
f8d9a5b8 37 virtual void FindRawClusters(Int_t mod=0); // Finds cluster of digits.
04366a57 38 //
aacedc3e 39 // Sets the debug flag for debugging output
40 void SetDebug(Int_t level=1){fDebug=level;}
41 // Clears the debug flag so no debugging output will be generated
42 void SetNoDebug(){fDebug=0;}
43 // Returns the debug flag value
5d766c75 44 Bool_t GetDebug(Int_t level=1)const {return fDebug>=level;}
aacedc3e 45 // Digit
46 virtual void SetDigits(TClonesArray *itsDigits) {// set digits
47 fDigits=itsDigits;fNdigits = fDigits->GetEntriesFast();}
48 virtual AliITSdigit* GetDigit(Int_t i){ // Returns ith digit
49 return (AliITSdigit*) fDigits->UncheckedAt(i);}
50 virtual TClonesArray* Digits(){return fDigits;}// Gets fDigits
51 virtual Int_t NDigits() const {return fNdigits;}// Get Number of Digits
aacedc3e 52 // clulsters
53 // Set fClusters up
54 virtual void SetClusters(TClonesArray *itsClusters){// set clusters
55 fClusters = itsClusters;fNRawClusters = fClusters->GetEntriesFast();}
56 // Get fCluters
57 virtual TClonesArray* Clusters(){return fClusters;}
58 // Get fCluter
59 virtual AliITSRawCluster* Cluster(Int_t i){
60 return (AliITSRawCluster*)(fClusters->At(i));}
61 // Returns the present number of enteries
62 virtual Int_t NClusters()const {return fClusters->GetEntriesFast();}
63 // returns fNRawClusters
64 virtual Int_t GetNRawClusters() const {return fNRawClusters;}
f8d9a5b8 65 // Determins if digit i has a neighbor and if so that neighor index is j.
aacedc3e 66 virtual void AddCluster(Int_t branch,AliITSRawCluster *c);
67 virtual void AddCluster(Int_t branch,AliITSRawCluster *c,
68 AliITSRecPoint &rp);
69 virtual void FillCluster(AliITSRawCluster *,Int_t) {}// fiil cluster
70 virtual void FillCluster(AliITSRawCluster *cluster) {// fill cluster
71 FillCluster(cluster,1);}
d2f55a22 72
aacedc3e 73 virtual void SetModule(Int_t module){fModule = module;}// Set module number
00a7cc50 74 virtual Int_t GetModule()const {return fModule;}// Returns module number
5d2c2f86 75
76 void SetEvent(Int_t event) { fEvent=event; }
77 virtual void RawdataToClusters(AliRawReader* /*rawReader*/,TClonesArray** /*clusters*/) {
78 Warning("RawdataToClusters","Method not implemented in this class ");}
79
aacedc3e 80 //
81 // RecPoints
f8d9a5b8 82 // Given a cluster of digits, creates the nessesary RecPoint. May also
83 // do some peak separation.
ac74f489 84 virtual void CreateRecPoints(TObjArray *,Int_t){};
aacedc3e 85 // Others
86 virtual void SetMap(AliITSMap *m) {fMap=m;}// map
87 AliITSMap* Map(){return fMap;}// map
88 virtual Int_t GetNperMax() const {return fNperMax;}// returns fNperMax
89 // returns fDeclusterFlag
90 virtual Int_t GetDeclusterFlag()const{return fDeclusterFlag;}
91 // returns fClusterSize
92 virtual Int_t GetClusterSize() const {return fClusterSize;}
93 virtual Int_t GetNPeaks() const {return fNPeaks;}// returns fNPeaks
94 //
95 virtual Bool_t IsNeighbor(TObjArray *digs,Int_t i,Int_t j[]) const;
ac74f489 96 virtual void Decluster(AliITSRawCluster *) {}// Decluster
aacedc3e 97 // Set max. Number of cells per local cluster
98 virtual void SetNperMax(Int_t npermax=3) {fNperMax = npermax;}
99 //Decluster
100 virtual void SetDeclusterFlag(Int_t flag=1){fDeclusterFlag=flag;}
101 // Set max. cluster size ; bigger clusters will be rejected
102 virtual void SetClusterSize(Int_t clsize=3) {fClusterSize = clsize;}
103 virtual void CalibrateCOG() {}// Self Calibration of COG
104 virtual void CorrectCOG(){}// correct COG
105 virtual Bool_t Centered(AliITSRawCluster *) const {return kTRUE;}// cluster
106 //split by local maxima
107 virtual void SplitByLocalMaxima(AliITSRawCluster *){}
108 // IO functions
7d62fb64 109 void Print(ostream *os) const; // Class ascii print function
aacedc3e 110 void Read(istream *os); // Class ascii read function
d2f55a22 111 virtual void Print(Option_t *option="") const {TObject::Print(option);}
112 virtual Int_t Read(const char *name) {return TObject::Read(name);}
e8189707 113
7d62fb64 114 virtual void SetDetTypeRec(AliITSDetTypeRec* dtr) {fDetTypeRec=dtr;}
115 AliITSDetTypeRec* GetDetTypeRec() const {return fDetTypeRec;}
04366a57 116
7d62fb64 117 void InitGeometry();
04366a57 118
aacedc3e 119 protected:
5d2c2f86 120 class Ali1Dcluster {
121 public:
122 void SetY(Float_t y) {fY=y;}
123 void SetQ(Float_t q) {fQ=q;}
124 void SetNd(Int_t n) {fNd=n;}
125 void SetLabels(Int_t *lab) {fLab[0]=lab[0];fLab[1]=lab[1];fLab[2]=lab[2];}
126 Float_t GetY() const {return fY;}
127 Float_t GetQ() const {return fQ;}
128 Int_t GetNd()const {return fNd;}
129 Int_t GetLabel(Int_t lab) const { return fLab[lab]; }
130 protected:
131 Float_t fY; //cluster position
132 Float_t fQ; //cluster charge
133 Int_t fNd; //number of digits
134 Int_t fLab[3]; //track label
135 };
136 class AliBin {
137 public:
138 AliBin():fIndex(0),fMask(0xFFFFFFFE),fQ(0){}
139 void SetIndex(UInt_t idx) {fIndex=idx;}
140 void SetQ(UShort_t q) {fQ=q;}
141 void SetMask(UInt_t m) {fMask=m;}
142 void Reset() {fIndex=0; fMask=0xFFFFFFFE; fQ=0;}
143
144 void Use() {fMask&=0xFFFFFFFE;}
145 Bool_t IsNotUsed() const {return (fMask&1);}
146 Bool_t IsUsed() const {return !(IsNotUsed());}
147
148 UInt_t GetIndex() const {return fIndex;}
149 UShort_t GetQ() const {return fQ;}
150 UInt_t GetMask() const {return fMask;}
151 protected:
152 UInt_t fIndex; //digit index
153 UInt_t fMask; //peak mask
154 UShort_t fQ; //signal
155 };
156 void MakeCluster(Int_t k,Int_t max,AliBin *bins,UInt_t m,AliITSRecPoint &c);
157 static Bool_t IsMaximum(Int_t k, Int_t max, const AliBin *bins);
158 static void FindPeaks(Int_t k,Int_t m,AliBin*b,Int_t*idx,UInt_t*msk,Int_t&n);
159 static void MarkPeak(Int_t k, Int_t max, AliBin *bins, UInt_t m);
160 static void FindCluster(Int_t k,Int_t maxz,AliBin *bins,Int_t &n,Int_t *idx);
161
162 static void CheckLabels2(Int_t lab[10]);
163 static void AddLabel(Int_t lab[10], Int_t label);
04366a57 164 // data members
88cb7938 165
8ba39da9 166 Int_t fDebug; //! Debug flag/level
167 Int_t fModule; //! Module number to be reconstuctted
168 TClonesArray *fDigits; //! digits
169 Int_t fNdigits; //! num of digits
170
171 AliITSDetTypeRec* fDetTypeRec; //ITS object for reconstruction
172 TClonesArray *fClusters; //! Array of clusters
173 Int_t fNRawClusters; //! in case we split the cluster
174 // and want to keep track of
175 // the cluster which was splitted
9de0700b 176 AliITSMap *fMap; //! map
177 Int_t fNperMax; //! NperMax
178 Int_t fDeclusterFlag; //! DeclusterFlag
179 Int_t fClusterSize; //! ClusterSize
180 Int_t fNPeaks; //! NPeaks
04366a57 181 // Data members needed to fill AliCluster objects
04366a57 182 Int_t fNdet[2200]; // detector index
183 Int_t fNlayer[2200]; // detector layer
aacedc3e 184
5d2c2f86 185 Int_t fNModules; // total number of modules
186 Int_t fEvent; //event number
187
188 AliITSClusterFinder(const AliITSClusterFinder &source); // copy constructor
e56160b8 189 // assignment operator
190 AliITSClusterFinder& operator=(const AliITSClusterFinder &source);
191
8ba39da9 192
5d2c2f86 193 ClassDef(AliITSClusterFinder,8) //Class for clustering and reconstruction of space points
9de0700b 194};
aacedc3e 195// Input and output functions for standard C++ input/output.
196ostream &operator<<(ostream &os,AliITSClusterFinder &source);
197istream &operator>>(istream &os,AliITSClusterFinder &source);
b0f5e3fc 198#endif