]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFClusterFinderV1.h
AliTOFDigitMap::GetFilledCellNumber method correction
[u/mrichter/AliRoot.git] / TOF / AliTOFClusterFinderV1.h
1 #ifndef ALITOFCLUSTERFINDERV1_H
2 #define ALITOFCLUSTERFINDERV1_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5 // AliTOFClusterFinderV1 Class
6 // Task: Transform digits/raw data to TOF Clusters, to fill TOF RecPoints
7 // and feed TOF tracking 
8
9 #include "TObject.h"
10
11 #include "AliTOFRawStream.h"
12
13 class TClonesArray;
14 class TTree;
15
16 class AliRunLoader;
17 class AliRawReader;
18
19 class AliTOFcluster;
20 class AliTOFcalib;
21 class AliTOFDigitMap;
22
23 class AliTOFClusterFinderV1 : public TObject
24 {
25
26   enum {kTofMaxCluster=77777}; //maximal number of the TOF clusters
27
28  public:
29
30   AliTOFClusterFinderV1(AliTOFcalib *calib);
31   AliTOFClusterFinderV1(const AliTOFClusterFinderV1 &source); // copy constructor
32   AliTOFClusterFinderV1& operator=(const AliTOFClusterFinderV1 &source); // ass. op.
33   virtual ~AliTOFClusterFinderV1();
34
35   void Digits2RecPoints(TTree* digitsTree, TTree* clusterTree);
36   void Digits2RecPoints(AliRawReader *rawReader, TTree *clustersTree);
37   void Raw2Digits(AliRawReader *rawReader, TTree* digitsTree); 
38
39   AliTOFClusterFinderV1(AliRunLoader* runLoader, AliTOFcalib *calib);
40   void Digits2RecPoints(Int_t iEvent);
41   void Digits2RecPoints(Int_t ievt, AliRawReader *rawReader);
42   void Raw2Digits(Int_t ievt, AliRawReader *rawReader);
43
44   void FillRecPoint();
45   void ResetRecpoint();
46   void ResetDigits();
47   void SetVerbose(Int_t Verbose){fVerbose=Verbose;} // To set the verbose level
48   void SetDecoderVersion(Int_t version){fDecoderVersion=version;} // To set the decoder version
49   Bool_t GetDecoderVersion() const {return fDecoderVersion;} // To get the decoder version
50   UShort_t GetClusterVolIndex(Int_t *ind) const; //Volume Id getter
51   void GetClusterPars(Int_t *ind, Double_t *pos, Double_t *cov) const; //cluster par getter
52   void GetClusterPars(Bool_t check, Int_t counter, Int_t **ind, Double_t *weight,
53                       Double_t *pos, Double_t *cov) const; //cluster par getter
54
55   void FindOnePadClusterPerStrip(Int_t nSector, Int_t nPlate, Int_t nStrip);
56   void FindClustersPerStrip(Int_t nSector, Int_t nPlate, Int_t nStrip, Int_t group);
57
58   void FindClusters34(Int_t nSector, Int_t nPlate, Int_t nStrip);
59   void FindClusters23(Int_t nSector, Int_t nPlate, Int_t nStrip);
60   void FindClusters24(Int_t nSector, Int_t nPlate, Int_t nStrip);
61
62   void SetMaxDeltaTime(Int_t a) {fMaxDeltaTime = a;};
63   Int_t GetMaxDeltaTime()       {return fMaxDeltaTime;};
64
65  public:
66   class AliTOFselectedDigit { 
67     friend class AliTOFClusterFinderV1; 
68    public:
69    AliTOFselectedDigit() 
70      :
71      fTDC(0.),
72      fADC(0.),
73      fTOT(0.),
74      fWeight(0.),
75      fIndex(-1) {
76      fDetectorIndex[0]=-1;
77      fDetectorIndex[1]=-1;
78      fDetectorIndex[2]=-1;
79      fDetectorIndex[3]=-1;
80      fDetectorIndex[4]=-1;
81      fTrackLabel[0]=-1;
82      fTrackLabel[1]=-1;
83      fTrackLabel[2]=-1;
84    };
85    AliTOFselectedDigit(Int_t *ind, Double_t h1, Double_t h2, Double_t h3, Double_t h4, Int_t idx, Int_t *l)
86      :
87      fTDC(h1),
88      fADC(h2),
89      fTOT(h3),
90      fWeight(h4),
91      fIndex(idx) {
92      fDetectorIndex[0]=ind[0];
93      fDetectorIndex[1]=ind[1];
94      fDetectorIndex[2]=ind[2];
95      fDetectorIndex[3]=ind[3];
96      fDetectorIndex[4]=ind[4];
97      fTrackLabel[0]=l[0];
98      fTrackLabel[1]=l[1];
99      fTrackLabel[2]=l[2];
100    };
101
102
103    Double_t GetTDC()    const {return fTDC;} // digit TOF
104    Double_t GetADC()    const {return fADC;} // digit ADC
105    Double_t GetTOT()    const {return fTOT;} // digit TOT
106    Double_t GetWeight() const {return fWeight;} // digit weight
107    Int_t GetTrackLabel(Int_t n)    const {return fTrackLabel[n];} // Labels of tracks in digit
108    Int_t GetDetectorIndex(Int_t n) const {return fDetectorIndex[n];} // Digit Detector Index n
109    Int_t GetIndex()     const {return fIndex;} // Digit Index
110
111    private: 
112
113    Int_t fDetectorIndex[5]; //digit detector indices (sector, plate, strip, padX, padZ) 
114    Double_t fTDC; //TDC count
115    Double_t fADC; //ADC count
116    Double_t fTOT; //TOT count
117    Double_t fWeight; //weight
118    Int_t fIndex; //index of the digit in the TOF digit tree
119    Int_t fTrackLabel[3]; //track labels
120    }; 
121
122
123  protected:
124
125   AliRunLoader *fRunLoader;   // Pointer to Run Loader
126   AliTOFcluster *fTofClusters[kTofMaxCluster];  // pointers to the TOF clusters
127   TClonesArray *fDigits;      // List of digits
128   TClonesArray *fRecPoints;   // List of reconstructed points
129   Int_t fNumberOfTofClusters; // Number of TOF Clusters
130   Int_t fNumberOfTofDigits;   // Number of TOF Digits
131
132  private:
133
134   Int_t fMaxDeltaTime; // max time difference in between two tof measurements
135                        // for two neighbouring pads
136
137   Int_t InsertCluster(AliTOFcluster *tofCluster);    // Fills TofClusters Array
138   Int_t FindClusterIndex(Double_t z) const; // Returns cluster index 
139   Bool_t MakeSlewingCorrection(Int_t *detectorIndex, Int_t tofDigitToT, Int_t tofDigitTdc,
140                                Int_t &tdcCorr);
141   void TOFclusterError(Bool_t check, Int_t counter, Int_t **ind, Double_t *weight,
142                        Double_t ppos[], Double_t cov[]) const;
143
144   void AverageCalculations(Int_t number, Float_t *interestingX,
145                            Float_t *interestingY, Float_t *interestingZ,
146                            Double_t *interestingTOF, Double_t *interestingTOT,
147                            Double_t *interestingADC, Double_t *interestingWeight,
148                            Int_t *parTOF, Double_t *posClus, Bool_t &check);
149
150   Int_t fVerbose;           // Verbose level (0:no msg, 1:msg, 2:digits in txt files)
151   Bool_t fDecoderVersion;   // setting whether to use the new decoder version 
152                             //  -true -> new version
153                             //  -false ->old version  (default value!!)
154   AliTOFcalib *fTOFcalib;       // pointer to the TOF calibration info
155   AliTOFDigitMap* fTOFdigitMap; // TOF digit map pointer
156
157   AliTOFRawStream fTOFRawStream; // AliTOFRawStream variable
158
159   ClassDef(AliTOFClusterFinderV1,2) // To run TOF clustering
160 };
161 #endif
162