LCOV - code coverage report
Current view: top level - VZERO/VZERObase - AliVZEROQADataMakerRec.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 16 445 3.6 %
Date: 2016-06-14 17:26:59 Functions: 3 17 17.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             : 
      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 "AliVZEROQADataMakerRec.h"
      43             : #include "AliQAChecker.h"
      44             : #include "AliRawReader.h"
      45             : #include "AliVZERORawStream.h"
      46             : #include "AliVZEROdigit.h"
      47             : #include "AliVZEROConst.h"
      48             : //#include "AliVZEROReconstructor.h"
      49             : #include "AliVZEROTrending.h"
      50             : #include "AliVZEROCalibData.h"
      51             : #include "AliVZEROTriggerData.h"
      52             : #include "AliCTPTimeParams.h"
      53             : #include "event.h"
      54             : 
      55             : const Float_t kMinBBA = 68. ;
      56             : const Float_t kMaxBBA = 100. ;
      57             : const Float_t kMinBBC = 75.5 ;
      58             : const Float_t kMaxBBC = 100. ;
      59             : const Float_t kMinBGA = 54. ;
      60             : const Float_t kMaxBGA = 58. ;
      61             : const Float_t kMinBGC = 69.5 ;
      62             : const Float_t kMaxBGC = 74. ;
      63             : 
      64             :  
      65             :  
      66             :  
      67             : 
      68          44 : ClassImp(AliVZEROQADataMakerRec)
      69             :            
      70             : //____________________________________________________________________________ 
      71             : AliVZEROQADataMakerRec::AliVZEROQADataMakerRec() : 
      72           6 : AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kVZERO), "VZERO Quality Assurance Data Maker"),
      73           2 :   fCalibData(0x0),
      74           2 :   fTriggerData(0x0),
      75             : //  fEvent(0), 
      76             : //  fNTotEvents(0), 
      77             : //  fNSubEvents(0), 
      78             : //  fTrendingUpdateEvent(0), 
      79             : //  fNTrendingUpdates(0), 
      80           2 :   fTrendingUpdateTime(0), 
      81           2 :   fCycleStartTime(0), 
      82           2 :   fCycleStopTime(0),
      83           2 :   fTimeSlewing(0)
      84             :     
      85          10 : {
      86             :   // Constructor
      87             :    
      88          10 :   AliDebug(AliQAv1::GetQADebugLevel(), "Construct VZERO QA Object");
      89             : 
      90         260 :   for(Int_t i=0; i<64; i++){  
      91         128 :     fEven[i] = 0;   
      92         128 :     fOdd[i]  = 0;
      93             :   }
      94             :   
      95         516 :   for(Int_t i=0; i<128; i++){  
      96         256 :     fADCmean[i] = 0.0;   }      
      97           4 : }
      98             : 
      99             : //____________________________________________________________________________ 
     100             : AliVZEROQADataMakerRec::AliVZEROQADataMakerRec(const AliVZEROQADataMakerRec& qadm) :
     101           0 :   AliQADataMakerRec(),
     102           0 :   fCalibData(0x0),
     103           0 :   fTriggerData(0x0),
     104             :   //  fEvent(0), 
     105             :   //  fNTotEvents(0), 
     106             :   //  fNSubEvents(0), 
     107             :   //  fTrendingUpdateEvent(0), 
     108             :   //  fNTrendingUpdates(0), 
     109           0 :   fTrendingUpdateTime(0), 
     110           0 :   fCycleStartTime(0), 
     111           0 :   fCycleStopTime(0),
     112           0 :   fTimeSlewing(0)
     113             :   
     114           0 : {
     115             :   // Copy constructor 
     116             :   
     117           0 :   SetName((const char*)qadm.GetName()) ; 
     118           0 :   SetTitle((const char*)qadm.GetTitle()); 
     119           0 : }
     120             : 
     121             : //__________________________________________________________________
     122             : AliVZEROQADataMakerRec& AliVZEROQADataMakerRec::operator = (const AliVZEROQADataMakerRec& qadm )
     123             : {
     124             :   // Equal operator
     125             :   
     126           0 :   this->~AliVZEROQADataMakerRec();
     127           0 :   new(this) AliVZEROQADataMakerRec(qadm);
     128           0 :   return *this;
     129           0 : }
     130             : 
     131             : //____________________________________________________________________________
     132             : AliVZEROCalibData* AliVZEROQADataMakerRec::GetCalibData() const
     133             : 
     134             : {
     135           0 :   AliCDBManager *man = AliCDBManager::Instance();
     136             : 
     137             :   AliCDBEntry *entry=0;
     138             : 
     139           0 :   entry = man->Get("VZERO/Calib/Data",fRun);
     140           0 :   if(!entry){
     141           0 :     AliWarning("Load of calibration data from default storage failed!");
     142           0 :     AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
     143             :         
     144           0 :     man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
     145           0 :     entry = man->Get("VZERO/Calib/Data",fRun);
     146           0 :   }
     147             :   // Retrieval of data in directory VZERO/Calib/Data:
     148             : 
     149             :   AliVZEROCalibData *calibdata = 0;
     150             : 
     151           0 :   if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject();
     152           0 :   if (!calibdata)  AliFatal("No calibration data from calibration database !");
     153             : 
     154           0 :   return calibdata;
     155           0 : }
     156             : 
     157             : //____________________________________________________________________________ 
     158             : void AliVZEROQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
     159             : {
     160             :   // Detector specific actions at end of cycle
     161             :   // Does the QA checking
     162           0 :   ResetEventTrigClasses();
     163             :   //
     164           0 :   AliQAChecker::Instance()->Run(AliQAv1::kVZERO, task, list) ;
     165             :   
     166           0 :   if(task == AliQAv1::kRAWS){
     167           0 :     TTimeStamp currentTime;
     168           0 :     fCycleStopTime = currentTime.GetSec();
     169           0 :   }
     170             : 
     171           0 :   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
     172           0 :     if (! IsValidEventSpecie(specie, list)) continue ;
     173           0 :     SetEventSpecie(AliRecoParam::ConvertIndex(specie));
     174           0 :     if(task == AliQAv1::kRAWS) {
     175             :     } else if (task == AliQAv1::kESDS) {
     176             :     }
     177             :   }
     178           0 : }
     179             : 
     180             : //____________________________________________________________________________ 
     181             : void AliVZEROQADataMakerRec::InitESDs()
     182             : {
     183             :   // Creates histograms to control ESDs
     184             :   
     185             :   const Bool_t expert   = kTRUE ; 
     186             :   const Bool_t image    = kTRUE ; 
     187             :         
     188             :   TH2F * h2d;
     189             :   TH1I * h1i;
     190             :   TH1F * h1d;
     191             :                 
     192           0 :   h1i = new TH1I("H1I_Cell_Multiplicity_V0A", "Cell Multiplicity in V0A;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;  
     193           0 :   Add2ESDsList(h1i, kCellMultiV0A, !expert, image)  ;  
     194             :                                                                                                         
     195           0 :   h1i = new TH1I("H1I_Cell_Multiplicity_V0C", "Cell Multiplicity in V0;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;  
     196           0 :   Add2ESDsList(h1i, kCellMultiV0C, !expert, image)  ;  
     197             :    
     198           0 :   h1d = new TH1F("H1D_MIP_Multiplicity_V0A", "MIP Multiplicity in V0A;Multiplicity (Nb of MIP);Counts", 1000, 0, 1000) ;  
     199           0 :   Add2ESDsList(h1d, kMIPMultiV0A, !expert, image)  ;  
     200             :   
     201           0 :   h1d = new TH1F("H1D_MIP_Multiplicity_V0C", "MIP Multiplicity in V0C;Multiplicity (Nb of MIP);Counts", 1000, 0, 1000) ;  
     202           0 :   Add2ESDsList(h1d, kMIPMultiV0C, !expert, image)  ;  
     203             : 
     204           0 :   h2d = new TH2F("H2D_MIP_Multiplicity_Channel", "MIP Multiplicity per Channel;Channel;Multiplicity (Nb of MIP)",64, 0, 64, 100, 0, 100) ;  
     205           0 :   Add2ESDsList(h2d, kMIPMultiChannel, !expert, image)  ;  
     206             :   
     207           0 :   h1d = new TH1F("H1D_BBFlag_Counters", "BB Flag Counters;Channel;Counts",64, 0, 64) ;  
     208           0 :   Add2ESDsList(h1d, kBBFlag, !expert, image)  ;  
     209             :   
     210           0 :   h1d = new TH1F("H1D_BGFlag_Counters", "BG Flag Counters;Channel;Counts",64, 0, 64) ;  
     211           0 :   Add2ESDsList(h1d, kBGFlag, !expert, image)  ;  
     212             :   
     213           0 :   h2d = new TH2F("H2D_Charge_Channel", "ADC Charge per channel;Channel;Charge (ADC counts)",64, 0, 64, 1024, 0, 1024) ;  
     214           0 :   Add2ESDsList(h2d, kChargeChannel, !expert, image)  ;  
     215             :   
     216           0 :   h2d = new TH2F("H2D_Time_Channel", "Time per channel;Channel;Time (ns)",64, 0, 64, 400, -100, 100) ;  
     217           0 :   Add2ESDsList(h2d, kTimeChannel, !expert, image)  ;  
     218             :   
     219           0 :   h1d = new TH1F("H1D_V0A_Time", "Mean V0A Time;Time (ns);Counts",1000, -100., 100.);
     220           0 :   Add2ESDsList(h1d,kESDV0ATime, !expert, image); 
     221             :   
     222           0 :   h1d = new TH1F("H1D_V0C_Time", "Mean V0C Time;Time (ns);Counts",1000, -100., 100.);
     223           0 :   Add2ESDsList(h1d,kESDV0CTime, !expert, image); 
     224             :   
     225           0 :   h1d = new TH1F("H1D_Diff_Time", "Diff Time V0A - V0C;Diff Time V0A - V0C (ns);Counts",1000, -200., 200.);
     226           0 :   Add2ESDsList(h1d,kESDDiffTime, !expert, image); 
     227             :   //
     228           0 :   ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line    
     229           0 : }
     230             : 
     231             : //____________________________________________________________________________ 
     232             : void AliVZEROQADataMakerRec::InitRaws()
     233             : {
     234             :   // Creates RAW histograms in Raws subdir
     235             : 
     236             :   const Bool_t expert   = kTRUE ; 
     237             :   const Bool_t saveCorr = kTRUE ; 
     238             :   const Bool_t image    = kTRUE ; 
     239             : 
     240             :   const Int_t kNintegrator  =    2;
     241             :  
     242             :   const Int_t kNTdcTimeBins  = 1280;
     243             :   const Float_t kTdcTimeMin    =    0.;
     244             :   const Float_t kTdcTimeMax    = 75.;
     245             :     const Int_t kNTdcWidthBins =  256;
     246             :   const Float_t kTdcWidthMin   =    0;
     247             :   const Float_t kTdcWidthMax   =  200.;
     248             :   const Int_t kNChargeBins   = 1024;
     249             :   const Float_t kChargeMin     =    0;
     250             :   const Float_t kChargeMax     = 1024;
     251             :   const Int_t kNChannelBins  =   64;
     252             :   const Float_t kChannelMin    =    0;
     253             :   const Float_t kChannelMax    =   64;
     254             :   const Int_t kNPedestalBins =  200;
     255             :   const Float_t kPedestalMin   =    0;
     256             :   const Float_t kPedestalMax   =  200;
     257             :   const Int_t kNMIPBins      = 512;
     258             :   const Float_t kMIPMin        =   0;
     259             :   const Float_t kMIPMax        = 16;
     260             : 
     261             :   TH2I * h2i;
     262             :   TH2F * h2d;
     263             :   TH1I * h1i;
     264             :   TH1F * h1d;
     265             : 
     266             :   int iHisto =0;
     267             :   // Creation of Trigger Histogram
     268           0 :   h1d = new TH1F("H1D_Trigger_Type", "V0 Trigger Type;;Counts", 4,0 ,4) ;  
     269           0 :   Add2RawsList(h1d,kTriggers, !expert, image, saveCorr);   iHisto++;
     270           0 :         h1d->SetFillColor(29);
     271           0 :         h1d->SetLineWidth(2);
     272           0 :         h1d->GetXaxis()->SetLabelSize(0.06);
     273           0 :         h1d->GetXaxis()->SetNdivisions(808,kFALSE);
     274           0 :         h1d->GetXaxis()->SetBinLabel(1, "V0-AND");
     275           0 :         h1d->GetXaxis()->SetBinLabel(2, "V0-OR");
     276           0 :         h1d->GetXaxis()->SetBinLabel(3, "V0-BGA");
     277           0 :         h1d->GetXaxis()->SetBinLabel(4, "V0-BGC");
     278             : 
     279           0 :         h2d = new TH2F("H2D_Trigger_Type", "V0 Trigger Type;V0A;V0C", 4,0 ,4,4,0,4) ;  
     280           0 :         Add2RawsList(h2d,kTriggers2, !expert, image, saveCorr);   iHisto++;
     281           0 :         h2d->SetOption("coltext");
     282           0 :         h2d->GetXaxis()->SetLabelSize(0.06);
     283           0 :         h2d->GetXaxis()->SetNdivisions(808,kFALSE);
     284           0 :         h2d->GetYaxis()->SetNdivisions(808,kFALSE);
     285           0 :         h2d->GetXaxis()->SetBinLabel(1, "Empty");
     286           0 :         h2d->GetXaxis()->SetBinLabel(2, "Fake");
     287           0 :         h2d->GetXaxis()->SetBinLabel(3, "BB");
     288           0 :         h2d->GetXaxis()->SetBinLabel(4, "BG");
     289           0 :         h2d->GetYaxis()->SetBinLabel(1, "Empty");
     290           0 :         h2d->GetYaxis()->SetBinLabel(2, "Fake");
     291           0 :         h2d->GetYaxis()->SetBinLabel(3, "BB");
     292           0 :         h2d->GetYaxis()->SetBinLabel(4, "BG");
     293             : 
     294             :   // Creation of Cell Multiplicity Histograms
     295           0 :   h1i = new TH1I("H1I_Multiplicity_V0A", "Cell Multiplicity in V0A;# of Cells;Entries", 35, 0, 35) ;  
     296           0 :   Add2RawsList(h1i,kMultiV0A, expert, image, saveCorr);   iHisto++;
     297           0 :   h1i = new TH1I("H1I_Multiplicity_V0C", "Cell Multiplicity in V0C;# of Cells;Entries", 35, 0, 35) ;  
     298           0 :   Add2RawsList(h1i,kMultiV0C, expert, image, saveCorr);   iHisto++;
     299             :  
     300             :   // Creation of Total Charge Histograms
     301           0 :   h1d = new TH1F("H1D_Charge_V0A", "Total Charge in V0A;Charge [ADC counts];Counts", 4000, 0, 30000) ;  
     302           0 :   Add2RawsList(h1d,kChargeV0A, expert, !image, saveCorr);   iHisto++;
     303           0 :   h1d = new TH1F("H1D_Charge_V0C", "Total Charge in V0C;Charge [ADC counts];Counts", 4000, 0, 50000) ;  
     304           0 :   Add2RawsList(h1d,kChargeV0C, expert, !image, saveCorr);   iHisto++;
     305           0 :   h1d = new TH1F("H1D_Charge_V0", "Total Charge in V0;Charge [ADC counts];Counts", 4000, 0, 80000) ;  
     306           0 :   Add2RawsList(h1d,kChargeV0, expert, !image, saveCorr);   iHisto++;
     307             :   
     308             :   // Creation of MIP Histograms
     309           0 :   h1d = new TH1F("H1D_MIP_V0A", "Total MIP in V0A;Multiplicity [MIP];Counts", kNMIPBins,kMIPMin ,32*kMIPMax) ;  
     310           0 :   Add2RawsList(h1d,kRawMIPV0A, expert, !image, saveCorr);   iHisto++;
     311           0 :   h1d = new TH1F("H1D_MIP_V0C", "Total MIP in V0C;Multiplicity [MIP];Counts", kNMIPBins,kMIPMin ,32*kMIPMax) ;  
     312           0 :   Add2RawsList(h1d,kRawMIPV0C, expert, !image, saveCorr);   iHisto++;
     313           0 :   h1d = new TH1F("H1D_MIP_V0", "Total MIP in V0;Multiplicity [MIP];Counts", 2*kNMIPBins,kMIPMin ,64*kMIPMax) ;  
     314           0 :   Add2RawsList(h1d,kRawMIPV0, expert, !image, saveCorr);   iHisto++;
     315           0 :   h2d = new TH2F("H2D_MIP_Channel", "Nb of MIP per channel;Channel;# of Mips", kNChannelBins, kChannelMin, kChannelMax,kNMIPBins,kMIPMin ,kMIPMax) ;  
     316           0 :   Add2RawsList(h2d,kRawMIPChannel, expert, !image, !saveCorr);   iHisto++;
     317             :   
     318             :  
     319             : 
     320             :   // Creation of Charge EoI histogram 
     321           0 :   h2d = new TH2F("H2D_ChargeEoI", "Charge Event of Interest;Channel Number;Charge [ADC counts]"
     322             :                  ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, 2.*kChargeMax);
     323           0 :   Add2RawsList(h2d,kChargeEoI, !expert, image, !saveCorr); iHisto++;
     324             : 
     325           0 :   for(Int_t iInt=0;iInt<kNintegrator;iInt++){
     326             :     // Creation of Pedestal histograms 
     327           0 :     h2i = new TH2I(Form("H2I_Pedestal_Int%d",iInt), Form("Pedestal (Int%d);Channel;Pedestal [ADC counts]",iInt)
     328             :                    ,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
     329           0 :     Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), expert, !image, !saveCorr); iHisto++;
     330             :         
     331             : 
     332             :     // Creation of Charge EoI histograms 
     333           0 :     h2i = new TH2I(Form("H2I_ChargeEoI_Int%d",iInt), Form("Charge EoI (Int%d);Channel;Charge [ADC counts]",iInt)
     334             :                    ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
     335           0 :     Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), expert, image, !saveCorr); iHisto++;
     336             :     
     337           0 :     h2i = new TH2I(Form("H2I_ChargeEoI_BB_Int%d",iInt), Form("Charge EoI w/ BB Flag (Int%d);Channel;Charge [ADC counts]",iInt)
     338             :                    ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
     339           0 :     Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1), expert, !image, !saveCorr); iHisto++;
     340             :     
     341           0 :     h2i = new TH2I(Form("H2I_ChargeEoI_BG_Int%d",iInt), Form("Charge EoI w/ BG Flag (Int%d);Channel;Charge [ADC counts]",iInt)
     342             :                    ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
     343           0 :     Add2RawsList(h2i,(iInt == 0 ?  kChargeEoIBGInt0: kChargeEoIBGInt1), expert, !image, !saveCorr); iHisto++;
     344             : 
     345             :     // Creation of Charge versus LHC Clock histograms 
     346           0 :     h2d = new TH2F(Form("H2D_ChargeVsClock_Int%d",iInt), Form("Charge Versus LHC-Clock (Int%d);Channel;LHCClock;Charge [ADC counts]",iInt)
     347             :                    ,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
     348           0 :     Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), expert, !image, !saveCorr); iHisto++;
     349             :         
     350             :     // Creation of Minimum Bias Charge histograms 
     351           0 :     for(Int_t iBB=0;iBB<2;iBB++){
     352           0 :       for(Int_t iBG=0;iBG<2;iBG++){
     353           0 :         h2i = new TH2I(Form("H2I_ChargeMB_BB%d_BG%d_Int%d",iBB,iBG,iInt), Form("MB Charge (BB=%d, BG=%d, Int=%d);Channel;Charge [ADC counts]",iBB,iBG,iInt)
     354             :                        ,kNChannelBins, kChannelMin, kChannelMax,kNChargeBins, kChargeMin, kChargeMax);
     355             :         int idx;
     356           0 :         if(iInt==0){
     357           0 :           if(iBB==0){
     358           0 :             if(iBG==0) idx = kChargeMBBB0BG0Int0;
     359             :             else idx = kChargeMBBB0BG1Int0;
     360             :           } else {
     361           0 :             if(iBG==0) idx = kChargeMBBB1BG0Int0;
     362             :             else idx = kChargeMBBB1BG1Int0;
     363             :           }
     364             :         } else {
     365           0 :           if(iBB==0){
     366           0 :             if(iBG==0) idx = kChargeMBBB0BG0Int1;
     367             :             else idx = kChargeMBBB0BG1Int1;
     368             :           } else {
     369           0 :             if(iBG==0) idx = kChargeMBBB1BG0Int1;
     370             :             else idx = kChargeMBBB1BG1Int1;
     371             :           }
     372             :         }
     373           0 :         Add2RawsList(h2i,idx, expert, !image, !saveCorr); iHisto++;
     374             :       }
     375             :     }
     376             :         
     377             :   }
     378             :  
     379             :   // Creation of Time histograms 
     380           0 :   h2i = new TH2I("H2I_Width", "HPTDC Width;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
     381           0 :   Add2RawsList(h2i,kWidth, expert, !image, !saveCorr); iHisto++;
     382             : 
     383           0 :   h2i = new TH2I("H2I_Width_BB", "HPTDC Width w/ BB Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
     384           0 :   Add2RawsList(h2i,kWidthBB, expert, !image, !saveCorr); iHisto++;
     385             : 
     386           0 :   h2i = new TH2I("H2I_Width_BG", "HPTDC Width w/ BG Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
     387           0 :   Add2RawsList(h2i,kWidthBG, expert, !image, !saveCorr); iHisto++;
     388             : 
     389           0 :   h2i = new TH2I("H2I_HPTDCTime", "HPTDC Time;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
     390           0 :   Add2RawsList(h2i,kHPTDCTime, expert, image, !saveCorr); iHisto++;
     391             : 
     392           0 :   h2i = new TH2I("H2I_HPTDCTime_BB", "HPTDC Time w/ BB Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
     393           0 :   Add2RawsList(h2i,kHPTDCTimeBB, !expert, image, !saveCorr); iHisto++;
     394             : 
     395           0 :   h2i = new TH2I("H2I_HPTDCTime_BG", "HPTDC Time w/ BG Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
     396           0 :   Add2RawsList(h2i,kHPTDCTimeBG, !expert, image, !saveCorr); iHisto++;
     397             :         
     398           0 :   h1d = new TH1F("H1D_V0A_Time", "V0A Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
     399           0 :   Add2RawsList(h1d,kV0ATime, expert, !image, saveCorr); iHisto++;
     400             :         
     401           0 :   h1d = new TH1F("H1D_V0C_Time", "V0C Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
     402           0 :   Add2RawsList(h1d,kV0CTime, expert, !image, saveCorr); iHisto++;
     403             :         
     404           0 :   h1d = new TH1F("H1D_Diff_Time","Diff V0A-V0C Time;Time [ns];Counts",kNTdcTimeBins, -50., 50.);
     405           0 :   Add2RawsList(h1d,kDiffTime, expert, image, saveCorr); iHisto++;
     406             : 
     407           0 :     h2d = new TH2F("H2D_TimeV0A_V0C", "Mean Time in V0C versus V0A;Time V0A [ns];Time V0C [ns]", 
     408             :                 kNTdcTimeBins/8, kTdcTimeMin,kTdcTimeMax,kNTdcTimeBins/8, kTdcTimeMin,kTdcTimeMax) ;  
     409           0 :     Add2RawsList(h2d,kTimeV0AV0C, !expert, image, !saveCorr);   iHisto++;
     410             :         
     411             :   // Creation of Flag versus LHC Clock histograms 
     412             : 
     413           0 :   h1d = new TH1F("H1D_BBFlagPerChannel", "BB-Flags Versus Channel;Channel;BB Flags Count",kNChannelBins, kChannelMin, kChannelMax );
     414           0 :   h1d->SetMinimum(0);
     415           0 :   Add2RawsList(h1d,kBBFlagsPerChannel, !expert, image, !saveCorr); iHisto++;
     416             : 
     417           0 :   h2d = new TH2F("H2D_BBFlagVsClock", "BB-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
     418           0 :   Add2RawsList(h2d,kBBFlagVsClock, expert, !image, !saveCorr); iHisto++;
     419             :         
     420           0 :   h2d = new TH2F("H2D_BGFlagVsClock", "BG-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
     421           0 :   Add2RawsList(h2d,kBGFlagVsClock, expert, !image, !saveCorr); iHisto++;
     422             :   // 
     423             :   // Creation of histograms with the charge sums used inthe centrality triggers
     424           0 :   h2d = new TH2F("H2D_CentrChargeV0A_V0C","Trigger charge sums V0C vs V0A; V0A Charge Sum [ADC counts]; V0C Charge Sum [ADC counts];",
     425             :                  300,0,15000,500,0,25000);
     426           0 :   Add2RawsList(h2d,kCentrChargeV0AV0C, !expert, image, saveCorr); iHisto++;
     427             : 
     428           0 :   AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto));
     429             :   //
     430           0 :   ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
     431           0 : }
     432             : 
     433             : //____________________________________________________________________________ 
     434             : void AliVZEROQADataMakerRec::InitDigits()
     435             : {
     436             :   // create Digits histograms in Digits subdir
     437             :   const Bool_t expert   = kTRUE ; 
     438             :   const Bool_t image    = kTRUE ; 
     439             :   
     440           0 :   TH1I *fhDigTDC[64]; 
     441           0 :   TH1I *fhDigADC[64]; 
     442             :   
     443             :   // create Digits histograms in Digits subdir
     444           0 :   TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in VZERO;# of Digits;Entries", 100, 0, 99) ; 
     445           0 :   h0->Sumw2() ;
     446           0 :   Add2DigitsList(h0, 0, !expert, image) ;
     447             :   
     448           0 :   for (Int_t i=0; i<64; i++)
     449             :     {
     450           0 :       fhDigTDC[i] = new TH1I(Form("hDigitTDC%d", i),Form("Digit TDC in cell %d; TDC value;Entries",i),300,0.,149.);
     451             :     
     452           0 :       fhDigADC[i]= new TH1I(Form("hDigitADC%d",i),Form("Digit ADC in cell %d;ADC value;Entries",i),1024,0.,1023.);
     453             :     
     454           0 :       Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
     455           0 :       Add2DigitsList(fhDigADC[i],i+1+64, !expert, image);  
     456             :     }  
     457             :   //
     458           0 :   ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
     459           0 : }
     460             : 
     461             : //____________________________________________________________________________
     462             : void AliVZEROQADataMakerRec::MakeDigits()
     463             : {
     464             :   // makes data from Digits
     465             : 
     466           0 :   FillDigitsData(0,fDigitsArray->GetEntriesFast()) ; 
     467           0 :   TIter next(fDigitsArray) ; 
     468             :   AliVZEROdigit *aVZERODigit ; 
     469           0 :   while ( (aVZERODigit = dynamic_cast<AliVZEROdigit *>(next())) ) {
     470           0 :     Int_t   aPMNumber  = aVZERODigit->PMNumber();         
     471           0 :     FillDigitsData(aPMNumber +1,    aVZERODigit->Time()) ;    // in 100 of picoseconds
     472           0 :     FillDigitsData(aPMNumber +1+64, aVZERODigit->ADC()) ;
     473             :   }  
     474           0 : }
     475             : 
     476             : 
     477             : //____________________________________________________________________________
     478             : void AliVZEROQADataMakerRec::MakeDigits(TTree *digitTree)
     479             : {
     480             :   // makes data from Digit Tree
     481             :         
     482           0 :   if ( fDigitsArray ) 
     483           0 :     fDigitsArray->Clear() ; 
     484             :   else 
     485           0 :     fDigitsArray = new TClonesArray("AliVZEROdigit", 1000) ; 
     486             :   
     487           0 :   TBranch * branch = digitTree->GetBranch("VZERODigit") ;
     488           0 :   if ( ! branch ) {
     489           0 :     AliWarning("VZERO branch in Digit Tree not found") ; 
     490           0 :   } else {
     491           0 :     branch->SetAddress(&fDigitsArray) ;
     492           0 :     branch->GetEntry(0) ; 
     493           0 :     MakeDigits() ; 
     494             :   }  
     495             :   //  
     496           0 :   IncEvCountCycleDigits();
     497           0 :   IncEvCountTotalDigits();
     498             :   //
     499           0 : }
     500             : 
     501             : 
     502             : //____________________________________________________________________________
     503             : void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
     504             : {
     505             :   // Creates QA data from ESDs
     506             :   
     507           0 :   UInt_t eventType = esd->GetEventType();
     508             : 
     509           0 :   switch (eventType){
     510             :   case PHYSICS_EVENT:
     511           0 :     AliESDVZERO *esdVZERO=esd->GetVZEROData();
     512             :    
     513           0 :     if (!esdVZERO) break;
     514             :                   
     515           0 :     FillESDsData(kCellMultiV0A,esdVZERO->GetNbPMV0A());
     516           0 :     FillESDsData(kCellMultiV0C,esdVZERO->GetNbPMV0C());  
     517           0 :     FillESDsData(kMIPMultiV0A,esdVZERO->GetMTotV0A());
     518           0 :     FillESDsData(kMIPMultiV0C,esdVZERO->GetMTotV0C());  
     519             :         
     520           0 :     for(Int_t i=0;i<64;i++) {
     521           0 :       FillESDsData(kMIPMultiChannel,(Float_t) i,(Float_t) esdVZERO->GetMultiplicity(i));
     522           0 :       FillESDsData(kChargeChannel,(Float_t) i,(Float_t) esdVZERO->GetAdc(i));
     523           0 :       if (i < 32) {
     524           0 :         if(esdVZERO->BBTriggerV0C(i)) FillESDsData(kBBFlag,(Float_t) i);
     525           0 :         if(esdVZERO->BGTriggerV0C(i)) FillESDsData(kBGFlag,(Float_t) i);
     526             :       }
     527             :       else {
     528           0 :         if(esdVZERO->BBTriggerV0A(i-32)) FillESDsData(kBBFlag,(Float_t) i);  
     529           0 :         if(esdVZERO->BGTriggerV0A(i-32)) FillESDsData(kBGFlag,(Float_t) i);
     530             :       }                 
     531           0 :       Float_t time = (Float_t) esdVZERO->GetTime(i); //Convert in ns:  1 TDC channel = 100ps 
     532           0 :       FillESDsData(kTimeChannel,(Float_t) i,time);
     533             :     }
     534             :                                 
     535           0 :     Float_t timeV0A = esdVZERO->GetV0ATime();
     536           0 :     Float_t timeV0C = esdVZERO->GetV0CTime();
     537             :     Float_t diffTime;
     538             : 
     539           0 :     if(timeV0A<-1024.+1.e-6 || timeV0C<-1024.+1.e-6) diffTime = -1024.;
     540           0 :     else diffTime = timeV0A - timeV0C;
     541             : 
     542           0 :     FillESDsData(kESDV0ATime,timeV0A);
     543           0 :     FillESDsData(kESDV0CTime,timeV0C);
     544           0 :     FillESDsData(kESDDiffTime,diffTime);
     545             :                 
     546             :     break;
     547             :   }  
     548             :   //
     549           0 :   IncEvCountCycleESDs();
     550           0 :   IncEvCountTotalESDs();  
     551             :   //
     552           0 : }
     553             : 
     554             : //____________________________________________________________________________
     555             : void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
     556             : {
     557             :   // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
     558             :                   
     559             :                                           
     560             :   // Check id histograms already created for this Event Specie
     561           0 :   if ( ! GetRawsData(kPedestalInt0) )
     562           0 :     InitRaws() ;
     563             : 
     564           0 :   rawReader->Reset() ; 
     565           0 :   AliVZERORawStream* rawStream  = new AliVZERORawStream(rawReader); 
     566           0 :   if(!(rawStream->Next())) return;  
     567             :  
     568           0 :   eventTypeType eventType = rawReader->GetType();
     569             : 
     570             :   Int_t    mulV0A = 0 ; 
     571             :   Int_t    mulV0C = 0 ; 
     572             :   Double_t timeV0A =0., timeV0C = 0.;
     573             :   Double_t weightV0A =0., weightV0C = 0.;
     574             :   UInt_t   itimeV0A=0, itimeV0C=0;
     575             :   Double_t chargeV0A=0., chargeV0C=0.;
     576             :   Double_t mipV0A=0., mipV0C=0.;
     577             : 
     578             :   Double_t diffTime=-100000.;
     579             : 
     580             :   
     581           0 :   switch (eventType){
     582             :   case PHYSICS_EVENT:
     583             :   
     584             :     //    fNTotEvents++; // Use framework counters instead
     585             : 
     586             :     Int_t  iFlag=0;
     587             :     Int_t  pedestal;
     588             :     Int_t  integrator;
     589           0 :     Bool_t flagBB[64];   
     590           0 :     Bool_t flagBG[64];   
     591             :     Int_t  mbCharge;
     592             :     Float_t charge;
     593             :     Int_t  offlineCh;
     594           0 :     Float_t adc[64], time[64], width[64], timeCorr[64]; 
     595             : 
     596           0 :     for(Int_t iChannel=0; iChannel<64; iChannel++) { // BEGIN : Loop over channels
     597             :                    
     598           0 :       offlineCh = rawStream->GetOfflineChannel(iChannel);
     599             :                    
     600             :       // Fill Pedestal histograms
     601             :            
     602           0 :       for(Int_t j=15; j<21; j++) {
     603           0 :         if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++;
     604             :       }
     605             : 
     606           0 :       if(iFlag == 0){ //No Flag found
     607           0 :         for(Int_t j=15; j<21; j++){
     608           0 :           pedestal= (Int_t) rawStream->GetPedestal(iChannel, j);
     609           0 :           integrator = rawStream->GetIntegratorFlag(iChannel, j);
     610             : 
     611           0 :           FillRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1),offlineCh,pedestal);
     612             :         }
     613           0 :       }
     614             : 
     615             :       // Fill Charge EoI histograms
     616             :            
     617           0 :       adc[offlineCh]    = 0.0;
     618             : 
     619             :       // Search for the maximum charge in the train of 21 LHC clocks 
     620             :       // regardless of the integrator which has been operated:
     621             :       Float_t maxadc = 0;
     622             :       Int_t imax = -1;
     623           0 :       Float_t adcPedSub[21];
     624           0 :       for(Int_t iClock=0; iClock<21; iClock++){
     625           0 :         Bool_t iIntegrator = rawStream->GetIntegratorFlag(iChannel,iClock);
     626           0 :         Int_t k = offlineCh+64*iIntegrator;
     627             : 
     628             :         //printf(Form("clock = %d adc = %f ped %f\n",iClock,rawStream->GetPedestal(iChannel,iClock),fPedestal[k]));
     629             : 
     630           0 :         adcPedSub[iClock] = rawStream->GetPedestal(iChannel,iClock) - fCalibData->GetPedestal(k);
     631             :         //                              if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) {
     632           0 :         if(adcPedSub[iClock] <= 2.*fCalibData->GetSigma(k)) {
     633           0 :           adcPedSub[iClock] = 0;
     634           0 :           continue;
     635             :         }
     636             :         //                              if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue;
     637           0 :         if(iClock < 8 || iClock > 12) continue;
     638           0 :         if(adcPedSub[iClock] > maxadc) {
     639             :           maxadc = adcPedSub[iClock];
     640             :           imax   = iClock;
     641           0 :         }
     642           0 :       }
     643             :       //printf(Form("Channel %d (online), %d (offline)\n",iChannel,j)); 
     644           0 :       if (imax != -1) {
     645             :         //                              Int_t start = imax - GetRecoParam()->GetNPreClocks();
     646           0 :         Int_t start = imax - 2;
     647           0 :         if (start < 0) start = 0;
     648             :         //                              Int_t end = imax + GetRecoParam()->GetNPostClocks();
     649           0 :         Int_t end = imax + 1;
     650           0 :         if (end > 20) end = 20;
     651           0 :         for(Int_t iClock = start; iClock <= end; iClock++) {
     652           0 :           adc[offlineCh] += adcPedSub[iClock];
     653             :         }
     654           0 :       }
     655             :         
     656             :                 
     657             :       Int_t iClock  = imax;
     658           0 :       charge = rawStream->GetPedestal(iChannel,iClock); // Charge at the maximum 
     659             : 
     660           0 :       integrator    = rawStream->GetIntegratorFlag(iChannel,iClock);
     661           0 :       flagBB[offlineCh]  = rawStream->GetBBFlag(iChannel, iClock);
     662           0 :       flagBG[offlineCh]  = rawStream->GetBGFlag(iChannel,iClock );
     663           0 :       Int_t board = AliVZEROCalibData::GetBoardNumber(offlineCh);
     664           0 :       time[offlineCh] = rawStream->GetTime(iChannel)*fCalibData->GetTimeResolution(board);
     665           0 :       width[offlineCh] = rawStream->GetWidth(iChannel)*fCalibData->GetWidthResolution(board);
     666             : 
     667           0 :       if (time[offlineCh] >= 1e-6) FillRawsData(kChargeEoI,offlineCh,adc[offlineCh]);
     668             : 
     669           0 :       FillRawsData((integrator == 0 ? kChargeEoIInt0 : kChargeEoIInt1),offlineCh,charge);
     670           0 :       if(flagBB[offlineCh]) FillRawsData((integrator == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1),offlineCh,charge);
     671           0 :       if(flagBG[offlineCh]) FillRawsData((integrator == 0 ? kChargeEoIBGInt0 : kChargeEoIBGInt1),offlineCh,charge);
     672             : 
     673           0 :       Float_t sigma = fCalibData->GetSigma(offlineCh+64*integrator);
     674             : 
     675             :                    
     676             :       // Calculation of the number of MIP
     677           0 :       Double_t mipEoI = adc[offlineCh] * fCalibData->GetMIPperADC(offlineCh);
     678             : 
     679           0 :       if((adc[offlineCh] > 2.*sigma) && !(time[offlineCh] <1.e-6)){ 
     680           0 :         FillRawsData(kRawMIPChannel,offlineCh,mipEoI);
     681           0 :         if(offlineCh<32) {
     682           0 :           mulV0C++;
     683           0 :           chargeV0C += adc[offlineCh];
     684           0 :           mipV0C += mipEoI;
     685           0 :         } else {
     686           0 :           mulV0A++;
     687           0 :           chargeV0A += adc[offlineCh];
     688           0 :           mipV0A += mipEoI;
     689             :         }
     690             :       }
     691             : 
     692             :       // Fill Charge Minimum Bias Histograms
     693             :                    
     694             :       int idx;
     695           0 :       for(Int_t iBunch=0; iBunch<10; iBunch++){
     696           0 :         integrator = rawStream->GetIntMBFlag(iChannel, iBunch);
     697           0 :         bool bbFlag     = rawStream->GetBBMBFlag(iChannel, iBunch);
     698           0 :         bool bgFlag     = rawStream->GetBGMBFlag(iChannel, iBunch);
     699           0 :         mbCharge   = rawStream->GetChargeMB(iChannel, iBunch);
     700             : 
     701           0 :         if(integrator==0){
     702           0 :           if(bbFlag==0){
     703           0 :             if(bgFlag==0) idx = kChargeMBBB0BG0Int0;
     704             :             else idx = kChargeMBBB0BG1Int0;
     705             :           } else {
     706           0 :             if(bgFlag==0) idx = kChargeMBBB1BG0Int0;
     707             :             else idx = kChargeMBBB1BG1Int0;
     708             :           }
     709             :         } else {
     710           0 :           if(bbFlag==0){
     711           0 :             if(bgFlag==0) idx = kChargeMBBB0BG0Int1;
     712             :             else idx = kChargeMBBB0BG1Int1;
     713             :           } else {
     714           0 :             if(bgFlag==0) idx = kChargeMBBB1BG0Int1;
     715             :             else idx = kChargeMBBB1BG1Int1;
     716             :           }
     717             :         }
     718           0 :         FillRawsData(idx,offlineCh,mbCharge);
     719             :       }   
     720             : 
     721             :       // Fill HPTDC Time Histograms
     722           0 :       timeCorr[offlineCh] = CorrectLeadingTime(offlineCh,time[offlineCh],adc[offlineCh]);
     723             : 
     724             :       const Float_t p1 = 2.50; // photostatistics term in the time resolution
     725           0 :       Float_t p2 = (AliCDBManager::Instance()->GetRun() >= 215011) ? 1.80 : 3.00; // slewing related term in the time resolution, smaller in Run2
     726           0 :       if(timeCorr[offlineCh]>-1024 + 1.e-6){
     727           0 :         Float_t nphe = adc[offlineCh]*kChargePerADC/(fCalibData->GetGain(offlineCh)*TMath::Qe());
     728             :         Float_t timeErr = 0;
     729             :         Float_t intTimeRes = kIntTimeRes;
     730             :         // For Run2 reco use the time resolution ring by ring
     731           0 :         if (AliCDBManager::Instance()->GetRun() >= 215011) intTimeRes = kIntTimeResRing[offlineCh/8];
     732           0 :         if (nphe>1.e-6) timeErr = TMath::Sqrt(intTimeRes*intTimeRes+
     733           0 :                                               p1*p1/nphe+
     734           0 :                                               p2*p2*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*
     735           0 :                                               TMath::Power(adc[offlineCh]/fCalibData->GetCalibDiscriThr(offlineCh,kTRUE,AliCDBManager::Instance()->GetRun()),2.*(fTimeSlewing->GetParameter(1)-1.))/
     736           0 :                                               (fCalibData->GetCalibDiscriThr(offlineCh,kTRUE,AliCDBManager::Instance()->GetRun())*fCalibData->GetCalibDiscriThr(offlineCh,kTRUE,AliCDBManager::Instance()->GetRun())));
     737             : 
     738           0 :         if (timeErr>1.e-6) {
     739           0 :           if (offlineCh<32) {
     740           0 :             itimeV0C++;
     741           0 :             timeV0C += timeCorr[offlineCh]/(timeErr*timeErr);
     742           0 :             weightV0C += 1./(timeErr*timeErr);
     743           0 :           }else{
     744           0 :             itimeV0A++;
     745           0 :             timeV0A += timeCorr[offlineCh]/(timeErr*timeErr);
     746           0 :             weightV0A += 1./(timeErr*timeErr);
     747             :           }
     748             :         }
     749           0 :       }
     750           0 :       FillRawsData(kHPTDCTime,offlineCh,timeCorr[offlineCh]);
     751           0 :       FillRawsData(kWidth,offlineCh,width[offlineCh]);
     752           0 :       if(flagBB[offlineCh]) {
     753           0 :         FillRawsData(kHPTDCTimeBB,offlineCh,timeCorr[offlineCh]);
     754           0 :         FillRawsData(kWidthBB,offlineCh,width[offlineCh]);
     755           0 :       }
     756           0 :       if(flagBG[offlineCh]) {
     757           0 :         FillRawsData(kHPTDCTimeBG,offlineCh,timeCorr[offlineCh]);
     758           0 :         FillRawsData(kWidthBG,offlineCh,width[offlineCh]);
     759           0 :       }
     760             : 
     761             :       // Fill Flag and Charge Versus LHC-Clock histograms
     762             :            
     763           0 :       for(Int_t iEvent=0; iEvent<21; iEvent++){
     764           0 :         charge = rawStream->GetPedestal(iChannel,iEvent);
     765           0 :         integrator = rawStream->GetIntegratorFlag(iChannel,iEvent);
     766           0 :         bool bbFlag       = rawStream->GetBBFlag(iChannel, iEvent);
     767           0 :         bool bgFlag       = rawStream->GetBGFlag(iChannel,iEvent );
     768             : 
     769           0 :         FillRawsData((integrator == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), offlineCh,(float)iEvent-10,(float)charge);
     770           0 :         FillRawsData(kBBFlagVsClock, offlineCh,(float)iEvent-10,(float)bbFlag);
     771           0 :         FillRawsData(kBGFlagVsClock, offlineCh,(float)iEvent-10,(float)bgFlag);
     772           0 :         if(iEvent==10) FillRawsData(kBBFlagsPerChannel, offlineCh,(float)bbFlag);
     773             :       }
     774             : 
     775           0 :     }// END of Loop over channels
     776             : 
     777           0 :     if(weightV0A>1.e-6) timeV0A /= weightV0A; 
     778             :     else timeV0A = -1024.;
     779           0 :     if(weightV0C>1.e-6) timeV0C /= weightV0C;
     780             :     else timeV0C = -1024.;
     781           0 :     if(timeV0A<-1024.+1.e-6 || timeV0C<-1024.+1.e-6) diffTime = -1024.;
     782           0 :     else diffTime = timeV0A - timeV0C;
     783             :     
     784             :     Bool_t v0ABB = kFALSE;
     785             :     Bool_t v0CBB = kFALSE;
     786             :     Bool_t v0ABG = kFALSE;
     787             :     Bool_t v0CBG = kFALSE;
     788             :     Bool_t v0AFake = kFALSE;
     789             :     Bool_t v0CFake = kFALSE;
     790             :     Bool_t v0AEmpty = kFALSE;
     791             :     Bool_t v0CEmpty = kFALSE;
     792             :     Int_t v0ATrigger=0;
     793             :     Int_t v0CTrigger=0; 
     794             :     
     795             :     // Change default BB and BG windows according to the Trigger Count Offset setting with respect to the default one which is 3247.
     796           0 :     Float_t winOffset = (fCalibData->GetTriggerCountOffset(0) - 3247)*25.;
     797             :     
     798           0 :     if((timeV0A>kMinBBA-winOffset) && (timeV0A<kMaxBBA-winOffset)) {
     799             :       v0ABB = kTRUE;
     800             :       v0ATrigger=2;
     801           0 :     } else if((timeV0A>kMinBGA-winOffset) && (timeV0A<kMaxBGA-winOffset)) {
     802             :       v0ABG = kTRUE;
     803             :       v0ATrigger=3;
     804           0 :     } else if(timeV0A>-1024.+1.e-6) {
     805             :       v0AFake = kTRUE;
     806             :       v0ATrigger=1;
     807           0 :     } else {
     808             :       v0AEmpty = kTRUE;
     809             :       v0ATrigger=0;
     810             :     }
     811             :     
     812           0 :     if((timeV0C>kMinBBC-winOffset) && (timeV0C<kMaxBBC-winOffset)) {
     813             :       v0CBB = kTRUE;
     814             :       v0CTrigger=2;
     815           0 :     } else if((timeV0C>kMinBGC-winOffset) && (timeV0C<kMaxBGC-winOffset)) {
     816             :       v0CBG = kTRUE;
     817             :       v0CTrigger=3;
     818           0 :     } else if(timeV0C>-1024.+1.e-6) {
     819             :       v0CFake = kTRUE;
     820             :       v0CTrigger=1;
     821           0 :     } else {
     822             :       v0CEmpty = kTRUE;
     823             :       v0CTrigger=0;
     824             :     }
     825             : 
     826             :     // Fill Trigger output histogram
     827           0 :     if(v0ABB && v0CBB) FillRawsData(kTriggers,0);
     828           0 :     if((v0ABB || v0CBB) && !(v0ABG || v0CBG)) FillRawsData(kTriggers,1);
     829           0 :     if(v0ABG && v0CBB) FillRawsData(kTriggers,2);
     830           0 :     if(v0ABB && v0CBG) FillRawsData(kTriggers,3);
     831             :                 
     832           0 :     FillRawsData(kTriggers2,v0ATrigger,v0CTrigger);
     833             : 
     834           0 :     FillRawsData(kV0ATime,timeV0A);
     835           0 :     FillRawsData(kV0CTime,timeV0C);
     836           0 :     FillRawsData(kDiffTime,diffTime);
     837           0 :     FillRawsData(kTimeV0AV0C,timeV0A,timeV0C);
     838             : 
     839           0 :     FillRawsData(kMultiV0A,mulV0A);
     840           0 :     FillRawsData(kMultiV0C,mulV0C);
     841             : 
     842           0 :     FillRawsData(kChargeV0A,chargeV0A);
     843           0 :     FillRawsData(kChargeV0C,chargeV0C);
     844           0 :     FillRawsData(kChargeV0,chargeV0A + chargeV0C);
     845             : 
     846           0 :     FillRawsData(kRawMIPV0A,mipV0A);
     847           0 :     FillRawsData(kRawMIPV0C,mipV0C);
     848           0 :     FillRawsData(kRawMIPV0,mipV0A + mipV0C);
     849             : 
     850             :     // Fill the histograms with charge sums used in the centrality triggers
     851           0 :     UShort_t chargeA = 0;
     852           0 :     UShort_t chargeC = 0;
     853           0 :     rawStream->CalculateChargeForCentrTriggers(fTriggerData,chargeA,chargeC);
     854           0 :     FillRawsData(kCentrChargeV0AV0C,(Float_t)chargeA,(Float_t)chargeC);
     855             :             
     856             :     break;
     857           0 :   } // END of SWITCH : EVENT TYPE 
     858             :         
     859             :   //  fEvent++;  // RS: Use framework counters instead
     860           0 :   TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0A)->GetName()))) ; 
     861           0 :   if (p) p->SetVal((double)mulV0A) ; 
     862             : 
     863           0 :   p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0C)->GetName()))) ; 
     864           0 :   if (p) p->SetVal((double)mulV0C) ;                     
     865             : 
     866           0 :   p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0A)->GetName()))) ; 
     867           0 :   if (p) p->SetVal((double)chargeV0A) ; 
     868             : 
     869           0 :   p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0C)->GetName()))) ; 
     870           0 :   if (p) p->SetVal((double)chargeV0C) ;                     
     871             : 
     872           0 :   p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0)->GetName()))) ; 
     873           0 :   if (p) p->SetVal((double)(chargeV0A + chargeV0C)) ;                     
     874             :         
     875           0 :   p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0A)->GetName()))) ; 
     876           0 :   if (p) p->SetVal((double)mipV0A) ; 
     877             :         
     878           0 :   p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0C)->GetName()))) ; 
     879           0 :   if (p) p->SetVal((double)mipV0C) ;                     
     880             :         
     881           0 :   p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0)->GetName()))) ; 
     882           0 :   if (p) p->SetVal((double)(mipV0A + mipV0C)) ;                     
     883             :         
     884           0 :   p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0ATime)->GetName()))) ; 
     885           0 :   if (p) p->SetVal((double)timeV0A) ; 
     886             :         
     887           0 :   p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0CTime)->GetName()))) ; 
     888           0 :   if (p) p->SetVal((double)timeV0C) ;                     
     889             :         
     890           0 :   p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ; 
     891           0 :   if (p) p->SetVal((double)diffTime) ;                     
     892             :         
     893           0 :   delete rawStream; rawStream = 0x0;      
     894             :   //
     895           0 :   IncEvCountCycleRaws();
     896           0 :   IncEvCountTotalRaws();
     897             :   //
     898           0 : }
     899             : 
     900             : //____________________________________________________________________________ 
     901             : void AliVZEROQADataMakerRec::StartOfDetectorCycle()
     902             : {
     903             :   // Detector specific actions at start of cycle
     904             :   
     905             :   // Reset of the histogram used - to have the trend versus time -
     906             :  
     907           0 :   fCalibData = GetCalibData();
     908             :  
     909           0 :   AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
     910           0 :   if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
     911           0 :   AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
     912           0 :   Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
     913             : 
     914           0 :   AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
     915           0 :   if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !");
     916           0 :   AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
     917           0 :   l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
     918             : 
     919           0 :   AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeDelays");
     920           0 :   if (!entry2) AliFatal("VZERO time delays are not found in OCDB !");
     921           0 :   TH1F *delays = (TH1F*)entry2->GetObject();
     922             : 
     923           0 :   AliCDBEntry *entry3 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeSlewing");
     924           0 :   if (!entry3) AliFatal("VZERO time slewing function is not found in OCDB !");
     925           0 :   fTimeSlewing = (TF1*)entry3->GetObject();
     926             : 
     927           0 :   AliCDBEntry *entry4 = AliCDBManager::Instance()->Get("VZERO/Trigger/Data");
     928           0 :   if (!entry4) AliFatal("VZERO trigger config data is not found in OCDB !");
     929           0 :   fTriggerData = (AliVZEROTriggerData*)entry4->GetObject();
     930             : 
     931           0 :   for(Int_t i = 0 ; i < 64; ++i) {
     932             :     //Int_t board = AliVZEROCalibData::GetBoardNumber(i);
     933           0 :     fTimeOffset[i] = (
     934             :                       //        ((Float_t)fCalibData->GetTriggerCountOffset(board) -
     935             :                       //        (Float_t)fCalibData->GetRollOver(board))*25.0 +
     936             :                       //     fCalibData->GetTimeOffset(i) -
     937             :                       //     l1Delay+
     938           0 :                       delays->GetBinContent(i+1)//+
     939             :                       //      kV0Offset
     940             :                       );
     941             :     //                AliInfo(Form(" fTimeOffset[%d] = %f  kV0offset %f",i,fTimeOffset[i],kV0Offset));
     942             :   }
     943             : 
     944             :  
     945             :  
     946             :   
     947             :         
     948           0 :   TTimeStamp currentTime;
     949           0 :   fCycleStartTime = currentTime.GetSec();
     950             :  
     951             :   //  fNTotEvents = 0;
     952           0 : }
     953             : 
     954             : 
     955             : //-------------------------------------------------------------------------------------------------
     956             : Float_t AliVZEROQADataMakerRec::CorrectLeadingTime(Int_t i, Float_t time, Float_t adc) const
     957             : {
     958             :   // Correct the leading time
     959             :   // for slewing effect and
     960             :   // misalignment of the channels
     961           0 :   if (time < 1e-6) return -1024;
     962             : 
     963             :   // Channel alignment and general offset subtraction
     964             :   //  if (i < 32) time -= kV0CDelayCables;
     965             :   //  time -= fTimeOffset[i];
     966             :   //AliInfo(Form("time-offset %f", time));
     967             : 
     968             :   // In case of pathological signals
     969           0 :   if (adc < 1e-6) return time;
     970             : 
     971             :   // Slewing correction
     972           0 :   Float_t thr = fCalibData->GetCalibDiscriThr(i,kTRUE,AliCDBManager::Instance()->GetRun());
     973             :   //AliInfo(Form("adc %f thr %f dtime %f ", adc,thr,fTimeSlewing->Eval(adc/thr)));
     974           0 :   time -= fTimeSlewing->Eval(adc/thr);
     975             : 
     976             :   return time;
     977           0 : }
     978             : 

Generated by: LCOV version 1.11