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