Changing once more (hopefully we get it correct this time...) the logic to trig the...
[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>
87f41a67 17#include "AliLog.h"
e8189707 18
19class AliITSMap;
20class AliITSresponse;
21class AliITSsegmentation;
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.
87f41a67 37 virtual void FindRawClusters(Int_t /*mod*/)=0; // Finds cluster of digits.
38 virtual void RawdataToClusters(AliRawReader* /*rawReader*/,TClonesArray** /*clusters*/) {
39 AliError("Method not implemented in this class ");
40 }
41
aacedc3e 42 // Digit
43 virtual void SetDigits(TClonesArray *itsDigits) {// set digits
44 fDigits=itsDigits;fNdigits = fDigits->GetEntriesFast();}
45 virtual AliITSdigit* GetDigit(Int_t i){ // Returns ith digit
46 return (AliITSdigit*) fDigits->UncheckedAt(i);}
47 virtual TClonesArray* Digits(){return fDigits;}// Gets fDigits
48 virtual Int_t NDigits() const {return fNdigits;}// Get Number of Digits
87f41a67 49
aacedc3e 50 // Set fClusters up
51 virtual void SetClusters(TClonesArray *itsClusters){// set clusters
87f41a67 52 fClusters = itsClusters;}
aacedc3e 53 // Get fCluters
54 virtual TClonesArray* Clusters(){return fClusters;}
aacedc3e 55 // Returns the present number of enteries
56 virtual Int_t NClusters()const {return fClusters->GetEntriesFast();}
d2f55a22 57
aacedc3e 58 virtual void SetModule(Int_t module){fModule = module;}// Set module number
00a7cc50 59 virtual Int_t GetModule()const {return fModule;}// Returns module number
5d2c2f86 60
87f41a67 61 void SetEvent(Int_t event) { fEvent=event; }
5d2c2f86 62
aacedc3e 63 // Others
64 virtual void SetMap(AliITSMap *m) {fMap=m;}// map
65 AliITSMap* Map(){return fMap;}// map
aacedc3e 66 virtual Int_t GetNPeaks() const {return fNPeaks;}// returns fNPeaks
67 //
68 virtual Bool_t IsNeighbor(TObjArray *digs,Int_t i,Int_t j[]) const;
aacedc3e 69 // Set max. cluster size ; bigger clusters will be rejected
87f41a67 70
aacedc3e 71 // IO functions
7d62fb64 72 void Print(ostream *os) const; // Class ascii print function
aacedc3e 73 void Read(istream *os); // Class ascii read function
d2f55a22 74 virtual void Print(Option_t *option="") const {TObject::Print(option);}
75 virtual Int_t Read(const char *name) {return TObject::Read(name);}
e8189707 76
7d62fb64 77 virtual void SetDetTypeRec(AliITSDetTypeRec* dtr) {fDetTypeRec=dtr;}
78 AliITSDetTypeRec* GetDetTypeRec() const {return fDetTypeRec;}
04366a57 79
7d62fb64 80 void InitGeometry();
04366a57 81
aacedc3e 82 protected:
5d2c2f86 83 class Ali1Dcluster {
84 public:
85 void SetY(Float_t y) {fY=y;}
86 void SetQ(Float_t q) {fQ=q;}
87 void SetNd(Int_t n) {fNd=n;}
88 void SetLabels(Int_t *lab) {fLab[0]=lab[0];fLab[1]=lab[1];fLab[2]=lab[2];}
89 Float_t GetY() const {return fY;}
90 Float_t GetQ() const {return fQ;}
91 Int_t GetNd()const {return fNd;}
92 Int_t GetLabel(Int_t lab) const { return fLab[lab]; }
93 protected:
94 Float_t fY; //cluster position
95 Float_t fQ; //cluster charge
96 Int_t fNd; //number of digits
97 Int_t fLab[3]; //track label
98 };
99 class AliBin {
100 public:
101 AliBin():fIndex(0),fMask(0xFFFFFFFE),fQ(0){}
102 void SetIndex(UInt_t idx) {fIndex=idx;}
103 void SetQ(UShort_t q) {fQ=q;}
104 void SetMask(UInt_t m) {fMask=m;}
105 void Reset() {fIndex=0; fMask=0xFFFFFFFE; fQ=0;}
106
107 void Use() {fMask&=0xFFFFFFFE;}
108 Bool_t IsNotUsed() const {return (fMask&1);}
109 Bool_t IsUsed() const {return !(IsNotUsed());}
110
111 UInt_t GetIndex() const {return fIndex;}
112 UShort_t GetQ() const {return fQ;}
113 UInt_t GetMask() const {return fMask;}
114 protected:
115 UInt_t fIndex; //digit index
116 UInt_t fMask; //peak mask
117 UShort_t fQ; //signal
118 };
119 void MakeCluster(Int_t k,Int_t max,AliBin *bins,UInt_t m,AliITSRecPoint &c);
120 static Bool_t IsMaximum(Int_t k, Int_t max, const AliBin *bins);
121 static void FindPeaks(Int_t k,Int_t m,AliBin*b,Int_t*idx,UInt_t*msk,Int_t&n);
122 static void MarkPeak(Int_t k, Int_t max, AliBin *bins, UInt_t m);
123 static void FindCluster(Int_t k,Int_t maxz,AliBin *bins,Int_t &n,Int_t *idx);
124
125 static void CheckLabels2(Int_t lab[10]);
126 static void AddLabel(Int_t lab[10], Int_t label);
88cb7938 127
87f41a67 128 // data members
129
130 Int_t fModule; //! Module number to be reconstuctted
131 TClonesArray *fDigits; //! digits
132 Int_t fNdigits; //! num of digits
133
134 AliITSDetTypeRec* fDetTypeRec; //ITS object for reconstruction
135 TClonesArray *fClusters; //! Array of clusters
136 AliITSMap *fMap; //! map
137 Int_t fNPeaks; //! NPeaks
138 // Data members needed to fill AliCluster objects
139 Int_t fNdet[2200]; // detector index
140 Int_t fNlayer[2200]; // detector layer
141
142 Int_t fNModules; // total number of modules
143 Int_t fEvent; //event number
144
145 AliITSClusterFinder(const AliITSClusterFinder &source); // copy constructor
146 // assignment operator
147 AliITSClusterFinder& operator=(const AliITSClusterFinder &source);
148
149
150 ClassDef(AliITSClusterFinder,9) //Class for clustering and reconstruction of space points
9de0700b 151};
aacedc3e 152// Input and output functions for standard C++ input/output.
153ostream &operator<<(ostream &os,AliITSClusterFinder &source);
154istream &operator>>(istream &os,AliITSClusterFinder &source);
b0f5e3fc 155#endif