LCOV - code coverage report
Current view: top level - AD/ADrec - AliADQADataMakerRec.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 683 0.1 %
Date: 2016-06-14 17:26:59 Functions: 1 18 5.6 %

          Line data    Source code
       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             : #include <TPaveText.h>
      34             : 
      35             : // --- Standard library ---
      36             : 
      37             : // --- AliRoot header files ---
      38             : #include "AliESDEvent.h"
      39             : #include "AliLog.h"
      40             : #include "AliCDBManager.h"
      41             : #include "AliCDBStorage.h"
      42             : #include "AliCDBEntry.h"
      43             : #include "AliADQADataMakerRec.h"
      44             : #include "AliQAChecker.h"
      45             : #include "AliRawReader.h"
      46             : #include "AliADRawStream.h"
      47             : #include "AliADdigit.h"
      48             : #include "AliADConst.h"
      49             : #include "AliADReconstructor.h"
      50             : #include "AliADTrending.h"
      51             : #include "AliADCalibData.h"
      52             : #include "AliADRecoParam.h"
      53             : #include "AliADQAParam.h"
      54             : #include "AliCTPTimeParams.h"
      55             : #include "AliLHCClockPhase.h"
      56             : #include "event.h"
      57             : 
      58          16 : ClassImp(AliADQADataMakerRec)
      59             :            
      60             : //____________________________________________________________________________ 
      61             : AliADQADataMakerRec::AliADQADataMakerRec() : 
      62           0 : AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kAD), "AD Quality Assurance Data Maker"),
      63           0 :   fCalibData(0x0),
      64           0 :   fRecoParam(0x0),
      65           0 :   fQAParam(0x0),
      66           0 :   fTrendingUpdateTime(0), 
      67           0 :   fCycleStartTime(0), 
      68           0 :   fCycleStopTime(0),
      69           0 :   fADADist(56.7),
      70           0 :   fADCDist(65.19),
      71           0 :   fOldRun(0)
      72             :     
      73           0 : {
      74             :   // Constructor
      75             :    
      76           0 :   AliDebug(AliQAv1::GetQADebugLevel(), "Construct AD QA Object");
      77             : 
      78           0 :   for(Int_t i=0; i<16; i++){  
      79           0 :     fEven[i] = 0;   
      80           0 :     fOdd[i]  = 0;
      81             :   }
      82             :   
      83           0 :   for(Int_t i=0; i<32; i++){  
      84           0 :     fADCmean[i] = 0.0;   }      
      85           0 : }
      86             : 
      87             : //____________________________________________________________________________ 
      88             : AliADQADataMakerRec::AliADQADataMakerRec(const AliADQADataMakerRec& qadm) :
      89           0 :   AliQADataMakerRec(),
      90           0 :   fCalibData(0x0),
      91           0 :   fRecoParam(0x0),
      92           0 :   fQAParam(0x0),
      93           0 :   fTrendingUpdateTime(0), 
      94           0 :   fCycleStartTime(0), 
      95           0 :   fCycleStopTime(0),
      96           0 :   fADADist(56.7),
      97           0 :   fADCDist(65.19),
      98           0 :   fOldRun(0)
      99             :   
     100           0 : {
     101             :   // Copy constructor 
     102             :   
     103           0 :   SetName((const char*)qadm.GetName()) ; 
     104           0 :   SetTitle((const char*)qadm.GetTitle()); 
     105           0 : }
     106             : 
     107             : //__________________________________________________________________
     108             : AliADQADataMakerRec& AliADQADataMakerRec::operator = (const AliADQADataMakerRec& qadm )
     109             : {
     110             :   // Equal operator
     111             :   
     112           0 :   this->~AliADQADataMakerRec();
     113           0 :   new(this) AliADQADataMakerRec(qadm);
     114           0 :   return *this;
     115           0 : }
     116             : 
     117             : //____________________________________________________________________________
     118             : AliADCalibData* AliADQADataMakerRec::GetCalibData() const
     119             : 
     120             : {
     121           0 :   AliCDBManager *man = AliCDBManager::Instance();
     122             : 
     123             :   AliCDBEntry *entry=0;
     124             : 
     125           0 :   entry = man->Get("AD/Calib/Data",fRun);
     126           0 :   if(!entry){
     127           0 :     AliWarning("Load of calibration data from default storage failed!");
     128           0 :     AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
     129             :         
     130           0 :     man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
     131           0 :     entry = man->Get("AD/Calib/Data",fRun);
     132           0 :   }
     133             :   // Retrieval of data in directory AD/Calib/Data:
     134             : 
     135             :   AliADCalibData *calibdata = 0;
     136             : 
     137           0 :   if (entry) calibdata = (AliADCalibData*) entry->GetObject();
     138           0 :   if (!calibdata)  AliFatal("No calibration data from calibration database !");
     139             : 
     140           0 :   return calibdata;
     141           0 : }
     142             : //____________________________________________________________________________
     143             : AliADQAParam* AliADQADataMakerRec::GetQAParam() const
     144             : 
     145             : {
     146           0 :   AliCDBManager *man = AliCDBManager::Instance();
     147             : 
     148             :   AliCDBEntry *entry=0;
     149             : 
     150           0 :   entry = man->Get("AD/Calib/QAParam",fRun);
     151           0 :   if(!entry){
     152           0 :     AliWarning("Load of QA param from default storage failed!");
     153           0 :     AliWarning("QA parameters will be loaded from local storage ($ALICE_ROOT)");
     154             :         
     155           0 :     man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
     156           0 :     entry = man->Get("AD/Calib/QAParam",fRun);
     157           0 :   }
     158             :   // Retrieval of data in directory AD/Calib/QA:
     159             : 
     160             :   AliADQAParam *QAParam = 0;
     161             : 
     162           0 :   if (entry) QAParam = (AliADQAParam*) entry->GetObject();
     163           0 :   if (!QAParam)  AliFatal("No QA param from calibration database !");
     164             : 
     165           0 :   return QAParam;
     166           0 : }
     167             : //____________________________________________________________________________ 
     168             : void AliADQADataMakerRec::StartOfDetectorCycle()
     169             : {
     170             :   // Detector specific actions at start of cycle
     171             :   
     172             :   // Reset of the histogram used - to have the trend versus time -
     173             :  
     174           0 :   fCalibData = GetCalibData();
     175           0 :   fQAParam = GetQAParam();
     176           0 :   if(!fRecoParam)fRecoParam = (AliADRecoParam*)GetRecoParam();
     177             :         
     178           0 :   TTimeStamp currentTime;
     179           0 :   fCycleStartTime = currentTime.GetSec();
     180             :  
     181           0 : }
     182             : //____________________________________________________________________________ 
     183             : void AliADQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
     184             : {
     185             :   // Detector specific actions at end of cycle
     186             :   // Does the QA checking
     187           0 :   ResetEventTrigClasses();
     188             :   
     189           0 :   if(task == AliQAv1::kRAWS){
     190           0 :     TDatime currentTime;
     191           0 :     fCycleStopTime = currentTime.GetSecond();
     192             :     
     193           0 :     if (fRun!=fOldRun){
     194           0 :     ((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADA))->SetBins(1,0,1);
     195           0 :     ((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADC))->SetBins(1,0,1);
     196           0 :     fOldRun=fRun;
     197           0 :     }
     198             :     
     199           0 :     Double_t xq[1] = {0.9};
     200           0 :     Double_t yq[1];
     201           0 :     UInt_t currentBins = ((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADC))->GetNbinsX();
     202             :     
     203           0 :     ((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADC))->SetBins(currentBins+1,0,currentBins+1);
     204           0 :     ((TH1F*)GetRawsData(kChargeADC_PC))->GetQuantiles(1,yq,xq);
     205             :     
     206           0 :     ((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADC))->SetBinContent(currentBins,yq[0]);
     207           0 :     ((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADC))->GetXaxis()->LabelsOption("v");
     208           0 :     if (currentBins%10 == 1)((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADC))->GetXaxis()->SetBinLabel(currentBins,Form("%d:%02d:%02d",currentTime.GetHour(),currentTime.GetMinute(),currentTime.GetSecond()));
     209           0 :     ((TH1F*)GetRawsData(kChargeADC_PC))->Reset("ICES");
     210             :     
     211           0 :     ((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADA))->SetBins(currentBins+1,0,currentBins+1);
     212           0 :     ((TH1F*)GetRawsData(kChargeADA_PC))->GetQuantiles(1,yq,xq);
     213             :     
     214           0 :     ((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADA))->SetBinContent(currentBins,yq[0]);
     215           0 :     ((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADA))->GetXaxis()->LabelsOption("v");
     216           0 :     if (currentBins%10 == 1)((TH1F*)GetRawsData(kTrend_TriggerChargeQuantileADA))->GetXaxis()->SetBinLabel(currentBins,Form("%d:%02d:%02d",currentTime.GetHour(),currentTime.GetMinute(),currentTime.GetSecond()));
     217           0 :     ((TH1F*)GetRawsData(kChargeADA_PC))->Reset("ICES");
     218             :     
     219             :     
     220             :     Int_t nCorrelation = 0;
     221             :     Int_t nPair = 1;
     222           0 :     for(Int_t i=0;i<8;i++){
     223           0 :         for(Int_t j=7;j>i;j--){
     224           0 :                 if( (j - i) == 4){ 
     225           0 :                         Float_t Mean = ((TH1F*)GetRawsData(kNTimeDiffADC + nCorrelation))->GetMean();
     226           0 :                         Float_t RMS = ((TH1F*)GetRawsData(kNTimeDiffADC + nCorrelation))->GetRMS();
     227           0 :                         SetRawsDataBinContent(kPairTimeDiffMean,nPair,Mean);
     228           0 :                         SetRawsDataBinContent(kPairTimeDiffRMS,nPair,RMS);
     229           0 :                         nPair++;
     230           0 :                         }
     231           0 :                  nCorrelation++;
     232             :                 }
     233             :         }
     234             :     nCorrelation = 0;
     235           0 :     for(Int_t i=0;i<8;i++){
     236           0 :         for(Int_t j=7;j>i;j--){
     237           0 :                 if( (j - i) == 4){ 
     238           0 :                         Float_t Mean = ((TH1F*)GetRawsData(kNTimeDiffADA + nCorrelation))->GetMean();
     239           0 :                         Float_t RMS = ((TH1F*)GetRawsData(kNTimeDiffADA + nCorrelation))->GetRMS();
     240           0 :                         SetRawsDataBinContent(kPairTimeDiffMean,nPair,Mean);
     241           0 :                         SetRawsDataBinContent(kPairTimeDiffRMS,nPair,RMS);
     242           0 :                         nPair++;
     243           0 :                         }
     244           0 :                  nCorrelation++;
     245             :                 }
     246             :         }
     247             :    
     248             : 
     249           0 :   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
     250           0 :     if (! IsValidEventSpecie(specie, list)) continue ;
     251           0 :     SetEventSpecie(AliRecoParam::ConvertIndex(specie));
     252           0 :     if(task == AliQAv1::kRAWS) {
     253           0 :         AliQAChecker::Instance()->Run(AliQAv1::kAD, task, list) ;
     254             :     } else if (task == AliQAv1::kESDS) {
     255             :     }
     256             :   }
     257             :   
     258           0 :     }
     259             :   
     260           0 : }
     261             : 
     262             : //____________________________________________________________________________ 
     263             : void AliADQADataMakerRec::InitESDs()
     264             : {
     265             :   const Bool_t expert   = kTRUE ; 
     266             :   const Bool_t image    = kTRUE ; 
     267             : 
     268           0 :   TH1I * h0 = new TH1I("H1I_Cell_Multiplicity_ADA", "Cell Multiplicity in ADA;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;  
     269           0 :   Add2ESDsList(h0, kCellMultiADA, !expert, image)  ;  
     270             :                                                                                                         
     271           0 :   TH1I * h1 = new TH1I("H1I_Cell_Multiplicity_ADC", "Cell Multiplicity in AD;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;  
     272           0 :   Add2ESDsList(h1, kCellMultiADC, !expert, image)  ;  
     273             :   
     274           0 :   TH1F * h2 = new TH1F("H1D_BBFlag_Counters", "BB Flag Counters;Channel;Counts",16, 0, 16) ;  
     275           0 :   Add2ESDsList(h2, kBBFlag, !expert, image)  ;  
     276             :   
     277           0 :   TH1F * h3 = new TH1F("H1D_BGFlag_Counters", "BG Flag Counters;Channel;Counts",16, 0, 16) ;  
     278           0 :   Add2ESDsList(h3, kBGFlag, !expert, image)  ;  
     279             :   
     280           0 :   TH2F * h4 = new TH2F("H2D_Charge_Channel", "ADC Charge per channel;Channel;Charge (ADC counts)",16, 0, 16, 1024, 0, 1024) ;  
     281           0 :   Add2ESDsList(h4, kChargeChannel, !expert, image)  ;  
     282             :   
     283           0 :   TH2F * h5 = new TH2F("H2D_Time_Channel", "Time per channel;Channel;Time (ns)",16,0,16, 1638, -79.980469, 79.980469);  
     284           0 :   Add2ESDsList(h5, kTimeChannel, !expert, image)  ;  
     285             :   
     286           0 :   TH1F * h6 = new TH1F("H1D_ADA_Time", "Mean ADA Time;Time (ns);Counts",1638, -79.980469, 79.980469);
     287           0 :   Add2ESDsList(h6,kESDADATime, !expert, image); 
     288             :   
     289           0 :   TH1F * h7 = new TH1F("H1D_ADC_Time", "Mean ADC Time;Time (ns);Counts",1638, -79.980469, 79.980469);
     290           0 :   Add2ESDsList(h7,kESDADCTime, !expert, image); 
     291             :   
     292           0 :   TH1F * h8 = new TH1F("H1D_Diff_Time", "Diff Time ADA - ADC;Diff Time ADA - ADC (ns);Counts",1000, -200., 200.);
     293           0 :   Add2ESDsList(h8,kESDDiffTime, !expert, image); 
     294             :   
     295           0 :   TH2F * h9 = new TH2F("H2D_ADA_TimeVsCharge", "TimeVsCharge ADA;Time (ns); Charge(ADC counts);Counts",1638, -79.980469, 79.980469,5000,0,5000);
     296           0 :   Add2ESDsList(h9,kESDADATimeVsCharge, !expert, image);
     297             :   
     298           0 :   TH2F * h10 = new TH2F("H2D_ADC_TimeVsCharge", "TimeVsCharge ADC;Time (ns); Charge(ADC counts);Counts",1638, -79.980469, 79.980469,5000,0,5000);
     299           0 :   Add2ESDsList(h10,kESDADCTimeVsCharge, !expert, image);
     300             :   
     301           0 :   TH2F * h11 = new TH2F("H2D_ADA_PairTimeSumDiff", "Pair Time Sum Vs Diff ADA; t1+t2 (ns); t1-t2 (ns);Counts",82, 79.980469, 160.058594,410, 0.000000, 40.039062);
     302           0 :   Add2ESDsList(h11,kESDADAPairTimeSumDiff, !expert, image);
     303             :   
     304           0 :   TH2F * h12 = new TH2F("H2D_ADC_PairTimeSumDiff", "Pair Time Sum Vs Diff ADC; t1+t2 (ns); t1-t2 (ns);Counts",82, 79.980469, 160.058594,410, 0.000000, 40.039062);
     305           0 :   Add2ESDsList(h12,kESDADCPairTimeSumDiff, !expert, image);
     306             :   
     307             :   //
     308           0 :   ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line    
     309           0 : }
     310             : 
     311             : //____________________________________________________________________________ 
     312             : void AliADQADataMakerRec::InitDigits()
     313             : {
     314             : // create Digits histograms in Digits subdir
     315             :   const Bool_t expert   = kTRUE ; 
     316             :   const Bool_t image    = kTRUE ; 
     317             : 
     318             :   // create Digits histograms in Digits subdir
     319           0 :   TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in AD;# of Digits;Entries", 17,-0.5,16.5) ; 
     320           0 :   h0->Sumw2() ;
     321           0 :   Add2DigitsList(h0, 0, !expert, image) ;
     322             :      
     323           0 :   TH2D * h1 = new TH2D("hDigitLeadingTimePerPM", "Leading time distribution per PM in AD;PM number;Leading Time [ns]",16,0,16, 3062, 0.976562, 300); 
     324           0 :   h1->Sumw2() ;
     325           0 :   Add2DigitsList(h1, 1, !expert, image) ; 
     326             :   
     327           0 :   TH2D * h2 = new TH2D("hDigitTimeWidthPerPM", "Time width distribution per PM in AD;PM number;Time width [ns]",16,0,16, 1000, 0, 100); 
     328           0 :   h2->Sumw2() ;
     329           0 :   Add2DigitsList(h2, 2, !expert, image) ;
     330             :   
     331           0 :   TH2I * h3 = new TH2I("hDigitChargePerClockPerPM", "Charge array per PM in AD;PM number; Clock",16,0,16,21, -10.5, 10.5);
     332           0 :   h3->Sumw2();
     333           0 :   Add2DigitsList(h3, 3, !expert, image) ;
     334             :   
     335           0 :   TH1I * h4 = new TH1I("hDigitBBflagsAD","Number of BB flags in AD; # of BB flags; Entries",17,-0.5,16.5);
     336           0 :   h4->Sumw2();
     337           0 :   Add2DigitsList(h4, 4, !expert, image) ;
     338             :   
     339           0 :   TH1I * h5 = new TH1I("hDigitBBflagsADA","Number of BB flags in ADA; # of BB flags; Entries",9,-0.5,8.5);
     340           0 :   h5->Sumw2();
     341           0 :   Add2DigitsList(h5, 5, !expert, image) ;
     342             :   
     343           0 :   TH1I * h6 = new TH1I("hDigitBBflagsADC","Number of BB flags in ADC; # of BB flags; Entries",9,-0.5,8.5);
     344           0 :   h6->Sumw2();
     345           0 :   Add2DigitsList(h6, 6, !expert, image) ;
     346             :   
     347           0 :   TH2D * h7 = new TH2D("hDigitTotalChargePerPM", "Total Charge per PM in AD;PM number; Charge [ADC counts]",16,0,16,10000,0,10000);
     348           0 :   h7->Sumw2();
     349           0 :   Add2DigitsList(h7, 7, !expert, image) ;
     350             :   
     351           0 :   TH2I * h8 = new TH2I("hDigitMaxChargeClockPerPM", "Clock with maximum charge per PM in AD;PM number; Clock ",16,0,16,21, -10.5, 10.5);
     352           0 :   h8->Sumw2();
     353           0 :   Add2DigitsList(h8, 8, !expert, image) ;
     354             :   
     355             :    
     356             :   //
     357           0 :   ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
     358           0 : }
     359             : 
     360             : //____________________________________________________________________________
     361             : void AliADQADataMakerRec::MakeDigits()
     362             : {
     363             :  // makes data from Digits
     364             : 
     365           0 :   FillDigitsData(0,fDigitsArray->GetEntriesFast()) ; 
     366           0 :   TIter next(fDigitsArray) ; 
     367             :     AliADdigit *ADDigit ; 
     368             :     Int_t nBBflagsADA = 0;
     369             :     Int_t nBBflagsADC = 0;
     370             :     
     371           0 :     while ( (ADDigit = dynamic_cast<AliADdigit *>(next())) ) {
     372             :          Int_t totCharge = 0;
     373           0 :          Int_t   PMNumber  = ADDigit->PMNumber();
     374           0 :          if(PMNumber<8 && ADDigit->GetBBflag()) nBBflagsADC++;
     375           0 :          if(PMNumber>7 && ADDigit->GetBBflag()) nBBflagsADA++;
     376             :          
     377           0 :          Short_t adc[21];
     378           0 :          for(Int_t iClock=0; iClock<21; iClock++) { 
     379           0 :          adc[iClock]= ADDigit->ChargeADC(iClock);
     380           0 :          FillDigitsData(3, PMNumber,(float)iClock-10,(float)adc[iClock]);
     381           0 :          totCharge += adc[iClock];
     382             :          }
     383             :             
     384           0 :          FillDigitsData(1,PMNumber,ADDigit->Time()); 
     385           0 :          FillDigitsData(2,PMNumber,ADDigit->Width());
     386           0 :          FillDigitsData(7,PMNumber,totCharge);
     387           0 :          FillDigitsData(8,PMNumber,TMath::LocMax(21,adc)-10); 
     388             :          
     389           0 :     }
     390           0 :     FillDigitsData(4,nBBflagsADA+nBBflagsADC);
     391           0 :     FillDigitsData(5,nBBflagsADA);
     392           0 :     FillDigitsData(6,nBBflagsADC);  
     393           0 : }
     394             : 
     395             : //____________________________________________________________________________
     396             : void AliADQADataMakerRec::MakeDigits(TTree* digitTree)
     397             : {
     398             :   // makes data from Digit Tree
     399             :         
     400           0 :   if (fDigitsArray)
     401           0 :     fDigitsArray->Clear() ; 
     402             :   else 
     403           0 :     fDigitsArray = new TClonesArray("AliADdigit", 1000) ; 
     404             : 
     405           0 :     TBranch * branch = digitTree->GetBranch("ADDigit") ;
     406           0 :     if ( ! branch ) {
     407           0 :          AliWarning("AD branch in Digit Tree not found") ; 
     408           0 :     } else {
     409           0 :          branch->SetAddress(&fDigitsArray) ;
     410           0 :          branch->GetEntry(0) ; 
     411           0 :          MakeDigits() ; 
     412             :     }
     413           0 :     digitTree->ResetBranchAddress(branch);  
     414             :     //
     415           0 :     IncEvCountCycleDigits();
     416           0 :     IncEvCountTotalDigits();
     417             :     //    
     418           0 : }
     419             : 
     420             : //____________________________________________________________________________
     421             : void AliADQADataMakerRec::MakeESDs(AliESDEvent* esd)
     422             : {
     423             : // Creates QA data from ESDs
     424             :   
     425           0 :   UInt_t eventType = esd->GetEventType();
     426             : 
     427           0 :   switch (eventType){
     428             :   case PHYSICS_EVENT:
     429           0 :     AliESDAD *esdAD=esd->GetADData();
     430             :    
     431           0 :     if (!esdAD) break;
     432             :                   
     433           0 :     FillESDsData(kCellMultiADA,esdAD->GetNbPMADA());
     434           0 :     FillESDsData(kCellMultiADC,esdAD->GetNbPMADC());   
     435             :         
     436           0 :     for(Int_t i=0;i<16;i++) {
     437           0 :       FillESDsData(kChargeChannel,(Float_t) i,(Float_t) esdAD->GetAdc(i));
     438           0 :       if (i < 8) {
     439           0 :         if(esdAD->BBTriggerADC(i)) {
     440           0 :                 FillESDsData(kBBFlag,(Float_t) i);
     441           0 :                 FillESDsData(kESDADCTimeVsCharge,esdAD->GetTime(i),esdAD->GetAdc(i));
     442           0 :                 }
     443           0 :         if(esdAD->BGTriggerADC(i)) FillESDsData(kBGFlag,(Float_t) i);
     444             :         
     445             :       }
     446             :       else {
     447           0 :         if(esdAD->BBTriggerADA(i-8)){ 
     448           0 :                 FillESDsData(kBBFlag,(Float_t) i); 
     449           0 :                 FillESDsData(kESDADATimeVsCharge,esdAD->GetTime(i),esdAD->GetAdc(i));
     450           0 :                 } 
     451           0 :         if(esdAD->BGTriggerADA(i-8)) FillESDsData(kBGFlag,(Float_t) i);
     452             :         
     453             :       }                 
     454           0 :       Float_t time = (Float_t) esdAD->GetTime(i);
     455           0 :       FillESDsData(kTimeChannel,(Float_t) i,time);
     456             :     }
     457             :     
     458           0 :     for (Int_t i = 0; i < 4; ++i) {
     459           0 :       Float_t time1 = esdAD->GetTime(i);
     460           0 :       Float_t time2 = esdAD->GetTime(i+4);
     461           0 :       if(time1<-1024.+1.e-6 || time2<-1024.+1.e-6) continue;
     462           0 :       Float_t timeDiff = TMath::Abs(time1-time2);
     463           0 :       Float_t timeSum = time1+time2;
     464           0 :       FillESDsData(kESDADCPairTimeSumDiff,timeSum,timeDiff);
     465           0 :         }
     466             :                 
     467           0 :      for (Int_t i = 8; i < 12; ++i) {
     468           0 :       Float_t time1 = esdAD->GetTime(i);
     469           0 :       Float_t time2 = esdAD->GetTime(i+4);
     470           0 :       if(time1<-1024.+1.e-6 || time2<-1024.+1.e-6) continue;
     471           0 :       Float_t timeDiff = TMath::Abs(time1-time2);
     472           0 :       Float_t timeSum = time1+time2;
     473           0 :       FillESDsData(kESDADAPairTimeSumDiff,timeSum,timeDiff);
     474           0 :         }
     475             :                                 
     476           0 :     Float_t timeADA = esdAD->GetADATime();
     477           0 :     Float_t timeADC = esdAD->GetADCTime();
     478             :     Float_t diffTime;
     479             : 
     480           0 :     if(timeADA<-1024.+1.e-6 || timeADC<-1024.+1.e-6) diffTime = -1024.;
     481           0 :     else diffTime = timeADA - timeADC;
     482             : 
     483           0 :     FillESDsData(kESDADATime,timeADA);
     484           0 :     FillESDsData(kESDADCTime,timeADC);
     485           0 :     FillESDsData(kESDDiffTime,diffTime);
     486             :                 
     487             :     break;
     488             :   }  
     489             :   //
     490           0 :   IncEvCountCycleESDs();
     491           0 :   IncEvCountTotalESDs();  
     492             :   // 
     493           0 : }
     494             : 
     495             : //____________________________________________________________________________ 
     496             : void AliADQADataMakerRec::InitRaws()
     497             : {
     498             :   // Creates RAW histograms in Raws subdir
     499           0 :   if(!fRecoParam)fRecoParam = (AliADRecoParam*)GetRecoParam();
     500           0 :   if(!fQAParam) fQAParam = (AliADQAParam*)GetQAParam();
     501             :  
     502             :   const Bool_t expert   = kTRUE ; 
     503             :   const Bool_t saveCorr = kTRUE ; 
     504             :   const Bool_t image    = kTRUE ; 
     505             : 
     506             :   const Int_t kNintegrator  =    2;
     507             :  
     508           0 :   const Int_t kNTdcTimeBins  = fQAParam->GetNTdcTimeBins();
     509           0 :   const Float_t kTdcTimeMin    =  fQAParam->GetTdcTimeMin();
     510           0 :   const Float_t kTdcTimeMax    = fQAParam->GetTdcTimeMax();
     511           0 :   const Int_t kNTdcTimeBinsFlag  = fQAParam->GetNTdcTimeBinsFlag();
     512           0 :   const Float_t kTdcTimeMinBBFlag    =  fQAParam->GetTdcTimeMinBBFlag();
     513           0 :   const Float_t kTdcTimeMaxBBFlag    =  fQAParam->GetTdcTimeMaxBBFlag();
     514           0 :   const Float_t kTdcTimeMinBGFlag    =  fQAParam->GetTdcTimeMinBGFlag();
     515           0 :   const Float_t kTdcTimeMaxBGFlag    =  fQAParam->GetTdcTimeMaxBGFlag();
     516           0 :   const Int_t kNTdcTimeRatioBins  = fQAParam->GetNTdcTimeRatioBins();
     517           0 :   const Float_t kTdcTimeRatioMin    =  fQAParam->GetTdcTimeRatioMin();
     518           0 :   const Float_t kTdcTimeRatioMax    = fQAParam->GetTdcTimeRatioMax();
     519             :   
     520           0 :   const Int_t kNTdcWidthBins =  fQAParam->GetNTdcWidthBins();
     521           0 :   const Float_t kTdcWidthMin   =    fQAParam->GetTdcWidthMin();
     522           0 :   const Float_t kTdcWidthMax   =  fQAParam->GetTdcWidthMax();
     523             :   
     524           0 :   const Int_t kNChargeChannelBins   =  fQAParam->GetNChargeChannelBins();
     525           0 :   const Int_t kChargeChannelMin   =  fQAParam->GetChargeChannelMin();
     526           0 :   const Int_t kChargeChannelMax   =  fQAParam->GetChargeChannelMax();
     527             :   
     528           0 :   const Int_t kNChargeSideBins   = fQAParam->GetNChargeSideBins();
     529           0 :   const Int_t kChargeSideMin   = fQAParam->GetChargeSideMin();
     530           0 :   const Int_t kChargeSideMax   = fQAParam->GetChargeSideMax();
     531             :   
     532           0 :   const Int_t kNChargeCorrBins   = fQAParam->GetNChargeCorrBins();
     533           0 :   const Int_t kChargeCorrMin   = fQAParam->GetChargeCorrMin();
     534           0 :   const Int_t kChargeCorrMax   = fQAParam->GetChargeCorrMax();
     535             :      
     536           0 :   const Int_t   kNPairTimeCorrBins = fQAParam->GetNPairTimeCorrBins(); 
     537           0 :   const Float_t kPairTimeCorrMin =  fQAParam->GetPairTimeCorrMin();
     538           0 :   const Float_t kPairTimeCorrMax =  fQAParam->GetPairTimeCorrMax(); 
     539             :    
     540           0 :   const Int_t kNPairTimeDiffBins = fQAParam->GetNPairTimeDiffBins();
     541           0 :   const Float_t kPairTimeDiffMin = fQAParam->GetPairTimeDiffMin();
     542           0 :   const Float_t kPairTimeDiffMax = fQAParam->GetPairTimeDiffMax(); 
     543             :   
     544           0 :   const Int_t   kNMeanTimeCorrBins = fQAParam->GetNMeanTimeCorrBins();
     545           0 :   const Float_t kMeanTimeCorrMin =   fQAParam->GetMeanTimeCorrMin();
     546           0 :   const Float_t kMeanTimeCorrMax =   fQAParam->GetMeanTimeCorrMax();    
     547             :   
     548             :   const Int_t kNChannelBins  =   16;
     549             :   const Float_t kChannelMin    =    -0.5;
     550             :   const Float_t kChannelMax    =   15.5;
     551             :   
     552             :   const Int_t kNPedestalBins =  40;
     553             :   const Float_t kPedestalMin   =    0;
     554             :   const Float_t kPedestalMax   =  40; 
     555             :   
     556             :   const Int_t kNPairBins  =   8;
     557             :   const Float_t kPairMin    =    -0.5;
     558             :   const Float_t kPairMax    =   7.5;
     559             :   
     560             :   TH2I * h2i;
     561             :   TH2F * h2d;
     562             :   TH1I * h1i;
     563             :   TH1F * h1d;
     564             : 
     565             :   int iHisto =0;
     566             :   
     567           0 :   h1d = new TH1F("H1D_Trend_TriggerChargeQuantileADA","Trigger charge quantile",1, 0, 1) ;  
     568           0 :   Add2RawsList(h1d,kTrend_TriggerChargeQuantileADA, !expert, image, saveCorr);   iHisto++;
     569           0 :   h1d->SetLineWidth(2);
     570           0 :   h1d->SetLineColor(kBlue);
     571             :   
     572           0 :   h1d = new TH1F("H1D_Charge_ADA_PC",Form("Total integrated [-%d,+%d] charge;Charge [ADC counts]",fRecoParam->GetNPreClocks(),fRecoParam->GetNPostClocks()), kNChargeSideBins, kChargeSideMin, kChargeSideMax) ;  
     573           0 :   Add2RawsList(h1d,kChargeADA_PC, !expert, image, saveCorr);   iHisto++;
     574             :   
     575           0 :   h1d = new TH1F("H1D_Trend_TriggerChargeQuantileADC","Trigger charge quantile",1, 0, 1) ;  
     576           0 :   Add2RawsList(h1d,kTrend_TriggerChargeQuantileADC, !expert, image, saveCorr);   iHisto++;
     577           0 :   h1d->SetLineWidth(2);
     578           0 :   h1d->SetLineColor(kRed);
     579             :   
     580           0 :   h1d = new TH1F("H1D_Charge_ADC_PC",Form("Total integrated [-%d,+%d] charge;Charge [ADC counts]",fRecoParam->GetNPreClocks(),fRecoParam->GetNPostClocks()), kNChargeSideBins, kChargeSideMin, kChargeSideMax) ;  
     581           0 :   Add2RawsList(h1d,kChargeADC_PC, !expert, image, saveCorr);   iHisto++;
     582             :   
     583             :  
     584             :   // Creation of Cell Multiplicity Histograms
     585           0 :   h1i = new TH1I("H1I_Multiplicity_ADA", "Number of channels with charge signal and time ADA;# of Channels;Entries", 9, -0.5, 8.5) ;  
     586           0 :   Add2RawsList(h1i,kMultiADA, expert, !image, !saveCorr);   iHisto++;
     587           0 :   h1i = new TH1I("H1I_Multiplicity_ADC", "Number of channels with charge signal and time ADC;# of Channels;Entries", 9, -0.5, 8.5) ;  
     588           0 :   Add2RawsList(h1i,kMultiADC, expert, !image, !saveCorr);   iHisto++;
     589             :  
     590             :   // Creation of Total Charge Histograms
     591           0 :   h1d = new TH1F("H1D_Charge_ADA",Form("Total integrated [-%d,+%d] charge;Charge [ADC counts]",fRecoParam->GetNPreClocks(),fRecoParam->GetNPostClocks()), kNChargeSideBins, kChargeSideMin, kChargeSideMax) ;  
     592           0 :   Add2RawsList(h1d,kChargeADA, !expert, image, saveCorr);   iHisto++;
     593           0 :   h1d->SetLineWidth(2);
     594           0 :   h1d->SetLineColor(kBlue);
     595           0 :   h1d = new TH1F("H1D_Charge_ADC",Form("Total integrated [-%d,+%d] charge;Charge [ADC counts]",fRecoParam->GetNPreClocks(),fRecoParam->GetNPostClocks()), kNChargeSideBins, kChargeSideMin, kChargeSideMax) ;  
     596           0 :   Add2RawsList(h1d,kChargeADC, !expert, image, saveCorr);   iHisto++;
     597           0 :   h1d->SetLineWidth(2);
     598           0 :   h1d->SetLineColor(kRed);
     599           0 :   h1d = new TH1F("H1D_Charge_AD",Form("Total integrated [-%d,+%d] charge;Charge [ADC counts]",fRecoParam->GetNPreClocks(),fRecoParam->GetNPostClocks()), 2*kNChargeSideBins, kChargeSideMin, 1+2*kNChargeSideBins) ;  
     600           0 :   Add2RawsList(h1d,kChargeAD, !expert,  !image, !saveCorr);   iHisto++;
     601             :    
     602             : 
     603             :   // Creation of Charge EoI histogram 
     604           0 :   h2d = new TH2F("H2D_ChargeEoI", Form("Integrated [-%d,+%d] charge;Channel Number;Charge [ADC counts]",fRecoParam->GetNPreClocks(),fRecoParam->GetNPostClocks())
     605           0 :                  ,kNChannelBins, kChannelMin, kChannelMax, kNChargeChannelBins, kChargeChannelMin, kChargeChannelMax);
     606           0 :   Add2RawsList(h2d,kChargeEoI, !expert, image, saveCorr); iHisto++;
     607             :   
     608           0 :   h2d = new TH2F("H2D_ChargeEoIBB", Form("Integrated [-%d,+%d] charge w/ BB Flag condition;Channel Number;Charge [ADC counts]",fRecoParam->GetNPreClocks(),fRecoParam->GetNPostClocks())
     609             :                  ,kNChannelBins, kChannelMin, kChannelMax, kNChargeChannelBins, kChargeChannelMin, kChargeChannelMax);
     610           0 :   Add2RawsList(h2d,kChargeEoIBB, !expert, image, saveCorr); iHisto++;
     611             :   
     612           0 :   h2d = new TH2F("H2D_ChargeEoIBG", Form("Integrated [-%d,+%d] charge w/ BG Flag condition;Channel Number;Charge [ADC counts]",fRecoParam->GetNPreClocks(),fRecoParam->GetNPostClocks())
     613             :                  ,kNChannelBins, kChannelMin, kChannelMax, kNChargeChannelBins, kChargeChannelMin, kChargeChannelMax);
     614           0 :   Add2RawsList(h2d,kChargeEoIBG, !expert, image, saveCorr); iHisto++;
     615             : 
     616             : 
     617           0 :   for(Int_t iInt=0;iInt<kNintegrator;iInt++){
     618             :     // Creation of Pedestal histograms 
     619           0 :     h2i = new TH2I(Form("H2I_Pedestal_Int%d",iInt), Form("Pedestal (Int%d);Channel;Pedestal [ADC counts]",iInt)
     620             :                    ,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
     621           0 :     Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), expert, image, !saveCorr); iHisto++;
     622             :     
     623           0 :     h2d = new TH2F(Form("H2D_PedestalDiff_Int%d",iInt), Form("Pedestal difference Online - OCDB (Int%d);Channel; Pedestal Online - OCDB",iInt)
     624             :                    ,kNChannelBins, kChannelMin, kChannelMax,81,-10.5,70.5);
     625           0 :     Add2RawsList(h2d,(iInt == 0 ? kPedestalDiffInt0 : kPedestalDiffInt1), !expert, image, !saveCorr); iHisto++;
     626             :         
     627             : 
     628             :     // Creation of Charge EoI histograms 
     629           0 :     h2i = new TH2I(Form("H2I_ChargeEoI_Int%d",iInt), Form("Maximum charge per clock (Int%d);Channel;Charge [ADC counts]",iInt)
     630             :                    ,kNChannelBins, kChannelMin, kChannelMax, 1025, 0, 1025);
     631           0 :     Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), !expert, image, saveCorr); iHisto++;  
     632             :   }
     633             :   
     634           0 :   h2i = new TH2I("H2I_ChargeSaturation", "Maximum charge per clock, both Ints;Channel;Charge [ADC counts]",kNChannelBins, kChannelMin, kChannelMax, 1024, 1, 1025);
     635           0 :   Add2RawsList(h2i,kChargeSaturation, !expert, image, saveCorr); iHisto++;      
     636             :   
     637             :   // Creation of Time histograms 
     638           0 :   h2i = new TH2I("H2I_Width", "HPTDC Width;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
     639           0 :   Add2RawsList(h2i,kWidth, expert, image, saveCorr); iHisto++;
     640             :   
     641           0 :   h2i = new TH2I("H2I_Width_BB", "HPTDC Width w/ BB Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
     642           0 :   Add2RawsList(h2i,kWidthBB, expert, !image, !saveCorr); iHisto++;
     643             : 
     644           0 :   h2i = new TH2I("H2I_Width_BG", "HPTDC Width w/ BG Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
     645           0 :   h2i->SetDrawOption("colz");
     646           0 :   Add2RawsList(h2i,kWidthBG, expert, !image, !saveCorr); iHisto++;
     647             : 
     648           0 :   h2i = new TH2I("H2I_HPTDCTime", "HPTDC Time;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
     649           0 :   Add2RawsList(h2i,kHPTDCTime, !expert, image, saveCorr); iHisto++;
     650             :   
     651           0 :   h2i = new TH2I("H2I_HPTDCTime_BB", "HPTDC Time w/ BB Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBinsFlag, kTdcTimeMinBBFlag, kTdcTimeMaxBBFlag);
     652           0 :   Add2RawsList(h2i,kHPTDCTimeBB, !expert, image, !saveCorr); iHisto++;
     653             : 
     654           0 :   h2i = new TH2I("H2I_HPTDCTime_BG", "HPTDC Time w/ BG Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBinsFlag, kTdcTimeMinBGFlag, kTdcTimeMaxBGFlag);
     655           0 :   Add2RawsList(h2i,kHPTDCTimeBG, !expert, image, !saveCorr); iHisto++;
     656             :   
     657             :   //With wide binning for ratio
     658           0 :   h2d = new TH2F("H2D_HPTDCTimeRebin", "HPTDC Time;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeRatioBins, kTdcTimeRatioMin, kTdcTimeRatioMax);
     659           0 :   Add2RawsList(h2d,kHPTDCTimeRebin, !expert, image, saveCorr); iHisto++;
     660             :   
     661           0 :   h2d = new TH2F("H2D_HPTDCTimeRebin_BB", "Ratio Time w_BB_Flag/All ;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeRatioBins, kTdcTimeRatioMin, kTdcTimeRatioMax);
     662           0 :   Add2RawsList(h2d,kHPTDCTimeRebinBB, !expert, image, !saveCorr); iHisto++;
     663             : 
     664           0 :   h2d = new TH2F("H2D_HPTDCTimeRebin_BG", "Ratio Time w_BG_Flag/All;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeRatioBins, kTdcTimeRatioMin, kTdcTimeRatioMax);
     665           0 :   Add2RawsList(h2d,kHPTDCTimeRebinBG, !expert, image, !saveCorr); iHisto++;
     666             : 
     667             :   //Mean time histograms        
     668           0 :   h1d = new TH1F("H1D_MeanTimeADA", "Mean Time;Mean time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
     669           0 :   Add2RawsList(h1d,kMeanTimeADA, expert, !image, !saveCorr); iHisto++;
     670           0 :   h1d->SetLineWidth(2);
     671           0 :   h1d->SetLineColor(kBlue);
     672             :         
     673           0 :   h1d = new TH1F("H1D_MeanTimeADC", "Mean Time;Mean time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
     674           0 :   Add2RawsList(h1d,kMeanTimeADC, expert, !image, !saveCorr); iHisto++;
     675           0 :   h1d->SetLineWidth(2);
     676           0 :   h1d->SetLineColor(kRed);
     677             :         
     678           0 :   h1d = new TH1F("H1D_MeanTimeDifference","Mean Time Difference ADA-ADC ;AD Mean time t_{A} - t_{C} [ns];Counts",1024,-150,150);
     679           0 :   Add2RawsList(h1d,kMeanTimeDiff, expert, !image, !saveCorr); iHisto++;
     680             : 
     681           0 :   h2d = new TH2F("H2D_MeanTimeCorr", "AD Mean time t_{A} vs t_{C};Mean time ADA [ns];Mean time ADC [ns]", kNMeanTimeCorrBins,kMeanTimeCorrMin,kMeanTimeCorrMax,kNMeanTimeCorrBins, kMeanTimeCorrMin,kMeanTimeCorrMax) ;  
     682           0 :   Add2RawsList(h2d,kMeanTimeCorr, expert, !image, !saveCorr);   iHisto++;
     683             :  
     684           0 :   h2d = new TH2F("H2D_MeanTimeSumDiff", "AD Mean time t_{A} - t_{C} vs t_{A} + t_{C}; AD Mean time t_{A} - t_{C} [ns];AD Mean time t_{A} + t_{C} [ns]", 307, -150.000000, 149.804688, 410, 200.0, 600.390625);  
     685           0 :   Add2RawsList(h2d,kMeanTimeSumDiff, expert, !image, !saveCorr);   iHisto++;
     686             :  
     687             :   //Slewing histograms
     688           0 :   h2d = new TH2F("H2D_TimeSlewingADA", "Time Vs Charge ADA;Log10(1/Charge) [ADC counts]; Leading Time[ns]", 200,-4,0, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);  
     689           0 :   Add2RawsList(h2d,kTimeSlewingADA, expert, !image, !saveCorr);   iHisto++;
     690             :   
     691           0 :   h2d = new TH2F("H2D_TimeSlewingADC", "Time Vs Charge ADC;Log10(1/Charge) [ADC counts]; Leading Time[ns]", 200,-4,0, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax) ;  
     692           0 :   Add2RawsList(h2d,kTimeSlewingADC, expert, !image, !saveCorr);   iHisto++;
     693             :   
     694           0 :   h2d = new TH2F("H2D_WidthSlewing", "Width Vs Charge ;Time Width [ns];Charge [ADC counts]", kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax, kNChargeCorrBins, kChargeCorrMin, kChargeCorrMax) ;  
     695           0 :   Add2RawsList(h2d,kWidthSlewing, expert, !image, !saveCorr);   iHisto++;
     696             :   
     697             :   //Creation of pair coincidence histograms
     698           0 :   h1i = new TH1I("H1I_MultiBBCoincidence_ADA", "Number of BB flag coincidences;# of BB Coincidences;Entries", 5, -0.5, 4.5) ;  
     699           0 :   Add2RawsList(h1i,kNBBCoincADA, !expert, image, saveCorr);   iHisto++;
     700           0 :   h1i->SetLineWidth(2);
     701           0 :   h1i->SetLineColor(kBlue);
     702           0 :   h1i->GetXaxis()->SetNdivisions(505);
     703           0 :   h1i = new TH1I("H1I_MultiBBCoincidence_ADC", "Number of BB flag coincidences;# of BB Coincidences;Entries", 5, -0.5, 4.5) ;  
     704           0 :   Add2RawsList(h1i,kNBBCoincADC, !expert, image, saveCorr);   iHisto++;
     705           0 :   h1i->SetLineWidth(2);
     706           0 :   h1i->SetLineColor(kRed);
     707           0 :   h1i->GetXaxis()->SetNdivisions(505);
     708             :   
     709           0 :   h1i = new TH1I("H1I_MultiBGCoincidence_ADA", "Number of BG flag coincidences;# of BG Coincidences;Entries", 5, -0.5, 4.5) ;  
     710           0 :   Add2RawsList(h1i,kNBGCoincADA, !expert, image, saveCorr);   iHisto++;
     711           0 :   h1i->SetLineWidth(2);
     712           0 :   h1i->SetLineColor(kBlue);
     713           0 :   h1i->GetXaxis()->SetNdivisions(505);
     714           0 :   h1i = new TH1I("H1I_MultiBGCoincidence_ADC", "Number of BG flag coincidences;# of BG Coincidences;Entries", 5, -0.5, 4.5) ;  
     715           0 :   Add2RawsList(h1i,kNBGCoincADC, !expert, image, saveCorr);   iHisto++;
     716           0 :   h1i->SetLineWidth(2);
     717           0 :   h1i->SetLineColor(kRed);
     718           0 :   h1i->GetXaxis()->SetNdivisions(505);
     719             :   
     720           0 :   h2i = new TH2I("H2I_BBCoincCorr", "Number of BB flag coincidences;# of BB Coincidences ADA;# of BB Coincidences ADC",5, -0.5, 4.5, 5, -0.5, 4.5);
     721           0 :   Add2RawsList(h2i,kNBBCoincCorr, !expert, image, !saveCorr); iHisto++;
     722           0 :   h2i->GetXaxis()->SetNdivisions(505);
     723           0 :   h2i->GetYaxis()->SetNdivisions(505);
     724             :   
     725           0 :   h2i = new TH2I("H2I_BGCoincCorr", "Number of BG flag coincidences;# of BG Coincidences ADA;# of BG Coincidences ADC",5, -0.5, 4.5, 5, -0.5, 4.5);
     726           0 :   Add2RawsList(h2i,kNBGCoincCorr, !expert, image, !saveCorr); iHisto++;
     727           0 :   h2i->GetXaxis()->SetNdivisions(505);
     728           0 :   h2i->GetYaxis()->SetNdivisions(505);
     729             :   
     730           0 :   h1d = new TH1F("H1D_NEventsBBFlag", "Number of events with a BB/BG flag per channel;# of Channels;Event rate", kNChannelBins, kChannelMin, kChannelMax);  
     731           0 :   Add2RawsList(h1d,kNEventsBBFlag, expert, image, saveCorr);   iHisto++;
     732           0 :   h1d->SetLineWidth(3);
     733           0 :   h1d->SetLineColor(kBlue);
     734             :   
     735           0 :   h1d = new TH1F("H1D_NEventsBGFlag", "Number of events with a BB/BG flag per channel;# of Channels;Event rate", kNChannelBins, kChannelMin, kChannelMax);  
     736           0 :   Add2RawsList(h1d,kNEventsBGFlag, expert, image, saveCorr);   iHisto++;
     737           0 :   h1d->SetLineWidth(3);
     738           0 :   h1d->SetLineColor(kRed);
     739             : 
     740             :   //Creation of trigger histogram
     741           0 :   h1d = new TH1F("H1D_Trigger_Type", "AD0 Trigger Type;;Counts", 11,0 ,11) ;  
     742           0 :   Add2RawsList(h1d,kTriggers, !expert, image, saveCorr);   iHisto++;
     743           0 :   h1d->SetFillColor(kAzure-8);
     744           0 :   h1d->SetLineWidth(2);
     745           0 :   h1d->GetXaxis()->SetLabelSize(0.04);
     746           0 :   h1d->GetXaxis()->SetNdivisions(808,kFALSE);
     747           0 :   h1d->GetXaxis()->SetBinLabel(1, "UBA");
     748           0 :   h1d->GetXaxis()->SetBinLabel(2, "UBC");
     749           0 :   h1d->GetXaxis()->SetBinLabel(3, "UGA");
     750           0 :   h1d->GetXaxis()->SetBinLabel(4, "UGC");
     751           0 :   h1d->GetXaxis()->SetBinLabel(5, "UBA & UBC");
     752           0 :   h1d->GetXaxis()->SetBinLabel(6, "UBA || UBC");
     753           0 :   h1d->GetXaxis()->SetBinLabel(7, "(UBA || UBC) & !(UGA || UGC)");
     754           0 :   h1d->GetXaxis()->SetBinLabel(8, "UGA & UBC");
     755           0 :   h1d->GetXaxis()->SetBinLabel(9, "UGC & UBA");
     756           0 :   h1d->GetXaxis()->SetBinLabel(10, "UGA || UGC");
     757           0 :   h1d->GetXaxis()->SetBinLabel(11, "(UGA & UBC) || (UGC & UBA)");
     758             :   
     759           0 :   h2d = new TH2F("H2D_Decision", "AD Decision; ADA; ADC", 4,0 ,4,4,0,4) ;  
     760           0 :   Add2RawsList(h2d,kDecisions, !expert, image, saveCorr);   iHisto++;
     761           0 :   h2d->SetOption("coltext");
     762           0 :   h2d->GetXaxis()->SetLabelSize(0.06);
     763           0 :   h2d->GetYaxis()->SetLabelSize(0.06);
     764           0 :   h2d->GetXaxis()->SetNdivisions(808,kFALSE);
     765           0 :   h2d->GetYaxis()->SetNdivisions(808,kFALSE);
     766           0 :   h2d->GetXaxis()->SetBinLabel(1, "Empty");
     767           0 :   h2d->GetXaxis()->SetBinLabel(2, "BB");
     768           0 :   h2d->GetXaxis()->SetBinLabel(3, "BG");
     769           0 :   h2d->GetXaxis()->SetBinLabel(4, "Fake");
     770           0 :   h2d->GetYaxis()->SetBinLabel(1, "Empty");
     771           0 :   h2d->GetYaxis()->SetBinLabel(2, "BB");
     772           0 :   h2d->GetYaxis()->SetBinLabel(3, "BG");
     773           0 :   h2d->GetYaxis()->SetBinLabel(4, "Fake");
     774             : 
     775             :   //Creation of debug histograms
     776           0 :   h1d = new TH1F("H1D_Pair_TimeDiffMean","Time difference mean for coincidence pair [ns];Pair number;Time mean [ns]",kNPairBins, kPairMin, kPairMax);
     777           0 :   Add2RawsList(h1d,kPairTimeDiffMean, expert, !image, !saveCorr); iHisto++;
     778             :   
     779           0 :   h1d = new TH1F("H1D_Pair_TimeDiffRMS","Time difference RMS for coincidence pair [ns];Pair number;Time RMS [ns]",kNPairBins, kPairMin, kPairMax);
     780           0 :   Add2RawsList(h1d,kPairTimeDiffRMS, expert, !image, !saveCorr); iHisto++;
     781             : 
     782             :   //Creation of Clock histograms
     783           0 :   h2d = new TH2F("H2D_BBFlagVsClock", "BB-Flags vs LHC-Clock(All events);Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
     784           0 :   Add2RawsList(h2d,kBBFlagVsClock, !expert, image, saveCorr); iHisto++;
     785             :   
     786           0 :   h2d = new TH2F("H2D_BBFlagVsClock_ADOR", "BB-Flags vs LHC-Clock(AD-OR);Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
     787           0 :   Add2RawsList(h2d,kBBFlagVsClock_ADOR, !expert, image, saveCorr); iHisto++;
     788             :         
     789           0 :   h2d = new TH2F("H2D_BGFlagVsClock", "BG-Flags vs LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
     790           0 :   Add2RawsList(h2d,kBGFlagVsClock, !expert, image, saveCorr); iHisto++;
     791             :  
     792           0 :   for(Int_t iInt=0;iInt<kNintegrator;iInt++){
     793           0 :         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 );
     794           0 :         Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), expert, image, saveCorr); iHisto++;
     795             :         }
     796             :         
     797           0 :   h2d = new TH2F("H2D_MaxChargeVsClock", "Maximum Charge Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
     798           0 :   Add2RawsList(h2d,kMaxChargeClock, !expert, image, saveCorr); iHisto++;
     799             :   
     800           0 :   h2d = new TH2F("H2D_BBFlagPerChannel", "BB-Flags Versus Channel;Channel;BB Flags Count",kNChannelBins, kChannelMin, kChannelMax,22,-0.5,21.5);
     801           0 :   Add2RawsList(h2d,kBBFlagsPerChannel, expert, !image, saveCorr); iHisto++;
     802             :   
     803           0 :   h2d = new TH2F("H2D_BGFlagPerChannel", "BG-Flags Versus Channel;Channel;BG Flags Count",kNChannelBins, kChannelMin, kChannelMax,22,-0.5,21.5);
     804           0 :   Add2RawsList(h2d,kBGFlagsPerChannel, expert, !image, saveCorr); iHisto++;
     805             :   
     806           0 :   h1d = new TH1F("H1D_FlagNoTime", "No Flag-No Time events;Channel;Event rate",kNChannelBins, kChannelMin, kChannelMax);
     807           0 :   Add2RawsList(h1d,kFlagNoTime, !expert, image, saveCorr); iHisto++;
     808           0 :   h1d->SetLineWidth(3);
     809           0 :   h1d->SetLineColor(kBlue);
     810             :   
     811           0 :   h1d = new TH1F("H1D_TimeNoFlag", "No Flag-No Time events;Channel;Event rate",kNChannelBins, kChannelMin, kChannelMax);
     812           0 :   Add2RawsList(h1d,kTimeNoFlag, !expert, image, saveCorr); iHisto++;
     813           0 :   h1d->SetLineWidth(3);
     814           0 :   h1d->SetLineColor(kRed);
     815             :   
     816             :   //Correlation histograms
     817             :   Int_t nCorrelation = 0;
     818           0 :   for(Int_t i=0;i<8;i++){
     819           0 :         for(Int_t j=7;j>i;j--){
     820           0 :                 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);
     821           0 :                 Add2RawsList(h2d,kNChargeCorrADA+nCorrelation, expert, !image, !saveCorr); iHisto++; nCorrelation++;
     822             :                 }
     823             :         }
     824             :   nCorrelation = 0;
     825           0 :   for(Int_t i=0;i<8;i++){
     826           0 :         for(Int_t j=7;j>i;j--){
     827           0 :                 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);
     828           0 :                 Add2RawsList(h2d,kNChargeCorrADC+nCorrelation, expert, !image, !saveCorr); iHisto++; nCorrelation++;
     829             :                 }
     830             :         }
     831             :   nCorrelation = 0;
     832           0 :   for(Int_t i=0;i<8;i++){
     833           0 :         for(Int_t j=7;j>i;j--){
     834           0 :                 h2d = new TH2F(Form("TimeCorr/H2D_kNTimeCorrADA_%d_%d",i,j),Form("Time Correlation ADA module%d - module%d",i,j),kNPairTimeCorrBins,kPairTimeCorrMin,kPairTimeCorrMax,kNPairTimeCorrBins,kPairTimeCorrMin,kPairTimeCorrMax);
     835           0 :                 Add2RawsList(h2d,kNTimeCorrADA+nCorrelation, expert, !image, !saveCorr); iHisto++; nCorrelation++;
     836             :                 }
     837             :         }
     838             :   nCorrelation = 0;
     839           0 :   for(Int_t i=0;i<8;i++){
     840           0 :         for(Int_t j=7;j>i;j--){
     841           0 :                 h2d = new TH2F(Form("TimeCorr/H2D_kNTimeCorrADC_%d_%d",i,j),Form("Time Correlation ADC module%d - module%d",i,j),kNPairTimeCorrBins,kPairTimeCorrMin,kPairTimeCorrMax,kNPairTimeCorrBins,kPairTimeCorrMin,kPairTimeCorrMax);
     842           0 :                 Add2RawsList(h2d,kNTimeCorrADC+nCorrelation, expert, !image, !saveCorr); iHisto++; nCorrelation++;
     843             :                 }
     844             :         }
     845             :   nCorrelation = 0;
     846           0 :   for(Int_t i=0;i<8;i++){
     847           0 :         for(Int_t j=7;j>i;j--){
     848           0 :                 h1d = new TH1F(Form("TimeDiff/H1D_kNTimeDiffADA_%d_%d",i,j),Form("Time Difference ADA module%d - module%d",i,j),kNPairTimeDiffBins,kPairTimeDiffMin,kPairTimeDiffMax);
     849           0 :                 Add2RawsList(h1d,kNTimeDiffADA+nCorrelation, expert, !image, !saveCorr); iHisto++; nCorrelation++;
     850             :                 }
     851             :         }
     852             :   nCorrelation = 0;
     853           0 :   for(Int_t i=0;i<8;i++){
     854           0 :         for(Int_t j=7;j>i;j--){
     855           0 :                 h1d = new TH1F(Form("TimeDiff/H1D_kNTimeDiffADC_%d_%d",i,j),Form("Time Difference ADC module%d - module%d",i,j),kNPairTimeDiffBins,kPairTimeDiffMin,kPairTimeDiffMax);
     856           0 :                 Add2RawsList(h1d,kNTimeDiffADC+nCorrelation, expert, !image, !saveCorr); iHisto++; nCorrelation++;
     857             :                 }
     858             :         }
     859             :   
     860           0 :   AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto));
     861             :   //
     862           0 :   ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
     863           0 : }
     864             : 
     865             : //____________________________________________________________________________
     866             : void AliADQADataMakerRec::MakeRaws(AliRawReader* rawReader)
     867             : {
     868             :   // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
     869             :                   
     870             :                                           
     871             :   // Check id histograms already created for this Event Specie
     872           0 :   if ( ! GetRawsData(kPedestalInt0) )
     873           0 :     InitRaws() ;
     874             : 
     875           0 :   rawReader->Reset() ; 
     876           0 :   AliADRawStream* rawStream  = new AliADRawStream(rawReader); 
     877           0 :   if(!(rawStream->Next())) return;  
     878             :  
     879           0 :   eventTypeType eventType = rawReader->GetType();
     880             : 
     881             :   Int_t    mulADA = 0 ; 
     882             :   Int_t    mulADC = 0 ; 
     883             :   Double_t timeADA =0., timeADC = 0.;
     884             :   Double_t weightADA =0., weightADC = 0.;
     885             :   UInt_t   itimeADA=0, itimeADC=0;
     886             :   Double_t chargeADA=0., chargeADC=0.;
     887             :   Double_t chargeTrigADA=0., chargeTrigADC=0.;
     888             : 
     889             :   Double_t diffTime=-100000, sumTime = -10000;
     890             :   
     891             :   Int_t    pBBmulADA = 0;
     892             :   Int_t    pBBmulADC = 0;
     893             :   Int_t    pBGmulADA = 0;
     894             :   Int_t    pBGmulADC = 0;
     895             :   Double_t pDiffTime =-100000.;
     896             : 
     897             :   
     898           0 :   switch (eventType){
     899             :   case PHYSICS_EVENT:
     900             :   
     901             :     Int_t  iFlag=0;
     902             :     Int_t  pedestal;
     903             :     Float_t OCDBdiff;
     904           0 :     Int_t  integrator[16];
     905           0 :     Bool_t flagBB[16];   
     906           0 :     Bool_t flagBG[16];   
     907             :     Float_t charge;
     908             :     Int_t  offlineCh;
     909           0 :     Float_t adc[16], time[16], width[16], timeCorr[16], adcTrig[16]; 
     910             :     Int_t  iPair=0;
     911             : 
     912           0 :     for(Int_t iChannel=0; iChannel<16; iChannel++) { // BEGIN : Loop over channels
     913             :                    
     914           0 :       offlineCh = kOfflineChannel[iChannel];
     915             :                    
     916             :       // Fill Pedestal histograms
     917             :       iFlag = 0;   
     918           0 :       for(Int_t j=0; j<=20; j++) {
     919           0 :         if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++;
     920             :       }
     921             : 
     922           0 :       if(iFlag == 0){ //No Flag found
     923           0 :         for(Int_t j=11; j<=17; j++){
     924           0 :           pedestal= (Int_t) rawStream->GetPedestal(iChannel, j);
     925           0 :           integrator[offlineCh] = rawStream->GetIntegratorFlag(iChannel, j);
     926           0 :           OCDBdiff = pedestal - fCalibData->GetPedestal(offlineCh+16*integrator[offlineCh]);
     927             : 
     928           0 :           FillRawsData((integrator[offlineCh] == 0 ? kPedestalInt0 : kPedestalInt1),offlineCh,pedestal);
     929           0 :           FillRawsData((integrator[offlineCh] == 0 ? kPedestalDiffInt0 : kPedestalDiffInt1),offlineCh,OCDBdiff);
     930             :         }
     931           0 :       }
     932             :       // Fill Charge EoI histograms
     933             :            
     934           0 :       adc[offlineCh]    = 0.0;
     935           0 :       adcTrig[offlineCh] = 0.0;
     936             :       // Search for the maximum charge in the train of 21 LHC clocks 
     937             :       // regardless of the integrator which has been operated:
     938             :       Float_t maxadc = 0;
     939             :       Int_t imax = -1;
     940           0 :       Float_t adcPedSub[21];
     941           0 :       for(Int_t iClock=0; iClock<21; iClock++){
     942           0 :         Bool_t iIntegrator = rawStream->GetIntegratorFlag(iChannel,iClock);
     943           0 :         Int_t k = offlineCh+16*iIntegrator;
     944             : 
     945           0 :         adcPedSub[iClock] = rawStream->GetPedestal(iChannel,iClock) - fCalibData->GetPedestal(k);
     946           0 :         if(adcPedSub[iClock] <= fRecoParam->GetNSigmaPed()*fCalibData->GetSigma(k)) {
     947           0 :           adcPedSub[iClock] = 0;
     948           0 :           continue;
     949             :         }
     950             :         
     951           0 :         if(iClock < fRecoParam->GetStartClock() || iClock > fRecoParam->GetEndClock()) continue;
     952           0 :         if(adcPedSub[iClock] > maxadc) {
     953             :           maxadc = adcPedSub[iClock];
     954             :           imax   = iClock;
     955           0 :         }
     956           0 :       }
     957           0 :       adcTrig[offlineCh] = adcPedSub[10];
     958           0 :       if (imax != -1) {
     959           0 :         Int_t start = imax - fRecoParam->GetNPreClocks();
     960           0 :         if (start < 0) start = 0;
     961           0 :         Int_t end = imax + fRecoParam->GetNPostClocks();
     962           0 :         if (end > 20) end = 20;
     963           0 :         for(Int_t iClock = start; iClock <= end; iClock++) {
     964           0 :           adc[offlineCh] += adcPedSub[iClock];
     965             :         }
     966           0 :         charge = rawStream->GetPedestal(iChannel,imax); // Charge at the maximum
     967           0 :       }
     968             :       else charge = -1024;              
     969             :       
     970           0 :       if(charge != -1024) FillRawsData(kMaxChargeClock,offlineCh,imax-10);
     971             :        
     972           0 :       integrator[offlineCh] = rawStream->GetIntegratorFlag(iChannel,imax);
     973             :       
     974           0 :       Int_t board = AliADCalibData::GetBoardNumber(offlineCh);
     975           0 :       time[offlineCh] = rawStream->GetTime(iChannel)*fCalibData->GetTimeResolution(board);
     976           0 :       width[offlineCh] = rawStream->GetWidth(iChannel)*fCalibData->GetWidthResolution(board);
     977             : 
     978           0 :       FillRawsData(kChargeEoI,offlineCh,adc[offlineCh]);
     979             : 
     980           0 :       FillRawsData((integrator[offlineCh] == 0 ? kChargeEoIInt0 : kChargeEoIInt1),offlineCh,charge);
     981           0 :       FillRawsData(kChargeSaturation,offlineCh,charge);
     982             : 
     983           0 :       Float_t sigma = fCalibData->GetSigma(offlineCh+16*integrator[offlineCh]);
     984             :                   
     985           0 :       if((adc[offlineCh] > fRecoParam->GetNSigmaPed()*sigma) && !(time[offlineCh] <1.e-6)){ 
     986           0 :         if(offlineCh<8) {
     987           0 :           mulADC++;
     988           0 :           chargeADC += adc[offlineCh];
     989           0 :           chargeTrigADC += adcTrig[offlineCh];
     990             :           
     991           0 :         } else {
     992           0 :           mulADA++;
     993           0 :           chargeADA += adc[offlineCh];
     994           0 :           chargeTrigADA += adcTrig[offlineCh];
     995             :         }
     996             :       }
     997             :       // Fill HPTDC Time Histograms
     998           0 :       timeCorr[offlineCh] = CorrectLeadingTime(offlineCh,time[offlineCh],adc[offlineCh]);
     999             :    
    1000           0 :       if(time[offlineCh] > 1.e-6){
    1001           0 :         FillRawsData(kWidthSlewing,width[offlineCh],adc[offlineCh]);
    1002             :         Float_t timeErr = 1;
    1003           0 :         if (adc[offlineCh]>1) timeErr = 1/adc[offlineCh];
    1004             : 
    1005           0 :         if (offlineCh<8) {
    1006           0 :             itimeADC++;
    1007           0 :             timeADC += time[offlineCh]/(timeErr*timeErr);
    1008           0 :             weightADC += 1./(timeErr*timeErr); 
    1009           0 :             if (adc[offlineCh]>1) FillRawsData(kTimeSlewingADC,TMath::Log10(1.0/adc[offlineCh]),time[offlineCh]);
    1010             :           }
    1011             :         else{
    1012           0 :             itimeADA++;
    1013           0 :             timeADA += time[offlineCh]/(timeErr*timeErr);
    1014           0 :             weightADA += 1./(timeErr*timeErr);
    1015           0 :             if (adc[offlineCh]>1) FillRawsData(kTimeSlewingADA,TMath::Log10(1.0/adc[offlineCh]),time[offlineCh]);
    1016             :           }
    1017             :         
    1018           0 :       }
    1019             :       
    1020             :       // Fill Flag and Charge Versus LHC-Clock histograms
    1021             :       Int_t nbbFlag = 0;
    1022             :       Int_t nbgFlag = 0;
    1023           0 :       flagBB[offlineCh] = rawStream->GetBBFlag(iChannel,10);
    1024           0 :       flagBG[offlineCh] = rawStream->GetBGFlag(iChannel,10);
    1025             :       
    1026           0 :       for(Int_t iEvent=0; iEvent<21; iEvent++){
    1027           0 :         charge = rawStream->GetPedestal(iChannel,iEvent);
    1028           0 :         Int_t intgr = rawStream->GetIntegratorFlag(iChannel,iEvent);
    1029           0 :         Bool_t bbFlag     = rawStream->GetBBFlag(iChannel,iEvent);
    1030           0 :         Bool_t bgFlag     = rawStream->GetBGFlag(iChannel,iEvent);
    1031           0 :         if(bbFlag) nbbFlag++;
    1032           0 :         if(bgFlag) nbgFlag++;
    1033             :         
    1034           0 :         FillRawsData((intgr == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), offlineCh,(float)iEvent-10,(float)charge);
    1035           0 :         FillRawsData(kBBFlagVsClock, offlineCh,(float)iEvent-10,(float)bbFlag);
    1036           0 :         FillRawsData(kBGFlagVsClock, offlineCh,(float)iEvent-10,(float)bgFlag);
    1037             :         
    1038             :       }
    1039           0 :       FillRawsData(kBBFlagsPerChannel, offlineCh,nbbFlag);
    1040           0 :       FillRawsData(kBGFlagsPerChannel, offlineCh,nbgFlag);
    1041             :       //if((nbbFlag+nbgFlag)>0 && time[offlineCh]<1e-6)FillRawsData(kFlagNoTime,offlineCh);
    1042             :       //if((nbbFlag+nbgFlag)==0 && time[offlineCh]>1e-6)FillRawsData(kTimeNoFlag,offlineCh);
    1043             :       
    1044           0 :       if((flagBB[offlineCh] || flagBG[offlineCh]) && time[offlineCh]<1e-6)FillRawsData(kFlagNoTime,offlineCh);
    1045           0 :       if((!flagBB[offlineCh] && !flagBG[offlineCh]) && time[offlineCh]>1e-6)FillRawsData(kTimeNoFlag,offlineCh);
    1046             :       
    1047           0 :       FillRawsData(kHPTDCTime,offlineCh,time[offlineCh]);
    1048           0 :       FillRawsData(kHPTDCTimeRebin,offlineCh,time[offlineCh]);
    1049           0 :       FillRawsData(kWidth,offlineCh,width[offlineCh]);
    1050           0 :       if(flagBB[offlineCh]) {
    1051             :       //if(nbbFlag > 0){
    1052           0 :         FillRawsData(kHPTDCTimeBB,offlineCh,time[offlineCh]);
    1053           0 :         FillRawsData(kHPTDCTimeRebinBB,offlineCh,time[offlineCh]);
    1054           0 :         FillRawsData(kWidthBB,offlineCh,width[offlineCh]);
    1055           0 :         FillRawsData(kChargeEoIBB,offlineCh,adc[offlineCh]);
    1056           0 :         FillRawsData(kNEventsBBFlag,offlineCh);
    1057           0 :       }
    1058           0 :       if(flagBG[offlineCh]) {
    1059             :       //if(nbgFlag > 0){
    1060           0 :         FillRawsData(kHPTDCTimeBG,offlineCh,time[offlineCh]);
    1061           0 :         FillRawsData(kHPTDCTimeRebinBG,offlineCh,time[offlineCh]);
    1062           0 :         FillRawsData(kWidthBG,offlineCh,width[offlineCh]);
    1063           0 :         FillRawsData(kChargeEoIBG,offlineCh,adc[offlineCh]);
    1064           0 :         FillRawsData(kNEventsBGFlag,offlineCh);
    1065           0 :       }
    1066             :       
    1067             : 
    1068           0 :     }// END of Loop over channels
    1069             :     
    1070             :     //Correlation Cside
    1071             :     Int_t nCorrelation = 0;
    1072           0 :     for(Int_t iChannel=0; iChannel<8; iChannel++) {
    1073           0 :         for(Int_t jChannel=7; jChannel>iChannel; jChannel--) {
    1074           0 :                 FillRawsData(kNChargeCorrADC+nCorrelation,adc[iChannel],adc[jChannel]);
    1075           0 :                 FillRawsData(kNTimeCorrADC+nCorrelation,time[iChannel],time[jChannel]);
    1076           0 :                 if(time[iChannel]>1e-6 && time[jChannel]>1e-6) FillRawsData(kNTimeDiffADC+nCorrelation,time[iChannel]-time[jChannel]);
    1077           0 :                 nCorrelation++;
    1078             :                 }
    1079             :         }
    1080             :     //Correlation Aside
    1081             :     nCorrelation = 0;
    1082           0 :     for(Int_t iChannel=8; iChannel<16; iChannel++) {
    1083           0 :         for(Int_t jChannel=15; jChannel>iChannel; jChannel--) {
    1084           0 :                 FillRawsData(kNChargeCorrADA+nCorrelation,adc[iChannel],adc[jChannel]);
    1085           0 :                 FillRawsData(kNTimeCorrADA+nCorrelation,time[iChannel],time[jChannel]);
    1086           0 :                 if(time[iChannel]>1e-6 && time[jChannel]>1e-6) FillRawsData(kNTimeDiffADA+nCorrelation,time[iChannel]-time[jChannel]);
    1087           0 :                 nCorrelation++;
    1088             :                 }
    1089             :         }
    1090             :                 
    1091           0 :     for(Int_t iChannel=0; iChannel<4; iChannel++) {//Loop over pairs of pads
    1092             :         //Enable time is used to turn off the coincidence 
    1093           0 :         if((!fCalibData->GetEnableTiming(iChannel) || flagBB[iChannel]) && (!fCalibData->GetEnableTiming(iChannel+4) || flagBB[iChannel+4])) pBBmulADC++;
    1094           0 :         if((!fCalibData->GetEnableTiming(iChannel) || flagBG[iChannel]) && (!fCalibData->GetEnableTiming(iChannel+4) || flagBG[iChannel+4])) pBGmulADC++;
    1095             : 
    1096           0 :         if((!fCalibData->GetEnableTiming(iChannel+8) || flagBB[iChannel+8]) && (!fCalibData->GetEnableTiming(iChannel+12) || flagBB[iChannel+12])) pBBmulADA++;
    1097           0 :         if((!fCalibData->GetEnableTiming(iChannel+8) || flagBG[iChannel+8]) && (!fCalibData->GetEnableTiming(iChannel+12) || flagBG[iChannel+12])) pBGmulADA++;
    1098             :         }
    1099             :                                         
    1100           0 :     FillRawsData(kNBBCoincADA,pBBmulADA);
    1101           0 :     FillRawsData(kNBBCoincADC,pBBmulADC);
    1102           0 :     FillRawsData(kNBGCoincADA,pBGmulADA);
    1103           0 :     FillRawsData(kNBGCoincADC,pBGmulADC);
    1104           0 :     FillRawsData(kNBBCoincCorr,pBBmulADA,pBBmulADC);
    1105           0 :     FillRawsData(kNBGCoincCorr,pBGmulADA,pBGmulADC);
    1106             :     
    1107           0 :     for(Int_t iChannel=0; iChannel<16; iChannel++) {
    1108           0 :         for(Int_t iEvent=0; iEvent<21; iEvent++){
    1109           0 :                 offlineCh = kOfflineChannel[iChannel];
    1110           0 :                 Bool_t bbFlag = rawStream->GetBBFlag(iChannel,iEvent);
    1111           0 :                 if(pBBmulADA>0 || pBBmulADC>0)FillRawsData(kBBFlagVsClock_ADOR, offlineCh,(float)iEvent-10,(float)bbFlag);
    1112             :                 }
    1113             :         }
    1114             :     
    1115             :     //Triggers
    1116             :     Bool_t UBA = kFALSE;
    1117             :     Bool_t UBC = kFALSE;
    1118             :     Bool_t UGA = kFALSE;
    1119             :     Bool_t UGC = kFALSE;
    1120             :     
    1121           0 :     if(pBBmulADA>=fCalibData->GetBBAThreshold()) UBA = kTRUE;
    1122           0 :     if(pBBmulADC>=fCalibData->GetBBCThreshold()) UBC = kTRUE;
    1123           0 :     if(pBGmulADA>=fCalibData->GetBGAThreshold()) UGA = kTRUE;
    1124           0 :     if(pBGmulADC>=fCalibData->GetBGCThreshold()) UGC = kTRUE;
    1125             : 
    1126           0 :     if(UBA) FillRawsData(kTriggers,0);
    1127           0 :     if(UBC) FillRawsData(kTriggers,1);
    1128           0 :     if(UGA) FillRawsData(kTriggers,2);
    1129           0 :     if(UGC) FillRawsData(kTriggers,3);
    1130           0 :     if(UBA && UBC) FillRawsData(kTriggers,4);
    1131           0 :     if(UBA || UBC) FillRawsData(kTriggers,5);
    1132           0 :     if((UBA || UBC) && !(UGA || UGC)) FillRawsData(kTriggers,6);
    1133           0 :     if(UGA && UBC) FillRawsData(kTriggers,7);
    1134           0 :     if(UGC && UBA) FillRawsData(kTriggers,8);
    1135           0 :     if(UGA || UGC) FillRawsData(kTriggers,9);
    1136           0 :     if((UGA && UBC) || (UGC && UBA)) FillRawsData(kTriggers,10);
    1137             :         
    1138             :     //Average times
    1139           0 :     if(weightADA>1) timeADA /= weightADA; 
    1140             :     else timeADA = -1024.;
    1141           0 :     if(weightADC>1) timeADC /= weightADC;
    1142             :     else timeADC = -1024.;
    1143           0 :     if(timeADA<1.e-6 || timeADC<1.e-6) {
    1144             :         diffTime = -1024.;
    1145             :         sumTime = -1024;
    1146           0 :         }
    1147             :     else {
    1148           0 :         diffTime = timeADA - timeADC;
    1149           0 :         sumTime = timeADA + timeADC;
    1150             :         }
    1151             :         
    1152           0 :     FillRawsData(kMeanTimeADA,timeADA);
    1153           0 :     FillRawsData(kMeanTimeADC,timeADC);
    1154           0 :     FillRawsData(kMeanTimeDiff,diffTime);
    1155           0 :     FillRawsData(kMeanTimeCorr,timeADA,timeADC);
    1156           0 :     FillRawsData(kMeanTimeSumDiff,diffTime,sumTime);
    1157             : 
    1158           0 :     FillRawsData(kMultiADA,mulADA);
    1159           0 :     FillRawsData(kMultiADC,mulADC);
    1160             : 
    1161           0 :     FillRawsData(kChargeADA,chargeADA);
    1162           0 :     FillRawsData(kChargeADC,chargeADC);
    1163           0 :     FillRawsData(kChargeAD,chargeADA + chargeADC);
    1164           0 :     if(mulADA!=0)FillRawsData(kChargeADA_PC,chargeTrigADA/mulADA);
    1165           0 :     if(mulADC!=0)FillRawsData(kChargeADC_PC,chargeTrigADA/mulADC);
    1166             :     
    1167             :     //Decisions
    1168           0 :     Int_t windowOffset = (fCalibData->GetTriggerCountOffset(0) - 3242)*25;
    1169             :     Int_t ADADecision=0;
    1170             :     Int_t ADCDecision=0; 
    1171             : 
    1172           0 :     if(timeADA > (fADADist - windowOffset + 5*fRecoParam->GetTimeWindowBBALow()) && timeADA < (fADADist - windowOffset  + 5*fRecoParam->GetTimeWindowBBAUp())) ADADecision=1;
    1173           0 :     else if(timeADA > (-fADADist - windowOffset + 5*fRecoParam->GetTimeWindowBGALow()) && timeADA < (-fADADist - windowOffset + 5*fRecoParam->GetTimeWindowBGAUp())) ADADecision=2;
    1174           0 :     else if(timeADA>-1024.+1.e-6) ADADecision=3;
    1175             :     else ADADecision=0;
    1176             :     
    1177           0 :     if(timeADC > (fADCDist - windowOffset + 5*fRecoParam->GetTimeWindowBBCLow()) && timeADC < (fADCDist - windowOffset + 5*fRecoParam->GetTimeWindowBBCUp())) ADCDecision=1;
    1178           0 :     else if(timeADC > (-fADCDist - windowOffset + 5*fRecoParam->GetTimeWindowBGCLow()) && timeADC < (-fADCDist - windowOffset + 5*fRecoParam->GetTimeWindowBGCUp())) ADCDecision=2;
    1179           0 :     else if(timeADC>-1024.+1.e-6) ADCDecision=3;
    1180             :     else ADCDecision=0;
    1181             : 
    1182           0 :     FillRawsData(kDecisions,ADADecision,ADCDecision);
    1183             :     
    1184             :     break;
    1185           0 :   } // END of SWITCH : EVENT TYPE 
    1186             :          
    1187           0 :   delete rawStream; rawStream = 0x0;      
    1188             :   //
    1189           0 :   IncEvCountCycleRaws();
    1190           0 :   IncEvCountTotalRaws();
    1191             :   //
    1192           0 : }
    1193             : 
    1194             : //____________________________________________________________________________ 
    1195             : Float_t AliADQADataMakerRec::CorrectLeadingTime(Int_t /*i*/, Float_t time, Float_t adc) const
    1196             : {
    1197             :   // Correct the leading time
    1198             :   // for slewing effect and
    1199             :   // misalignment of the channels
    1200           0 :   if (time < 1e-6) return -1024;
    1201             :   // In case of pathological signals
    1202           0 :   if (adc < 1)return time;
    1203             : 
    1204             :   // Slewing correction
    1205             :   //time -= fTimeSlewing->Eval(adc);
    1206             :   
    1207             :    // Channel alignment and general offset subtraction
    1208             :   //  time -= fHptdcOffset[i];
    1209             :   //AliInfo(Form("time-offset %f", time));
    1210             :   
    1211             : 
    1212             :   return time;
    1213           0 : }
    1214             : 

Generated by: LCOV version 1.11