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 */
8 ///////////////////////////////////////////////////////////////////////////////
10 // TRD calibration class for the HLT parameters //
12 ///////////////////////////////////////////////////////////////////////////////
28 class AliTRDCalibraMode;
29 class AliTRDCalibraVector;
33 class AliTRDmcmTracklet;
35 class AliTRDCalibraFillHisto : public TObject {
40 static AliTRDCalibraFillHisto *Instance();
41 static void Terminate();
42 static void Destroy();
44 AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c);
45 AliTRDCalibraFillHisto &operator=(const AliTRDCalibraFillHisto &) { return *this; }
47 // Functions for initialising the AliTRDCalibraFillHisto in the code
48 Bool_t Init2Dhistos();
50 // Functions for filling the histos in the code
52 Bool_t UpdateHistograms(AliTRDcluster *cl, AliTRDtrack *t);
53 Bool_t UpdateHistogramcm(AliTRDmcmTracklet *trk);
56 Bool_t IsPadOn(Int_t detector, Int_t col, Int_t row) const;
58 // Functions for plotting the 2D
61 // Functions for writting the 2D
65 Double_t *StatH(TH2 *ch, Int_t i);
68 // Set of Get the variables
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; }
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; }
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; }
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; }
118 void SetWrite(Int_t i) { fWrite[i] = kTRUE; }
119 void SetWriteName(TString writeName) { fWriteName = writeName; }
121 Bool_t GetWrite(Int_t i) const { return fWrite[i]; }
122 TString GetWriteName() const { return fWriteName; }
125 AliTRDCalibraMode *GetCalibraMode() const { return fCalibraMode; }
128 AliTRDCalibraVector *GetCalibraVector() const { return fCalibraVector; }
132 // This is a singleton, contructor is private!
133 AliTRDCalibraFillHisto();
134 virtual ~AliTRDCalibraFillHisto();
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
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
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
161 AliTRDCalibraMode *fCalibraMode; // Calibration mode
164 // Internal variables
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
191 AliTRDCalibraVector *fCalibraVector; // The vector object
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
200 // A lot of internal functions......
203 // Init AliTRDCalibraFillHisto
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);
212 void FillTheInfoOfTheTrackPH();
213 void FillTheInfoOfTheTrackCH();
214 void ResetfVariables();
215 Bool_t LocalisationDetectorXbins(Int_t detector);
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;
226 // Instance of this class and so on
227 static AliTRDCalibraFillHisto *fgInstance; // Instance
228 static Bool_t fgTerminated; // If terminated
230 ClassDef(AliTRDCalibraFillHisto,1) // TRD Calibration class