#101318: Patch for various problems in AliROOT
[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"
6786addd 10#include "TTask.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
6786addd 75class AliTOFClusterFinderV1 : public TTask
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;};
6786addd 118 Int_t GetNumberOfTOFclusters() const {return fNumberOfTofClusters;}
119 Int_t GetNumberOfTOFtrgPads() const {return fNumberOfTofTrgPads;}
e3bd5504 120
e3bd5504 121
d7ed6a6d 122 void SetCalibrateFlag(Bool_t dummy) {fCalibrateTOFtimes = dummy;};
123 Bool_t GetCalibrateFlag() const {return fCalibrateTOFtimes;};
e3bd5504 124
125 protected:
126
127 AliRunLoader *fRunLoader; // Pointer to Run Loader
128 AliTOFcluster *fTofClusters[kTofMaxCluster]; // pointers to the TOF clusters
129 TClonesArray *fDigits; // List of digits
130 TClonesArray *fRecPoints; // List of reconstructed points
131 Int_t fNumberOfTofClusters; // Number of TOF Clusters
132 Int_t fNumberOfTofDigits; // Number of TOF Digits
6786addd 133 Int_t fNumberOfTofTrgPads; // Number of TOF trigger pads
e3bd5504 134
135 private:
136
d7ed6a6d 137 const AliTOFRecoParam* fkRecoParam; // pointer to TOF reconstruction parameters
138
e885fb81 139 Int_t fMaxDeltaTime; // max time difference in between two tof
140 // measurements for two neighbouring pads
e3bd5504 141
142 Int_t InsertCluster(AliTOFcluster *tofCluster); // Fills TofClusters Array
143 Int_t FindClusterIndex(Double_t z) const; // Returns cluster index
144 Bool_t MakeSlewingCorrection(Int_t *detectorIndex, Int_t tofDigitToT, Int_t tofDigitTdc,
145 Int_t &tdcCorr);
e885fb81 146 void TOFclusterError(/*Bool_t check,*/ Int_t counter, Int_t **ind, Double_t *weight,
e3bd5504 147 Double_t ppos[], Double_t cov[]) const;
148
149 void AverageCalculations(Int_t number, Float_t *interestingX,
150 Float_t *interestingY, Float_t *interestingZ,
151 Double_t *interestingTOF, Double_t *interestingTOT,
152 Double_t *interestingADC, Double_t *interestingWeight,
153 Int_t *parTOF, Double_t *posClus, Bool_t &check);
154
155 Int_t fVerbose; // Verbose level (0:no msg, 1:msg, 2:digits in txt files)
156 Bool_t fDecoderVersion; // setting whether to use the new decoder version
157 // -true -> new version
158 // -false ->old version (default value!!)
e885fb81 159 AliTOFcalib *fTOFcalib; // pointer to the TOF calibration info
160 AliTOFDigitMap* fTOFdigitMap; // TOF digit map pointer
161 AliTOFGeometry *fTOFGeometry; // pointer to the TOF geometry
162 TTree *fTOFdigits; // pointer to the TOF digit tree
e3bd5504 163
0275b7df 164 AliTOFRawStream fTOFRawStream; // AliTOFRawStream variable
165
d7ed6a6d 166 Bool_t fCalibrateTOFtimes; // used for check
167
6786addd 168 ClassDef(AliTOFClusterFinderV1,6) // To run TOF clustering
e3bd5504 169};
170#endif
171