Update RecoParam and add TimeSlewing AD CDB objects
[u/mrichter/AliRoot.git] / AD / ADrec / AliADQADataMakerRec.cxx
CommitLineData
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"
4462d42f 49#include "AliADTrending.h"
a6f3cc02 50#include "AliADCalibData.h"
e15d4621 51#include "AliADRecoParam.h"
a6f3cc02 52#include "AliCTPTimeParams.h"
53#include "event.h"
54
55ClassImp(AliADQADataMakerRec)
56
57//____________________________________________________________________________
58AliADQADataMakerRec::AliADQADataMakerRec() :
59AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kAD), "AD Quality Assurance Data Maker"),
60 fCalibData(0x0),
e15d4621 61 fRecoParam(0x0),
a6f3cc02 62 fTrendingUpdateTime(0),
63 fCycleStartTime(0),
64 fCycleStopTime(0),
65 fTimeSlewing(0)
66
67{
68 // Constructor
69
70 AliDebug(AliQAv1::GetQADebugLevel(), "Construct AD QA Object");
71
72 for(Int_t i=0; i<16; i++){
73 fEven[i] = 0;
74 fOdd[i] = 0;
75 }
76
77 for(Int_t i=0; i<32; i++){
78 fADCmean[i] = 0.0; }
79}
80
81//____________________________________________________________________________
82AliADQADataMakerRec::AliADQADataMakerRec(const AliADQADataMakerRec& qadm) :
83 AliQADataMakerRec(),
84 fCalibData(0x0),
e15d4621 85 fRecoParam(0x0),
a6f3cc02 86 fTrendingUpdateTime(0),
87 fCycleStartTime(0),
88 fCycleStopTime(0),
89 fTimeSlewing(0)
90
91{
92 // Copy constructor
93
94 SetName((const char*)qadm.GetName()) ;
95 SetTitle((const char*)qadm.GetTitle());
96}
97
98//__________________________________________________________________
99AliADQADataMakerRec& AliADQADataMakerRec::operator = (const AliADQADataMakerRec& qadm )
100{
101 // Equal operator
102
103 this->~AliADQADataMakerRec();
104 new(this) AliADQADataMakerRec(qadm);
105 return *this;
106}
107
108//____________________________________________________________________________
109AliADCalibData* AliADQADataMakerRec::GetCalibData() const
110
111{
112 AliCDBManager *man = AliCDBManager::Instance();
113
114 AliCDBEntry *entry=0;
115
734ca89d 116 entry = man->Get("AD/Calib/Data",fRun);
117 if(!entry){
118 AliWarning("Load of calibration data from default storage failed!");
119 AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
a6f3cc02 120
121 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
122 entry = man->Get("AD/Calib/Data",fRun);
734ca89d 123 }
a6f3cc02 124 // Retrieval of data in directory AD/Calib/Data:
125
126 AliADCalibData *calibdata = 0;
127
128 if (entry) calibdata = (AliADCalibData*) entry->GetObject();
129 if (!calibdata) AliFatal("No calibration data from calibration database !");
130
131 return calibdata;
132}
133//____________________________________________________________________________
134void AliADQADataMakerRec::StartOfDetectorCycle()
135{
136 // Detector specific actions at start of cycle
137
138 // Reset of the histogram used - to have the trend versus time -
139
140 fCalibData = GetCalibData();
e15d4621 141 fRecoParam = (AliADRecoParam*)GetRecoParam();
a6f3cc02 142
143 AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
144 if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
145 AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
146 Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
147
148 AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
149 if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !");
150 AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
151 l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
69e96215 152 /*/
a6f3cc02 153 AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("AD/Calib/TimeDelays");
154 if (!entry2) AliFatal("AD time delays are not found in OCDB !");
155 TH1F *delays = (TH1F*)entry2->GetObject();
e15d4621 156 /*/
a6f3cc02 157 AliCDBEntry *entry3 = AliCDBManager::Instance()->Get("AD/Calib/TimeSlewing");
158 if (!entry3) AliFatal("AD time slewing function is not found in OCDB !");
159 fTimeSlewing = (TF1*)entry3->GetObject();
e15d4621 160
a6f3cc02 161
162 for(Int_t i = 0 ; i < 16; ++i) {
163 //Int_t board = AliADCalibData::GetBoardNumber(i);
164 fTimeOffset[i] = (
165 // ((Float_t)fCalibData->GetTriggerCountOffset(board) -
166 // (Float_t)fCalibData->GetRollOver(board))*25.0 +
167 // fCalibData->GetTimeOffset(i) -
168 // l1Delay+
69e96215 169 //delays->GetBinContent(i+1)//+
734ca89d 170 // kADOffset
69e96215 171 0
a6f3cc02 172 );
734ca89d 173 // AliInfo(Form(" fTimeOffset[%d] = %f kADoffset %f",i,fTimeOffset[i],kADOffset));
a6f3cc02 174 }
175
176
177
178
179
180 TTimeStamp currentTime;
181 fCycleStartTime = currentTime.GetSec();
182
a6f3cc02 183}
184//____________________________________________________________________________
185void AliADQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
186{
187 // Detector specific actions at end of cycle
188 // Does the QA checking
189 ResetEventTrigClasses();
a6f3cc02 190
191 if(task == AliQAv1::kRAWS){
192 TTimeStamp currentTime;
193 fCycleStopTime = currentTime.GetSec();
e106c740 194
195 Int_t nCorrelation = 0;
196 Int_t nPair = 1;
197 for(Int_t i=0;i<8;i++){
198 for(Int_t j=7;j>i;j--){
199 if( (j - i) == 4){
200 Float_t Mean = ((TH1F*)GetRawsData(kNTimeDiffADC + nCorrelation))->GetMean();
201 Float_t RMS = ((TH1F*)GetRawsData(kNTimeDiffADC + nCorrelation))->GetRMS();
202 SetRawsDataBinContent(kPairTimeDiffMean,nPair,Mean);
203 SetRawsDataBinContent(kPairTimeDiffRMS,nPair,RMS);
204 nPair++;
205 }
206 nCorrelation++;
207 }
208 }
209 nCorrelation = 0;
210 for(Int_t i=0;i<8;i++){
211 for(Int_t j=7;j>i;j--){
212 if( (j - i) == 4){
213 Float_t Mean = ((TH1F*)GetRawsData(kNTimeDiffADA + nCorrelation))->GetMean();
214 Float_t RMS = ((TH1F*)GetRawsData(kNTimeDiffADA + nCorrelation))->GetRMS();
215 SetRawsDataBinContent(kPairTimeDiffMean,nPair,Mean);
216 SetRawsDataBinContent(kPairTimeDiffRMS,nPair,RMS);
217 nPair++;
218 }
219 nCorrelation++;
220 }
221 }
222
a6f3cc02 223 }
224
225 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
226 if (! IsValidEventSpecie(specie, list)) continue ;
227 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
228 if(task == AliQAv1::kRAWS) {
229 } else if (task == AliQAv1::kESDS) {
230 }
231 }
b924d21d 232 AliQAChecker::Instance()->Run(AliQAv1::kAD, task, list) ;
a6f3cc02 233}
234
235//____________________________________________________________________________
236void AliADQADataMakerRec::InitESDs()
237{
734ca89d 238 const Bool_t expert = kTRUE ;
239 const Bool_t image = kTRUE ;
b924d21d 240
241 TH1I * h0 = new TH1I("H1I_Cell_Multiplicity_ADA", "Cell Multiplicity in ADA;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;
242 Add2ESDsList(h0, kCellMultiADA, !expert, image) ;
734ca89d 243
b924d21d 244 TH1I * h1 = new TH1I("H1I_Cell_Multiplicity_ADC", "Cell Multiplicity in AD;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;
245 Add2ESDsList(h1, kCellMultiADC, !expert, image) ;
734ca89d 246
b924d21d 247 TH1F * h2 = new TH1F("H1D_BBFlag_Counters", "BB Flag Counters;Channel;Counts",16, 0, 16) ;
248 Add2ESDsList(h2, kBBFlag, !expert, image) ;
734ca89d 249
b924d21d 250 TH1F * h3 = new TH1F("H1D_BGFlag_Counters", "BG Flag Counters;Channel;Counts",16, 0, 16) ;
251 Add2ESDsList(h3, kBGFlag, !expert, image) ;
734ca89d 252
b924d21d 253 TH2F * h4 = new TH2F("H2D_Charge_Channel", "ADC Charge per channel;Channel;Charge (ADC counts)",16, 0, 16, 1024, 0, 1024) ;
254 Add2ESDsList(h4, kChargeChannel, !expert, image) ;
734ca89d 255
b924d21d 256 TH2F * h5 = new TH2F("H2D_Time_Channel", "Time per channel;Channel;Time (ns)",16, 0, 16, 400, -100, 100) ;
257 Add2ESDsList(h5, kTimeChannel, !expert, image) ;
734ca89d 258
b924d21d 259 TH1F * h6 = new TH1F("H1D_ADA_Time", "Mean ADA Time;Time (ns);Counts",1000, -100., 100.);
260 Add2ESDsList(h6,kESDADATime, !expert, image);
734ca89d 261
b924d21d 262 TH1F * h7 = new TH1F("H1D_ADC_Time", "Mean ADC Time;Time (ns);Counts",1000, -100., 100.);
263 Add2ESDsList(h7,kESDADCTime, !expert, image);
734ca89d 264
b924d21d 265 TH1F * h8 = new TH1F("H1D_Diff_Time", "Diff Time ADA - ADC;Diff Time ADA - ADC (ns);Counts",1000, -200., 200.);
266 Add2ESDsList(h8,kESDDiffTime, !expert, image);
734ca89d 267 //
268 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
a6f3cc02 269}
270
271//____________________________________________________________________________
272void AliADQADataMakerRec::InitDigits()
273{
734ca89d 274// create Digits histograms in Digits subdir
275 const Bool_t expert = kTRUE ;
276 const Bool_t image = kTRUE ;
a6f3cc02 277
734ca89d 278 // create Digits histograms in Digits subdir
279 TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in AD;# of Digits;Entries", 17,-0.5,16.5) ;
280 h0->Sumw2() ;
281 Add2DigitsList(h0, 0, !expert, image) ;
282
283 TH2D * h1 = new TH2D("hDigitLeadingTimePerPM", "Leading time distribution per PM in AD;PM number;Leading Time [ns]",16,0,16, 1000, 200, 300);
284 h1->Sumw2() ;
285 Add2DigitsList(h1, 1, !expert, image) ;
286
287 TH2D * h2 = new TH2D("hDigitTimeWidthPerPM", "Time width distribution per PM in AD;PM number;Time width [ns]",16,0,16, 1000, 0, 100);
288 h2->Sumw2() ;
289 Add2DigitsList(h2, 2, !expert, image) ;
290
291 TH2I * h3 = new TH2I("hDigitChargePerClockPerPM", "Charge array per PM in AD;PM number; Clock",16,0,16,21, -10.5, 10.5);
292 h3->Sumw2();
293 Add2DigitsList(h3, 3, !expert, image) ;
294
295 TH1I * h4 = new TH1I("hDigitBBflagsAD","Number of BB flags in AD; # of BB flags; Entries",17,-0.5,16.5);
296 h4->Sumw2();
297 Add2DigitsList(h4, 4, !expert, image) ;
298
299 TH1I * h5 = new TH1I("hDigitBBflagsADA","Number of BB flags in ADA; # of BB flags; Entries",9,-0.5,8.5);
300 h5->Sumw2();
301 Add2DigitsList(h5, 5, !expert, image) ;
302
303 TH1I * h6 = new TH1I("hDigitBBflagsADC","Number of BB flags in ADC; # of BB flags; Entries",9,-0.5,8.5);
304 h6->Sumw2();
305 Add2DigitsList(h6, 6, !expert, image) ;
306
307 TH2D * h7 = new TH2D("hDigitTotalChargePerPM", "Total Charge per PM in AD;PM number; Charge [ADC counts]",16,0,16,10000,0,10000);
308 h7->Sumw2();
309 Add2DigitsList(h7, 7, !expert, image) ;
310
311 TH2I * h8 = new TH2I("hDigitMaxChargeClockPerPM", "Clock with maximum charge per PM in AD;PM number; Clock ",16,0,16,21, -10.5, 10.5);
312 h8->Sumw2();
313 Add2DigitsList(h8, 8, !expert, image) ;
314
315 //
316 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
a6f3cc02 317}
318
319//____________________________________________________________________________
320void AliADQADataMakerRec::MakeDigits()
321{
734ca89d 322 // makes data from Digits
a6f3cc02 323
734ca89d 324 FillDigitsData(0,fDigitsArray->GetEntriesFast()) ;
325 TIter next(fDigitsArray) ;
326 AliADdigit *ADDigit ;
327 Int_t nBBflagsADA = 0;
328 Int_t nBBflagsADC = 0;
329
330 while ( (ADDigit = dynamic_cast<AliADdigit *>(next())) ) {
331 Int_t totCharge = 0;
332 Int_t PMNumber = ADDigit->PMNumber();
f4ee622e 333 if(PMNumber<8 && ADDigit->GetBBflag()) nBBflagsADC++;
334 if(PMNumber>7 && ADDigit->GetBBflag()) nBBflagsADA++;
734ca89d 335
336 Short_t adc[21];
337 for(Int_t iClock=0; iClock<21; iClock++) {
338 adc[iClock]= ADDigit->ChargeADC(iClock);
339 FillDigitsData(3, PMNumber,(float)iClock-10,(float)adc[iClock]);
340 totCharge += adc[iClock];
341 }
342
343 FillDigitsData(1,PMNumber,ADDigit->Time());
344 FillDigitsData(2,PMNumber,ADDigit->Width());
345 FillDigitsData(7,PMNumber,totCharge);
346 FillDigitsData(8,PMNumber,TMath::LocMax(21,adc)-10);
347
348 }
349 FillDigitsData(4,nBBflagsADA+nBBflagsADC);
350 FillDigitsData(5,nBBflagsADA);
351 FillDigitsData(6,nBBflagsADC);
a6f3cc02 352}
353
354//____________________________________________________________________________
734ca89d 355void AliADQADataMakerRec::MakeDigits(TTree* digitTree)
a6f3cc02 356{
734ca89d 357 // makes data from Digit Tree
358
359 if (fDigitsArray)
360 fDigitsArray->Clear() ;
361 else
362 fDigitsArray = new TClonesArray("AliADdigit", 1000) ;
363
364 TBranch * branch = digitTree->GetBranch("ADDigit") ;
365 if ( ! branch ) {
366 AliWarning("AD branch in Digit Tree not found") ;
367 } else {
368 branch->SetAddress(&fDigitsArray) ;
369 branch->GetEntry(0) ;
370 MakeDigits() ;
371 }
372 //
373 IncEvCountCycleDigits();
374 IncEvCountTotalDigits();
375 //
a6f3cc02 376}
377
378
379//____________________________________________________________________________
734ca89d 380void AliADQADataMakerRec::MakeESDs(AliESDEvent* esd)
a6f3cc02 381{
734ca89d 382// Creates QA data from ESDs
383
384 UInt_t eventType = esd->GetEventType();
385
386 switch (eventType){
387 case PHYSICS_EVENT:
388 AliESDAD *esdAD=esd->GetADData();
389
390 if (!esdAD) break;
391
392 FillESDsData(kCellMultiADA,esdAD->GetNbPMADA());
393 FillESDsData(kCellMultiADC,esdAD->GetNbPMADC());
394
395 for(Int_t i=0;i<16;i++) {
396 FillESDsData(kChargeChannel,(Float_t) i,(Float_t) esdAD->GetAdc(i));
397 if (i < 8) {
f4ee622e 398 if(esdAD->BBTriggerADC(i)) FillESDsData(kBBFlag,(Float_t) i);
399 if(esdAD->BGTriggerADC(i)) FillESDsData(kBGFlag,(Float_t) i);
734ca89d 400 }
401 else {
f4ee622e 402 if(esdAD->BBTriggerADA(i-8)) FillESDsData(kBBFlag,(Float_t) i);
403 if(esdAD->BGTriggerADA(i-8)) FillESDsData(kBGFlag,(Float_t) i);
734ca89d 404 }
405 Float_t time = (Float_t) esdAD->GetTime(i);
406 FillESDsData(kTimeChannel,(Float_t) i,time);
407 }
408
409 Float_t timeADA = esdAD->GetADATime();
410 Float_t timeADC = esdAD->GetADCTime();
411 Float_t diffTime;
412
413 if(timeADA<-1024.+1.e-6 || timeADC<-1024.+1.e-6) diffTime = -1024.;
414 else diffTime = timeADA - timeADC;
415
416 FillESDsData(kESDADATime,timeADA);
417 FillESDsData(kESDADCTime,timeADC);
418 FillESDsData(kESDDiffTime,diffTime);
419
420 break;
421 }
422 //
423 IncEvCountCycleESDs();
424 IncEvCountTotalESDs();
425 //
a6f3cc02 426}
427
428//____________________________________________________________________________
429void AliADQADataMakerRec::InitRaws()
430{
431 // Creates RAW histograms in Raws subdir
e15d4621 432 if(!fRecoParam) fRecoParam = (AliADRecoParam*)GetRecoParam();
433
a6f3cc02 434 const Bool_t expert = kTRUE ;
435 const Bool_t saveCorr = kTRUE ;
436 const Bool_t image = kTRUE ;
437
438 const Int_t kNintegrator = 2;
439
e15d4621 440 const Int_t kNTdcTimeBins = fRecoParam->GetNTdcTimeBins();
441 const Float_t kTdcTimeMin = fRecoParam->GetTdcTimeMin();
442 const Float_t kTdcTimeMax = fRecoParam->GetTdcTimeMax();
443 const Int_t kNTdcWidthBins = fRecoParam->GetNTdcWidthBins();
444 const Float_t kTdcWidthMin = fRecoParam->GetTdcWidthMin();
445 const Float_t kTdcWidthMax = fRecoParam->GetTdcWidthMax();
446 const Int_t kNChargeChannelBins = fRecoParam->GetNChargeChannelBins();
447 const Int_t kNChargeSideBins = fRecoParam->GetNChargeSideBins();
448 const Int_t kNChargeCorrBins = fRecoParam->GetNChargeCorrBins();
449
450 const Float_t kChargeChannelMin = 1;
451 const Float_t kChargeChannelMax = 1+kNChargeChannelBins;
452 const Float_t kChargeSideMin = 1;
453 const Float_t kChargeSideMax = 1+kNChargeSideBins;
454 const Float_t kChargeCorrMin = 0;
455 const Float_t kChargeCorrMax = kNChargeCorrBins;
456
457 const Int_t kNTimeCorrBins = 614;
458 const Float_t kTimeCorrMin = 70.019531;
459 const Float_t kTimeCorrMax = 129.980469;
460
461 const Int_t kNTimeDiffBins = 154;
462 const Float_t kTimeDiffMin = -15.039062;
463 const Float_t kTimeDiffMax = 15.039062;
464
a6f3cc02 465 const Int_t kNChannelBins = 16;
466 const Float_t kChannelMin = 0;
467 const Float_t kChannelMax = 16;
e15d4621 468
e106c740 469 const Int_t kNPedestalBins = 40;
a6f3cc02 470 const Float_t kPedestalMin = 0;
e106c740 471 const Float_t kPedestalMax = 40;
e15d4621 472
69e96215 473 const Int_t kNPairBins = 8;
474 const Float_t kPairMin = 0;
475 const Float_t kPairMax = 8;
e15d4621 476
a6f3cc02 477 TH2I * h2i;
478 TH2F * h2d;
479 TH1I * h1i;
480 TH1F * h1d;
481
482 int iHisto =0;
483
484 // Creation of Cell Multiplicity Histograms
69e96215 485 h1i = new TH1I("H1I_Multiplicity_ADA", "Number of fired cells in ADA;# of Cells;Entries", 10, 0, 10) ;
a6f3cc02 486 Add2RawsList(h1i,kMultiADA, !expert, image, saveCorr); iHisto++;
69e96215 487 h1i = new TH1I("H1I_Multiplicity_ADC", "Number of fired cells in ADC;# of Cells;Entries", 10, 0, 10) ;
a6f3cc02 488 Add2RawsList(h1i,kMultiADC, !expert, image, saveCorr); iHisto++;
489
490 // Creation of Total Charge Histograms
e15d4621 491 h1d = new TH1F("H1D_Charge_ADA", "Total Charge in ADA;Charge [ADC counts];Counts", kNChargeSideBins, kChargeSideMin, kChargeSideMax) ;
a6f3cc02 492 Add2RawsList(h1d,kChargeADA, !expert, image, saveCorr); iHisto++;
e15d4621 493 h1d = new TH1F("H1D_Charge_ADC", "Total Charge in ADC;Charge [ADC counts];Counts", kNChargeSideBins, kChargeSideMin, kChargeSideMax) ;
a6f3cc02 494 Add2RawsList(h1d,kChargeADC, !expert, image, saveCorr); iHisto++;
495 h1d = new TH1F("H1D_Charge_AD", "Total Charge in AD;Charge [ADC counts];Counts", 4000, 0, 80000) ;
496 Add2RawsList(h1d,kChargeAD, !expert, image, saveCorr); iHisto++;
497
498
499 // Creation of Charge EoI histogram
500 h2d = new TH2F("H2D_ChargeEoI", "Charge Event of Interest;Channel Number;Charge [ADC counts]"
e15d4621 501 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeChannelBins, kChargeChannelMin, kChargeChannelMax);
a6f3cc02 502 Add2RawsList(h2d,kChargeEoI, !expert, image, saveCorr); iHisto++;
503
504 for(Int_t iInt=0;iInt<kNintegrator;iInt++){
505 // Creation of Pedestal histograms
506 h2i = new TH2I(Form("H2I_Pedestal_Int%d",iInt), Form("Pedestal (Int%d);Channel;Pedestal [ADC counts]",iInt)
507 ,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
508 Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), !expert, image, saveCorr); iHisto++;
e106c740 509
510 h2d = new TH2F(Form("H2D_PedestalDiff_Int%d",iInt), Form("Pedestal difference Online - OCDB (Int%d);Channel; Pedestal Online - OCDB",iInt)
511 ,kNChannelBins, kChannelMin, kChannelMax,81,-40.5,40.5);
512 Add2RawsList(h2d,(iInt == 0 ? kPedestalDiffInt0 : kPedestalDiffInt1), !expert, image, saveCorr); iHisto++;
a6f3cc02 513
514
515 // Creation of Charge EoI histograms
516 h2i = new TH2I(Form("H2I_ChargeEoI_Int%d",iInt), Form("Charge EoI (Int%d);Channel;Charge [ADC counts]",iInt)
e15d4621 517 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeChannelBins, kChargeChannelMin, kChargeChannelMax);
a6f3cc02 518 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), !expert, image, saveCorr); iHisto++;
519
520 }
521
522 // Creation of Time histograms
523 h2i = new TH2I("H2I_Width", "HPTDC Width;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
524 Add2RawsList(h2i,kWidth, !expert, image, saveCorr); iHisto++;
cf283524 525
526 h2i = new TH2I("H2I_Width_BB", "HPTDC Width w/ BB Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
527 Add2RawsList(h2i,kWidthBB, !expert, image, saveCorr); iHisto++;
528
529 h2i = new TH2I("H2I_Width_BG", "HPTDC Width w/ BG Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
530 Add2RawsList(h2i,kWidthBG, !expert, image, saveCorr); iHisto++;
a6f3cc02 531
532 h2i = new TH2I("H2I_HPTDCTime", "HPTDC Time;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
533 Add2RawsList(h2i,kHPTDCTime, !expert, image, saveCorr); iHisto++;
cf283524 534
535 h2i = new TH2I("H2I_HPTDCTime_BB", "HPTDC Time w/ BB Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
536 Add2RawsList(h2i,kHPTDCTimeBB, !expert, image, !saveCorr); iHisto++;
537
538 h2i = new TH2I("H2I_HPTDCTime_BG", "HPTDC Time w/ BG Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
539 Add2RawsList(h2i,kHPTDCTimeBG, !expert, image, !saveCorr); iHisto++;
a6f3cc02 540
541 h1d = new TH1F("H1D_ADA_Time", "ADA Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
542 Add2RawsList(h1d,kADATime, !expert, image, saveCorr); iHisto++;
543
544 h1d = new TH1F("H1D_ADC_Time", "ADC Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
545 Add2RawsList(h1d,kADCTime, !expert, image, saveCorr); iHisto++;
546
e15d4621 547 h1d = new TH1F("H1D_Diff_Time","Diff ADA-ADC Time;Time [ns];Counts",kNTimeDiffBins,kTimeDiffMin,kTimeDiffMax);
a6f3cc02 548 Add2RawsList(h1d,kDiffTime, !expert, image, saveCorr); iHisto++;
549
550 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) ;
551 Add2RawsList(h2d,kTimeADAADC, !expert, image, saveCorr); iHisto++;
552
e15d4621 553 h2d = new TH2F("H2D_TimeSlewingOff", "Time Vs Charge (no slewing correction);Leading Time[ns];Charge [ADC counts]", kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax, kNChargeCorrBins, kChargeCorrMin, kChargeCorrMax) ;
e106c740 554 Add2RawsList(h2d,kTimeSlewingOff, !expert, image, saveCorr); iHisto++;
555
e15d4621 556 h2d = new TH2F("H2D_TimeSlewingOn", "Time Vs Charge (after slewing correction);Leading Time[ns];Charge [ADC counts]", kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax, kNChargeCorrBins, kChargeCorrMin, kChargeCorrMax) ;
e106c740 557 Add2RawsList(h2d,kTimeSlewingOn, !expert, image, saveCorr); iHisto++;
558
e15d4621 559 h2d = new TH2F("H2D_WidthSlewing", "Width Vs Charge ;Time Width [ns];Charge [ADC counts]", kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax, kNChargeCorrBins, kChargeCorrMin, kChargeCorrMax) ;
e106c740 560 Add2RawsList(h2d,kWidthSlewing, !expert, image, saveCorr); iHisto++;
561
69e96215 562 //Creation of pair coincidence histograms
e106c740 563 h1i = new TH1I("H1I_MultiCoincidence_ADA", "Number of coincidences in ADA;# of Coincidences;Entries", 5, -0.5, 4.5) ;
69e96215 564 Add2RawsList(h1i,kNCoincADA, !expert, image, saveCorr); iHisto++;
e106c740 565 h1i = new TH1I("H1I_MultiCoincidence_ADC", "Number of coincidences in ADC;# of Coincidences;Entries", 5, -0.5, 4.5) ;
69e96215 566 Add2RawsList(h1i,kNCoincADC, !expert, image, saveCorr); iHisto++;
567
e106c740 568 h1d = new TH1F("H1D_Pair_TimeDiffMean","Time difference mean for coincidence pair [ns];Pair number;Time mean [ns]",kNPairBins, kPairMin, kPairMax);
569 Add2RawsList(h1d,kPairTimeDiffMean, expert, image, saveCorr); iHisto++;
b8cf9c79 570
e106c740 571 h1d = new TH1F("H1D_Pair_TimeDiffRMS","Time difference RMS for coincidence pair [ns];Pair number;Time RMS [ns]",kNPairBins, kPairMin, kPairMax);
572 Add2RawsList(h1d,kPairTimeDiffRMS, expert, image, saveCorr); iHisto++;
a6f3cc02 573
cf283524 574 //Creation of Clock histograms
575 h2d = new TH2F("H2D_BBFlagVsClock", "BB-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
576 Add2RawsList(h2d,kBBFlagVsClock, !expert, image, saveCorr); iHisto++;
577
578 h2d = new TH2F("H2D_BGFlagVsClock", "BG-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
579 Add2RawsList(h2d,kBGFlagVsClock, !expert, image, saveCorr); iHisto++;
580
581 for(Int_t iInt=0;iInt<kNintegrator;iInt++){
582 h2d = new TH2F(Form("H2D_ChargeVsClock_Int%d",iInt), Form("Charge Versus LHC-Clock (Int%d);Channel;LHCClock;Charge [ADC counts]",iInt),kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
4462d42f 583 Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), !expert, image, saveCorr); iHisto++;
cf283524 584 }
585
78c1b015 586 h2d = new TH2F("H2D_BBFlagPerChannel", "BB-Flags Versus Channel;Channel;BB Flags Count",kNChannelBins, kChannelMin, kChannelMax,22,-0.5,21.5);
95930403 587 Add2RawsList(h2d,kBBFlagsPerChannel, !expert, image, saveCorr); iHisto++;
588
589 h2d = new TH2F("H2D_BGFlagPerChannel", "BG-Flags Versus Channel;Channel;BG Flags Count",kNChannelBins, kChannelMin, kChannelMax,22,-0.5,21.5);
590 Add2RawsList(h2d,kBGFlagsPerChannel, !expert, image, saveCorr); iHisto++;
69e96215 591
e106c740 592 h1d = new TH1F("H1D_FlagNoTime", "Fraction of events with BB/BG flag but no time measurement;Channel;Entries",kNChannelBins, kChannelMin, kChannelMax);
593 Add2RawsList(h1d,kFlagNoTime, expert, image, saveCorr); iHisto++;
594
595 h1d = new TH1F("H1D_TimeNoFlag", "Fraction of events with time measurement but no BB/BG flag;Channel;Entries",kNChannelBins, kChannelMin, kChannelMax);
596 Add2RawsList(h1d,kTimeNoFlag, expert, image, saveCorr); iHisto++;
597
598 //Correlation histograms
599 Int_t nCorrelation = 0;
600 for(Int_t i=0;i<8;i++){
601 for(Int_t j=7;j>i;j--){
e15d4621 602 h2d = new TH2F(Form("ChargeCorr/H2D_kNChargeCorrADA_%d_%d",i,j),Form("Charge Correlation ADA module%d - module%d",i,j),kNChargeCorrBins, kChargeCorrMin, kChargeCorrMax,kNChargeCorrBins, kChargeCorrMin, kChargeCorrMax);
e106c740 603 Add2RawsList(h2d,kNChargeCorrADA+nCorrelation, expert, image, saveCorr); iHisto++; nCorrelation++;
604 }
605 }
606 nCorrelation = 0;
607 for(Int_t i=0;i<8;i++){
608 for(Int_t j=7;j>i;j--){
e15d4621 609 h2d = new TH2F(Form("ChargeCorr/H2D_kNChargeCorrADC_%d_%d",i,j),Form("Charge Correlation ADC module%d - module%d",i,j),kNChargeCorrBins, kChargeCorrMin, kChargeCorrMax,kNChargeCorrBins, kChargeCorrMin, kChargeCorrMax);
e106c740 610 Add2RawsList(h2d,kNChargeCorrADC+nCorrelation, expert, image, saveCorr); iHisto++; nCorrelation++;
611 }
612 }
613 nCorrelation = 0;
614 for(Int_t i=0;i<8;i++){
615 for(Int_t j=7;j>i;j--){
616 h2d = new TH2F(Form("TimeCorr/H2D_kNTimeCorrADA_%d_%d",i,j),Form("Time Correlation ADA module%d - module%d",i,j),kNTimeCorrBins,kTimeCorrMin,kTimeCorrMax,kNTimeCorrBins,kTimeCorrMin,kTimeCorrMax);
617 Add2RawsList(h2d,kNTimeCorrADA+nCorrelation, expert, image, saveCorr); iHisto++; nCorrelation++;
618 }
619 }
620 nCorrelation = 0;
621 for(Int_t i=0;i<8;i++){
622 for(Int_t j=7;j>i;j--){
623 h2d = new TH2F(Form("TimeCorr/H2D_kNTimeCorrADC_%d_%d",i,j),Form("Time Correlation ADC module%d - module%d",i,j),kNTimeCorrBins,kTimeCorrMin,kTimeCorrMax,kNTimeCorrBins,kTimeCorrMin,kTimeCorrMax);
624 Add2RawsList(h2d,kNTimeCorrADC+nCorrelation, expert, image, saveCorr); iHisto++; nCorrelation++;
625 }
626 }
627 nCorrelation = 0;
628 for(Int_t i=0;i<8;i++){
629 for(Int_t j=7;j>i;j--){
630 h1d = new TH1F(Form("TimeDiff/H1D_kNTimeDiffADA_%d_%d",i,j),Form("Time Difference ADA module%d - module%d",i,j),kNTimeDiffBins,kTimeDiffMin,kTimeDiffMax);
631 Add2RawsList(h1d,kNTimeDiffADA+nCorrelation, expert, image, saveCorr); iHisto++; nCorrelation++;
632 }
633 }
634 nCorrelation = 0;
635 for(Int_t i=0;i<8;i++){
636 for(Int_t j=7;j>i;j--){
637 h1d = new TH1F(Form("TimeDiff/H1D_kNTimeDiffADC_%d_%d",i,j),Form("Time Difference ADC module%d - module%d",i,j),kNTimeDiffBins,kTimeDiffMin,kTimeDiffMax);
638 Add2RawsList(h1d,kNTimeDiffADC+nCorrelation, expert, image, saveCorr); iHisto++; nCorrelation++;
639 }
640 }
641
a6f3cc02 642 AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto));
643 //
644 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
645}
646
647//____________________________________________________________________________
648void AliADQADataMakerRec::MakeRaws(AliRawReader* rawReader)
649{
650 // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
651
652
653 // Check id histograms already created for this Event Specie
654 if ( ! GetRawsData(kPedestalInt0) )
655 InitRaws() ;
656
657 rawReader->Reset() ;
658 AliADRawStream* rawStream = new AliADRawStream(rawReader);
659 if(!(rawStream->Next())) return;
660
661 eventTypeType eventType = rawReader->GetType();
662
663 Int_t mulADA = 0 ;
664 Int_t mulADC = 0 ;
665 Double_t timeADA =0., timeADC = 0.;
666 Double_t weightADA =0., weightADC = 0.;
667 UInt_t itimeADA=0, itimeADC=0;
668 Double_t chargeADA=0., chargeADC=0.;
669
670 Double_t diffTime=-100000.;
69e96215 671
672 Int_t pmulADA = 0;
673 Int_t pmulADC = 0;
674 Double_t pDiffTime =-100000.;
a6f3cc02 675
676
677 switch (eventType){
678 case PHYSICS_EVENT:
679
680 // fNTotEvents++; // Use framework counters instead
681
682 Int_t iFlag=0;
683 Int_t pedestal;
e106c740 684 Float_t OCDBdiff;
69e96215 685 Int_t integrator[16];
a6f3cc02 686 Bool_t flagBB[16];
687 Bool_t flagBG[16];
688 Float_t charge;
689 Int_t offlineCh;
690 Float_t adc[16], time[16], width[16], timeCorr[16];
69e96215 691 Int_t iPair=0;
a6f3cc02 692
693 for(Int_t iChannel=0; iChannel<16; iChannel++) { // BEGIN : Loop over channels
694
f008f2e5 695 offlineCh = kOfflineChannel[iChannel];
a6f3cc02 696
697 // Fill Pedestal histograms
698
699 for(Int_t j=15; j<21; j++) {
700 if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++;
701 }
702
703 if(iFlag == 0){ //No Flag found
704 for(Int_t j=15; j<21; j++){
705 pedestal= (Int_t) rawStream->GetPedestal(iChannel, j);
69e96215 706 integrator[offlineCh] = rawStream->GetIntegratorFlag(iChannel, j);
e106c740 707 OCDBdiff = pedestal - fCalibData->GetPedestal(offlineCh+16*integrator[offlineCh]);
a6f3cc02 708
69e96215 709 FillRawsData((integrator[offlineCh] == 0 ? kPedestalInt0 : kPedestalInt1),offlineCh,pedestal);
e106c740 710 FillRawsData((integrator[offlineCh] == 0 ? kPedestalDiffInt0 : kPedestalDiffInt1),offlineCh,OCDBdiff);
a6f3cc02 711 }
712 }
a6f3cc02 713 // Fill Charge EoI histograms
714
715 adc[offlineCh] = 0.0;
a6f3cc02 716 // Search for the maximum charge in the train of 21 LHC clocks
717 // regardless of the integrator which has been operated:
718 Float_t maxadc = 0;
719 Int_t imax = -1;
720 Float_t adcPedSub[21];
721 for(Int_t iClock=0; iClock<21; iClock++){
722 Bool_t iIntegrator = rawStream->GetIntegratorFlag(iChannel,iClock);
69e96215 723 Int_t k = offlineCh+16*iIntegrator;
a6f3cc02 724
a6f3cc02 725 adcPedSub[iClock] = rawStream->GetPedestal(iChannel,iClock) - fCalibData->GetPedestal(k);
e15d4621 726 if(adcPedSub[iClock] <= fRecoParam->GetNSigmaPed()*fCalibData->GetSigma(k)) {
a6f3cc02 727 adcPedSub[iClock] = 0;
728 continue;
729 }
e15d4621 730
731 if(iClock < fRecoParam->GetStartClock() || iClock > fRecoParam->GetEndClock()) continue;
a6f3cc02 732 if(adcPedSub[iClock] > maxadc) {
733 maxadc = adcPedSub[iClock];
734 imax = iClock;
735 }
736 }
737 //printf(Form("Channel %d (online), %d (offline)\n",iChannel,j));
738 if (imax != -1) {
e15d4621 739 Int_t start = imax - fRecoParam->GetNPreClocks();
a6f3cc02 740 if (start < 0) start = 0;
e15d4621 741 Int_t end = imax + fRecoParam->GetNPostClocks();
a6f3cc02 742 if (end > 20) end = 20;
743 for(Int_t iClock = start; iClock <= end; iClock++) {
744 adc[offlineCh] += adcPedSub[iClock];
745 }
746 }
747
748
749 Int_t iClock = imax;
750 charge = rawStream->GetPedestal(iChannel,iClock); // Charge at the maximum
751
69e96215 752 integrator[offlineCh] = rawStream->GetIntegratorFlag(iChannel,iClock);
a6f3cc02 753 flagBB[offlineCh] = rawStream->GetBBFlag(iChannel, iClock);
754 flagBG[offlineCh] = rawStream->GetBGFlag(iChannel,iClock );
755 Int_t board = AliADCalibData::GetBoardNumber(offlineCh);
756 time[offlineCh] = rawStream->GetTime(iChannel)*fCalibData->GetTimeResolution(board);
757 width[offlineCh] = rawStream->GetWidth(iChannel)*fCalibData->GetWidthResolution(board);
758
759 if (time[offlineCh] >= 1e-6) FillRawsData(kChargeEoI,offlineCh,adc[offlineCh]);
760
69e96215 761 FillRawsData((integrator[offlineCh] == 0 ? kChargeEoIInt0 : kChargeEoIInt1),offlineCh,charge);
a6f3cc02 762
69e96215 763 Float_t sigma = fCalibData->GetSigma(offlineCh+16*integrator[offlineCh]);
a6f3cc02 764
765 if((adc[offlineCh] > 2.*sigma) && !(time[offlineCh] <1.e-6)){
766 if(offlineCh<8) {
767 mulADC++;
768 chargeADC += adc[offlineCh];
769
770 } else {
771 mulADA++;
772 chargeADA += adc[offlineCh];
773 }
774 }
775
776
777 // Fill HPTDC Time Histograms
e15d4621 778 timeCorr[offlineCh] = CorrectLeadingTime(offlineCh,time[offlineCh],adc[offlineCh]);
779 //timeCorr[offlineCh] = time[offlineCh];
a6f3cc02 780
fcb6ff8b 781 //const Float_t p1 = 2.50; // photostatistics term in the time resolution
782 //const Float_t p2 = 3.00; // sleewing related term in the time resolution
a6f3cc02 783 if(timeCorr[offlineCh]>-1024 + 1.e-6){
fcb6ff8b 784 //Float_t nphe = adc[offlineCh]*kChargePerADC/(fCalibData->GetGain(offlineCh)*TMath::Qe());
69e96215 785 Float_t timeErr = 1;
786 /*/
a6f3cc02 787 if (nphe>1.e-6) timeErr = TMath::Sqrt(kIntTimeRes*kIntTimeRes+
788 p1*p1/nphe+
789 p2*p2*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*
790 TMath::Power(adc[offlineCh]/fCalibData->GetCalibDiscriThr(offlineCh,kTRUE),2.*(fTimeSlewing->GetParameter(1)-1.))/
69e96215 791 (fCalibData->GetCalibDiscriThr(offlineCh,kTRUE)*fCalibData->GetCalibDiscriThr(offlineCh,kTRUE)));/*/
a6f3cc02 792
793 if (timeErr>1.e-6) {
794 if (offlineCh<8) {
795 itimeADC++;
796 timeADC += timeCorr[offlineCh]/(timeErr*timeErr);
797 weightADC += 1./(timeErr*timeErr);
798 }else{
799 itimeADA++;
800 timeADA += timeCorr[offlineCh]/(timeErr*timeErr);
801 weightADA += 1./(timeErr*timeErr);
802 }
803 }
804 }
cf283524 805
95930403 806 // Fill Flag and Charge Versus LHC-Clock histograms
78c1b015 807 Int_t nbbFlag = 0;
95930403 808 Int_t nbgFlag = 0;
78c1b015 809
cf283524 810 for(Int_t iEvent=0; iEvent<21; iEvent++){
811 charge = rawStream->GetPedestal(iChannel,iEvent);
812 Int_t intgr = rawStream->GetIntegratorFlag(iChannel,iEvent);
813 Bool_t bbFlag = rawStream->GetBBFlag(iChannel, iEvent);
814 Bool_t bgFlag = rawStream->GetBGFlag(iChannel,iEvent );
78c1b015 815 if(bbFlag) nbbFlag++;
95930403 816 if(bgFlag) nbgFlag++;
78c1b015 817
cf283524 818 FillRawsData((intgr == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), offlineCh,(float)iEvent-10,(float)charge);
819 FillRawsData(kBBFlagVsClock, offlineCh,(float)iEvent-10,(float)bbFlag);
820 FillRawsData(kBGFlagVsClock, offlineCh,(float)iEvent-10,(float)bgFlag);
78c1b015 821
cf283524 822 }
78c1b015 823 FillRawsData(kBBFlagsPerChannel, offlineCh,nbbFlag);
95930403 824 FillRawsData(kBGFlagsPerChannel, offlineCh,nbgFlag);
e106c740 825 if((nbbFlag+nbgFlag)>0 && time[offlineCh]<1e-6)FillRawsData(kFlagNoTime,offlineCh);
826 if((nbbFlag+nbgFlag)==0 && time[offlineCh]>1e-6)FillRawsData(kTimeNoFlag,offlineCh);
827
828 FillRawsData(kTimeSlewingOff,time[offlineCh],adc[offlineCh]);
829 FillRawsData(kTimeSlewingOn,timeCorr[offlineCh],adc[offlineCh]);
830 FillRawsData(kWidthSlewing,width[offlineCh],adc[offlineCh]);
95930403 831
832 FillRawsData(kHPTDCTime,offlineCh,timeCorr[offlineCh]);
833 FillRawsData(kWidth,offlineCh,width[offlineCh]);
834 //if(flagBB[offlineCh]) {
835 if(nbbFlag > 0){
836 FillRawsData(kHPTDCTimeBB,offlineCh,timeCorr[offlineCh]);
837 FillRawsData(kWidthBB,offlineCh,width[offlineCh]);
838 }
839 //if(flagBG[offlineCh]) {
840 if(nbgFlag > 0){
841 FillRawsData(kHPTDCTimeBG,offlineCh,timeCorr[offlineCh]);
842 FillRawsData(kWidthBG,offlineCh,width[offlineCh]);
843 }
844
a6f3cc02 845
846 }// END of Loop over channels
69e96215 847
e106c740 848 //Correlation Cside
849 Int_t nCorrelation = 0;
850 for(Int_t iChannel=0; iChannel<8; iChannel++) {
851 for(Int_t jChannel=7; jChannel>iChannel; jChannel--) {
852 FillRawsData(kNChargeCorrADC+nCorrelation,adc[iChannel],adc[jChannel]);
853 FillRawsData(kNTimeCorrADC+nCorrelation,time[iChannel],time[jChannel]);
854 if(time[iChannel]>1e-6 && time[jChannel]>1e-6) FillRawsData(kNTimeDiffADC+nCorrelation,time[iChannel]-time[jChannel]);
855 nCorrelation++;
69e96215 856 }
857 }
e106c740 858 //Correlation Aside
859 nCorrelation = 0;
860 for(Int_t iChannel=8; iChannel<16; iChannel++) {
861 for(Int_t jChannel=15; jChannel>iChannel; jChannel--) {
862 FillRawsData(kNChargeCorrADA+nCorrelation,adc[iChannel],adc[jChannel]);
863 FillRawsData(kNTimeCorrADA+nCorrelation,time[iChannel],time[jChannel]);
e106c740 864 if(time[iChannel]>1e-6 && time[jChannel]>1e-6) FillRawsData(kNTimeDiffADA+nCorrelation,time[iChannel]-time[jChannel]);
865 nCorrelation++;
b8cf9c79 866 }
e106c740 867 }
868
869 for(Int_t iChannel=0; iChannel<4; iChannel++) {//Loop over pairs
870 if(flagBB[iChannel] && flagBB[iChannel+4]) pmulADC++;
871 if(flagBB[iChannel+8] && flagBB[iChannel+12]) pmulADA++;
872 }
69e96215 873 FillRawsData(kNCoincADA,pmulADA);
874 FillRawsData(kNCoincADC,pmulADC);
875
876
a6f3cc02 877 if(weightADA>1.e-6) timeADA /= weightADA;
878 else timeADA = -1024.;
879 if(weightADC>1.e-6) timeADC /= weightADC;
880 else timeADC = -1024.;
881 if(timeADA<-1024.+1.e-6 || timeADC<-1024.+1.e-6) diffTime = -1024.;
882 else diffTime = timeADA - timeADC;
883
884
885
886 FillRawsData(kADATime,timeADA);
887 FillRawsData(kADCTime,timeADC);
888 FillRawsData(kDiffTime,diffTime);
889 FillRawsData(kTimeADAADC,timeADA,timeADC);
890
891 FillRawsData(kMultiADA,mulADA);
892 FillRawsData(kMultiADC,mulADC);
893
894 FillRawsData(kChargeADA,chargeADA);
895 FillRawsData(kChargeADC,chargeADC);
896 FillRawsData(kChargeAD,chargeADA + chargeADC);
897
898 break;
899 } // END of SWITCH : EVENT TYPE
900
901 TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiADA)->GetName()))) ;
902 if (p) p->SetVal((double)mulADA) ;
903
904 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiADC)->GetName()))) ;
905 if (p) p->SetVal((double)mulADC) ;
906
907 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeADA)->GetName()))) ;
908 if (p) p->SetVal((double)chargeADA) ;
909
910 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeADC)->GetName()))) ;
911 if (p) p->SetVal((double)chargeADC) ;
912
913 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeAD)->GetName()))) ;
914 if (p) p->SetVal((double)(chargeADA + chargeADC)) ;
915
916 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kADATime)->GetName()))) ;
917 if (p) p->SetVal((double)timeADA) ;
918
919 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kADCTime)->GetName()))) ;
920 if (p) p->SetVal((double)timeADC) ;
921
922 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ;
923 if (p) p->SetVal((double)diffTime) ;
924
925 delete rawStream; rawStream = 0x0;
926 //
927 IncEvCountCycleRaws();
928 IncEvCountTotalRaws();
929 //
930}
931
932//____________________________________________________________________________
e15d4621 933Float_t AliADQADataMakerRec::CorrectLeadingTime(Int_t /*i*/, Float_t time, Float_t adc) const
a6f3cc02 934{
935 // Correct the leading time
936 // for slewing effect and
937 // misalignment of the channels
938 if (time < 1e-6) return -1024;
939
940 // Channel alignment and general offset subtraction
a6f3cc02 941 // time -= fTimeOffset[i];
942 //AliInfo(Form("time-offset %f", time));
943
944 // In case of pathological signals
69e96215 945 //if (adc < 1e-6) return time;
a6f3cc02 946
947 // Slewing correction
69e96215 948 //Float_t thr = fCalibData->GetCalibDiscriThr(i,kTRUE);
a6f3cc02 949 //AliInfo(Form("adc %f thr %f dtime %f ", adc,thr,fTimeSlewing->Eval(adc/thr)));
e15d4621 950 time -= fTimeSlewing->Eval(adc);
a6f3cc02 951
952 return time;
953}
954