]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFRunParams.h
a3dccf2ea62779b17d74029aaefeffc23e44a121
[u/mrichter/AliRoot.git] / TOF / AliTOFRunParams.h
1 #ifndef ALITOFRUNPARAMS_H
2 #define ALITOFRUNPARAMS_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6 /* $Id$ */
7
8 // *
9 // *
10 // *
11 // * this class defines the TOF object to be stored
12 // * in OCDB on a run-by-run basis in order to have the measurement
13 // * of the time evolution of T0 and of TOF resolution including
14 // * average T0 uncertainty
15 // *
16 // *
17 // *
18
19 #include "TObject.h"
20
21 class TGraph;
22
23 class AliTOFRunParams :
24 public TObject
25 {
26
27  public:
28
29   AliTOFRunParams(); // default constructor
30   AliTOFRunParams(Int_t nPoints, Int_t nRuns = 1); // standard constructor
31   virtual ~AliTOFRunParams(); // default destructor
32   AliTOFRunParams(const AliTOFRunParams &source); // copy constructor
33   AliTOFRunParams &operator=(const AliTOFRunParams &source); // operator=
34
35   Int_t GetNPoints() const {return fNPoints;}; // getter
36   UInt_t GetTimestamp(Int_t i) const {return fTimestamp && i < fNPoints ? fTimestamp[i] : 0;}; // getter
37   Float_t GetT0(Int_t i) const {return fT0 && i < fNPoints ? fT0[i] : 0.;}; // getter
38   Float_t GetTOFResolution(Int_t i) const {return fTOFResolution && i < fNPoints ? fTOFResolution[i] : 0.;}; // getter
39   Float_t GetT0Spread(Int_t i) const {return fT0Spread && i < fNPoints ? fT0Spread[i] : 0.;}; // getter
40   
41   UInt_t GetRunNb(Int_t i) const {return fRunNb && i < fNRuns ? fRunNb[i] : 0;}; // getter
42   UInt_t GetRunFirstPoint(Int_t i) const {return fRunFirstPoint && i < fNRuns ? fRunFirstPoint[i] : 0;}; // getter
43   UInt_t GetRunLastPoint(Int_t i) const {return fRunLastPoint && i < fNRuns ? fRunLastPoint[i] : 0;}; // getter
44
45   void SetTimestamp(UInt_t *value) {if (fTimestamp) for (Int_t i = 0; i < fNPoints; i++) fTimestamp[i] = value[i];}; // setter
46   void SetT0(Float_t *value) {if (fT0) for (Int_t i = 0; i < fNPoints; i++) fT0[i] = value[i];}; // setter
47   void SetTOFResolution(Float_t *value) {if (fTOFResolution) for (Int_t i = 0; i < fNPoints; i++) fTOFResolution[i] = value[i];}; // setter
48   void SetT0Spread(Float_t *value) {if (fT0Spread) for (Int_t i = 0; i < fNPoints; i++) fT0Spread[i] = value[i];}; // setter
49
50   void SetRunNb(UInt_t *value) {if (fRunNb) for (Int_t i = 0; i < fNRuns; i++) fRunNb[i] = value[i];}; // setter
51   void SetRunFirstPoint(UInt_t *value) {if (fRunFirstPoint) for (Int_t i = 0; i < fNRuns; i++) fRunFirstPoint[i] = value[i];}; // setter
52   void SetRunLastPoint(UInt_t *value) {if (fRunLastPoint) for (Int_t i = 0; i < fNRuns; i++) fRunLastPoint[i] = value[i];}; // setter
53
54   Float_t EvalT0(UInt_t timestamp); // eval T0
55   Float_t EvalTOFResolution(UInt_t timestamp); // eval TOF resolution
56   Float_t EvalT0Spread(UInt_t timestamp); // eval T0 spread
57   
58   Float_t AverageT0(UInt_t runNb) {return Average(fT0, runNb);}; // average T0
59   Float_t AverageTOFResolution(UInt_t runNb) {return Average(fTOFResolution, runNb);}; // average TOF resolution
60   Float_t AverageT0Spread(UInt_t runNb) {return Average(fT0Spread, runNb);}; // average T0 spread
61
62   TGraph *DrawGraphT0(Option_t *option = "") {return DrawGraph(fT0, option);}; // draw graph t0
63   TGraph *DrawGraphTOFResolution(Option_t *option = "") {return DrawGraph(fTOFResolution, option);}; // draw graph t0
64   TGraph *DrawGraphT0Spread(Option_t *option = "") {return DrawGraph(fT0Spread, option);}; // draw graph t0
65
66
67  private:
68   
69   /* private methods */
70   
71   Float_t Average(Float_t *data, UInt_t runNb); // average
72   Float_t Average(Float_t *data, Int_t first, Int_t last); // average
73   TGraph *DrawGraph(Float_t *data, Option_t *option = ""); // draw graph
74   
75   /* data members */
76
77   Int_t fNPoints;
78   UInt_t *fTimestamp; //[fNPoints] time stamp
79   Float_t *fT0; //[fNPoints] average T0 (ps)
80   Float_t *fTOFResolution; //[fNPoints] average TOF resolution (T0 uncertainty included) (ps)
81   Float_t *fT0Spread; //[fNPoints] estimated T0 spread (from vertex spread z) (ps)
82
83   Int_t fNRuns;
84   UInt_t *fRunNb; //[fNRuns] run number
85   UInt_t *fRunFirstPoint; //[fNRuns] run start point
86   UInt_t *fRunLastPoint; //[fNRuns] run last point
87
88
89   ClassDef(AliTOFRunParams, 2);
90 };
91
92 #endif /* ALITOFRUNPARAMS_H */