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