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