]> git.uio.no Git - u/mrichter/AliRoot.git/blob - START/AliSTARTParameters.cxx
START positions
[u/mrichter/AliRoot.git] / START / AliSTARTParameters.cxx
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
36 AliSTARTAlignData* AliSTARTParameters::fgAlignData = 0;
37 AliSTARTCalibData* AliSTARTParameters::fgCalibData = 0;
38 //====================================================================
39 ClassImp(AliSTARTParameters)
40 #if 0
41   ; // This is here to keep Emacs for indenting the next line
42 #endif
43
44 //____________________________________________________________________
45 AliSTARTParameters* AliSTARTParameters::fgInstance = 0;
46 //____________________________________________________________________
47 AliSTARTParameters* 
48 AliSTARTParameters::Instance() 
49 {
50   // Get static instance 
51   if (!fgInstance) fgInstance = new AliSTARTParameters;
52   return fgInstance;
53 }
54
55 //____________________________________________________________________
56 AliSTARTParameters::AliSTARTParameters() 
57   : fIsInit(kFALSE)
58 {
59   // Default constructor 
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);
67       SetVariableDelayLine(ipmt);
68       SetSlewingLED(ipmt);
69       SetPh2Mip();      
70       SetChannelWidth();
71       SetmV2channel();
72       SetGain();
73       SetQTmin();
74       SetQTmax();
75       SetPMTeff(ipmt);
76    }
77   SetZposition();
78   
79 }
80
81 //__________________________________________________________________
82 void
83 AliSTARTParameters::Init()
84 {
85   // Initialize the parameters manager.  We need to get stuff from the
86   // CDB here. 
87   //  if (fIsInit) return;
88   
89   AliCDBManager* cdb      = AliCDBManager::Instance();
90   cout<<" AliSTARTParameters::Init() CDB "<<cdb<<endl;
91   AliCDBStorage *stor = cdb->GetStorage("local://$ALICE_ROOT");
92   fCalibentry  = stor->Get("START/Calib/Gain_TimeDelay_Slewing_Walk",1);
93   if (fCalibentry){
94    fgCalibData  = (AliSTARTCalibData*)fCalibentry->GetObject();
95    cout<<" got calibdata "<<endl;
96   }
97    fAlignentry     = stor-> Get("START/Align/Positions",1);
98   if (fAlignentry){
99    fgAlignData  = (AliSTARTAlignData*) fAlignentry->GetObject();
100    cout<<" got align data "<<endl;
101   }
102   cout<<" in INT :: calib "<<fCalibentry<<" align "<<fAlignentry<<endl;
103
104   fIsInit = kTRUE;
105 }
106
107
108 //__________________________________________________________________
109 Float_t
110 AliSTARTParameters::GetGain(Int_t ipmt) const
111 {
112   // Returns the calibrated gain for each PMT 
113   // 
114
115   if (!fCalibentry) 
116     return fFixedGain;
117    
118   return fgCalibData->GetGain(ipmt);
119 }
120
121 //__________________________________________________________________
122 Float_t
123 AliSTARTParameters::GetTimeDelayLED(Int_t ipmt) 
124 {
125   // return time delay for LED channel
126   // 
127   if (!fCalibentry) {
128     fTimeDelayLED = fTimeDelayCablesLED[ipmt] + fTimeDelayElectronicLED[ipmt] + fTimeDelayPMT[ipmt];
129     return  fTimeDelayLED;
130   } 
131   return fgCalibData ->GetTimeDelayLED(ipmt);
132 }
133 //__________________________________________________________________
134 Float_t
135 AliSTARTParameters::GetTimeDelayCFD(Int_t ipmt) 
136 {
137   // return time delay for CFD channel
138    // 
139   if (!fCalibentry) 
140     {
141       fTimeDelayCFD = fTimeDelayCablesCFD[ipmt] + fTimeDelayElectronicCFD[ipmt] + fTimeDelayPMT[ipmt] + fVariableDelayLine[ipmt];
142       return fTimeDelayCFD;
143     }
144    
145   return fgCalibData->GetTimeDelayCFD(ipmt);
146 }
147
148 //__________________________________________________________________
149
150 void 
151 AliSTARTParameters::SetSlewingLED(Int_t ipmt)
152 {
153   //  Set Slweing Correction for LED channel 
154
155   Float_t mv[23] = {25, 30,40,60, 80,100,150,200,250,300,400,500,600,800,1000,1500, 2000, 3000, 4000, 5500, 6000, 7000,8000};
156   Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327,  1937, 1781, 1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234, 156, 78, 0};
157
158   TGraph* gr = new TGraph(23,mv,y);
159   fSlewingLED.AddAtAndExpand(gr,ipmt);
160  }
161 //__________________________________________________________________
162 void 
163 AliSTARTParameters::SetPMTeff(Int_t ipmt)
164 {
165   Float_t lambda[50];
166   Float_t eff[50 ] = {0,        0,       0.23619,  0.202909, 0.177913, 
167                     0.175667, 0.17856, 0.190769, 0.206667, 0.230286,
168                     0.252276, 0.256267,0.26,     0.27125,  0.281818,
169                     0.288118, 0.294057,0.296222, 0.301622, 0.290421, 
170                     0.276615, 0.2666,  0.248,    0.23619,  0.227814, 
171                     0.219818, 0.206667,0.194087, 0.184681, 0.167917, 
172                     0.154367, 0.1364,  0.109412, 0.0834615,0.0725283, 
173                     0.0642963,0.05861, 0.0465,   0.0413333,0.032069, 
174                     0.0252203,0.02066, 0.016262, 0.012,    0.00590476,
175                     0.003875, 0.00190, 0,        0,        0          } ;
176   for (Int_t i=0; i<50; i++) lambda[i]=200+10*i; 
177
178   TGraph* gr = new TGraph(50,lambda,eff);
179   fPMTeff.AddAtAndExpand(gr,ipmt);
180 }