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