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