]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TRD/AliHLTTRDCalibra.h
initial HLT-TRD commit
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDCalibra.h
1 #ifndef ALIHLTTRDCALIBRA_H
2 #define ALIHLTTRDCALIBRA_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
18 #include "TProfile2D.h"
19 #include "TH2I.h"
20
21 class TProfile2D;
22 class TH2I;
23
24 class AliLog;
25
26 class AliTRDmcmTracklet;
27
28 class AliHLTTRDCalibra : public TObject {
29
30  public: 
31
32   // Instance
33   static AliHLTTRDCalibra *Instance();
34   static void Terminate();
35   static void Destroy();
36
37   AliHLTTRDCalibra(const AliHLTTRDCalibra &c);
38   AliHLTTRDCalibra &operator=(const AliHLTTRDCalibra &) { return *this; }
39
40   // Functions for initialising the AliHLTTRDCalibra in the code
41           Bool_t   Init2Dhistos();
42
43   // Functions for filling the histos in the code
44           Bool_t   UpdateHistogramcm(AliTRDmcmTracklet *trk);
45  
46   // Is Pad on
47           Bool_t   IsPadOn(Int_t detector, Int_t col, Int_t row) const;
48
49   // Functions for writting the 2D
50           Bool_t   Write2d();
51
52   // Pad Calibration
53           Bool_t   ModePadFragmentation(Int_t iPlane,Int_t iChamb, Int_t iSect, Int_t i);
54           void     ModePadCalibration(Int_t iChamb, Int_t i);
55           
56   //
57   // Set of Get the variables
58   //
59
60   // Choice to fill or not the 2D
61           void     SetOn()                                                   { fOn          = kTRUE;           }
62           Bool_t   GetOn() const                                             { return fOn;                     }
63           
64   //Get the 2D histos      
65           TH2I            *GetCH2d() const                                           { return fCH2d;                   }
66           TProfile2D      *GetPH2d() const                                           { return fPH2d;                   }
67           TProfile2D      *GetPRF2d() const                                          { return fPRF2d;                  }
68   
69   // How to fill the 2D
70           void     SetRelativeScale(Float_t relativeScale);
71           void     SetThresholdClusterPRF2(Float_t thresholdClusterPRF2)     { fThresholdClusterPRF2 = thresholdClusterPRF2; }
72           void     SetNz(Int_t i, Short_t nz);
73           void     SetNrphi(Int_t i, Short_t nrphi);
74           void     SetProcent(Float_t procent)                               { fProcent              = procent;              }
75           void     SetDifference(Short_t difference)                         { fDifference           = difference;           }
76           void     SetNumberClusters(Short_t numberClusters)                 { fNumberClusters       = numberClusters;       }
77           void     SetNumberBinCharge(Short_t numberBinCharge)               { fNumberBinCharge      = numberBinCharge;      }
78           void     SetNumberBinPRF(Short_t numberBinPRF)                     { fNumberBinPRF         = numberBinPRF;         }
79   
80           Float_t  GetThresholdClusterPRF2() const                           { return fThresholdClusterPRF2;   }
81           Short_t  GetNz(Int_t i) const                                      { return fNz[i];                  }
82           Short_t  GetNrphi(Int_t i) const                                   { return fNrphi[i];               }
83           Float_t  GetProcent() const                                        { return fProcent;                }
84           Short_t  GetDifference() const                                     { return fDifference;             }
85           Short_t  GetNumberClusters() const                                 { return fNumberClusters;         }
86           Short_t  GetNumberBinCharge() const                                { return fNumberBinCharge;        }
87           Short_t  GetNumberBinPRF() const                                   { return fNumberBinPRF;           }
88   
89   // Write
90           void     SetWriteName(TString writeName)                           { fWriteName     = writeName;     }
91           TString  GetWriteName() const                                      { return fWriteName;              }
92           
93   //
94   // Internal variables to be sure!
95   //
96   
97   // Pad calibration
98           Short_t  GetNnz(Int_t i) const                                     { return fNnZ[i];                 }
99           Short_t  GetNnrphi(Int_t i) const                                  { return fNnRphi[i];              }
100           Short_t  GetNfragz(Int_t i) const                                  { return fNfragZ[i];              }
101           Short_t  GetNfragrphi(Int_t i) const                               { return fNfragRphi[i];           }
102           Short_t  GetDetChamb0(Int_t i) const                               { return fDetChamb0[i];           }
103           Short_t  GetDetChamb2(Int_t i) const                               { return fDetChamb2[i];           }
104
105  private:
106    
107   // This is a singleton, contructor is private!
108           AliHLTTRDCalibra();
109           virtual ~AliHLTTRDCalibra();
110
111  protected:
112
113   // Choice to fill or not the 2D
114           Bool_t   fOn;                     // Chose to fill the 2D histos 
115             
116   // How to fill the 2D
117           Float_t  fRelativeScale;          // Scale of the deposited charge
118           Float_t  fThresholdClusterPRF2;   // Threshold on cluster pad signals for PRF peripherique
119           Short_t  fNz[3];                  // Mode of calibration 
120           Short_t  fNrphi[3];               // Mode of calibration 
121           Int_t    fNtotal[3];              // Total number of Xbins
122
123   // Write
124           TString  fWriteName;              // Where the 2D histos are written
125            
126   //
127   // Internal variables
128   //
129  
130   // Fill the 2D histos in the offline tracking
131           Bool_t   fGoodTrack;              // If goes through a kaputt pad
132           Float_t *fAmpTotal;               //! Energy deposited in the calibration group by the track
133           Short_t *fPHPlace;                //! Calibration group of PH
134           Float_t *fPHValue;                //! PH
135           Short_t  fNumberClusters;         // Minimum number of clusters in the tracklets
136           Float_t  fProcent;                // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH)
137           Short_t  fDifference;             // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH)
138           Int_t    fNumberTrack;            // How many tracks could be used
139           Int_t    fNumberUsedCh[2];        // How many tracks have been really used for the gain (0, strict; 1 with fProcent)
140           Int_t    fNumberUsedPh[2];        // How many tracks have been really used for the drift velocity (0, strict; 1 with fDifference)
141
142   //
143   // For debugging 
144   //
145
146  // Variables in the loop for the coef or more general
147           Int_t    fTimeMax;                // Number of time bins
148           Float_t  fSf;                     // Sampling frequence
149                              
150  // Pad Calibration
151           Short_t  fNnZ[3];                 // Number of pad rows in a group
152           Short_t  fNnRphi[3];              // Number of pad cols in a group
153           Short_t  fNfragZ[3];              // Number of  pad row group
154           Short_t  fNfragRphi[3];           // Number of pad col group
155           Short_t  fRowMin[3];              // Limits of the group in pad row
156           Short_t  fRowMax[3];              // Limits of the group in pad row
157           Short_t  fColMin[3];              // Limits of the group in pad col
158           Short_t  fColMax[3];              // Limits of the group in pad col
159           Int_t    fXbins[3];               // First Xbins of the detector
160           Short_t  fDetChamb0[3];           // Number of XBins for chamber != 2
161           Short_t  fDetChamb2[3];           // Number of Xbins for chamber 2
162   
163  
164   // CH
165           Short_t  fNumberBinCharge;        // Number of bins for the gain factor
166  
167   // PRF
168           Short_t          fNumberBinPRF;   // Number of bin for the PRF
169   
170   // Histograms to store the info from the digits, from the tracklets or from the tracks
171           TProfile2D      *fPH2d;           // 2D average pulse height
172           TProfile2D      *fPRF2d;          // 2D PRF
173           TH2I            *fCH2d;          // 2D deposited charge 
174     
175   //
176   // A lot of internal functions......
177   //
178
179   // Init AliHLTTRDCalibra
180           void     Init();
181
182   // Create the 2D histo to be filled Online
183           void     CreateCH2d(Int_t nn);
184           void     CreatePH2d(Int_t nn);
185           void     CreatePRF2d(Int_t nn);  
186   
187   // Fill the 2D
188           void     FillTheInfoOfTheTrackPH();
189           void     FillTheInfoOfTheTrackCH();
190           void     ResetfVariables();
191           Bool_t   LocalisationDetectorXbins(Int_t detector);
192  
193   // Pad group calibration mode
194           void     ReconstructionRowPadGroup(Int_t idect, Int_t i);
195           void     CalculXBins(Int_t idect, Int_t i);  
196
197  
198   // Clear
199           void     ClearHistos();
200          
201   // Some basic geometry function
202   virtual Int_t    GetPlane(Int_t d) const;
203   virtual Int_t    GetChamber(Int_t d) const;
204   virtual Int_t    GetSector(Int_t d) const;
205   
206   // Instance of this class and so on
207   static  AliHLTTRDCalibra *fgInstance;        // Instance
208   static  Bool_t   fgTerminated;            // If terminated
209     
210   ClassDef(AliHLTTRDCalibra,2)                 // TRD Calibration class
211
212 };
213   
214 #endif
215
216