]>
Commit | Line | Data |
---|---|---|
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" | |
5ac84465 | 30 | #include <AliCDBManager.h> |
31 | #include <AliCDBEntry.h> | |
32 | #include <AliCDBStorage.h> | |
33 | #include <Riostream.h> | |
34 | ||
5ac84465 | 35 | AliSTARTCalibData* AliSTARTParameters::fgCalibData = 0; |
36 | //==================================================================== | |
37 | ClassImp(AliSTARTParameters) | |
38 | #if 0 | |
39 | ; // This is here to keep Emacs for indenting the next line | |
40 | #endif | |
41 | ||
42 | //____________________________________________________________________ | |
43 | AliSTARTParameters* AliSTARTParameters::fgInstance = 0; | |
44 | //____________________________________________________________________ | |
45 | AliSTARTParameters* | |
46 | AliSTARTParameters::Instance() | |
47 | { | |
48 | // Get static instance | |
49 | if (!fgInstance) fgInstance = new AliSTARTParameters; | |
50 | return fgInstance; | |
51 | } | |
52 | ||
53 | //____________________________________________________________________ | |
54 | AliSTARTParameters::AliSTARTParameters() | |
5ac84465 | 55 | { |
56 | // Default constructor | |
7bdc4686 | 57 | |
5ac84465 | 58 | for (Int_t ipmt=0; ipmt<24; ipmt++) |
59 | { | |
60 | SetTimeDelayCablesCFD(ipmt); | |
61 | SetTimeDelayCablesLED(ipmt); | |
62 | SetTimeDelayElectronicCFD(ipmt); | |
63 | SetTimeDelayElectronicLED(ipmt); | |
64 | SetTimeDelayPMT(ipmt); | |
7bdc4686 | 65 | SetVariableDelayLine(ipmt); |
5ac84465 | 66 | SetSlewingLED(ipmt); |
7bdc4686 | 67 | SetSlewingRec(ipmt); |
5ac84465 | 68 | SetPh2Mip(); |
4c7da157 | 69 | SetmV2Mip(); |
5ac84465 | 70 | SetChannelWidth(); |
71 | SetmV2channel(); | |
72 | SetGain(); | |
73 | SetQTmin(); | |
74 | SetQTmax(); | |
75 | SetPMTeff(ipmt); | |
76 | } | |
7bdc4686 | 77 | SetTimeDelayTVD(); |
5ac84465 | 78 | SetZposition(); |
79 | ||
80 | } | |
81 | ||
82 | //__________________________________________________________________ | |
83 | void | |
84 | AliSTARTParameters::Init() | |
85 | { | |
86 | // Initialize the parameters manager. We need to get stuff from the | |
87 | // CDB here. | |
7bdc4686 | 88 | // if (fIsInit) return; |
5ac84465 | 89 | |
90 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
7bdc4686 | 91 | // AliCDBStorage *stor = cdb->GetStorage("local://$ALICE_ROOT"); |
92 | fCalibentry = cdb->Get("START/Calib/Gain_TimeDelay_Slewing_Walk"); | |
5ac84465 | 93 | if (fCalibentry){ |
94 | fgCalibData = (AliSTARTCalibData*)fCalibentry->GetObject(); | |
5ac84465 | 95 | } |
5ac84465 | 96 | |
97 | fIsInit = kTRUE; | |
98 | } | |
99 | ||
100 | ||
101 | //__________________________________________________________________ | |
102 | Float_t | |
103 | AliSTARTParameters::GetGain(Int_t ipmt) const | |
104 | { | |
105 | // Returns the calibrated gain for each PMT | |
106 | // | |
107 | ||
108 | if (!fCalibentry) | |
109 | return fFixedGain; | |
110 | ||
111 | return fgCalibData->GetGain(ipmt); | |
112 | } | |
113 | ||
114 | //__________________________________________________________________ | |
115 | Float_t | |
116 | AliSTARTParameters::GetTimeDelayLED(Int_t ipmt) | |
117 | { | |
118 | // return time delay for LED channel | |
119 | // | |
120 | if (!fCalibentry) { | |
121 | fTimeDelayLED = fTimeDelayCablesLED[ipmt] + fTimeDelayElectronicLED[ipmt] + fTimeDelayPMT[ipmt]; | |
122 | return fTimeDelayLED; | |
123 | } | |
124 | return fgCalibData ->GetTimeDelayLED(ipmt); | |
125 | } | |
126 | //__________________________________________________________________ | |
127 | Float_t | |
128 | AliSTARTParameters::GetTimeDelayCFD(Int_t ipmt) | |
129 | { | |
130 | // return time delay for CFD channel | |
131 | // | |
132 | if (!fCalibentry) | |
133 | { | |
134 | fTimeDelayCFD = fTimeDelayCablesCFD[ipmt] + fTimeDelayElectronicCFD[ipmt] + fTimeDelayPMT[ipmt] + fVariableDelayLine[ipmt]; | |
135 | return fTimeDelayCFD; | |
136 | } | |
137 | ||
138 | return fgCalibData->GetTimeDelayCFD(ipmt); | |
139 | } | |
140 | ||
141 | //__________________________________________________________________ | |
142 | ||
143 | void | |
144 | AliSTARTParameters::SetSlewingLED(Int_t ipmt) | |
145 | { | |
146 | // Set Slweing Correction for LED channel | |
7bdc4686 | 147 | Float_t mv[23] = {25, 30,40,60, 80,100,150,200,250,300, |
148 | 400,500,600,800,1000,1500, 2000, 3000, 4000, 5500, | |
149 | 6000, 7000,8000}; | |
150 | Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327, 2067, 1937, 1781, | |
151 | 1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234, | |
152 | 156, 78, 0}; | |
153 | ||
154 | TGraph* gr = new TGraph(23,mv,y); | |
155 | fSlewingLED.AddAtAndExpand(gr,ipmt); | |
156 | } | |
157 | //__________________________________________________________________ | |
158 | ||
159 | Float_t AliSTARTParameters::GetSlewingLED(Int_t ipmt, Float_t mv) const | |
160 | { | |
161 | if (!fCalibentry) { | |
162 | return ((TGraph*)fSlewingLED.At(ipmt))->Eval(mv); | |
163 | } | |
164 | return fgCalibData->GetSlewingLED(ipmt, mv) ; | |
165 | } | |
166 | ||
167 | ||
168 | //__________________________________________________________________ | |
169 | ||
170 | TGraph *AliSTARTParameters::GetSlew(Int_t ipmt) const | |
171 | { | |
172 | if (!fCalibentry) { | |
173 | return (TGraph*)fSlewingLED.At(ipmt); | |
174 | } | |
175 | return fgCalibData -> GetSlew(ipmt) ; | |
176 | } | |
177 | ||
178 | //__________________________________________________________________ | |
179 | ||
5ac84465 | 180 | |
7bdc4686 | 181 | void |
182 | AliSTARTParameters::SetSlewingRec(Int_t ipmt) | |
183 | { | |
184 | // Set Slweing Correction for LED channel | |
185 | Float_t mv[23] = {25, 30, 40,60, 80,100,150,200,250,300, | |
186 | 400,500,600,800,1000,1500, 2000, 3000, 4000, 5500, | |
187 | 6000, 7000,8000}; | |
188 | Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327, 2067, 1937, 1781, | |
189 | 1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234, | |
190 | 156, 78, 0}; | |
191 | Float_t y1[23], mv1[23]; | |
192 | for (Int_t i=0; i<23; i++){ | |
193 | y1[i] = y[22-i]; mv1[i] = mv[22-i];} | |
89961342 | 194 | |
7bdc4686 | 195 | TGraph* gr = new TGraph(23,y1,mv1); |
196 | fSlewingRec.AddAtAndExpand(gr,ipmt); | |
197 | ||
198 | } | |
199 | //__________________________________________________________________ | |
200 | ||
201 | Float_t AliSTARTParameters::GetSlewingRec(Int_t ipmt, Float_t mv) const | |
202 | { | |
203 | if (!fCalibentry) { | |
204 | return ((TGraph*)fSlewingRec.At(ipmt))->Eval(mv); | |
205 | } | |
206 | return fgCalibData -> GetSlewingRec(ipmt, mv) ; | |
207 | } | |
208 | ||
209 | //__________________________________________________________________ | |
210 | ||
211 | TGraph *AliSTARTParameters::GetSlewRec(Int_t ipmt) const | |
212 | { | |
213 | if (!fCalibentry) { | |
214 | return (TGraph*)fSlewingRec.At(ipmt); | |
215 | } | |
216 | return fgCalibData -> GetSlewRec(ipmt) ; | |
217 | } | |
5ac84465 | 218 | |
5ac84465 | 219 | //__________________________________________________________________ |
220 | void | |
221 | AliSTARTParameters::SetPMTeff(Int_t ipmt) | |
222 | { | |
223 | Float_t lambda[50]; | |
224 | Float_t eff[50 ] = {0, 0, 0.23619, 0.202909, 0.177913, | |
225 | 0.175667, 0.17856, 0.190769, 0.206667, 0.230286, | |
226 | 0.252276, 0.256267,0.26, 0.27125, 0.281818, | |
227 | 0.288118, 0.294057,0.296222, 0.301622, 0.290421, | |
228 | 0.276615, 0.2666, 0.248, 0.23619, 0.227814, | |
229 | 0.219818, 0.206667,0.194087, 0.184681, 0.167917, | |
230 | 0.154367, 0.1364, 0.109412, 0.0834615,0.0725283, | |
231 | 0.0642963,0.05861, 0.0465, 0.0413333,0.032069, | |
232 | 0.0252203,0.02066, 0.016262, 0.012, 0.00590476, | |
233 | 0.003875, 0.00190, 0, 0, 0 } ; | |
234 | for (Int_t i=0; i<50; i++) lambda[i]=200+10*i; | |
235 | ||
236 | TGraph* gr = new TGraph(50,lambda,eff); | |
237 | fPMTeff.AddAtAndExpand(gr,ipmt); | |
238 | } |