]>
Commit | Line | Data |
---|---|---|
b0d2c2d3 | 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 | /// class for VZERO reconstruction // | |
21 | /// // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
b44c933e | 24 | #include <TH1F.h> |
25 | #include <TF1.h> | |
b6fd9c4a | 26 | #include <TParameter.h> |
b44c933e | 27 | |
35b120ff | 28 | #include "AliRunLoader.h" |
2eb38194 | 29 | #include "AliRawReader.h" |
fe0adf2a | 30 | #include "AliGRPObject.h" |
31 | #include "AliCDBManager.h" | |
32 | #include "AliCDBStorage.h" | |
33 | #include "AliCDBEntry.h" | |
b0d2c2d3 | 34 | #include "AliVZEROReconstructor.h" |
2eb38194 | 35 | #include "AliVZERORawStream.h" |
b44c933e | 36 | #include "AliVZEROConst.h" |
b14e6eb4 | 37 | #include "AliESDEvent.h" |
a055ee24 | 38 | #include "AliVZEROTriggerMask.h" |
b090e6a3 | 39 | #include "AliESDfriend.h" |
40 | #include "AliESDVZEROfriend.h" | |
fad64858 | 41 | #include "AliVZEROdigit.h" |
e58b4e66 | 42 | #include "AliVZEROCalibData.h" |
75b6bc77 | 43 | #include "AliRunInfo.h" |
b44c933e | 44 | #include "AliCTPTimeParams.h" |
30d5d647 | 45 | #include "AliLHCClockPhase.h" |
b0d2c2d3 | 46 | |
b0d2c2d3 | 47 | ClassImp(AliVZEROReconstructor) |
48 | ||
ce7090f5 | 49 | //_____________________________________________________________________________ |
cb2228e6 | 50 | AliVZEROReconstructor:: AliVZEROReconstructor(): AliReconstructor(), |
fe0adf2a | 51 | fESDVZERO(0x0), |
52 | fESD(0x0), | |
53 | fESDVZEROfriend(0x0), | |
b44c933e | 54 | fCalibData(NULL), |
55 | fTimeSlewing(NULL), | |
fe0adf2a | 56 | fCollisionMode(0), |
dbf24214 | 57 | fBeamEnergy(0.), |
58 | fDigitsArray(0) | |
ce7090f5 | 59 | { |
60 | // Default constructor | |
ce7090f5 | 61 | // Get calibration data |
62 | ||
b44c933e | 63 | fCalibData = GetCalibData(); |
64 | ||
65 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming"); | |
66 | if (!entry) AliFatal("CTP timing parameters are not found in OCDB !"); | |
67 | AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject(); | |
68 | Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0; | |
69 | ||
7905581c | 70 | AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign"); |
71 | if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !"); | |
72 | AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject(); | |
73 | l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0); | |
74 | ||
b44c933e | 75 | AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeDelays"); |
76 | if (!entry2) AliFatal("VZERO time delays are not found in OCDB !"); | |
77 | TH1F *delays = (TH1F*)entry2->GetObject(); | |
78 | ||
79 | AliCDBEntry *entry3 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeSlewing"); | |
80 | if (!entry3) AliFatal("VZERO time slewing function is not found in OCDB !"); | |
81 | fTimeSlewing = (TF1*)entry3->GetObject(); | |
82 | ||
30d5d647 | 83 | AliCDBEntry *entry4 = AliCDBManager::Instance()->Get("GRP/Calib/LHCClockPhase"); |
84 | if (!entry4) AliFatal("LHC clock-phase shift is not found in OCDB !"); | |
85 | AliLHCClockPhase *phase = (AliLHCClockPhase*)entry4->GetObject(); | |
86 | ||
b44c933e | 87 | for(Int_t i = 0 ; i < 64; ++i) { |
88 | Int_t board = AliVZEROCalibData::GetBoardNumber(i); | |
89 | fTimeOffset[i] = (((Float_t)fCalibData->GetTriggerCountOffset(board)- | |
90 | (Float_t)fCalibData->GetRollOver(board))*25.0+ | |
7905581c | 91 | fCalibData->GetTimeOffset(i)- |
30d5d647 | 92 | l1Delay- |
93 | phase->GetMeanPhase()+ | |
b44c933e | 94 | delays->GetBinContent(i+1)+ |
95 | kV0Offset); | |
96 | } | |
ce7090f5 | 97 | } |
98 | ||
99 | ||
100 | //_____________________________________________________________________________ | |
101 | AliVZEROReconstructor& AliVZEROReconstructor::operator = | |
102 | (const AliVZEROReconstructor& /*reconstructor*/) | |
103 | { | |
104 | // assignment operator | |
105 | ||
106 | Fatal("operator =", "assignment operator not implemented"); | |
107 | return *this; | |
108 | } | |
109 | ||
110 | //_____________________________________________________________________________ | |
111 | AliVZEROReconstructor::~AliVZEROReconstructor() | |
112 | { | |
113 | // destructor | |
44b6212f | 114 | |
b090e6a3 | 115 | delete fESDVZERO; |
116 | delete fESDVZEROfriend; | |
dbf24214 | 117 | delete fDigitsArray; |
35b120ff | 118 | } |
119 | ||
120 | //_____________________________________________________________________________ | |
d76c31f4 | 121 | void AliVZEROReconstructor::Init() |
35b120ff | 122 | { |
ef314913 | 123 | // initializer |
ce7090f5 | 124 | |
35b120ff | 125 | fESDVZERO = new AliESDVZERO; |
b090e6a3 | 126 | fESDVZEROfriend = new AliESDVZEROfriend; |
fe0adf2a | 127 | |
128 | GetCollisionMode(); // fCollisionMode =1 for Pb-Pb simulated data | |
35b120ff | 129 | } |
130 | ||
131 | //______________________________________________________________________ | |
2e0ee64a | 132 | void AliVZEROReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const |
35b120ff | 133 | { |
75b6bc77 | 134 | // converts RAW to digits |
ef314913 | 135 | |
2e0ee64a | 136 | if (!digitsTree) { |
137 | AliError("No digits tree!"); | |
138 | return; | |
139 | } | |
35b120ff | 140 | |
dbf24214 | 141 | if (!fDigitsArray) |
142 | fDigitsArray = new TClonesArray("AliVZEROdigit", 64); | |
143 | digitsTree->Branch("VZERODigit", &fDigitsArray); | |
2e0ee64a | 144 | |
b090e6a3 | 145 | fESDVZEROfriend->Reset(); |
146 | ||
2e0ee64a | 147 | rawReader->Reset(); |
148 | AliVZERORawStream rawStream(rawReader); | |
75b6bc77 | 149 | if (rawStream.Next()) { |
1d51e5e5 | 150 | |
151 | Int_t aBBflagsV0A = 0; | |
152 | Int_t aBBflagsV0C = 0; | |
153 | Int_t aBGflagsV0A = 0; | |
154 | Int_t aBGflagsV0C = 0; | |
155 | ||
156 | for(Int_t iChannel=0; iChannel < 64; ++iChannel) { | |
157 | Int_t offlineCh = rawStream.GetOfflineChannel(iChannel); | |
158 | // ADC charge samples | |
159 | Short_t chargeADC[AliVZEROdigit::kNClocks]; | |
160 | for(Int_t iClock=0; iClock < AliVZEROdigit::kNClocks; ++iClock) { | |
161 | chargeADC[iClock] = rawStream.GetPedestal(iChannel,iClock); | |
162 | } | |
163 | // Integrator flag | |
164 | Bool_t integrator = rawStream.GetIntegratorFlag(iChannel,AliVZEROdigit::kNClocks/2); | |
165 | // Beam-beam and beam-gas flags | |
166 | if(offlineCh<32) { | |
167 | if (rawStream.GetBBFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBBflagsV0C |= (1 << offlineCh); | |
168 | if (rawStream.GetBGFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBGflagsV0C |= (1 << offlineCh); | |
169 | } else { | |
170 | if (rawStream.GetBBFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBBflagsV0A |= (1 << (offlineCh-32)); | |
171 | if (rawStream.GetBGFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBGflagsV0A |= (1 << (offlineCh-32)); | |
172 | } | |
173 | // HPTDC data (leading time and width) | |
174 | Int_t board = AliVZEROCalibData::GetBoardNumber(offlineCh); | |
175 | Float_t time = rawStream.GetTime(iChannel)*fCalibData->GetTimeResolution(board); | |
176 | Float_t width = rawStream.GetWidth(iChannel)*fCalibData->GetWidthResolution(board); | |
177 | // Add a digit | |
178 | if(!fCalibData->IsChannelDead(iChannel)){ | |
179 | new ((*fDigitsArray)[fDigitsArray->GetEntriesFast()]) | |
b47d88ce | 180 | AliVZEROdigit(offlineCh, time, |
1d51e5e5 | 181 | width,integrator, |
182 | chargeADC); | |
183 | } | |
184 | ||
185 | // Filling the part of esd friend object that is available only for raw data | |
186 | fESDVZEROfriend->SetBBScalers(offlineCh,rawStream.GetBBScalers(iChannel)); | |
187 | fESDVZEROfriend->SetBGScalers(offlineCh,rawStream.GetBGScalers(iChannel)); | |
188 | for (Int_t iBunch = 0; iBunch < AliESDVZEROfriend::kNBunches; iBunch++) { | |
189 | fESDVZEROfriend->SetChargeMB(offlineCh,iBunch,rawStream.GetChargeMB(iChannel,iBunch)); | |
190 | fESDVZEROfriend->SetIntMBFlag(offlineCh,iBunch,rawStream.GetIntMBFlag(iChannel,iBunch)); | |
191 | fESDVZEROfriend->SetBBMBFlag(offlineCh,iBunch,rawStream.GetBBMBFlag(iChannel,iBunch)); | |
192 | fESDVZEROfriend->SetBGMBFlag(offlineCh,iBunch,rawStream.GetBGMBFlag(iChannel,iBunch)); | |
193 | } | |
194 | ||
195 | } | |
196 | ||
197 | // Filling the global part of esd friend object that is available only for raw data | |
198 | fESDVZEROfriend->SetTriggerInputs(rawStream.GetTriggerInputs()); | |
199 | fESDVZEROfriend->SetTriggerInputsMask(rawStream.GetTriggerInputsMask()); | |
200 | ||
201 | for(Int_t iScaler = 0; iScaler < AliESDVZEROfriend::kNScalers; iScaler++) | |
202 | fESDVZEROfriend->SetTriggerScalers(iScaler,rawStream.GetTriggerScalers(iScaler)); | |
203 | ||
204 | for(Int_t iBunch = 0; iBunch < AliESDVZEROfriend::kNBunches; iBunch++) | |
205 | fESDVZEROfriend->SetBunchNumbersMB(iBunch,rawStream.GetBunchNumbersMB(iBunch)); | |
b090e6a3 | 206 | |
1d51e5e5 | 207 | // Store the BB and BG flags in the digits tree (user info) |
208 | digitsTree->GetUserInfo()->Add(new TParameter<int>("BBflagsV0A",aBBflagsV0A)); | |
209 | digitsTree->GetUserInfo()->Add(new TParameter<int>("BBflagsV0C",aBBflagsV0C)); | |
210 | digitsTree->GetUserInfo()->Add(new TParameter<int>("BGflagsV0A",aBGflagsV0A)); | |
211 | digitsTree->GetUserInfo()->Add(new TParameter<int>("BGflagsV0C",aBGflagsV0C)); | |
b090e6a3 | 212 | |
1d51e5e5 | 213 | digitsTree->Fill(); |
2e0ee64a | 214 | } |
dbf24214 | 215 | |
216 | fDigitsArray->Clear(); | |
1d51e5e5 | 217 | } |
2e0ee64a | 218 | |
219 | //______________________________________________________________________ | |
220 | void AliVZEROReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/, | |
b14e6eb4 | 221 | AliESDEvent* esd) const |
2e0ee64a | 222 | { |
75b6bc77 | 223 | // fills multiplicities to the ESD - pedestal is now subtracted |
fe0adf2a | 224 | |
2e0ee64a | 225 | if (!digitsTree) { |
fe0adf2a | 226 | AliError("No digits tree!"); |
227 | return; | |
2e0ee64a | 228 | } |
a055ee24 | 229 | |
2e0ee64a | 230 | TBranch* digitBranch = digitsTree->GetBranch("VZERODigit"); |
dbf24214 | 231 | digitBranch->SetAddress(&fDigitsArray); |
35b120ff | 232 | |
44b6212f | 233 | Float_t mult[64]; |
db0db003 | 234 | Float_t adc[64]; |
235 | Float_t time[64]; | |
236 | Float_t width[64]; | |
b6fd9c4a | 237 | Bool_t aBBflag[64]; |
238 | Bool_t aBGflag[64]; | |
d0502ab2 | 239 | |
35b120ff | 240 | for (Int_t i=0; i<64; i++){ |
db0db003 | 241 | adc[i] = 0.0; |
d0502ab2 | 242 | mult[i] = 0.0; |
b44c933e | 243 | time[i] = kInvalidTime; |
db0db003 | 244 | width[i] = 0.0; |
b6fd9c4a | 245 | aBBflag[i] = kFALSE; |
246 | aBGflag[i] = kFALSE; | |
a055ee24 | 247 | } |
35b120ff | 248 | |
b6fd9c4a | 249 | Int_t aBBflagsV0A = 0; |
250 | Int_t aBBflagsV0C = 0; | |
251 | Int_t aBGflagsV0A = 0; | |
252 | Int_t aBGflagsV0C = 0; | |
253 | ||
254 | if (digitsTree->GetUserInfo()->FindObject("BBflagsV0A")) { | |
255 | aBBflagsV0A = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BBflagsV0A"))->GetVal(); | |
256 | } | |
257 | else | |
258 | AliWarning("V0A beam-beam flags not found in digits tree UserInfo! The flags will not be written to the raw-data stream!"); | |
259 | ||
260 | if (digitsTree->GetUserInfo()->FindObject("BBflagsV0C")) { | |
261 | aBBflagsV0C = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BBflagsV0C"))->GetVal(); | |
262 | } | |
263 | else | |
264 | AliWarning("V0C beam-beam flags not found in digits tree UserInfo! The flags will not be written to the raw-data stream!"); | |
265 | ||
266 | if (digitsTree->GetUserInfo()->FindObject("BGflagsV0A")) { | |
267 | aBGflagsV0A = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BGflagsV0A"))->GetVal(); | |
268 | } | |
269 | else | |
270 | AliWarning("V0A beam-gas flags not found in digits tree UserInfo! The flags will not be written to the raw-data stream!"); | |
271 | ||
272 | if (digitsTree->GetUserInfo()->FindObject("BGflagsV0C")) { | |
273 | aBGflagsV0C = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BGflagsV0C"))->GetVal(); | |
274 | } | |
275 | else | |
276 | AliWarning("V0C beam-gas flags not found in digits tree UserInfo! The flags will not be written to the raw-data stream!"); | |
277 | ||
1d51e5e5 | 278 | // Beam-beam and beam-gas flags (hardware) |
279 | for (Int_t iChannel = 0; iChannel < 64; ++iChannel) { | |
280 | if(iChannel < 32) { | |
281 | aBBflag[iChannel] = (aBBflagsV0C >> iChannel) & 0x1; | |
282 | aBGflag[iChannel] = (aBGflagsV0C >> iChannel) & 0x1; | |
283 | } | |
284 | else { | |
285 | aBBflag[iChannel] = (aBBflagsV0A >> (iChannel-32)) & 0x1; | |
286 | aBGflag[iChannel] = (aBGflagsV0A >> (iChannel-32)) & 0x1; | |
287 | } | |
288 | } | |
b6fd9c4a | 289 | |
2e0ee64a | 290 | Int_t nEntries = (Int_t)digitsTree->GetEntries(); |
35b120ff | 291 | for (Int_t e=0; e<nEntries; e++) { |
2e0ee64a | 292 | digitsTree->GetEvent(e); |
35b120ff | 293 | |
dbf24214 | 294 | Int_t nDigits = fDigitsArray->GetEntriesFast(); |
35b120ff | 295 | |
296 | for (Int_t d=0; d<nDigits; d++) { | |
dbf24214 | 297 | AliVZEROdigit* digit = (AliVZEROdigit*) fDigitsArray->At(d); |
1d51e5e5 | 298 | Int_t pmNumber = digit->PMNumber(); |
299 | ||
300 | // Pedestal retrieval and suppression | |
301 | Bool_t integrator = digit->Integrator(); | |
302 | Float_t maxadc = 0; | |
303 | Int_t imax = -1; | |
304 | Float_t adcPedSub[AliVZEROdigit::kNClocks]; | |
305 | for(Int_t iClock=0; iClock < AliVZEROdigit::kNClocks; ++iClock) { | |
306 | Short_t charge = digit->ChargeADC(iClock); | |
307 | Bool_t iIntegrator = (iClock%2 == 0) ? integrator : !integrator; | |
308 | Int_t k = pmNumber + 64*iIntegrator; | |
309 | adcPedSub[iClock] = (Float_t)charge - fCalibData->GetPedestal(k); | |
310 | if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) { | |
311 | adcPedSub[iClock] = 0; | |
312 | continue; | |
313 | } | |
314 | if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue; | |
315 | if(adcPedSub[iClock] > maxadc) { | |
316 | maxadc = adcPedSub[iClock]; | |
317 | imax = iClock; | |
318 | } | |
b6fd9c4a | 319 | } |
1d51e5e5 | 320 | |
321 | if (imax != -1) { | |
322 | Int_t start = imax - GetRecoParam()->GetNPreClocks(); | |
323 | if (start < 0) start = 0; | |
324 | Int_t end = imax + GetRecoParam()->GetNPostClocks(); | |
325 | if (end > 20) end = 20; | |
326 | for(Int_t iClock = start; iClock <= end; iClock++) { | |
327 | adc[pmNumber] += adcPedSub[iClock]; | |
328 | } | |
b6fd9c4a | 329 | } |
330 | ||
1d51e5e5 | 331 | // HPTDC leading time and width |
332 | // Correction for slewing and various time delays | |
333 | time[pmNumber] = CorrectLeadingTime(pmNumber,digit->Time(),adc[pmNumber]); | |
334 | width[pmNumber] = digit->Width(); | |
335 | ||
336 | if (adc[pmNumber] > 0) AliDebug(1,Form("PM = %d ADC = %f TDC %f (%f) Int %d (%d %d %d %d %d) %f %f %f %f %d %d",pmNumber, adc[pmNumber], | |
337 | digit->Time(),time[pmNumber], | |
b6fd9c4a | 338 | integrator, |
339 | digit->ChargeADC(8),digit->ChargeADC(9),digit->ChargeADC(10), | |
340 | digit->ChargeADC(11),digit->ChargeADC(12), | |
341 | fCalibData->GetPedestal(pmNumber),fCalibData->GetSigma(pmNumber), | |
342 | fCalibData->GetPedestal(pmNumber+64),fCalibData->GetSigma(pmNumber+64), | |
343 | aBBflag[pmNumber],aBGflag[pmNumber])); | |
75b6bc77 | 344 | |
1d51e5e5 | 345 | mult[pmNumber] = adc[pmNumber]*fCalibData->GetMIPperADC(pmNumber); |
346 | ||
347 | // Fill ESD friend object | |
348 | for (Int_t iEv = 0; iEv < AliESDVZEROfriend::kNEvOfInt; iEv++) { | |
349 | fESDVZEROfriend->SetPedestal(pmNumber,iEv,(Float_t)digit->ChargeADC(iEv)); | |
350 | fESDVZEROfriend->SetIntegratorFlag(pmNumber,iEv,(iEv%2 == 0) ? integrator : !integrator); | |
351 | fESDVZEROfriend->SetBBFlag(pmNumber,iEv,aBBflag[pmNumber]); | |
352 | fESDVZEROfriend->SetBGFlag(pmNumber,iEv,aBGflag[pmNumber]); | |
353 | } | |
354 | fESDVZEROfriend->SetTime(pmNumber,digit->Time()); | |
355 | fESDVZEROfriend->SetWidth(pmNumber,digit->Width()); | |
356 | ||
35b120ff | 357 | } // end of loop over digits |
35b120ff | 358 | } // end of loop over events in digits tree |
6c6d6114 | 359 | |
b44c933e | 360 | fESDVZERO->SetBit(AliESDVZERO::kCorrectedLeadingTime,kTRUE); |
6c6d6114 | 361 | fESDVZERO->SetMultiplicity(mult); |
28fdf12c | 362 | fESDVZERO->SetADC(adc); |
363 | fESDVZERO->SetTime(time); | |
d0502ab2 | 364 | fESDVZERO->SetWidth(width); |
89a39339 | 365 | fESDVZERO->SetBit(AliESDVZERO::kOnlineBitsFilled,kTRUE); |
b6fd9c4a | 366 | fESDVZERO->SetBBFlag(aBBflag); |
367 | fESDVZERO->SetBGFlag(aBGflag); | |
a055ee24 | 368 | |
b44c933e | 369 | // now fill the V0 decision and channel flags |
370 | { | |
371 | AliVZEROTriggerMask triggerMask; | |
372 | triggerMask.FillMasks(fESDVZERO, fCalibData, fTimeSlewing); | |
373 | } | |
a055ee24 | 374 | |
2e0ee64a | 375 | if (esd) { |
44b6212f | 376 | AliDebug(1, Form("Writing VZERO data to ESD tree")); |
377 | esd->SetVZEROData(fESDVZERO); | |
2e0ee64a | 378 | } |
b090e6a3 | 379 | |
380 | if (esd) { | |
fe0adf2a | 381 | AliESDfriend *fr = (AliESDfriend*)esd->FindListObject("AliESDfriend"); |
382 | if (fr) { | |
383 | AliDebug(1, Form("Writing VZERO friend data to ESD tree")); | |
384 | fr->SetVZEROfriend(fESDVZEROfriend); | |
b090e6a3 | 385 | } |
386 | } | |
dbf24214 | 387 | |
388 | fDigitsArray->Clear(); | |
35b120ff | 389 | } |
390 | ||
ce7090f5 | 391 | //_____________________________________________________________________________ |
392 | AliCDBStorage* AliVZEROReconstructor::SetStorage(const char *uri) | |
393 | { | |
ef314913 | 394 | // Sets the storage |
395 | ||
ce7090f5 | 396 | Bool_t deleteManager = kFALSE; |
397 | ||
398 | AliCDBManager *manager = AliCDBManager::Instance(); | |
399 | AliCDBStorage *defstorage = manager->GetDefaultStorage(); | |
400 | ||
401 | if(!defstorage || !(defstorage->Contains("VZERO"))){ | |
402 | AliWarning("No default storage set or default storage doesn't contain VZERO!"); | |
403 | manager->SetDefaultStorage(uri); | |
404 | deleteManager = kTRUE; | |
405 | } | |
406 | ||
407 | AliCDBStorage *storage = manager->GetDefaultStorage(); | |
408 | ||
409 | if(deleteManager){ | |
44b6212f | 410 | AliCDBManager::Instance()->UnsetDefaultStorage(); |
411 | defstorage = 0; // the storage is killed by AliCDBManager::Instance()->Destroy() | |
ce7090f5 | 412 | } |
413 | ||
414 | return storage; | |
415 | } | |
416 | ||
fe0adf2a | 417 | //____________________________________________________________________________ |
418 | void AliVZEROReconstructor::GetCollisionMode() | |
419 | { | |
75b6bc77 | 420 | // Retrieval of collision mode |
fe0adf2a | 421 | |
75b6bc77 | 422 | TString beamType = GetRunInfo()->GetBeamType(); |
fe0adf2a | 423 | if(beamType==AliGRPObject::GetInvalidString()){ |
75b6bc77 | 424 | AliError("VZERO cannot retrieve beam type"); |
fe0adf2a | 425 | return; |
426 | } | |
427 | ||
75b6bc77 | 428 | if( (beamType.CompareTo("P-P") ==0) || (beamType.CompareTo("p-p") ==0) ){ |
429 | fCollisionMode=0; | |
430 | } | |
431 | else if( (beamType.CompareTo("Pb-Pb") ==0) || (beamType.CompareTo("A-A") ==0) ){ | |
432 | fCollisionMode=1; | |
fe0adf2a | 433 | } |
fe0adf2a | 434 | |
75b6bc77 | 435 | fBeamEnergy = GetRunInfo()->GetBeamEnergy(); |
fe0adf2a | 436 | if(fBeamEnergy==AliGRPObject::GetInvalidFloat()) { |
75b6bc77 | 437 | AliError("Missing value for the beam energy ! Using 0"); |
fe0adf2a | 438 | fBeamEnergy = 0.; |
439 | } | |
440 | ||
75b6bc77 | 441 | AliDebug(1,Form("\n ++++++ Beam type and collision mode retrieved as %s %d @ %1.3f GeV ++++++\n\n",beamType.Data(), fCollisionMode, fBeamEnergy)); |
fe0adf2a | 442 | |
443 | } | |
444 | ||
ce7090f5 | 445 | //_____________________________________________________________________________ |
446 | AliVZEROCalibData* AliVZEROReconstructor::GetCalibData() const | |
447 | { | |
ef314913 | 448 | // Gets calibration object for VZERO set |
ce7090f5 | 449 | |
c0b82b5a | 450 | AliCDBManager *man = AliCDBManager::Instance(); |
ce7090f5 | 451 | |
c0b82b5a | 452 | AliCDBEntry *entry=0; |
453 | ||
454 | entry = man->Get("VZERO/Calib/Data"); | |
455 | ||
c0b82b5a | 456 | AliVZEROCalibData *calibdata = 0; |
457 | ||
458 | if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject(); | |
94a600a1 | 459 | if (!calibdata) AliFatal("No calibration data from calibration database !"); |
ce7090f5 | 460 | |
461 | return calibdata; | |
462 | } | |
44b6212f | 463 | |
b44c933e | 464 | Float_t AliVZEROReconstructor::CorrectLeadingTime(Int_t i, Float_t time, Float_t adc) const |
465 | { | |
466 | // Correct the leading time | |
467 | // for slewing effect and | |
468 | // misalignment of the channels | |
469 | if (time < 1e-6) return kInvalidTime; | |
470 | ||
471 | // Channel alignment and general offset subtraction | |
472 | if (i < 32) time -= kV0CDelayCables; | |
473 | time -= fTimeOffset[i]; | |
474 | ||
475 | // In case of pathological signals | |
476 | if (adc < 1e-6) return time; | |
477 | ||
478 | // Slewing correction | |
479 | Float_t thr = fCalibData->GetDiscriThr(i); | |
480 | time -= fTimeSlewing->Eval(adc/thr); | |
481 | ||
482 | return time; | |
483 | } |