]>
Commit | Line | Data |
---|---|---|
a6f3cc02 | 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 | ||
17 | // Produces the data needed to calculate the quality assurance | |
18 | // All data must be mergeable objects | |
19 | // Handles ESDs and Raws | |
20 | // Histos defined will be used for Raw Data control and monitoring | |
21 | ||
22 | // --- ROOT system --- | |
23 | #include <TClonesArray.h> | |
24 | #include <TFile.h> | |
25 | #include <TF1.h> | |
26 | #include <TH1F.h> | |
27 | #include <TH1I.h> | |
28 | #include <TH2I.h> | |
29 | #include <TH2F.h> | |
30 | #include <TGraph.h> | |
31 | #include <TParameter.h> | |
32 | #include <TTimeStamp.h> | |
33 | ||
34 | // --- Standard library --- | |
35 | ||
36 | // --- AliRoot header files --- | |
37 | #include "AliESDEvent.h" | |
38 | #include "AliLog.h" | |
39 | #include "AliCDBManager.h" | |
40 | #include "AliCDBStorage.h" | |
41 | #include "AliCDBEntry.h" | |
42 | #include "AliADQADataMakerRec.h" | |
43 | #include "AliQAChecker.h" | |
44 | #include "AliRawReader.h" | |
45 | #include "AliADRawStream.h" | |
46 | #include "AliADdigit.h" | |
47 | #include "AliADConst.h" | |
48 | #include "AliADReconstructor.h" | |
49 | //#include "AliADTrending.h" | |
50 | #include "AliADCalibData.h" | |
51 | #include "AliCTPTimeParams.h" | |
52 | #include "event.h" | |
53 | ||
54 | ClassImp(AliADQADataMakerRec) | |
55 | ||
56 | //____________________________________________________________________________ | |
57 | AliADQADataMakerRec::AliADQADataMakerRec() : | |
58 | AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kAD), "AD Quality Assurance Data Maker"), | |
59 | fCalibData(0x0), | |
60 | fTrendingUpdateTime(0), | |
61 | fCycleStartTime(0), | |
62 | fCycleStopTime(0), | |
63 | fTimeSlewing(0) | |
64 | ||
65 | { | |
66 | // Constructor | |
67 | ||
68 | AliDebug(AliQAv1::GetQADebugLevel(), "Construct AD QA Object"); | |
69 | ||
70 | for(Int_t i=0; i<16; i++){ | |
71 | fEven[i] = 0; | |
72 | fOdd[i] = 0; | |
73 | } | |
74 | ||
75 | for(Int_t i=0; i<32; i++){ | |
76 | fADCmean[i] = 0.0; } | |
77 | } | |
78 | ||
79 | //____________________________________________________________________________ | |
80 | AliADQADataMakerRec::AliADQADataMakerRec(const AliADQADataMakerRec& qadm) : | |
81 | AliQADataMakerRec(), | |
82 | fCalibData(0x0), | |
83 | fTrendingUpdateTime(0), | |
84 | fCycleStartTime(0), | |
85 | fCycleStopTime(0), | |
86 | fTimeSlewing(0) | |
87 | ||
88 | { | |
89 | // Copy constructor | |
90 | ||
91 | SetName((const char*)qadm.GetName()) ; | |
92 | SetTitle((const char*)qadm.GetTitle()); | |
93 | } | |
94 | ||
95 | //__________________________________________________________________ | |
96 | AliADQADataMakerRec& AliADQADataMakerRec::operator = (const AliADQADataMakerRec& qadm ) | |
97 | { | |
98 | // Equal operator | |
99 | ||
100 | this->~AliADQADataMakerRec(); | |
101 | new(this) AliADQADataMakerRec(qadm); | |
102 | return *this; | |
103 | } | |
104 | ||
105 | //____________________________________________________________________________ | |
106 | AliADCalibData* AliADQADataMakerRec::GetCalibData() const | |
107 | ||
108 | { | |
109 | AliCDBManager *man = AliCDBManager::Instance(); | |
110 | ||
111 | AliCDBEntry *entry=0; | |
112 | ||
113 | entry = man->Get("AD/Calib/Data",fRun); | |
114 | if(!entry){ | |
115 | AliWarning("Load of calibration data from default storage failed!"); | |
116 | AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)"); | |
117 | ||
118 | man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
119 | entry = man->Get("AD/Calib/Data",fRun); | |
120 | } | |
121 | // Retrieval of data in directory AD/Calib/Data: | |
122 | ||
123 | AliADCalibData *calibdata = 0; | |
124 | ||
125 | if (entry) calibdata = (AliADCalibData*) entry->GetObject(); | |
126 | if (!calibdata) AliFatal("No calibration data from calibration database !"); | |
127 | ||
128 | return calibdata; | |
129 | } | |
130 | //____________________________________________________________________________ | |
131 | void AliADQADataMakerRec::StartOfDetectorCycle() | |
132 | { | |
133 | // Detector specific actions at start of cycle | |
134 | ||
135 | // Reset of the histogram used - to have the trend versus time - | |
136 | ||
137 | fCalibData = GetCalibData(); | |
138 | ||
139 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming"); | |
140 | if (!entry) AliFatal("CTP timing parameters are not found in OCDB !"); | |
141 | AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject(); | |
142 | Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0; | |
143 | ||
144 | AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign"); | |
145 | if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !"); | |
146 | AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject(); | |
147 | l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0); | |
148 | ||
149 | AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("AD/Calib/TimeDelays"); | |
150 | if (!entry2) AliFatal("AD time delays are not found in OCDB !"); | |
151 | TH1F *delays = (TH1F*)entry2->GetObject(); | |
152 | ||
153 | AliCDBEntry *entry3 = AliCDBManager::Instance()->Get("AD/Calib/TimeSlewing"); | |
154 | if (!entry3) AliFatal("AD time slewing function is not found in OCDB !"); | |
155 | fTimeSlewing = (TF1*)entry3->GetObject(); | |
156 | ||
157 | ||
158 | for(Int_t i = 0 ; i < 16; ++i) { | |
159 | //Int_t board = AliADCalibData::GetBoardNumber(i); | |
160 | fTimeOffset[i] = ( | |
161 | // ((Float_t)fCalibData->GetTriggerCountOffset(board) - | |
162 | // (Float_t)fCalibData->GetRollOver(board))*25.0 + | |
163 | // fCalibData->GetTimeOffset(i) - | |
164 | // l1Delay+ | |
165 | delays->GetBinContent(i+1)//+ | |
166 | // kV0Offset | |
167 | ); | |
168 | // AliInfo(Form(" fTimeOffset[%d] = %f kV0offset %f",i,fTimeOffset[i],kV0Offset)); | |
169 | } | |
170 | ||
171 | ||
172 | ||
173 | ||
174 | ||
175 | TTimeStamp currentTime; | |
176 | fCycleStartTime = currentTime.GetSec(); | |
177 | ||
178 | // fNTotEvents = 0; | |
179 | } | |
180 | //____________________________________________________________________________ | |
181 | void AliADQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list) | |
182 | { | |
183 | // Detector specific actions at end of cycle | |
184 | // Does the QA checking | |
185 | ResetEventTrigClasses(); | |
186 | // | |
187 | AliQAChecker::Instance()->Run(AliQAv1::kAD, task, list) ; | |
188 | ||
189 | if(task == AliQAv1::kRAWS){ | |
190 | TTimeStamp currentTime; | |
191 | fCycleStopTime = currentTime.GetSec(); | |
192 | } | |
193 | ||
194 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { | |
195 | if (! IsValidEventSpecie(specie, list)) continue ; | |
196 | SetEventSpecie(AliRecoParam::ConvertIndex(specie)); | |
197 | if(task == AliQAv1::kRAWS) { | |
198 | } else if (task == AliQAv1::kESDS) { | |
199 | } | |
200 | } | |
201 | } | |
202 | ||
203 | //____________________________________________________________________________ | |
204 | void AliADQADataMakerRec::InitESDs() | |
205 | { | |
206 | // Creates histograms to control ESDs | |
207 | } | |
208 | ||
209 | //____________________________________________________________________________ | |
210 | void AliADQADataMakerRec::InitDigits() | |
211 | { | |
212 | ||
213 | } | |
214 | ||
215 | //____________________________________________________________________________ | |
216 | void AliADQADataMakerRec::MakeDigits() | |
217 | { | |
218 | ||
219 | } | |
220 | ||
221 | //____________________________________________________________________________ | |
222 | void AliADQADataMakerRec::MakeDigits(TTree *digitTree) | |
223 | { | |
224 | ||
225 | } | |
226 | ||
227 | ||
228 | //____________________________________________________________________________ | |
229 | void AliADQADataMakerRec::MakeESDs(AliESDEvent * esd) | |
230 | { | |
231 | ||
232 | } | |
233 | ||
234 | //____________________________________________________________________________ | |
235 | void AliADQADataMakerRec::InitRaws() | |
236 | { | |
237 | // Creates RAW histograms in Raws subdir | |
238 | ||
239 | const Bool_t expert = kTRUE ; | |
240 | const Bool_t saveCorr = kTRUE ; | |
241 | const Bool_t image = kTRUE ; | |
242 | ||
243 | const Int_t kNintegrator = 2; | |
244 | ||
245 | const Int_t kNTdcTimeBins = 1280; | |
246 | const Float_t kTdcTimeMin = 0.; | |
247 | const Float_t kTdcTimeMax = 75.; | |
248 | const Int_t kNTdcWidthBins = 256; | |
249 | const Float_t kTdcWidthMin = 0; | |
250 | const Float_t kTdcWidthMax = 200.; | |
251 | const Int_t kNChargeBins = 1024; | |
252 | const Float_t kChargeMin = 0; | |
253 | const Float_t kChargeMax = 1024; | |
254 | const Int_t kNChannelBins = 16; | |
255 | const Float_t kChannelMin = 0; | |
256 | const Float_t kChannelMax = 16; | |
257 | const Int_t kNPedestalBins = 200; | |
258 | const Float_t kPedestalMin = 0; | |
259 | const Float_t kPedestalMax = 200; | |
260 | ||
261 | TH2I * h2i; | |
262 | TH2F * h2d; | |
263 | TH1I * h1i; | |
264 | TH1F * h1d; | |
265 | ||
266 | int iHisto =0; | |
267 | ||
268 | // Creation of Cell Multiplicity Histograms | |
269 | h1i = new TH1I("H1I_Multiplicity_ADA", "Cell Multiplicity in ADA;# of Cells;Entries", 35, 0, 35) ; | |
270 | Add2RawsList(h1i,kMultiADA, !expert, image, saveCorr); iHisto++; | |
271 | h1i = new TH1I("H1I_Multiplicity_ADC", "Cell Multiplicity in ADC;# of Cells;Entries", 35, 0, 35) ; | |
272 | Add2RawsList(h1i,kMultiADC, !expert, image, saveCorr); iHisto++; | |
273 | ||
274 | // Creation of Total Charge Histograms | |
275 | h1d = new TH1F("H1D_Charge_ADA", "Total Charge in ADA;Charge [ADC counts];Counts", 4000, 0, 30000) ; | |
276 | Add2RawsList(h1d,kChargeADA, !expert, image, saveCorr); iHisto++; | |
277 | h1d = new TH1F("H1D_Charge_ADC", "Total Charge in ADC;Charge [ADC counts];Counts", 4000, 0, 50000) ; | |
278 | Add2RawsList(h1d,kChargeADC, !expert, image, saveCorr); iHisto++; | |
279 | h1d = new TH1F("H1D_Charge_AD", "Total Charge in AD;Charge [ADC counts];Counts", 4000, 0, 80000) ; | |
280 | Add2RawsList(h1d,kChargeAD, !expert, image, saveCorr); iHisto++; | |
281 | ||
282 | ||
283 | // Creation of Charge EoI histogram | |
284 | h2d = new TH2F("H2D_ChargeEoI", "Charge Event of Interest;Channel Number;Charge [ADC counts]" | |
285 | ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, 2.*kChargeMax); | |
286 | Add2RawsList(h2d,kChargeEoI, !expert, image, saveCorr); iHisto++; | |
287 | ||
288 | for(Int_t iInt=0;iInt<kNintegrator;iInt++){ | |
289 | // Creation of Pedestal histograms | |
290 | h2i = new TH2I(Form("H2I_Pedestal_Int%d",iInt), Form("Pedestal (Int%d);Channel;Pedestal [ADC counts]",iInt) | |
291 | ,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax ); | |
292 | Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), !expert, image, saveCorr); iHisto++; | |
293 | ||
294 | ||
295 | // Creation of Charge EoI histograms | |
296 | h2i = new TH2I(Form("H2I_ChargeEoI_Int%d",iInt), Form("Charge EoI (Int%d);Channel;Charge [ADC counts]",iInt) | |
297 | ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax); | |
298 | Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), !expert, image, saveCorr); iHisto++; | |
299 | ||
300 | } | |
301 | ||
302 | // Creation of Time histograms | |
303 | h2i = new TH2I("H2I_Width", "HPTDC Width;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax); | |
304 | Add2RawsList(h2i,kWidth, !expert, image, saveCorr); iHisto++; | |
305 | ||
306 | h2i = new TH2I("H2I_HPTDCTime", "HPTDC Time;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax); | |
307 | Add2RawsList(h2i,kHPTDCTime, !expert, image, saveCorr); iHisto++; | |
308 | ||
309 | h1d = new TH1F("H1D_ADA_Time", "ADA Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax); | |
310 | Add2RawsList(h1d,kADATime, !expert, image, saveCorr); iHisto++; | |
311 | ||
312 | h1d = new TH1F("H1D_ADC_Time", "ADC Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax); | |
313 | Add2RawsList(h1d,kADCTime, !expert, image, saveCorr); iHisto++; | |
314 | ||
315 | h1d = new TH1F("H1D_Diff_Time","Diff ADA-ADC Time;Time [ns];Counts",kNTdcTimeBins, -50., 50.); | |
316 | Add2RawsList(h1d,kDiffTime, !expert, image, saveCorr); iHisto++; | |
317 | ||
318 | h2d = new TH2F("H2D_TimeADA_ADC", "Mean Time in ADC versus ADA;Time ADA [ns];Time ADC [ns]", kNTdcTimeBins/8, kTdcTimeMin,kTdcTimeMax,kNTdcTimeBins/8, kTdcTimeMin,kTdcTimeMax) ; | |
319 | Add2RawsList(h2d,kTimeADAADC, !expert, image, saveCorr); iHisto++; | |
320 | ||
321 | ||
322 | AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto)); | |
323 | // | |
324 | ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line | |
325 | } | |
326 | ||
327 | //____________________________________________________________________________ | |
328 | void AliADQADataMakerRec::MakeRaws(AliRawReader* rawReader) | |
329 | { | |
330 | // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted) | |
331 | ||
332 | ||
333 | // Check id histograms already created for this Event Specie | |
334 | if ( ! GetRawsData(kPedestalInt0) ) | |
335 | InitRaws() ; | |
336 | ||
337 | rawReader->Reset() ; | |
338 | AliADRawStream* rawStream = new AliADRawStream(rawReader); | |
339 | if(!(rawStream->Next())) return; | |
340 | ||
341 | eventTypeType eventType = rawReader->GetType(); | |
342 | ||
343 | Int_t mulADA = 0 ; | |
344 | Int_t mulADC = 0 ; | |
345 | Double_t timeADA =0., timeADC = 0.; | |
346 | Double_t weightADA =0., weightADC = 0.; | |
347 | UInt_t itimeADA=0, itimeADC=0; | |
348 | Double_t chargeADA=0., chargeADC=0.; | |
349 | ||
350 | Double_t diffTime=-100000.; | |
351 | ||
352 | ||
353 | switch (eventType){ | |
354 | case PHYSICS_EVENT: | |
355 | ||
356 | // fNTotEvents++; // Use framework counters instead | |
357 | ||
358 | Int_t iFlag=0; | |
359 | Int_t pedestal; | |
360 | Int_t integrator; | |
361 | Bool_t flagBB[16]; | |
362 | Bool_t flagBG[16]; | |
363 | Float_t charge; | |
364 | Int_t offlineCh; | |
365 | Float_t adc[16], time[16], width[16], timeCorr[16]; | |
366 | ||
367 | for(Int_t iChannel=0; iChannel<16; iChannel++) { // BEGIN : Loop over channels | |
368 | ||
369 | offlineCh = rawStream->GetOfflineChannel(iChannel); | |
370 | ||
371 | // Fill Pedestal histograms | |
372 | ||
373 | for(Int_t j=15; j<21; j++) { | |
374 | if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++; | |
375 | } | |
376 | ||
377 | if(iFlag == 0){ //No Flag found | |
378 | for(Int_t j=15; j<21; j++){ | |
379 | pedestal= (Int_t) rawStream->GetPedestal(iChannel, j); | |
380 | integrator = rawStream->GetIntegratorFlag(iChannel, j); | |
381 | ||
382 | FillRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1),offlineCh,pedestal); | |
383 | } | |
384 | } | |
385 | ||
386 | // Fill Charge EoI histograms | |
387 | ||
388 | adc[offlineCh] = 0.0; | |
389 | ||
390 | // Search for the maximum charge in the train of 21 LHC clocks | |
391 | // regardless of the integrator which has been operated: | |
392 | Float_t maxadc = 0; | |
393 | Int_t imax = -1; | |
394 | Float_t adcPedSub[21]; | |
395 | for(Int_t iClock=0; iClock<21; iClock++){ | |
396 | Bool_t iIntegrator = rawStream->GetIntegratorFlag(iChannel,iClock); | |
397 | Int_t k = offlineCh+64*iIntegrator; | |
398 | ||
399 | //printf(Form("clock = %d adc = %f ped %f\n",iClock,rawStream->GetPedestal(iChannel,iClock),fPedestal[k])); | |
400 | ||
401 | adcPedSub[iClock] = rawStream->GetPedestal(iChannel,iClock) - fCalibData->GetPedestal(k); | |
402 | // if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) { | |
403 | if(adcPedSub[iClock] <= 2.*fCalibData->GetSigma(k)) { | |
404 | adcPedSub[iClock] = 0; | |
405 | continue; | |
406 | } | |
407 | // if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue; | |
408 | if(iClock < 8 || iClock > 12) continue; | |
409 | if(adcPedSub[iClock] > maxadc) { | |
410 | maxadc = adcPedSub[iClock]; | |
411 | imax = iClock; | |
412 | } | |
413 | } | |
414 | //printf(Form("Channel %d (online), %d (offline)\n",iChannel,j)); | |
415 | if (imax != -1) { | |
416 | // Int_t start = imax - GetRecoParam()->GetNPreClocks(); | |
417 | Int_t start = imax - 2; | |
418 | if (start < 0) start = 0; | |
419 | // Int_t end = imax + GetRecoParam()->GetNPostClocks(); | |
420 | Int_t end = imax + 1; | |
421 | if (end > 20) end = 20; | |
422 | for(Int_t iClock = start; iClock <= end; iClock++) { | |
423 | adc[offlineCh] += adcPedSub[iClock]; | |
424 | } | |
425 | } | |
426 | ||
427 | ||
428 | Int_t iClock = imax; | |
429 | charge = rawStream->GetPedestal(iChannel,iClock); // Charge at the maximum | |
430 | ||
431 | integrator = rawStream->GetIntegratorFlag(iChannel,iClock); | |
432 | flagBB[offlineCh] = rawStream->GetBBFlag(iChannel, iClock); | |
433 | flagBG[offlineCh] = rawStream->GetBGFlag(iChannel,iClock ); | |
434 | Int_t board = AliADCalibData::GetBoardNumber(offlineCh); | |
435 | time[offlineCh] = rawStream->GetTime(iChannel)*fCalibData->GetTimeResolution(board); | |
436 | width[offlineCh] = rawStream->GetWidth(iChannel)*fCalibData->GetWidthResolution(board); | |
437 | ||
438 | if (time[offlineCh] >= 1e-6) FillRawsData(kChargeEoI,offlineCh,adc[offlineCh]); | |
439 | ||
440 | FillRawsData((integrator == 0 ? kChargeEoIInt0 : kChargeEoIInt1),offlineCh,charge); | |
441 | ||
442 | Float_t sigma = fCalibData->GetSigma(offlineCh+16*integrator); | |
443 | ||
444 | if((adc[offlineCh] > 2.*sigma) && !(time[offlineCh] <1.e-6)){ | |
445 | if(offlineCh<8) { | |
446 | mulADC++; | |
447 | chargeADC += adc[offlineCh]; | |
448 | ||
449 | } else { | |
450 | mulADA++; | |
451 | chargeADA += adc[offlineCh]; | |
452 | } | |
453 | } | |
454 | ||
455 | ||
456 | // Fill HPTDC Time Histograms | |
457 | timeCorr[offlineCh] = CorrectLeadingTime(offlineCh,time[offlineCh],adc[offlineCh]); | |
458 | ||
459 | const Float_t p1 = 2.50; // photostatistics term in the time resolution | |
460 | const Float_t p2 = 3.00; // sleewing related term in the time resolution | |
461 | if(timeCorr[offlineCh]>-1024 + 1.e-6){ | |
462 | Float_t nphe = adc[offlineCh]*kChargePerADC/(fCalibData->GetGain(offlineCh)*TMath::Qe()); | |
463 | Float_t timeErr = 0; | |
464 | if (nphe>1.e-6) timeErr = TMath::Sqrt(kIntTimeRes*kIntTimeRes+ | |
465 | p1*p1/nphe+ | |
466 | p2*p2*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))* | |
467 | TMath::Power(adc[offlineCh]/fCalibData->GetCalibDiscriThr(offlineCh,kTRUE),2.*(fTimeSlewing->GetParameter(1)-1.))/ | |
468 | (fCalibData->GetCalibDiscriThr(offlineCh,kTRUE)*fCalibData->GetCalibDiscriThr(offlineCh,kTRUE))); | |
469 | ||
470 | if (timeErr>1.e-6) { | |
471 | if (offlineCh<8) { | |
472 | itimeADC++; | |
473 | timeADC += timeCorr[offlineCh]/(timeErr*timeErr); | |
474 | weightADC += 1./(timeErr*timeErr); | |
475 | }else{ | |
476 | itimeADA++; | |
477 | timeADA += timeCorr[offlineCh]/(timeErr*timeErr); | |
478 | weightADA += 1./(timeErr*timeErr); | |
479 | } | |
480 | } | |
481 | } | |
482 | FillRawsData(kHPTDCTime,offlineCh,timeCorr[offlineCh]); | |
483 | FillRawsData(kWidth,offlineCh,width[offlineCh]); | |
484 | ||
485 | }// END of Loop over channels | |
486 | ||
487 | if(weightADA>1.e-6) timeADA /= weightADA; | |
488 | else timeADA = -1024.; | |
489 | if(weightADC>1.e-6) timeADC /= weightADC; | |
490 | else timeADC = -1024.; | |
491 | if(timeADA<-1024.+1.e-6 || timeADC<-1024.+1.e-6) diffTime = -1024.; | |
492 | else diffTime = timeADA - timeADC; | |
493 | ||
494 | ||
495 | ||
496 | FillRawsData(kADATime,timeADA); | |
497 | FillRawsData(kADCTime,timeADC); | |
498 | FillRawsData(kDiffTime,diffTime); | |
499 | FillRawsData(kTimeADAADC,timeADA,timeADC); | |
500 | ||
501 | FillRawsData(kMultiADA,mulADA); | |
502 | FillRawsData(kMultiADC,mulADC); | |
503 | ||
504 | FillRawsData(kChargeADA,chargeADA); | |
505 | FillRawsData(kChargeADC,chargeADC); | |
506 | FillRawsData(kChargeAD,chargeADA + chargeADC); | |
507 | ||
508 | break; | |
509 | } // END of SWITCH : EVENT TYPE | |
510 | ||
511 | TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiADA)->GetName()))) ; | |
512 | if (p) p->SetVal((double)mulADA) ; | |
513 | ||
514 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiADC)->GetName()))) ; | |
515 | if (p) p->SetVal((double)mulADC) ; | |
516 | ||
517 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeADA)->GetName()))) ; | |
518 | if (p) p->SetVal((double)chargeADA) ; | |
519 | ||
520 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeADC)->GetName()))) ; | |
521 | if (p) p->SetVal((double)chargeADC) ; | |
522 | ||
523 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeAD)->GetName()))) ; | |
524 | if (p) p->SetVal((double)(chargeADA + chargeADC)) ; | |
525 | ||
526 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kADATime)->GetName()))) ; | |
527 | if (p) p->SetVal((double)timeADA) ; | |
528 | ||
529 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kADCTime)->GetName()))) ; | |
530 | if (p) p->SetVal((double)timeADC) ; | |
531 | ||
532 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ; | |
533 | if (p) p->SetVal((double)diffTime) ; | |
534 | ||
535 | delete rawStream; rawStream = 0x0; | |
536 | // | |
537 | IncEvCountCycleRaws(); | |
538 | IncEvCountTotalRaws(); | |
539 | // | |
540 | } | |
541 | ||
542 | //____________________________________________________________________________ | |
543 | Float_t AliADQADataMakerRec::CorrectLeadingTime(Int_t i, Float_t time, Float_t adc) const | |
544 | { | |
545 | // Correct the leading time | |
546 | // for slewing effect and | |
547 | // misalignment of the channels | |
548 | if (time < 1e-6) return -1024; | |
549 | ||
550 | // Channel alignment and general offset subtraction | |
551 | // if (i < 32) time -= kV0CDelayCables; | |
552 | // time -= fTimeOffset[i]; | |
553 | //AliInfo(Form("time-offset %f", time)); | |
554 | ||
555 | // In case of pathological signals | |
556 | if (adc < 1e-6) return time; | |
557 | ||
558 | // Slewing correction | |
559 | Float_t thr = fCalibData->GetCalibDiscriThr(i,kTRUE); | |
560 | //AliInfo(Form("adc %f thr %f dtime %f ", adc,thr,fTimeSlewing->Eval(adc/thr))); | |
561 | time -= fTimeSlewing->Eval(adc/thr); | |
562 | ||
563 | return time; | |
564 | } | |
565 |