]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AD/ADbase/AliADCalibData.h
Filling BB flags in digit with trigger simulator
[u/mrichter/AliRoot.git] / AD / ADbase / AliADCalibData.h
1 #ifndef ALIADCALIBDATA_H
2 #define ALIADCALIBDATA_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 #include "TNamed.h"
8 #include "AliADConst.h"
9
10 class AliADDataDCS;
11
12
13 class AliADCalibData: public TNamed {
14
15  public:
16   AliADCalibData();
17   AliADCalibData(const char* name);
18   
19   AliADCalibData(const AliADCalibData &calibda);
20   AliADCalibData& operator= (const AliADCalibData &calibda);
21   virtual ~AliADCalibData();
22   void Reset();
23   void FillDCSData(AliADDataDCS * data);
24
25   Float_t  GetPedestal(Int_t channel)   const {return fPedestal[channel];}
26   Float_t* GetPedestal()   const {return (float*)fPedestal;}
27   Float_t  GetSigma(Int_t channel)   const {return fSigma[channel];}
28   Float_t* GetSigma()   const {return (float*)fSigma;}
29   Float_t  GetADCmean(Int_t channel)    const {return fADCmean[channel];}
30   Float_t* GetADCmean()   const {return (float*)fADCmean;}
31   Float_t  GetADCsigma(Int_t channel)   const {return fADCsigma[channel];}
32   Float_t* GetADCsigma()   const {return (float*)fADCsigma;}
33   Float_t  GetMeanHV(Int_t channel)     const {return fMeanHV[channel];}
34   Float_t* GetMeanHV()   const {return (float*)fMeanHV;} 
35   Float_t  GetWidthHV(Int_t channel)    const {return fWidthHV[channel];}
36   Float_t* GetWidthHV()   const {return (float*)fWidthHV;}
37   Bool_t   IsChannelDead(Int_t channel) const {return fDeadChannel[channel];}
38   Bool_t*  GetDeadMap()   const {return (bool*)fDeadChannel;} 
39    
40   Float_t  GetGain(Int_t channel);
41   Float_t  GetTimeOffset(Int_t channel) const {return fTimeOffset[channel];}
42   Float_t* GetTimeOffset()   const {return (float*)fTimeOffset;}
43   Float_t  GetTimeGain(Int_t channel)   const {return fTimeGain[channel];}
44   Float_t* GetTimeGain()   const {return (float*)fTimeGain;}
45
46   Float_t* GetTimeResolution() const {return (Float_t*) fTimeResolution;};
47   Float_t  GetTimeResolution(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fTimeResolution[board]:0);};
48
49   Float_t* GetWidthResolution() const {return (Float_t*) fWidthResolution;};
50   Float_t  GetWidthResolution(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fWidthResolution[board]:0);};
51
52   const UInt_t*  GetMatchWindow() const { return fMatchWindow; }
53   UInt_t   GetMatchWindow(Int_t board) const { return ((board>=0 && board<kNCIUBoards)?fMatchWindow[board]:0); }
54   const UInt_t*  GetSearchWindow() const { return fSearchWindow; }
55   UInt_t   GetSearchWindow(Int_t board) const { return ((board>=0 && board<kNCIUBoards)?fSearchWindow[board]:0); }
56   const UInt_t*  GetTriggerCountOffset() const { return fTriggerCountOffset; }
57   UInt_t   GetTriggerCountOffset(Int_t board) const { return ((board>=0 && board<kNCIUBoards)?fTriggerCountOffset[board]:0); }
58   const UInt_t*  GetRollOver() const { return fRollOver; }
59   UInt_t   GetRollOver(Int_t board) const { return ((board>=0 && board<kNCIUBoards)?fRollOver[board]:0); }
60
61   Float_t  GetDiscriThr(Int_t channel)  const {return fDiscriThr[channel];}
62   Float_t* GetDiscriThr()   const {return (Float_t*)fDiscriThr;}
63   Float_t  GetCalibDiscriThr(Int_t channel, Bool_t scaled);
64   
65   UShort_t * GetClk1Win1() const {return (UShort_t*)fClk1Win1;};
66   UShort_t GetClk1Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk1Win1[board]:0);};
67   UShort_t * GetClk2Win1() const {return (UShort_t*)fClk2Win1;};
68   UShort_t GetClk2Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk2Win1[board]:0);};
69
70   UShort_t * GetClk1Win2() const {return (UShort_t*)fClk1Win2;};
71   UShort_t GetClk1Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk1Win2[board]:0);};
72   UShort_t * GetClk2Win2() const {return (UShort_t*)fClk2Win2;};
73   UShort_t GetClk2Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk2Win2[board]:0);};
74
75   UShort_t * GetDelayClk1Win1() const {return (UShort_t*)fDelayClk1Win1;};
76   UShort_t GetDelayClk1Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk1Win1[board]:0);};
77   UShort_t * GetDelayClk2Win1() const {return (UShort_t*)fDelayClk2Win1;};
78   UShort_t GetDelayClk2Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk2Win1[board]:0);};
79   
80   UShort_t * GetDelayClk1Win2() const {return (UShort_t*)fDelayClk1Win2;};
81   UShort_t GetDelayClk1Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk1Win2[board]:0);};
82   UShort_t * GetDelayClk2Win2() const {return (UShort_t*)fDelayClk2Win2;};
83   UShort_t GetDelayClk2Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk2Win2[board]:0);};
84   
85   UShort_t * GetLatchWin1() const {return (UShort_t*)fLatchWin1;};
86   UShort_t GetLatchWin1(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fLatchWin1[board]:0);};
87   UShort_t * GetLatchWin2() const {return (UShort_t*)fLatchWin2;};
88   UShort_t GetLatchWin2(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fLatchWin2[board]:0);};
89   
90   UShort_t * GetResetWin1() const {return (UShort_t*)fResetWin1;};
91   UShort_t GetResetWin1(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fResetWin1[board]:0);};
92   UShort_t * GetResetWin2() const {return (UShort_t*)fResetWin2;};
93   UShort_t GetResetWin2(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fResetWin2[board]:0);};
94   
95   Bool_t * GetPedestalSubtraction() const {return (Bool_t*) fPedestalSubtraction;};
96   Bool_t GetPedestalSubtraction(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fPedestalSubtraction[board]:0);};
97
98   UShort_t GetBBAThreshold() const {return fBBAThreshold;};
99   UShort_t GetBBCThreshold() const {return fBBCThreshold;};
100
101   UShort_t GetBGAThreshold() const {return fBGAThreshold;};
102   UShort_t GetBGCThreshold() const {return fBGCThreshold;};
103
104   UShort_t GetBBAForBGThreshold() const {return fBBAForBGThreshold;};
105   UShort_t GetBBCForBGThreshold() const {return fBBCForBGThreshold;};
106   
107   UShort_t GetMultADAThrLow() const {return fMultADAThrLow;};
108   UShort_t GetMultADAThrHigh() const {return fMultADAThrHigh;};
109
110   UShort_t GetMultADCThrLow() const {return fMultADCThrLow;};
111   UShort_t GetMultADCThrHigh() const {return fMultADCThrHigh;};
112
113   UShort_t GetTriggerSelected(Int_t output) const {return ((output>=0 && output<5)?fTriggerSelected[output]:0);};
114   
115   Bool_t GetEnableCharge(Int_t channel);
116   Bool_t GetEnableTiming(Int_t channel);
117   UShort_t GetOnlinePedestal(Int_t integrator, Int_t channel);
118   UShort_t GetOnlinePedestalCut(Int_t integrator, Int_t channel);
119
120
121   static Int_t GetBoardNumber(Int_t channel);
122   static Int_t GetFEEChannelNumber(Int_t channel);
123   static Int_t GetOfflineChannelNumber(Int_t board, Int_t channel);
124   
125   Float_t  GetLightYields(Int_t channel);
126
127   Float_t *GetPMGainsA() const { return fPMGainsA; }
128   Float_t *GetPMGainsB() const { return fPMGainsB; }
129
130   void     SetPedestal(Float_t val, Int_t channel) {fPedestal[channel]=val;}
131   void     SetPedestal(const Float_t* Pedestal);
132   void     SetSigma(Float_t val, Int_t channel) {fSigma[channel]=val;}
133   void     SetSigma(const Float_t* Sigma);
134   void     SetADCmean(Float_t val, Int_t channel) {fADCmean[channel]=val;}
135   void     SetADCmean(const Float_t* ADCmean);  
136   void     SetADCsigma(Float_t val, Int_t channel) {fADCsigma[channel]=val;}
137   void     SetADCsigma(const Float_t* ADCsigma);
138   void     SetMeanHV(Float_t val, Int_t channel) {fMeanHV[channel]=val;}
139   void     SetMeanHV(const Float_t* MeanHV);  
140   void     SetWidthHV(Float_t val, Int_t channel) {fWidthHV[channel]=val;}
141   void     SetWidthHV(const Float_t* WidthHV); 
142   void     SetDeadChannel(Bool_t val, Int_t channel) {fDeadChannel[channel]=val;}
143   void     SetDeadMap(const Bool_t* deadMap);  
144    
145   void     SetTimeOffset(Float_t val, Int_t board, Int_t channel);
146   void     SetTimeOffset(const Float_t* TimeOffset);
147   void     SetTimeGain(Float_t val, Int_t channel) {fTimeGain[channel]=val;}
148   void     SetTimeGain(const Float_t* TimeGain);
149   
150   void     SetParameter(TString name, Int_t val);
151   void     SetTimeResolution(UShort_t *resols);
152   void     SetTimeResolution(UShort_t resol, Int_t board);
153   void     SetWidthResolution(UShort_t *resols);
154   void     SetWidthResolution(UShort_t resol, Int_t board);
155
156   void     SetMatchWindow(UInt_t *windows);
157   void     SetMatchWindow(UInt_t window, Int_t board);
158   void     SetSearchWindow(UInt_t *windows);
159   void     SetSearchWindow(UInt_t window, Int_t board);
160   void     SetTriggerCountOffset(UInt_t *offsets);
161   void     SetTriggerCountOffset(UInt_t offset, Int_t board);
162   void     SetRollOver(UInt_t *offsets);
163   void     SetRollOver(UInt_t offset, Int_t board);
164
165   void     SetDiscriThr(Float_t thr, Int_t board, Int_t channel);
166   void     SetDiscriThr(const Float_t* thresholds);
167
168   void SetClk1Win1(UShort_t* clks);
169   void SetClk1Win1(UShort_t clk, Int_t board);
170   void SetClk2Win1(UShort_t* clks);
171   void SetClk2Win1(UShort_t clk, Int_t board);
172   
173   void SetClk1Win2(UShort_t* clks);
174   void SetClk1Win2(UShort_t clk, Int_t board);
175   void SetClk2Win2(UShort_t* clks);
176   void SetClk2Win2(UShort_t clk, Int_t board);
177   
178   void SetDelayClk1Win1(UShort_t* delays);
179   void SetDelayClk1Win1(UShort_t delay, Int_t board);
180   void SetDelayClk2Win1(UShort_t* delays);
181   void SetDelayClk2Win1(UShort_t delay, Int_t board);
182   
183   void SetDelayClk1Win2(UShort_t* delays);
184   void SetDelayClk1Win2(UShort_t delay, Int_t board);
185   void SetDelayClk2Win2(UShort_t* delays);
186   void SetDelayClk2Win2(UShort_t delay, Int_t board);
187   
188   void SetLatchWin1(UShort_t *latchs);
189   void SetLatchWin1(UShort_t latch, Int_t board);
190   void SetLatchWin2(UShort_t *latchs);
191   void SetLatchWin2(UShort_t latch, Int_t board);
192   
193   void SetResetWin1(UShort_t *resets);
194   void SetResetWin1(UShort_t reset, Int_t board);
195   void SetResetWin2(UShort_t *resets);
196   void SetResetWin2(UShort_t reset, Int_t board);
197   
198   void SetPedestalSubtraction(Bool_t *peds);
199   void SetPedestalSubtraction(Bool_t ped, Int_t board);
200   
201   void SetBBAThreshold(UShort_t th) {fBBAThreshold = th;};
202   void SetBBCThreshold(UShort_t th) {fBBCThreshold = th;};
203
204   void SetBGAThreshold(UShort_t th) {fBGAThreshold = th;};
205   void SetBGCThreshold(UShort_t th) {fBGCThreshold = th;};
206
207   void SetBBAForBGThreshold(UShort_t th) {fBBAForBGThreshold = th;};
208   void SetBBCForBGThreshold(UShort_t th) {fBBCForBGThreshold = th;};
209   
210   
211   void SetMultADAThrLow(UShort_t th) {fMultADAThrLow = th;};
212   void SetMultADAThrHigh(UShort_t th) {fMultADAThrHigh = th;};
213   
214   void SetMultADCThrLow(UShort_t th) {fMultADCThrLow = th;};
215   void SetMultADCThrHigh(UShort_t th) {fMultADCThrHigh = th;};
216   
217   void SetTriggerSelected(UShort_t trigger, Int_t output);
218   
219   void SetEnableCharge(Bool_t val, Int_t board, Int_t channel);
220   void SetEnableTiming(Bool_t val, Int_t board, Int_t channel);
221   void SetEnableCharge(Bool_t val, Int_t channel);
222   void SetEnableTiming(Bool_t val, Int_t channel);
223   void SetOnlinePedestal(UShort_t val, Int_t integrator, Int_t board, Int_t channel);
224   void SetOnlinePedestalCut(UShort_t val, Int_t integrator, Int_t board, Int_t channel);
225   void SetOnlinePedestal(UShort_t val, Int_t integrator, Int_t channel);
226   void SetOnlinePedestalCut(UShort_t val, Int_t integrator, Int_t channel);
227
228  protected:
229   void     InitLightYields();
230   void     InitPMGains();
231   Bool_t   IsClkValid(UShort_t clock) const;
232
233   Float_t  fPedestal[32];     // Mean pedestal values - used offline
234   Float_t  fSigma[32];        // Sigmas of pedestal peaks - used offline
235   Float_t  fADCmean[32];      // ADC mean values
236   Float_t  fADCsigma[32];     // ADC sigma values
237   Float_t  fMeanHV[16];        // Mean PMT HV needed to compute MIP value
238   Float_t  fWidthHV[16];       // Width of the PMT HV
239   
240   Float_t  fTimeOffset[16];    // Time offsets of the TDC
241   Float_t  fTimeGain[16];      // Gain factors of the TDC
242   Bool_t   fDeadChannel[16];   // List of dead channels
243   Float_t  fTimeResolution[kNCIUBoards]; // Time Resolution of the TDC (ns / channel)
244   Float_t  fWidthResolution[kNCIUBoards]; // Time Width Resolution of the TDC (ns / channel)
245
246   UInt_t   fMatchWindow[kNCIUBoards]; // HPTDC matching window (25ns units)
247   UInt_t   fSearchWindow[kNCIUBoards];// HPTDC search window (25ns units)
248   UInt_t   fTriggerCountOffset[kNCIUBoards]; // HPTDC trigger count offset (25ns units)
249   UInt_t   fRollOver[kNCIUBoards]; // HPTDC roll-over (25ns units)
250   
251   UShort_t fClk1Win1[kNCIUBoards]; //Profil of the Clock 1  of the Window 1 (BB window)
252   UShort_t fClk2Win1[kNCIUBoards]; //Profil of the Clock 2  of the Window 1 (BB window)
253   UShort_t fClk1Win2[kNCIUBoards]; //Profil of the Clock 1  of the Window 2 (BG window)
254   UShort_t fClk2Win2[kNCIUBoards]; //Profil of the Clock 2  of the Window 2 (BG window)
255   UShort_t fDelayClk1Win1[kNCIUBoards]; // Delays of the Clock 1  of the Window 1 (BB window)
256   UShort_t fDelayClk2Win1[kNCIUBoards]; // Delays of the Clock 2 of the Window 1 (BB window)
257   UShort_t fDelayClk1Win2[kNCIUBoards]; // Delays of the Clock 1  of the Window 2 (BG window)
258   UShort_t fDelayClk2Win2[kNCIUBoards]; // Delays of the Clock 2 of the Window 2 (BG window)
259   UShort_t fLatchWin1[kNCIUBoards]; //Profil of the Clock of the Latch signal of Window 1 (BB window)
260   UShort_t fLatchWin2[kNCIUBoards]; //Profil of the Clock of the Latch signal of Window 2 (BG window)
261   UShort_t fResetWin1[kNCIUBoards]; //Profil of the Clock of the Reset signal of Window 1 (BB window)
262   UShort_t fResetWin2[kNCIUBoards]; //Profil of the Clock of the Reset signal of Window 2 (BG window)
263   Bool_t   fPedestalSubtraction[kNCIUBoards]; // Flag to en(dis)able pedestal subtraction before centrality trigger calculation
264   UShort_t fBBAThreshold;  // Minimum bias Threshold in number of channel hit for ADA
265   UShort_t fBBCThreshold;  // Minimum bias Threshold in number of channel hit for ADC
266   UShort_t fBGAThreshold;  // Beam Gas Threshold in number of channel hit for ADA
267   UShort_t fBGCThreshold;  // Beam Gas Threshold in number of channel hit for ADC
268   UShort_t fBBAForBGThreshold;  // BBA threshold for Beam Gas triggers (i.e. BBA and BGC)
269   UShort_t fBBCForBGThreshold;  // BBC threshold for Beam Gas triggers (i.e. BBC and BGA)
270   UShort_t fMultADAThrLow;  // Threshold used for multiplicity triggers (i.e. MTA and MTC)
271   UShort_t fMultADAThrHigh; // Threshold used for multiplicity triggers (i.e. MTA and MTC)
272   UShort_t fMultADCThrLow;  // Threshold used for multiplicity triggers (i.e. MTA and MTC)
273   UShort_t fMultADCThrHigh; // Threshold used for multiplicity triggers (i.e. MTA and MTC)
274   UShort_t fTriggerSelected[5]; // Triggers selected on the 5 outputs to CTP
275   Bool_t   fEnableCharge[16]; // Flag to know is a channel is participating to the Charge triggers
276   Bool_t   fEnableTiming[16]; // Flag to know is a channel is participating to the Timing triggers
277   UShort_t fPedestalOdd[16]; // Pedestals for the Odd integrators
278   UShort_t fPedestalEven[16]; // Pedestals for the Even integrators
279   UShort_t fPedestalCutOdd[16]; // Pedestals Cut for the Odd integrators
280   UShort_t fPedestalCutEven[16]; // Pedestals Cut for the Even integrators
281
282   Float_t  fDiscriThr[16];     // Discriminator thresholds
283
284   Float_t *fLightYields;       //! Light Yields channel by channel (read from separate OCDB entry)
285   Float_t *fPMGainsA;          //! PM gain factors channel by channel (read from separate OCDB entry)
286   Float_t *fPMGainsB;          //! PM gain factors channel by channel (read from separate OCDB entry)
287
288   ClassDef(AliADCalibData,1)    // AD Calibration data
289 };
290
291 #endif
292