]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFcalib.h
Add classes for TOF Calibration (C.Zampolli)
[u/mrichter/AliRoot.git] / TOF / AliTOFcalib.h
1 #ifndef ALITOFCALIB_H
2 #define ALITOFCALIB_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 //////////////////////////////////////////////////////////////////
8 //  class for TOF calibration:: simulation of uncalibrated data //
9 //////////////////////////////////////////////////////////////////
10
11 #include "TTask.h"
12 #include "TH1F.h"
13 #include "AliTOFChannel.h"
14 #include "TClonesArray.h"
15 #include "TList.h"
16 #include "AliTOFCal.h"
17 #include "AliTOFGeometry.h"
18 #include "AliESD.h"
19 #include "AliRunLoader.h"
20
21 class AliTOFcalib:public TTask{
22 public:
23   AliTOFcalib();          // ctor
24   AliTOFcalib(char* headerFile, Int_t nEvents=0) ; 
25   AliTOFcalib(const AliTOFcalib & calib);
26   void Init();
27   virtual ~AliTOFcalib() ; // dtor
28   Int_t NSector()const {return fNSector;}
29   Int_t NPlate()const {return fNPlate;}
30   Int_t NStripA()const {return fNStripA;}
31   Int_t NStripB()const {return fNStripB;}
32   Int_t NStripC()const {return fNStripC;}
33   Int_t NpadZ()const {return fNpadZ;}
34   Int_t NpadX()const {return fNpadX;}
35   TClonesArray * DecalibrateDigits(TClonesArray *digits);
36   void SelectESD(AliESD *event, AliRunLoader * rl); 
37   void CombESDId();
38   void CalibrateESD();
39   TH1F* Profile(Int_t i); 
40   Int_t Size()const{return fsize;}
41   void SetFitFunctions();
42   TF1* SetFitFunctions(TH1F* histo);
43   TList* GetFitFunctions() {return flistFunc;}
44   TH1F** GetHistosToT() {return fhToT;}
45   void SetHistos();
46   void CorrectESDTime();
47   void CorrectESDTime(AliESD *event, AliRunLoader *rl);
48   void WriteOnCDB();
49   void ReadFromCDB(Char_t *sel, Int_t nrun);
50   Int_t GetIndex(Int_t *detId);
51
52  public: 
53   class AliTOFArray : public TObject {
54   public:
55     AliTOFArray(): TObject(),fSize(0),fArray(0x0){}
56     AliTOFArray(Int_t size) :
57       TObject(),
58       fSize(size),
59       fArray(new TArrayF*[size]) {
60     } 
61     Int_t GetSize() const {return fSize;}
62     void AddArray(Int_t pos, TArrayF * parr) {
63       if (pos>-1 && pos < fSize)
64         fArray[pos] = parr;
65       //else
66       //AliError("Index  out of range");  
67     }
68     TArrayF * GetArray(Int_t pos) {
69       TArrayF * parr = 0x0;
70       if  (pos>-1 && pos < fSize)
71         parr = fArray[pos];
72       //else
73         //AliError("Index out of range");  
74       return parr;
75     }
76     virtual ~AliTOFArray() {
77       delete [] fArray;
78     }
79     
80   private:
81     
82     Int_t fSize;       // Size of the array of TArrayFs
83     TArrayF ** fArray; //[fSize]};
84     
85   };
86
87
88 private:
89   static const Int_t fgkchannel;  // max number of entries per channel 
90   static const Char_t * ffile[6]; // spectra
91   Int_t fsize;     // number of channels
92   Int_t fNSector;  // number of TOF sectors
93   Int_t fNPlate;   // number of TOF plates
94   Int_t fNStripA;  // number of TOF strips A
95   Int_t fNStripB;  // number of TOF strips B
96   Int_t fNStripC;  // number of TOF strips C
97   Int_t fNpadZ;    // number of TOF pads Z
98   Int_t fNpadX;    // number of TOF pads X
99   TObjArray * fESDsel;   // selected ESD tracks for calibration
100   TList *flistFunc;      // functions for simulated Time Slewing spectra
101   TH1F* fhToT[6];           // simulated ToT distributions
102   Float_t fMaxToT[6];       // max simulated ToT
103   Float_t fMinToT[6];       // min simulated ToT
104   Float_t fMaxToTDistr[6];  // max value in the ToT distributions
105   AliTOFArray *fArrayToT;   // array for ToT values
106   AliTOFArray *fArrayTime;  // array for Time values
107   Int_t fNevents;           // number of events
108   AliTOFCal *fTOFCal;       // array of AliTOFChannels storing calib parameters
109   TString fT0File ;         // output file;
110   TString fHeadersFile;     // input file
111   AliTOFGeometry *fGeom;    // AliTOFgeometry pointer
112   ClassDef(AliTOFcalib,1);
113 };
114
115 #endif // AliTOFcalib_H
116