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