]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDDataDCS.h
Included also 3 and 4 prong decays; added variables to ntuple
[u/mrichter/AliRoot.git] / TRD / AliTRDDataDCS.h
1 #ifndef ALITRDDATADCS_H
2 #define ALITRDDATADCS_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 ////////////////////////////////////////////////////////////////////////////
10 //                                                                        //
11 // Extracts the DCS information                                           //
12 //                                                                        //
13 ////////////////////////////////////////////////////////////////////////////
14
15 #include <TNamed.h>
16
17 class TObjArray;
18 class TString;
19
20 class TGraph;
21 class AliSplineFit;
22 class TMap;
23
24 class AliTRDDataDCS : public TNamed
25 {
26   
27  public :
28     
29   AliTRDDataDCS ();
30   ~AliTRDDataDCS ();
31   
32   Bool_t ExtractDCS (TMap * aliDCS);
33   Bool_t PerformFit ();
34   void   ClearFits ();
35   void   ClearGraphs ();
36   
37   UInt_t        GetNAlias () const {return fNAlias;}
38   TString       GetAmandaStr (UInt_t iAlias) const;
39   UInt_t        GetNChannel (UInt_t iAlias) const; 
40   
41   TGraph *              GetGraph (UInt_t iAlias, UInt_t iChannel = 0) const;
42   AliSplineFit *        GetFit (UInt_t iAlias, UInt_t iChannel = 0) const;
43   
44   // Get TGraph
45   TGraph * GetGraphChamberByteStatus (UInt_t iSensor) const             {return GetGraph (kChamberByteStatus, iSensor);}
46   TGraph * GetGraphPreTrigger () const                                  {return GetGraph (kPreTrigger);}
47   TGraph * GetGraphGoofyHv () const                                     {return GetGraph (kGoofyHv);}
48   TGraph * GetGraphGoofyPeakPos (UInt_t iSensor) const                  {return GetGraph (kGoofyPeakPos, iSensor);}
49   TGraph * GetGraphGoofyPeakArea (UInt_t iSensor) const                 {return GetGraph (kGoofyPeakArea, iSensor);}
50   TGraph * GetGraphGoofyTemp (UInt_t iSensor) const                     {return GetGraph (kGoofyTemp, iSensor);}
51   TGraph * GetGraphGoofyPressure () const                               {return GetGraph (kGoofyPressure);}
52   TGraph * GetGraphGoofyVelocity () const                               {return GetGraph (kGoofyVelocity);}
53   TGraph * GetGraphGoofyGain (UInt_t iSensor) const                     {return GetGraph (kGoofyGain, iSensor);}
54   TGraph * GetGraphGoofyCO2 ()  const                                   {return GetGraph (kGoofyCO2);}
55   TGraph * GetGraphGoofyN2 () const                                     {return GetGraph (kGoofyN2);}
56   TGraph * GetGraphGasO2 () const                                       {return GetGraph (kGasO2);}
57   TGraph * GetGraphGasOverpressure () const                             {return GetGraph (kGasOverpressure);}
58   TGraph * GetGraphEnvTemp (UInt_t iSensor) const                       {return GetGraph (kEnvTemp, iSensor);}
59   TGraph * GetGraphHvAnodeImon (UInt_t iSensor) const                   {return GetGraph (kHvAnodeImon, iSensor);}
60   TGraph * GetGraphHvDriftImon (UInt_t iSensor) const                   {return GetGraph (kHvDriftImon, iSensor);}
61   TGraph * GetGraphHvAnodeUmon (UInt_t iSensor) const                   {return GetGraph (kHvAnodeUmon, iSensor);}
62   TGraph * GetGraphHvDriftUmon (UInt_t iSensor) const                   {return GetGraph (kHvDriftUmon, iSensor);}
63   TGraph * GetGraphAdcClkPhase () const                                 {return GetGraph (kAdcClkPhase);}
64   TGraph * GetGraphAtmPressure () const                                 {return GetGraph (kAtmPressure);}
65   TGraph * GetGraphLuminosity () const                                  {return GetGraph (kLuminosity);}
66   TGraph * GetGraphMagneticField () const                               {return GetGraph (kMagneticField);}
67   
68   AliSplineFit * GetFitChamberByteStatus (UInt_t iSensor) const         {return GetFit (kChamberByteStatus, iSensor);}
69   AliSplineFit * GetFitPreTrigger () const                              {return GetFit (kPreTrigger);}
70   AliSplineFit * GetFitGoofyHv () const                                 {return GetFit (kGoofyHv);}
71   AliSplineFit * GetFitGoofyPeakPos (UInt_t iSensor) const              {return GetFit (kGoofyPeakPos, iSensor);}
72   AliSplineFit * GetFitGoofyPeakArea (UInt_t iSensor) const             {return GetFit (kGoofyPeakArea, iSensor);}
73   AliSplineFit * GetFitGoofyTemp (UInt_t iSensor) const                 {return GetFit (kGoofyTemp, iSensor);}
74   AliSplineFit * GetFitGoofyPressure () const                           {return GetFit (kGoofyPressure);}
75   AliSplineFit * GetFitGoofyVelocity () const                           {return GetFit (kGoofyVelocity);}
76   AliSplineFit * GetFitGoofyGain (UInt_t iSensor) const                 {return GetFit (kGoofyGain, iSensor);}
77   AliSplineFit * GetFitGoofyCO2 ()  const                               {return GetFit (kGoofyCO2);}
78   AliSplineFit * GetFitGoofyN2 () const                                 {return GetFit (kGoofyN2);}
79   AliSplineFit * GetFitGasO2 () const                                   {return GetFit (kGasO2);}
80   AliSplineFit * GetFitGasOverpressure () const                         {return GetFit (kGasOverpressure);}
81   AliSplineFit * GetFitEnvTemp (UInt_t iSensor) const                   {return GetFit (kEnvTemp, iSensor);}
82   AliSplineFit * GetFitHvAnodeImon (UInt_t iSensor) const               {return GetFit (kHvAnodeImon, iSensor);}
83   AliSplineFit * GetFitHvDriftImon (UInt_t iSensor) const               {return GetFit (kHvDriftImon, iSensor);}
84   AliSplineFit * GetFitHvAnodeUmon (UInt_t iSensor) const               {return GetFit (kHvAnodeUmon, iSensor);}
85   AliSplineFit * GetFitHvDriftUmon (UInt_t iSensor) const               {return GetFit (kHvDriftUmon, iSensor);}
86   AliSplineFit * GetFitAdcClkPhase () const                             {return GetFit (kAdcClkPhase);}
87   AliSplineFit * GetFitAtmPressure () const                             {return GetFit (kAtmPressure);}
88   AliSplineFit * GetFitLuminosity () const                              {return GetFit (kLuminosity);}
89   AliSplineFit * GetFitMagneticField () const                           {return GetFit (kMagneticField);}
90   
91   void Print (Option_t* option = "") const;
92     
93  protected :
94           
95       TGraph * FindAndMakeGraph (TMap * dcsMap, const char * amandaStr,
96                                  char dataType);
97     AliSplineFit * Fit (TGraph * graph,
98                         Int_t  kMinPoints, Int_t  kIter, 
99                         Double_t  kMaxDelta, Int_t  kFitReq);
100     
101     void Init ();
102     void InitFits ();
103     void InitGraphs ();
104     
105     void SetConf (UInt_t iAlias, const char * amanda, char dataType, UInt_t nChannel, 
106                   Bool_t enableGraph, Bool_t enableFit, Int_t kMinPoints, 
107                   Int_t kIter, Double_t kMaxDelta, Int_t kFitReq);
108     
109  private :
110     
111     enum { kChamberByteStatus = 0
112          , kPreTrigger        = 1
113          , kGoofyHv           = 2
114          , kGoofyPeakPos      = 3
115          , kGoofyPeakArea     = 4
116          , kGoofyTemp         = 5
117          , kGoofyPressure     = 6
118          , kGoofyVelocity     = 7
119          , kGoofyGain         = 8
120          , kGoofyCO2          = 9
121          , kGoofyN2           = 10
122          , kGasO2             = 11
123          , kGasOverpressure   = 12
124          , kEnvTemp           = 13
125          , kHvAnodeImon       = 14
126          , kHvDriftImon       = 15
127          , kHvAnodeUmon       = 16
128          , kHvDriftUmon       = 17
129          , kAdcClkPhase       = 18
130          , kAtmPressure       = 19
131          , kLuminosity        = 20
132          , kMagneticField     = 21
133     };
134               
135   Bool_t fGraphsAreIni;              // Check whether graphs are initialized
136   Bool_t fFitsAreIni;                // Check whether firs are initialized
137   UInt_t fNAlias;                    // Number of aliases
138       
139     class AliTRDDataDCSdata {
140      public:
141       AliTRDDataDCSdata()
142         :fFit(0x0)
143         ,fGraph(0x0) { };
144       virtual ~AliTRDDataDCSdata() { };
145       TObjArray GetFit() const          { return fFit;      }
146       TObjArray GetGraph() const        { return fGraph;    }
147       TObject*  GetFit(Int_t i) const   { return fFit[i];   }
148       TObject*  GetGraph(Int_t i) const { return fGraph[i]; }
149      protected:
150       TObjArray fFit;                   // array of AliSplineFit
151       TObjArray fGraph;                 // array of TGraph
152     };      
153
154     class AliTRDDataDCSconf {
155      public:
156       AliTRDDataDCSconf()
157         :fAmanda(0)
158         ,fDataType(0)
159         ,fNChannel(0)
160         ,fEnableGraph(0)
161         ,fEnableFit(0)
162         ,fMinPoints(0)
163         ,fIter(0)
164         ,fMaxDelta(0)
165         ,fFitReq(0) { };
166       virtual ~AliTRDDataDCSconf() { };
167       TString  GetAmanda() const        { return fAmanda;      }
168       Char_t   GetDataType() const      { return fDataType;    }
169       UInt_t   GetNChannel() const      { return fNChannel;    }
170       Bool_t   GetEnableGraph() const   { return fEnableGraph; }
171       Bool_t   GetEnableFit() const     { return fEnableFit;   }
172       Int_t    GetMinPoints() const     { return fMinPoints;   }
173       Int_t    GetIter() const          { return fIter;        }
174       Double_t GetMaxDelta() const      { return fMaxDelta;    }
175       Int_t    GetFitReq() const        { return fFitReq;      }
176       void     SetAmanda(TString s)     { fAmanda      = s;    }
177       void     SetDataType(Char_t d)    { fDataType    = d;    }
178       void     SetNChannel(UInt_t n)    { fNChannel    = n;    }
179       void     SetEnableGraph(Bool_t e) { fEnableGraph = e;    }
180       void     SetEnableFit(Bool_t e)   { fEnableFit   = e;    }
181       void     SetMinPoints(Int_t m)    { fMinPoints   = m;    }
182       void     SetIter(Int_t i)         { fIter        = i;    }
183       void     SetMaxDelta(Double_t m)  { fMaxDelta    = m;    }
184       void     SetFitReq(Int_t f)       { fFitReq      = f;    }
185      protected:
186         TString   fAmanda;              // amanda string
187         Char_t    fDataType;            // 'c' for char, 'f' for float
188         UInt_t    fNChannel;            // number of channel
189         Bool_t    fEnableGraph;         // will be converted in TGraph
190         Bool_t    fEnableFit;           // will be converted in AliSplineFit
191         Int_t     fMinPoints;           // minimum number of points per knot in fit
192         Int_t     fIter;                // number of iterations for spline fit
193         Double_t  fMaxDelta;            // precision parameter for spline fit
194         Int_t     fFitReq;              // fit requirement, 2 = continuous 2nd derivative
195       };      
196
197       AliTRDDataDCSdata fDatas [22];    // configurations       
198       AliTRDDataDCSconf fConfs [22];    // data arrays          
199       
200       ClassDef(AliTRDDataDCS,1)         // TRD calibration class
201         
202 };
203
204 #endif