memory leak fixed
[u/mrichter/AliRoot.git] / T0 / AliT0Parameters.h
CommitLineData
dc7ca31d 1#ifndef ALIT0PARAMETERS_H
2#define ALIT0PARAMETERS_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
4 * reserved.
5 *
f16935f7 6 * Alla Maevskaya INR RAS alla@inr.ru
dc7ca31d 7 *
8 * See cxx source for full Copyright notice
9 */
10
11//____________________________________________________________________
12//
13// Singleton class to handle various parameters of the
14// T0 - T0
15// Should get data fromm Conditions DB.
16//
17# include <TNamed.h>
18# include <TF1.h>
e0bba6cc 19# include <TMap.h>
dc7ca31d 20# include <TGraph.h>
21#include <TObjArray.h>
22class AliT0CalibData;
23class AliCDBEntry;
82ee3b37 24class AliT0CalibWalk;
25class AliT0CalibTimeEq;
58bd3a16 26class AliT0CalibLatency;
dc7ca31d 27
28class AliT0Parameters : public TNamed
29{
30public:
31 static AliT0Parameters* Instance();
66a6ab38 32
33 AliT0Parameters();
34 virtual ~AliT0Parameters() {};
66a6ab38 35
dc7ca31d 36 void Init();
f8bea420 37 void InitIfOnline();
38
dc7ca31d 39 // Set various `Fixed' parameters
40 void SetPh2Mip(Int_t r=300) { fPh2Mip = r; }
41 void SetmV2Mip(Int_t r=50) { fmV2Mip = r; }
8955c6b4 42 void SetChannelWidth(Float_t s=24.4) { fChannelWidth = s;}
dc7ca31d 43 void SetmV2channel(Int_t size=320) { fmV2Channel = size; }
44 void SetQTmin(Int_t qt=13) {fQTmin = qt;}
45 void SetQTmax(Int_t qt=125) {fQTmax = qt;}
dc7ca31d 46 void SetZposition( Float_t valueC=69.7, Float_t valueA=373) {
47 fT0zPosition[0]=valueC, fT0zPosition[1]=valueA;}
48 void SetPMTeff(Int_t ipmt);
49
50 void SetTimeDelayTVD(Float_t r=150) { fTimeDelayTVD = r; };
e2b5c18d 51 Float_t GetTimeDelayTVD() const { return fTimeDelayTVD; }
dc7ca31d 52
dc7ca31d 53
dc7ca31d 54 // Get `Fixed' various parameters
55 Int_t GetPh2Mip() const { return fPh2Mip; }
56 Int_t GetmV2Mip() const { return fmV2Mip; }
8955c6b4 57 Float_t GetChannelWidth() const { return fChannelWidth; }
dc7ca31d 58 Int_t GetmV2channel() const { return fmV2Channel; }
59 Int_t GetQTmin() const {return fQTmin;}
60 Int_t GetQTmax() const {return fQTmax;}
5325480c 61 Double_t GetZposition(Int_t i) const {return fT0zPosition[i];}
62 Double_t GetZPosition(const char* symname) ;
29d3e0eb 63 Double_t GetZPositionShift(const char* symname);
64
65
58bd3a16 66
74adb36a 67 TGraph * GetPMTeff(Int_t ipmt) const
dc7ca31d 68 {return (TGraph*)fPMTeff.At(ipmt);}
69 Float_t GetpmtEFF(Int_t ipmt, Float_t lambda) const
70 {return((TGraph*)fPMTeff.At(ipmt))->Eval(lambda);}
71
dc7ca31d 72
58bd3a16 73 TGraph *GetAmpLEDRec(Int_t ipmt) const;
74adb36a 74 TGraph *GetWalk(Int_t ipmt ) const;
c883fdf2 75 TGraph *GetQTC(Int_t ipmt) const;
76 TGraph *GetAmpLED(Int_t ipmt) const;
c41ceaac 77
dc7ca31d 78 Float_t GetTimeDelayCFD(Int_t ipmt);
82ee3b37 79// Float_t GetTimeV0(Int_t ipmt = 512) {return fTimeV0;}
112274a2 80 Float_t GetCFD (Int_t ipmt);
b95e8d87 81 void SetMeanT0(Float_t mean=512) { fMeanT0 = mean; };
82 Float_t GetMeanT0 () {return fMeanT0;};
83 void SetMeanVertex(Float_t mean=0) { fMeanVertex = mean; };
84 Float_t GetMeanVertex ();
dc7ca31d 85
82ee3b37 86 TMap * GetMapLookup();
e0bba6cc 87 Int_t GetChannel(Int_t trm, Int_t tdc, Int_t chain, Int_t channel);
5325480c 88 Int_t GetNumberOfTRMs();
89 void SetNumberOfTRMs(Int_t ntrms=2) {fNumberOfTRMs = ntrms;}
58bd3a16 90
91 Float_t GetLatencyHPTDC();
92 Float_t GetLatencyL1();/* {return fLatencyL1;} */
93 Float_t GetLatencyL1A(); /* {return fLatencyL1A;}*/
94 Float_t GetLatencyL1C(); /* {return fLatencyL1C;} */
95
96 void SetLatencyHPTDC(Float_t lat) {fLatencyHPTDC=lat;}
97 void SetLatencyL1(Float_t lat) {fLatencyL1=lat;}
98 void SetLatencyL1A(Float_t lat) { fLatencyL1A=lat;}
99 void SetLatencyL1C(Float_t lat) { fLatencyL1C=lat;}
100
74adb36a 101 protected:
dc7ca31d 102 static AliT0Parameters* fgInstance; // Static singleton instance
103
29d3e0eb 104 Bool_t fIsInit; // Whether we've been initialised
105 Float_t fT0zPosition[2] ; // z-position of the two T0s
106 Int_t fPh2Mip; // # photoelectrons per MIP in radiator
107 Int_t fmV2Mip; // # mV per MIP in radiator
8955c6b4 108 Float_t fChannelWidth; // channel width in ns
29d3e0eb 109 Int_t fmV2Channel; // ADC mv 2 channel # (200000ps/(25*25).
110 Int_t fQTmin; //min time for QTC
111 Int_t fQTmax; //max time fro QTC
112 TObjArray fAmpLEDRec; // array of amlitude vs LED-CFD (simulation & reconstruction)
dc7ca31d 113 TObjArray fPMTeff; //array PMT registration efficiency
29d3e0eb 114 TObjArray fWalk; //array time-amplitude walk
c883fdf2 115 TObjArray fQTC; //array of TGraphs for QTC vs number of MIPs
116 TObjArray fAmpLED; //array of TGraphs for LED-CFD vs number of MIPs
117
dc7ca31d 118
29d3e0eb 119 Float_t fTimeDelayCFD; // sum time delay for CFD channel
82ee3b37 120 // Float_t fTimeV0; // sum time delay for CFD channel
29d3e0eb 121 Float_t fTimeDelayTVD; //time delay for TVD (vertex trigger channel)
b95e8d87 122 Float_t fMeanT0; //mean of T0distribution with vertex=0;
123 Float_t fMeanVertex; // mean of vertex distribution;
58bd3a16 124
125 Float_t fLatencyHPTDC; // all latencies;
126 Float_t fLatencyL1; // all latencies;
127 Float_t fLatencyL1A; // all latencies;
128 Float_t fLatencyL1C; // all latencies;
129
29d3e0eb 130 TMap fLookUp; //lookup table
131 Int_t fNumberOfTRMs; // number of TRMs in setup
f8bea420 132
58bd3a16 133 //latency
134
5325480c 135
82ee3b37 136 static AliT0CalibTimeEq * fgCalibData; // singleton for Calibration data
e0bba6cc 137 static AliT0CalibData * fgLookUp; // singleton for Calibration data
82ee3b37 138 static AliT0CalibWalk * fgSlewCorr; // singleton for Calibration data
58bd3a16 139 static AliT0CalibLatency * fgLatency; // singleton for Calibration data
e0bba6cc 140
dc7ca31d 141 AliCDBEntry* fCalibentry ; // pointer to T0 calibration object
e0bba6cc 142 AliCDBEntry* fLookUpentry ; // pointer to T0 lokkup table
c41ceaac 143 AliCDBEntry* fSlewCorr ; // pointer to slewing correction
58bd3a16 144 AliCDBEntry* fLatency ; // pointer to latency
beb87b2c 145
146 private:
147 AliT0Parameters(const AliT0Parameters&);
148 AliT0Parameters& operator=(const AliT0Parameters&);
e0bba6cc 149
58bd3a16 150 ClassDef(AliT0Parameters,6)
66a6ab38 151
dc7ca31d 152};
153
dc7ca31d 154#endif
155//____________________________________________________________________
156