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