]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDCalibraFillHisto.h
Conversion of survey data into alignable objects implemented
[u/mrichter/AliRoot.git] / TRD / AliTRDCalibraFillHisto.h
CommitLineData
55a288e5 1#ifndef ALITRDCALIBRAFILLHISTO_H
2#define ALITRDCALIBRAFILLHISTO_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8///////////////////////////////////////////////////////////////////////////////
9// //
10// TRD calibration class for the HLT parameters //
11// //
12///////////////////////////////////////////////////////////////////////////////
13
14#ifndef ROOT_TObject
15# include <TObject.h>
16#endif
17
18class TTree;
19class TProfile2D;
20class TGraphErrors;
21class TGraph;
22class TObjArray;
23class TH1F;
24class TH2I;
25class TH2;
26
27class AliLog;
28class AliTRDCalibraMode;
29class AliTRDCalibraVector;
30
31class AliTRDcluster;
32class AliTRDtrack;
33class AliTRDmcmTracklet;
34
35class AliTRDCalibraFillHisto : public TObject {
36
37 public:
38
39 // Instance
40 static AliTRDCalibraFillHisto *Instance();
41 static void Terminate();
42 static void Destroy();
43
44 AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c);
45 AliTRDCalibraFillHisto &operator=(const AliTRDCalibraFillHisto &) { return *this; }
46
47 // Functions for initialising the AliTRDCalibraFillHisto in the code
48 Bool_t Init2Dhistos();
49
50 // Functions for filling the histos in the code
51 Bool_t ResetTrack();
52 Bool_t UpdateHistograms(AliTRDcluster *cl, AliTRDtrack *t);
53 Bool_t UpdateHistogramcm(AliTRDmcmTracklet *trk);
54
55 // Is Pad on
56 Bool_t IsPadOn(Int_t detector, Int_t col, Int_t row) const;
57
58 // Functions for plotting the 2D
59 void Plot2d();
60
61 // Functions for writting the 2D
62 Bool_t Write2d();
63
64 //For the statistics
65 Double_t *StatH(TH2 *ch, Int_t i);
66
67 //
68 // Set of Get the variables
69 //
70
71 // Choice to fill or not the 2D
72 void SetMITracking(Bool_t mitracking = kTRUE) { fMITracking = mitracking; }
73 void SetMcmTracking(Bool_t mcmtracking = kTRUE) { fMcmTracking = mcmtracking; }
74 void SetMcmCorrectAngle() { fMcmCorrectAngle = kTRUE; }
75 void SetPH2dOn() { fPH2dOn = kTRUE; }
76 void SetCH2dOn() { fCH2dOn = kTRUE; }
77 void SetPRF2dOn() { fPRF2dOn = kTRUE; }
78 void SetHisto2d() { fHisto2d = kTRUE; }
79 void SetVector2d() { fVector2d = kTRUE; }
80
81 Bool_t GetMITracking() const { return fMITracking; }
82 Bool_t GetMcmTracking() const { return fMcmTracking; }
83 Bool_t GetMcmCorrectAngle() const { return fMcmCorrectAngle; }
84 Bool_t GetPH2dOn() const { return fPH2dOn; }
85 Bool_t GetCH2dOn() const { return fCH2dOn; }
86 Bool_t GetPRF2dOn() const { return fPRF2dOn; }
87 Bool_t GetHisto2d() const { return fHisto2d; }
88 Bool_t GetVector2d() const { return fVector2d; }
89 TH2I *GetCH2d() const { return fCH2d; }
90 TProfile2D *GetPH2d() const { return fPH2d; }
91 TProfile2D *GetPRF2d() const { return fPRF2d; }
92
93 // How to fill the 2D
94 void SetRelativeScaleAuto() { fRelativeScaleAuto = kTRUE; }
95 void SetRelativeScale(Float_t relativeScale);
96 void SetThresholdClusterPRF1(Float_t thresholdClusterPRF1) { fThresholdClusterPRF1 = thresholdClusterPRF1; }
97 void SetThresholdClusterPRF2(Float_t thresholdClusterPRF2) { fThresholdClusterPRF2 = thresholdClusterPRF2; }
98 void SetCenterOfflineCluster() { fCenterOfflineCluster = kTRUE; }
99 void SetNz(Int_t i, Short_t nz);
100 void SetNrphi(Int_t i, Short_t nrphi);
101 void SetProcent(Float_t procent) { fProcent = procent; }
102 void SetDifference(Short_t difference) { fDifference = difference; }
103 void SetNumberClusters(Short_t numberClusters) { fNumberClusters = numberClusters; }
104 void SetNumberBinCharge(Short_t numberBinCharge) { fNumberBinCharge = numberBinCharge; }
105 void SetNumberBinPRF(Short_t numberBinPRF) { fNumberBinPRF = numberBinPRF; }
106
107 Float_t GetRelativeScale() const { return fRelativeScale; }
108 Bool_t GetRelativeScaleAuto() const { return fRelativeScaleAuto; }
109 Float_t GetThresholdClusterPRF1() const { return fThresholdClusterPRF1; }
110 Float_t GetThresholdClusterPRF2() const { return fThresholdClusterPRF2; }
111 Float_t GetProcent() const { return fProcent; }
112 Short_t GetDifference() const { return fDifference; }
113 Short_t GetNumberClusters() const { return fNumberClusters; }
114 Short_t GetNumberBinCharge() const { return fNumberBinCharge; }
115 Short_t GetNumberBinPRF() const { return fNumberBinPRF; }
116
117 // Write
118 void SetWrite(Int_t i) { fWrite[i] = kTRUE; }
119 void SetWriteName(TString writeName) { fWriteName = writeName; }
120
121 Bool_t GetWrite(Int_t i) const { return fWrite[i]; }
122 TString GetWriteName() const { return fWriteName; }
123
124 // Calibration mode
125AliTRDCalibraMode *GetCalibraMode() const { return fCalibraMode; }
126
127// Vector method
128AliTRDCalibraVector *GetCalibraVector() const { return fCalibraVector; }
129
130 private:
131
132 // This is a singleton, contructor is private!
133 AliTRDCalibraFillHisto();
134 virtual ~AliTRDCalibraFillHisto();
135
136 protected:
137
138 // Choice to fill or not the 2D
139 Bool_t fMITracking; // Chose to fill the 2D histos or vectors during the offline MI tracking
140 Bool_t fMcmTracking; // Chose to fill the 2D histos or vectors during the tracking with tracklets
141 Bool_t fMcmCorrectAngle; // Apply correction due to the mcmtrackletangle in the z direction (only) assuming from vertex
142 Bool_t fCH2dOn; // Chose to fill the 2D histos or vectors for the relative gain calibration
143 Bool_t fPH2dOn; // Chose to fill the 2D histos or vectors for the drift velocity and T0
144 Bool_t fPRF2dOn; // Chose to fill the 2D histos or vectors for the pad response function calibration
145 Bool_t fHisto2d; // Chose to fill the 2D histos
146 Bool_t fVector2d; // Chose to fill vectors
147
148 // How to fill the 2D
149 Float_t fRelativeScale; // Scale of the deposited charge
150 Int_t fCountRelativeScale; // fCountRelativeScale first data used for the scaling
151 Bool_t fRelativeScaleAuto; // Scaling with the first fCountRelativeScale objects
152 Float_t fThresholdClusterPRF1; // Threshold on cluster pad signals for PRF peripherique
153 Float_t fThresholdClusterPRF2; // Threshold on cluster pad signals for PRF peripherique
154 Bool_t fCenterOfflineCluster; // Choose to use the offline determination of the center of the cluster
155
156 // Write
157 Bool_t fWrite[3]; // Do you want to write the 2D histo or vectors converted in a tree
158 TString fWriteName; // Where the 2D or trees are written
159
160 // Calibration mode
161 AliTRDCalibraMode *fCalibraMode; // Calibration mode
162
163 //
164 // Internal variables
165 //
166
167 // Fill the 2D histos in the offline tracking
168 Bool_t fDetectorAliTRDtrack; // Change of track
169 Int_t fChamberAliTRDtrack; // Change of chamber
170 Int_t fDetectorPreviousTrack; // Change of detector
171 Bool_t fGoodTrack; // If goes through a kaputt pad
172 Float_t *fAmpTotal; // Energy deposited in the calibration group by the track
173 Short_t *fPHPlace; // Calibration group of PH
174 Float_t *fPHValue; // PH
175 Short_t fNumberClusters; // Minimum number of clusters in the tracklets
176 Float_t fProcent; // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH)
177 Short_t fDifference; // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH)
178 Int_t fNumberTrack; // How many tracks could be used (Debug for the moment)
179 Int_t fNumberUsedCh[2]; // How many tracks have been really used for the gain (0, strict; 1 with fProcent)
180 Int_t fNumberUsedPh[2]; // How many tracks have been really used for the drift velocity (0, strict; 1 with fDifference)
181 Int_t fTimeMax; // Number of time bins
182 Float_t fSf; // Sampling frequence
183 Short_t fNumberBinCharge; // Number of bins for the gain factor
184 Short_t fNumberBinPRF; // Number of bin for the PRF
185
186 //
187 // Vector method
188 //
189
190
191 AliTRDCalibraVector *fCalibraVector; // The vector object
192
193
194 // Histograms to store the info from the digits, from the tracklets or from the tracks
195 TProfile2D *fPH2d; // 2D average pulse height
196 TProfile2D *fPRF2d; // 2D PRF
197 TH2I *fCH2d; // 2D deposited charge
198
199 //
200 // A lot of internal functions......
201 //
202
203 // Init AliTRDCalibraFillHisto
204 void Init();
205
206 // Create the 2D histo to be filled Online
207 void CreateCH2d(Int_t nn);
208 void CreatePH2d(Int_t nn);
209 void CreatePRF2d(Int_t nn);
210
211 // Fill the 2D
212 void FillTheInfoOfTheTrackPH();
213 void FillTheInfoOfTheTrackCH();
214 void ResetfVariables();
215 Bool_t LocalisationDetectorXbins(Int_t detector);
216
217 // Clear
218 void ClearHistos();
219
220 // Some basic geometry function
221 virtual Int_t GetPlane(Int_t d) const;
222 virtual Int_t GetChamber(Int_t d) const;
223 virtual Int_t GetSector(Int_t d) const;
224
225
226 // Instance of this class and so on
227 static AliTRDCalibraFillHisto *fgInstance; // Instance
228 static Bool_t fgTerminated; // If terminated
229
230 ClassDef(AliTRDCalibraFillHisto,1) // TRD Calibration class
231
232};
233
234#endif
235
236