]> git.uio.no Git - u/mrichter/AliRoot.git/blame - START/AliSTARTParameters.cxx
Updated code for PDC06 (Alla)
[u/mrichter/AliRoot.git] / START / AliSTARTParameters.cxx
CommitLineData
5ac84465 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id: */
17
18//____________________________________________________________________
19//
20// START - T0.
21//
22// This class is a singleton that handles various parameters of
23// the START detectors.
24// Eventually, this class will use the Conditions DB to get the
25// various parameters, which code can then request from here.
26//
27#include "AliLog.h"
28#include "AliSTARTParameters.h"
29#include "AliSTARTCalibData.h"
30#include "AliSTARTAlignData.h"
31#include <AliCDBManager.h>
32#include <AliCDBEntry.h>
33#include <AliCDBStorage.h>
34#include <Riostream.h>
35
36AliSTARTAlignData* AliSTARTParameters::fgAlignData = 0;
37AliSTARTCalibData* AliSTARTParameters::fgCalibData = 0;
38//====================================================================
39ClassImp(AliSTARTParameters)
40#if 0
41 ; // This is here to keep Emacs for indenting the next line
42#endif
43
44//____________________________________________________________________
45AliSTARTParameters* AliSTARTParameters::fgInstance = 0;
46//____________________________________________________________________
47AliSTARTParameters*
48AliSTARTParameters::Instance()
49{
50 // Get static instance
51 if (!fgInstance) fgInstance = new AliSTARTParameters;
52 return fgInstance;
53}
54
55//____________________________________________________________________
56AliSTARTParameters::AliSTARTParameters()
5ac84465 57{
58 // Default constructor
7bdc4686 59
5ac84465 60 for (Int_t ipmt=0; ipmt<24; ipmt++)
61 {
62 SetTimeDelayCablesCFD(ipmt);
63 SetTimeDelayCablesLED(ipmt);
64 SetTimeDelayElectronicCFD(ipmt);
65 SetTimeDelayElectronicLED(ipmt);
66 SetTimeDelayPMT(ipmt);
7bdc4686 67 SetVariableDelayLine(ipmt);
5ac84465 68 SetSlewingLED(ipmt);
7bdc4686 69 SetSlewingRec(ipmt);
5ac84465 70 SetPh2Mip();
4c7da157 71 SetmV2Mip();
5ac84465 72 SetChannelWidth();
73 SetmV2channel();
74 SetGain();
75 SetQTmin();
76 SetQTmax();
77 SetPMTeff(ipmt);
78 }
7bdc4686 79 SetTimeDelayTVD();
5ac84465 80 SetZposition();
81
82}
83
84//__________________________________________________________________
85void
86AliSTARTParameters::Init()
87{
88 // Initialize the parameters manager. We need to get stuff from the
89 // CDB here.
7bdc4686 90 // if (fIsInit) return;
5ac84465 91
92 AliCDBManager* cdb = AliCDBManager::Instance();
7bdc4686 93 // AliCDBStorage *stor = cdb->GetStorage("local://$ALICE_ROOT");
94 fCalibentry = cdb->Get("START/Calib/Gain_TimeDelay_Slewing_Walk");
5ac84465 95 if (fCalibentry){
96 fgCalibData = (AliSTARTCalibData*)fCalibentry->GetObject();
97 cout<<" got calibdata "<<endl;
98 }
7bdc4686 99 fAlignentry = cdb-> Get("START/Align/Positions");
5ac84465 100 if (fAlignentry){
101 fgAlignData = (AliSTARTAlignData*) fAlignentry->GetObject();
102 cout<<" got align data "<<endl;
103 }
5ac84465 104
105 fIsInit = kTRUE;
106}
107
108
109//__________________________________________________________________
110Float_t
111AliSTARTParameters::GetGain(Int_t ipmt) const
112{
113 // Returns the calibrated gain for each PMT
114 //
115
116 if (!fCalibentry)
117 return fFixedGain;
118
119 return fgCalibData->GetGain(ipmt);
120}
121
122//__________________________________________________________________
123Float_t
124AliSTARTParameters::GetTimeDelayLED(Int_t ipmt)
125{
126 // return time delay for LED channel
127 //
128 if (!fCalibentry) {
129 fTimeDelayLED = fTimeDelayCablesLED[ipmt] + fTimeDelayElectronicLED[ipmt] + fTimeDelayPMT[ipmt];
130 return fTimeDelayLED;
131 }
132 return fgCalibData ->GetTimeDelayLED(ipmt);
133}
134//__________________________________________________________________
135Float_t
136AliSTARTParameters::GetTimeDelayCFD(Int_t ipmt)
137{
138 // return time delay for CFD channel
139 //
140 if (!fCalibentry)
141 {
142 fTimeDelayCFD = fTimeDelayCablesCFD[ipmt] + fTimeDelayElectronicCFD[ipmt] + fTimeDelayPMT[ipmt] + fVariableDelayLine[ipmt];
143 return fTimeDelayCFD;
144 }
145
146 return fgCalibData->GetTimeDelayCFD(ipmt);
147}
148
149//__________________________________________________________________
150
151void
152AliSTARTParameters::SetSlewingLED(Int_t ipmt)
153{
154 // Set Slweing Correction for LED channel
7bdc4686 155 Float_t mv[23] = {25, 30,40,60, 80,100,150,200,250,300,
156 400,500,600,800,1000,1500, 2000, 3000, 4000, 5500,
157 6000, 7000,8000};
158 Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327, 2067, 1937, 1781,
159 1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234,
160 156, 78, 0};
161
162 TGraph* gr = new TGraph(23,mv,y);
163 fSlewingLED.AddAtAndExpand(gr,ipmt);
164 }
165//__________________________________________________________________
166
167Float_t AliSTARTParameters::GetSlewingLED(Int_t ipmt, Float_t mv) const
168{
169 if (!fCalibentry) {
170 return ((TGraph*)fSlewingLED.At(ipmt))->Eval(mv);
171 }
172 return fgCalibData->GetSlewingLED(ipmt, mv) ;
173}
174
175
176//__________________________________________________________________
177
178TGraph *AliSTARTParameters::GetSlew(Int_t ipmt) const
179{
180 if (!fCalibentry) {
181 return (TGraph*)fSlewingLED.At(ipmt);
182 }
183 return fgCalibData -> GetSlew(ipmt) ;
184}
185
186//__________________________________________________________________
187
5ac84465 188
7bdc4686 189void
190AliSTARTParameters::SetSlewingRec(Int_t ipmt)
191{
192 // Set Slweing Correction for LED channel
193 Float_t mv[23] = {25, 30, 40,60, 80,100,150,200,250,300,
194 400,500,600,800,1000,1500, 2000, 3000, 4000, 5500,
195 6000, 7000,8000};
196 Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327, 2067, 1937, 1781,
197 1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234,
198 156, 78, 0};
199 Float_t y1[23], mv1[23];
200 for (Int_t i=0; i<23; i++){
201 y1[i] = y[22-i]; mv1[i] = mv[22-i];}
202 cout<<endl;
203 TGraph* gr = new TGraph(23,y1,mv1);
204 fSlewingRec.AddAtAndExpand(gr,ipmt);
205
206}
207//__________________________________________________________________
208
209Float_t AliSTARTParameters::GetSlewingRec(Int_t ipmt, Float_t mv) const
210{
211 if (!fCalibentry) {
212 return ((TGraph*)fSlewingRec.At(ipmt))->Eval(mv);
213 }
214 return fgCalibData -> GetSlewingRec(ipmt, mv) ;
215}
216
217//__________________________________________________________________
218
219TGraph *AliSTARTParameters::GetSlewRec(Int_t ipmt) const
220{
221 if (!fCalibentry) {
222 return (TGraph*)fSlewingRec.At(ipmt);
223 }
224 return fgCalibData -> GetSlewRec(ipmt) ;
225}
5ac84465 226
5ac84465 227//__________________________________________________________________
228void
229AliSTARTParameters::SetPMTeff(Int_t ipmt)
230{
231 Float_t lambda[50];
232 Float_t eff[50 ] = {0, 0, 0.23619, 0.202909, 0.177913,
233 0.175667, 0.17856, 0.190769, 0.206667, 0.230286,
234 0.252276, 0.256267,0.26, 0.27125, 0.281818,
235 0.288118, 0.294057,0.296222, 0.301622, 0.290421,
236 0.276615, 0.2666, 0.248, 0.23619, 0.227814,
237 0.219818, 0.206667,0.194087, 0.184681, 0.167917,
238 0.154367, 0.1364, 0.109412, 0.0834615,0.0725283,
239 0.0642963,0.05861, 0.0465, 0.0413333,0.032069,
240 0.0252203,0.02066, 0.016262, 0.012, 0.00590476,
241 0.003875, 0.00190, 0, 0, 0 } ;
242 for (Int_t i=0; i<50; i++) lambda[i]=200+10*i;
243
244 TGraph* gr = new TGraph(50,lambda,eff);
245 fPMTeff.AddAtAndExpand(gr,ipmt);
246}