]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFClusterFinderV1.h
coding conventions
[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()     const {return fMaxDeltaTime;};
67
68  public:
69   class AliTOFselectedDigit { 
70     friend class AliTOFClusterFinderV1; // to define AliTOFClusterFinderV1 friend object
71    public:
72    AliTOFselectedDigit() :
73      fTDC(0.),fADC(0.),fTOT(0.),fWeight(0.),fIndex(-1) {
74        for (Int_t ii=0; ii<5; ii++) fDetectorIndex[ii]=-1;
75        for (Int_t ii=0; ii<3; ii++) fTrackLabel[ii]=-1;
76    };
77    AliTOFselectedDigit(Int_t * const ind, Double_t h1, Double_t h2, Double_t h3, Double_t h4, Int_t idx, Int_t * const l):
78      fTDC(h1),fADC(h2),fTOT(h3),fWeight(h4),fIndex(idx) {
79      for (Int_t ii=0; ii<5; ii++) fDetectorIndex[ii]=ind[ii];
80      for (Int_t ii=0; ii<5; ii++) fTrackLabel[ii]=l[ii];
81    };
82
83
84    Double_t GetTDC()    const {return fTDC;} // digit TOF
85    Double_t GetADC()    const {return fADC;} // digit ADC
86    Double_t GetTOT()    const {return fTOT;} // digit TOT
87    Double_t GetWeight() const {return fWeight;} // digit weight
88    Int_t GetTrackLabel(Int_t n)    const {return fTrackLabel[n];} // Labels of tracks in digit
89    Int_t GetDetectorIndex(Int_t n) const {return fDetectorIndex[n];} // Digit Detector Index n
90    Int_t GetIndex()     const {return fIndex;} // Digit Index
91
92    private: 
93
94    Int_t fDetectorIndex[5]; //digit detector indices (sector, plate, strip, padX, padZ) 
95    Double_t fTDC; //TDC count
96    Double_t fADC; //ADC count
97    Double_t fTOT; //TOT count
98    Double_t fWeight; //weight
99    Int_t fIndex; //index of the digit in the TOF digit tree
100    Int_t fTrackLabel[3]; //track labels
101    }; 
102
103
104  protected:
105
106   AliRunLoader *fRunLoader;   // Pointer to Run Loader
107   AliTOFcluster *fTofClusters[kTofMaxCluster];  // pointers to the TOF clusters
108   TClonesArray *fDigits;      // List of digits
109   TClonesArray *fRecPoints;   // List of reconstructed points
110   Int_t fNumberOfTofClusters; // Number of TOF Clusters
111   Int_t fNumberOfTofDigits;   // Number of TOF Digits
112
113  private:
114
115   Int_t fMaxDeltaTime; // max time difference in between two tof
116                        // measurements for two neighbouring pads
117
118   Int_t InsertCluster(AliTOFcluster *tofCluster);    // Fills TofClusters Array
119   Int_t FindClusterIndex(Double_t z) const; // Returns cluster index 
120   Bool_t MakeSlewingCorrection(Int_t *detectorIndex, Int_t tofDigitToT, Int_t tofDigitTdc,
121                                Int_t &tdcCorr);
122   void TOFclusterError(/*Bool_t check,*/ Int_t counter, Int_t **ind, Double_t *weight,
123                        Double_t ppos[], Double_t cov[]) const;
124
125   void AverageCalculations(Int_t number, Float_t *interestingX,
126                            Float_t *interestingY, Float_t *interestingZ,
127                            Double_t *interestingTOF, Double_t *interestingTOT,
128                            Double_t *interestingADC, Double_t *interestingWeight,
129                            Int_t *parTOF, Double_t *posClus, Bool_t &check);
130
131   Int_t fVerbose;           // Verbose level (0:no msg, 1:msg, 2:digits in txt files)
132   Bool_t fDecoderVersion;   // setting whether to use the new decoder version 
133                             //  -true -> new version
134                             //  -false ->old version  (default value!!)
135   AliTOFcalib *fTOFcalib;        // pointer to the TOF calibration info
136   AliTOFDigitMap* fTOFdigitMap;  // TOF digit map pointer
137   AliTOFGeometry *fTOFGeometry;  // pointer to the TOF geometry
138   TTree *fTOFdigits;             // pointer to the TOF digit tree
139
140   AliTOFRawStream fTOFRawStream; // AliTOFRawStream variable
141
142   ClassDef(AliTOFClusterFinderV1,2) // To run TOF clustering
143 };
144 #endif
145