LCOV - code coverage report
Current view: top level - TOF/TOFrec - AliTOFQADataMakerRec.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 16 838 1.9 %
Date: 2016-06-14 17:26:59 Functions: 3 33 9.1 %

          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             : //                                                                   //
      18             : //  Produces the data needed to calculate the TOF quality assurance. //
      19             : //  QA objects are 1 & 2 Dimensional histograms.                     //
      20             : //  first author: S.Arcelli                                          //
      21             : //  mantained by: F. Bellini                                         //
      22             : ///////////////////////////////////////////////////////////////////////
      23             : 
      24             : /*
      25             : Modified by fbellini on 01/11/2011
      26             : - removed TLines as functions
      27             : - changed shifters plots for 2012 DQM
      28             : 
      29             : Modified by fbellini on 01/11/2011
      30             : - added histograms for LTM monitoring
      31             : - fix for coverity
      32             : 
      33             : Modified by fbellini on 17/10/2011
      34             : - fix for memory leak in constructor
      35             : - added methods to read histos ranges from config file in DQM
      36             : - added CTTM maps + relative methods to retrieve CTTM numbering
      37             : - removed obslete comments
      38             : 
      39             : Modified by fbellini & rshanoian on 06/07/2011
      40             : - changes for trigger classes implementation
      41             : - fRunNumber added as private member
      42             : - added time vs BCID plot
      43             : 
      44             : Modified by fbellini on 18/01/2011
      45             : - reduced histo binning to reduce size 
      46             : - added decoding errors plot
      47             : - added channel maps and options for DQM shifters
      48             : - new list of recPoints and ESDs plots
      49             : - removed hTrmChannels035 and hTrmChannels3671
      50             : 
      51             :  Modified by bvonhall on 03/11/2010
      52             :    - modified declaration of hTrmChannels035 and hTrmChannels3671 in EndOfDetectorCycle()
      53             :      to prevent memory corruption
      54             :    
      55             :  Modified by adecaro on 18/10/2010
      56             :    - fTOFRawStream object set as private member
      57             :  
      58             : Modified by fbellini on 13/09/2010
      59             :   - Set TLines as private members
      60             :   - Set image flag for expert histos
      61             : 
      62             : Modified by fbellini on 14/06/2010
      63             :   - Updated plots
      64             :   - use LoadRawDataBuffersV2()
      65             : 
      66             :   Modified by fbellini on 10/05/2010
      67             :   - Fixed EndOfDetectorCycle() memory corruption bug
      68             : 
      69             :   Modified by fbellini on 22/04/2010
      70             :    - Added filter for physics events
      71             : 
      72             :    Modified by fbellini on 16/04/2010
      73             :    - Added EnableDqmShifterOpt() 
      74             :    - Modified EndOfDetectorCycle() with options for DQM         
      75             :    - Updated ESDs QA
      76             : 
      77             :    Modified by fbellini on 30/03/2010
      78             :    - Changed raws time histos range to 610ns
      79             :    - Added FilterLTMData() and FilterSpare() methods
      80             :    - Added check on enabled channels for raw data               
      81             :    - Updated RecPoints QA
      82             : 
      83             :    Modified by fbellini on 02/03/2010
      84             :    - Fixed raw data decoding methods (use AliTOFRawStream::LoadRawDataBuffer())
      85             :    - Added filter for noisy channels and read map from OCDB
      86             :    - Added GetCalibData() method
      87             :    - Added CheckVolumeID() and CheckEquipID() methods  
      88             :    - Updated Raw QA
      89             : */
      90             : #include <iostream>
      91             : #include <fstream>
      92             : 
      93             : #include <TClonesArray.h>
      94             : #include <TH1F.h> 
      95             : #include <TH2F.h> 
      96             : #include <TLine.h>
      97             : #include <TPaveText.h>
      98             : 
      99             : #include "AliCDBManager.h"
     100             : #include "AliCDBEntry.h"
     101             : #include "AliESDEvent.h"
     102             : #include "AliESDtrack.h"
     103             : #include "AliQAChecker.h"
     104             : #include "AliRawReader.h"
     105             : #include "AliTOFRawStream.h"
     106             : #include "AliTOFcluster.h"
     107             : #include "AliTOFQADataMakerRec.h"
     108             : #include "AliTOFrawData.h"
     109             : #include "AliTOFGeometry.h"
     110             : #include "AliTOFChannelOnlineStatusArray.h"
     111             : #include "AliTOFDecoderSummaryData.h"
     112             : #include "AliTOFDecoderV2.h"
     113             : 
     114          26 : ClassImp(AliTOFQADataMakerRec)
     115             : 
     116             : Int_t AliTOFQADataMakerRec::fgNbinsMultiplicity=2000; //number of bins in multiplicity plot
     117             : Int_t AliTOFQADataMakerRec::fgRangeMinMultiplicity=0;//min range in multiplicity plot
     118             : Int_t AliTOFQADataMakerRec::fgRangeMaxMultiplicity=1000;//max range in multiplicity plot
     119             : Int_t AliTOFQADataMakerRec::fgNbinsTime=250;//number of bins in time plot
     120             : const Float_t AliTOFQADataMakerRec::fgkNbinsWidthTime=2.44;//width of bins in time plot
     121             : Float_t AliTOFQADataMakerRec::fgRangeMinTime=0.0;//range min in time plot
     122             : Float_t AliTOFQADataMakerRec::fgRangeMaxTime=620.0; //range max in time plot
     123             : Int_t AliTOFQADataMakerRec::fgCutNmaxFiredMacropad=50;//cut on number of max fired macropad
     124             : const Int_t AliTOFQADataMakerRec::fgkFiredMacropadLimit=50;//cut on number of max fired macropad
     125             : 
     126             : 
     127             : //____________________________________________________________________________ 
     128             :   AliTOFQADataMakerRec::AliTOFQADataMakerRec() : 
     129           6 :   AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
     130           2 :   fCalibData(0x0),
     131           2 :   fEnableNoiseFiltering(kFALSE),
     132           2 :   fEnableDqmShifterOpt(kFALSE),
     133           2 :   fIsSOC(kFALSE),
     134           2 :   fLineExpTimeMin(0x0),
     135           2 :   fLineExpTimeMax(0x0),
     136           2 :   fLineExpTotMin(0x0),
     137           2 :   fLineExpTotMax(0x0),
     138           2 :   fTOFRawStream(AliTOFRawStream()),
     139           2 :   fDecoderSummary(0),
     140           2 :   fRunNumber(-1),
     141           2 :   fCalib(AliTOFcalib())
     142          10 : {
     143             :   //
     144             :   // ctor
     145             :   //   
     146             :   // fLineExpTimeMin = new TLine(200., 0., 200., 0.);
     147             :   // fLineExpTimeMax = new TLine(250., 0., 250., 0.);
     148             :   // fLineExpTotMin = new TLine(5., 0., 5., 0.);
     149             :   // fLineExpTotMax = new TLine(20., 0., 20., 0.);
     150             :   /*
     151             :     for (Int_t sm=0;sm<17;sm++){
     152             :     fLineSMid[sm] = new TLine( sm+1, 0., sm+1, 91.);
     153             :   }
     154             : 
     155             :   for (Int_t sm=0;sm<71;sm++){
     156             :     fLineLTMid[sm] = new TLine( sm+1, 0., sm+1, 23.);
     157             :   }
     158             : 
     159             :   for (Int_t sm=0;sm<22;sm++){
     160             :     fLineLTMbitId[sm] = new TLine( 0., sm+1, 72. ,sm+1);
     161             :   }
     162             :   */
     163           4 : }
     164             : 
     165             : //____________________________________________________________________________ 
     166             : AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
     167           0 :   AliQADataMakerRec(),
     168           0 :   fCalibData(qadm.fCalibData),
     169           0 :   fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
     170           0 :   fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
     171           0 :   fIsSOC(qadm.fIsSOC),
     172           0 :   fLineExpTimeMin(qadm.fLineExpTimeMin),
     173           0 :   fLineExpTimeMax(qadm.fLineExpTimeMax),
     174           0 :   fLineExpTotMin(qadm.fLineExpTotMin),
     175           0 :   fLineExpTotMax(qadm.fLineExpTotMax),
     176           0 :   fTOFRawStream(qadm.fTOFRawStream),
     177           0 :   fDecoderSummary(qadm.fDecoderSummary),
     178           0 :   fRunNumber(qadm.fRunNumber),
     179           0 :   fCalib(qadm.fCalib)
     180           0 : {
     181             :   //
     182             :   //copy ctor 
     183             :   //
     184           0 :   SetName((const char*)qadm.GetName()) ; 
     185           0 :   SetTitle((const char*)qadm.GetTitle()); 
     186             :   /*
     187             :   for (Int_t sm=0;sm<17;sm++){
     188             :     fLineSMid[sm]=qadm.fLineSMid[sm];
     189             :   }
     190             : 
     191             :  for (Int_t sm=0;sm<71;sm++){
     192             :     fLineLTMid[sm] = qadm.fLineLTMid[sm];
     193             :   }
     194             : 
     195             :   for (Int_t sm=0;sm<22;sm++){
     196             :     fLineLTMbitId[sm] = qadm.fLineLTMbitId[sm];
     197             :   }
     198             :   */
     199           0 : }
     200             : 
     201             : //__________________________________________________________________
     202             : AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm )
     203             : {
     204             :   //
     205             :   // assignment operator.
     206             :   //
     207           0 :   this->~AliTOFQADataMakerRec();
     208           0 :   new(this) AliTOFQADataMakerRec(qadm);
     209           0 :   return *this;
     210           0 : }
     211             :  
     212             : //----------------------------------------------------------------------------
     213             : AliTOFQADataMakerRec::~AliTOFQADataMakerRec()
     214           0 : {
     215             :   //destructor
     216           0 :   fTOFRawStream.Clear();
     217           0 :   fCalib.Clear();
     218           0 :   if (fLineExpTimeMin)
     219           0 :     delete fLineExpTimeMin;
     220           0 :   if (fLineExpTimeMax)
     221           0 :     delete fLineExpTimeMax;
     222           0 :   if (fLineExpTotMin)
     223           0 :     delete fLineExpTotMin;
     224           0 :   if (fLineExpTotMax)
     225           0 :     delete fLineExpTotMax;
     226             :   /*
     227             :     for (Int_t sm=0;sm<17;sm++){
     228             :     if (fLineSMid[sm])
     229             :       delete fLineSMid[sm];
     230             :   }
     231             :   for (Int_t sm=0;sm<71;sm++){
     232             :     if (fLineLTMid[sm])
     233             :       delete fLineLTMid[sm];
     234             :   }
     235             : for (Int_t sm=0;sm<22;sm++){
     236             :     if (fLineLTMbitId[sm])
     237             :       delete fLineLTMbitId[sm];
     238             :   }
     239             :   */
     240           0 : }
     241             : //----------------------------------------------------------------------------
     242             : AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData() 
     243             : {
     244             :   //
     245             :   // Retrive TOF calib objects from OCDB
     246             :   //
     247           0 :   AliCDBManager *man = AliCDBManager::Instance();
     248             :   AliCDBEntry *cdbe=0;
     249             :  
     250           0 :   if (fRun<=0) fRunNumber=145288; //reference run from LHC11a
     251           0 :   else fRunNumber=fRun;
     252             :   
     253           0 :   if (man->GetRun()!=fRunNumber){
     254           0 :     fRunNumber=man->GetRun();
     255           0 :     AliWarning(Form("Run number mismatch found: setting it to value from current AliCDBManager instance = %i", fRunNumber));
     256           0 :   }
     257           0 :   cdbe = man->Get("TOF/Calib/Status",fRunNumber);
     258             :   
     259           0 :   if(!cdbe){
     260             :     // for DQM online
     261           0 :     AliWarning("Load of calibration data from default (alien://) storage failed!");
     262           0 :     printf("Calibration data will be loaded from local storage - ok if on DQM station!");
     263           0 :     man->SetDefaultStorage("local:///local/cdb/");
     264           0 :     cdbe = man->Get("TOF/Calib/Status",fRun);
     265             :     
     266           0 :     if(!cdbe){
     267           0 :       AliWarning("Load of calibration data from local DQM machine storage failed!");
     268           0 :       AliWarning("Calibration data will be loaded from local ($ALICE_ROOT) storage ");
     269           0 :       man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
     270           0 :       cdbe = man->Get("TOF/Calib/Status",fRunNumber);
     271           0 :     }
     272             :   }
     273             :   // Retrieval of data in directory TOF/Calib/Data:
     274             :   AliTOFChannelOnlineStatusArray * array = 0;
     275           0 :   if (cdbe) {
     276           0 :     printf("======= OCDB object for TOF retrieved from run %i in %s\n",fRunNumber,cdbe->GetName());
     277           0 :     array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
     278           0 :   }
     279           0 :   if (!array)  AliFatal("No calibration data from calibration database !");
     280             :   
     281           0 :   fCalib.Init(fRunNumber);
     282           0 :   return array;
     283           0 : }
     284             : 
     285             : //____________________________________________________________________________ 
     286             : void AliTOFQADataMakerRec::InitRaws()
     287             : {
     288             :   //
     289             :   // create Raws histograms in Raws subdir
     290             :   //
     291           0 :   ReadHistogramRangeFromFile(gSystem->Getenv("TOFDQMHISTO_CONFIGFILE"));
     292             :   
     293             :   const Bool_t expert   = kTRUE ; 
     294             :   const Bool_t saveCorr = kTRUE ; 
     295             :   const Bool_t image    = kTRUE ; 
     296             : 
     297           0 :   TH1I * h0 =  new TH1I("hTOFRaws","TOF raw hit multiplicity; TOF raw hits number; Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
     298           0 :   TPaveText * hitsMsg = new TPaveText(0.65,0.5,0.9,0.75,"NDC");
     299           0 :   h0->GetListOfFunctions()->Add(hitsMsg);
     300           0 :   hitsMsg->SetName("hitsMsg");
     301             : 
     302           0 :   TH1I * h1 =  new TH1I("hTOFRawsIA","TOF raw hit multiplicity - I/A side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
     303           0 :   TH1I * h2 =  new TH1I("hTOFRawsOA","TOF raw hit multiplicity - O/A side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
     304           0 :   TH1I * h3 =  new TH1I("hTOFRawsIC","TOF raw hit multiplicity - I/C side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
     305           0 :   TH1I * h4 =  new TH1I("hTOFRawsOC","TOF raw hit multiplicity - O/C side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
     306             : 
     307           0 :   TH1F * h5  = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime); 
     308           0 :   TPaveText * timeMsg = new TPaveText(0.65,0.5,0.9,0.75,"NDC");
     309           0 :   h5->GetListOfFunctions()->Add(timeMsg);
     310           0 :   timeMsg->SetName("timeMsg");
     311           0 :   TH1F * h6  = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime); 
     312           0 :   TH1F * h7  = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime); 
     313           0 :   TH1F * h8  = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime); 
     314           0 :   TH1F * h9  = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime); 
     315             :   
     316           0 :   TH1F * h10  = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Hits", 100, 0., 48.8); 
     317           0 :   TPaveText * totMsg = new TPaveText(0.65,0.5,0.9,0.75,"NDC");
     318           0 :   h10->GetListOfFunctions()->Add(totMsg);
     319           0 :   totMsg->SetName("totMsg");
     320           0 :   TH1F * h11  = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8); 
     321           0 :   TH1F * h12  = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8); 
     322           0 :   TH1F * h13  = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8); 
     323           0 :   TH1F * h14  = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8); 
     324             :   
     325           0 :   TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts",  72, 0., 72.);
     326           0 :   TH2F * h16  = new TH2F("hTOFrefMap", "TOF enabled channel reference map;sector;strip",  72, 0., 18., 91, 0., 91.);
     327           0 :   TH2F * h17  = new TH2F("hTOFRawHitMap","TOF raw hit map (1 bin = 1 FEA/24);sector;strip", 72, 0., 18., 91, 0., 91.);
     328             :  
     329           0 :   TH2I * h18 = new TH2I("hTOFDecodingErrors","Decoding error monitoring; DDL; Error ", 72, 0, 72, 13,1,14);
     330             :   
     331           0 :   h18->GetYaxis()->SetBinLabel(1,"DRM ");
     332           0 :   h18->GetYaxis()->SetBinLabel(2,"LTM ");
     333           0 :   h18->GetYaxis()->SetBinLabel(3,"TRM 3 ");
     334           0 :   h18->GetYaxis()->SetBinLabel(4,"TRM 4");
     335           0 :   h18->GetYaxis()->SetBinLabel(5,"TRM 5");
     336           0 :   h18->GetYaxis()->SetBinLabel(6,"TRM 6");
     337           0 :   h18->GetYaxis()->SetBinLabel(7,"TRM 7");
     338           0 :   h18->GetYaxis()->SetBinLabel(8,"TRM 8");
     339           0 :   h18->GetYaxis()->SetBinLabel(9,"TRM 9");
     340           0 :   h18->GetYaxis()->SetBinLabel(10,"TRM 10");
     341           0 :   h18->GetYaxis()->SetBinLabel(11,"TRM 11");
     342           0 :   h18->GetYaxis()->SetBinLabel(12,"TRM 12");
     343           0 :   h18->GetYaxis()->SetBinLabel(13,"recovered");
     344             :   
     345           0 :   TH1F * h19  = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Hits",fgNbinsTime,fgRangeMinTime,fgRangeMaxTime); 
     346           0 :   TH2F * h20 = new TH2F("hTOFRawTimeVsTRM035", "TOF raws - Hit time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF raw time [ns]", 361, 0., 361.,fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
     347           0 :   TH2F * h21 = new TH2F("hTOFRawTimeVsTRM3671", "TOF raws - Hit time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF raw time [ns]", 361, 360., 721.,fgNbinsTime, fgRangeMinTime,fgRangeMaxTime);
     348           0 :   TH2F * h22 = new TH2F("hTOFTimeVsStrip","TOF raw hit time vs. MRPC (along z axis); MRPC index along z axis; Raws TOF time (ns) ", 91,0.,91,fgNbinsTime,fgRangeMinTime,fgRangeMaxTime); 
     349           0 :   TH2F * h23 = new TH2F("hTOFtimeVsBCID","TOF time vs BCID; BCID; time (ns) ", 3564, 0., 3564.,fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
     350           0 :   TH2F * h24 = new TH2F("hTOFchannelEfficiencyMap","TOF channels (HWok && efficient && !noisy && !problematic);sector;strip",  72, 0., 18., 91, 0., 91.);
     351           0 :   TH2F * h25 = new TH2F("hTOFhitsCTTM","Map of hit pads according to CTTM numbering;LTM index;bit index",  72, 0., 72., 23, 0., 23.);
     352           0 :   TH2F * h26 = new TH2F("hTOFmacropadCTTM","Map of hit macropads according to CTTM numbering;LTM index; bit index",  72, 0., 72., 23, 0., 23.);
     353           0 :   h26->SetOption("colz");
     354           0 :   TH2F * h27 = new TH2F("hTOFmacropadDeltaPhiTime","#Deltat vs #Delta#Phi of hit macropads;#Delta#Phi (degrees);#DeltaBX",  18, 0., 180., 20, 0., 20.0);
     355           0 :   h27->SetOption("colz");
     356           0 :   TH2I * h28 = new TH2I("hBXVsCttmBit","BX ID in TOF matching window vs trg channel; trg channel; BX", 1728, 0, 1728, 24, 0, 24); 
     357           0 :   h28->SetOption("colz");
     358           0 :   TH2F * h29 = new TH2F("hTimeVsCttmBit","TOF raw time vs trg channel; trg channel; raw time (ns)", 1728, 0., 1728., fgNbinsTime, fgRangeMinTime, fgRangeMaxTime); 
     359           0 :   h29->SetOption("colz");
     360           0 :   TH2F * h30 = new TH2F("hTOFRawHitMap24","TOF raw hit map (1 bin = 1 FEA/24);sector;strip", 72, 0., 18., 91, 0., 91.);
     361           0 :   h30->SetOption("colz");
     362           0 :   TH2I * h31 =  new TH2I("hHitMultiVsDDL","TOF raw hit multiplicity per event vs DDL ; DDL; TOF raw hits number; Events ", 72, 0., 72., 500, 0, 500);
     363           0 :   h31->SetOption("colz");
     364           0 :   TH1I * h32 =  new TH1I("hNfiredMacropad","Number of fired TOF macropads per event; number of fired macropads; Events ", 50, 0, 50);
     365           0 :   h32->SetOption("hist");
     366             : 
     367             : 
     368           0 :   h25->GetYaxis()->SetTickLength(-0.02);
     369           0 :   h26->GetYaxis()->SetTickLength(-0.02);
     370           0 :   h25->GetYaxis()->SetNdivisions(210);
     371           0 :   h26->GetYaxis()->SetNdivisions(210);
     372           0 :   h25->GetXaxis()->SetTickLength(-0.02);
     373           0 :   h26->GetXaxis()->SetTickLength(-0.02);
     374           0 :   h25->GetXaxis()->SetLabelOffset(0.015);
     375           0 :   h26->GetXaxis()->SetLabelOffset(0.015);
     376           0 :   h25->GetXaxis()->SetNdivisions(515);
     377           0 :   h26->GetXaxis()->SetNdivisions(515);
     378             : 
     379           0 :   h0->Sumw2() ;
     380           0 :   h1->Sumw2() ;
     381           0 :   h2->Sumw2() ;
     382           0 :   h3->Sumw2() ;
     383           0 :   h4->Sumw2() ;
     384           0 :   h6->Sumw2() ;
     385           0 :   h7->Sumw2() ;
     386           0 :   h8->Sumw2() ;
     387           0 :   h9->Sumw2() ;
     388           0 :   h11->Sumw2() ;
     389           0 :   h12->Sumw2() ;
     390           0 :   h13->Sumw2() ;
     391           0 :   h14->Sumw2() ;
     392           0 :   h15->Sumw2() ;
     393           0 :   h16->Sumw2() ;
     394           0 :   h17->Sumw2() ;
     395           0 :   h18->Sumw2() ;
     396           0 :   h19->Sumw2() ;
     397           0 :   h20->Sumw2() ;
     398           0 :   h21->Sumw2() ;
     399           0 :   h22->Sumw2() ;
     400           0 :   h23->Sumw2() ;
     401           0 :   h24->Sumw2() ;
     402           0 :   h25->Sumw2() ;
     403           0 :   h26->Sumw2() ;
     404           0 :   h27->Sumw2() ;
     405           0 :   h28->Sumw2() ;
     406           0 :   h29->Sumw2() ;
     407           0 :   h30->Sumw2() ;
     408           0 :   h31->Sumw2() ;
     409           0 :   h32->Sumw2() ;
     410             : 
     411             :   //add lines for DQM shifter
     412           0 :   fLineExpTimeMin = new TLine(150., 0., 150., 0.);
     413           0 :   fLineExpTimeMax = new TLine(250., 0., 250., 0.);
     414           0 :   fLineExpTotMin = new TLine(10., 0., 10., 0.);
     415           0 :   fLineExpTotMax = new TLine(15., 0., 15., 0.);
     416             : 
     417           0 :   fLineExpTimeMin->SetLineColor(kGreen);
     418           0 :   fLineExpTimeMin->SetLineWidth(2);
     419             :   
     420           0 :   fLineExpTimeMax->SetLineColor(kGreen);
     421           0 :   fLineExpTimeMax->SetLineWidth(2);
     422             :   
     423           0 :   fLineExpTotMin->SetLineColor(kGreen);
     424           0 :   fLineExpTotMin->SetLineWidth(2);
     425             :   
     426           0 :   fLineExpTotMax->SetLineColor(kGreen);
     427           0 :   fLineExpTotMax->SetLineWidth(2);
     428             : 
     429           0 :   h5->GetListOfFunctions()->Add(fLineExpTimeMin);
     430           0 :   h5->GetListOfFunctions()->Add(fLineExpTimeMax);
     431           0 :   h10->GetListOfFunctions()->Add(fLineExpTotMin);
     432           0 :   h10->GetListOfFunctions()->Add(fLineExpTotMax);
     433             : 
     434           0 :   TPaveText *phosHoleBox=new TPaveText(13,38,16,53,"b");      
     435           0 :   phosHoleBox->SetFillStyle(0);
     436           0 :   phosHoleBox->SetFillColor(kWhite);
     437           0 :   phosHoleBox->SetLineColor(kMagenta);
     438           0 :   phosHoleBox->SetLineWidth(2);
     439           0 :   phosHoleBox->AddText("PHOS");    
     440           0 :   TPaveText *phosHoleBox2=dynamic_cast<TPaveText*>(phosHoleBox->Clone()); //new TPaveText(13,38,16,53,"b");
     441             :   //TPaveText *phosHoleBox3=dynamic_cast<TPaveText*>(phosHoleBox->Clone()); //new TPaveText(13,38,16,53,"b");
     442           0 :   h16->GetListOfFunctions()->Add(phosHoleBox);
     443           0 :   h17->GetListOfFunctions()->Add(phosHoleBox2);
     444             :   //h30->GetListOfFunctions()->Add(phosHoleBox3);
     445             : 
     446           0 :   Add2RawsList(h0,   0, !expert,  image, !saveCorr) ;
     447           0 :   Add2RawsList(h1,   1,  expert, !image, !saveCorr) ;
     448           0 :   Add2RawsList(h2,   2,  expert, !image, !saveCorr) ;
     449           0 :   Add2RawsList(h3,   3,  expert, !image, !saveCorr) ;
     450           0 :   Add2RawsList(h4,   4,  expert, !image, !saveCorr) ;
     451           0 :   Add2RawsList(h5,   5, !expert,  image, !saveCorr) ;
     452           0 :   Add2RawsList(h6,   6,  expert, !image, !saveCorr) ;
     453           0 :   Add2RawsList(h7,   7,  expert, !image, !saveCorr) ;
     454           0 :   Add2RawsList(h8,   8,  expert, !image, !saveCorr) ;
     455           0 :   Add2RawsList(h9,   9,  expert, !image, !saveCorr) ;
     456           0 :   Add2RawsList(h10, 10, !expert,  image, !saveCorr) ;
     457           0 :   Add2RawsList(h11, 11,  expert, !image, !saveCorr) ;
     458           0 :   Add2RawsList(h12, 12,  expert, !image, !saveCorr) ;
     459           0 :   Add2RawsList(h13, 13,  expert, !image, !saveCorr) ;
     460           0 :   Add2RawsList(h14, 14,  expert, !image, !saveCorr) ;
     461           0 :   Add2RawsList(h15, 15,  expert, !image, !saveCorr) ;
     462           0 :   Add2RawsList(h16, 16, !expert,  image, !saveCorr) ;
     463           0 :   Add2RawsList(h17, 17, !expert,  image, !saveCorr) ;
     464           0 :   Add2RawsList(h18, 18,  expert, !image, !saveCorr) ;
     465           0 :   Add2RawsList(h19, 19,  expert, !image, !saveCorr) ;
     466           0 :   Add2RawsList(h20, 20, !expert, image, !saveCorr) ;
     467           0 :   Add2RawsList(h21, 21, !expert, image, !saveCorr) ;
     468           0 :   Add2RawsList(h22, 22,  expert, !image, !saveCorr) ;
     469           0 :   Add2RawsList(h23, 23,  expert, !image, !saveCorr) ;
     470           0 :   Add2RawsList(h24, 24,  expert, !image, !saveCorr) ;
     471           0 :   Add2RawsList(h25, 25,  expert, !image, !saveCorr) ;
     472           0 :   Add2RawsList(h26, 26, !expert,  image, !saveCorr) ;
     473           0 :   Add2RawsList(h27, 27,  expert,  image, !saveCorr) ;
     474           0 :   Add2RawsList(h28, 28,  expert, !image, !saveCorr) ;
     475           0 :   Add2RawsList(h29, 29,  expert, !image, !saveCorr) ;
     476           0 :   Add2RawsList(h30, 30, !expert,  image, !saveCorr) ;
     477           0 :   Add2RawsList(h31, 31, !expert,  image, !saveCorr) ;
     478           0 :   Add2RawsList(h32, 32, !expert,  image, !saveCorr) ;
     479             : 
     480             : //
     481           0 :   ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
     482           0 : }
     483             : 
     484             : //____________________________________________________________________________ 
     485             : void AliTOFQADataMakerRec::InitRecPoints()
     486             : {
     487             :   //
     488             :   // create RecPoints histograms in RecPoints subdir
     489             :   //
     490             :   
     491             :   const Bool_t expert   = kTRUE ; 
     492             :   const Bool_t image    = kTRUE ; 
     493             : 
     494           0 :   TH1I * h0 = new TH1I("hTOFRecPoints",    "TOF RecPoints multiplicity ; TOF RecPoints number;Events",200, 0, 200) ;
     495             : 
     496           0 :   TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ; 
     497           0 :   TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
     498           0 :   TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
     499           0 :   TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
     500             :   
     501           0 :   TH1F * h5  = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
     502           0 :   TH1F * h6  = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
     503           0 :   TH1F * h7  = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
     504           0 :   TH1F * h8  = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ; 
     505             :  
     506           0 :   TH1F * h9   = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
     507           0 :   TH1F * h10  = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
     508           0 :   TH1F * h11  = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
     509           0 :   TH1F * h12  = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ; 
     510             :   
     511           0 :   TH2F * h13 = new TH2F("hTOFRecPointsClusMap","RecPoints map; sector ;strip", 72, 0., 18., 91, 0., 91.) ; 
     512           0 :   TH2F * h14 = new TH2F("hTOFRecPointsTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",91, 0., 91., 250, 0., 610.) ;
     513           0 :   TH2F * h15 = new TH2F("hTOFRecPointsTimeVsTRM035","TOF RecPoints time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF time [ns]", 361, 0., 361., 250, 0., 610.0) ;
     514           0 :   TH2F * h16 = new TH2F("hTOFRecPointsTimeVsTRM3671","TOF RecPoints time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF time [ns]", 361, 360., 721., 250, 0., 610.0) ;
     515             : 
     516           0 :   h0->Sumw2() ;
     517           0 :   h1->Sumw2() ;
     518           0 :   h2->Sumw2() ;
     519           0 :   h3->Sumw2() ;
     520           0 :   h4->Sumw2() ;
     521           0 :   h5->Sumw2() ;
     522           0 :   h6->Sumw2() ;
     523           0 :   h7->Sumw2() ;
     524           0 :   h8->Sumw2() ;
     525           0 :   h9->Sumw2() ;
     526           0 :   h10->Sumw2() ;
     527           0 :   h11->Sumw2() ;
     528           0 :   h12->Sumw2() ;
     529           0 :   h13->Sumw2() ;
     530           0 :   h14->Sumw2() ;
     531           0 :   h15->Sumw2() ;
     532           0 :   h16->Sumw2() ;
     533             :    
     534           0 :   Add2RecPointsList(h0, 0,   !expert,  image) ;
     535           0 :   Add2RecPointsList(h1, 1,   !expert,  image) ;
     536           0 :   Add2RecPointsList(h2, 2,   !expert,  image) ;
     537           0 :   Add2RecPointsList(h3, 3,   !expert,  image) ;
     538           0 :   Add2RecPointsList(h4, 4,   !expert,  image) ;
     539           0 :   Add2RecPointsList(h5, 5,    expert,  !image) ;
     540           0 :   Add2RecPointsList(h6, 6,    expert, !image) ;
     541           0 :   Add2RecPointsList(h7, 7,    expert, !image) ;
     542           0 :   Add2RecPointsList(h8, 8,    expert, !image) ;
     543           0 :   Add2RecPointsList(h9, 9,   !expert, !image) ;
     544           0 :   Add2RecPointsList(h10, 10, !expert, !image) ;
     545           0 :   Add2RecPointsList(h11, 11, !expert, !image) ;
     546           0 :   Add2RecPointsList(h12, 12, !expert, !image) ;
     547           0 :   Add2RecPointsList(h13, 13,  expert, !image) ;
     548           0 :   Add2RecPointsList(h14, 14,  expert, image) ;
     549           0 :   Add2RecPointsList(h15, 15,  expert, !image) ;
     550           0 :   Add2RecPointsList(h16, 16,  expert, !image) ;
     551             :   //
     552           0 :   ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
     553           0 : }
     554             : 
     555             : //____________________________________________________________________________ 
     556             : void AliTOFQADataMakerRec::InitESDs()
     557             : {
     558             :   //
     559             :   //create ESDs histograms in ESDs subdir
     560             :   //
     561             : 
     562             :   const Bool_t expert   = kTRUE ; 
     563             :   const Bool_t image    = kTRUE ; 
     564             : 
     565           0 :   TH1I * h0  = new TH1I("hTOFESDs", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 200, 0, 200) ;  
     566           0 :   TH1F * h1  = new TH1F("hTOFESDsTime", "Matched  ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 250, 0., 610. ) ; 
     567           0 :   TH1F * h2  = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 250, 0., 610.) ; 
     568           0 :   TH1F * h3  = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",100, 0., 48.8) ; 
     569           0 :   TH1F * h4  = new TH1F("hTOFESDskTOFOUT", "p_{T}  distribution of tracks with kTOFout; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;  
     570           0 :   TH1F * h5  = new TH1F("hTOFESDskTIME", "p_{T}  distribution of tracks with kTOFout && kTIME; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;  
     571           0 :   TH1F * h6  = new TH1F("hTOFESDsMatched", "p_{T} distribution of tracks with kTOFout && TOFtime>0; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;  
     572           0 :   TH1F * h7  = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability;TOF matching probability (%)  ;Counts",101, -1.0, 100) ;  
     573           0 :   TH1F * h8  = new TH1F("hTOFESDsDiffTime", "ESDs t_{TOF}-t_{exp,pi} spectrum in TOF (ps); t_{TOF}-t_{exp,pi} [ps];Counts", 200, -2440., 2440.) ; 
     574           0 :   TH1F * h9  = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ; 
     575             : 
     576           0 :   h0->Sumw2() ;
     577           0 :   h1->Sumw2() ;
     578           0 :   h2->Sumw2() ;
     579           0 :   h3->Sumw2() ;
     580           0 :   h4->Sumw2() ;
     581           0 :   h5->Sumw2() ;
     582           0 :   h6->Sumw2() ;
     583           0 :   h7->Sumw2() ;
     584           0 :   h8->Sumw2() ;
     585           0 :   h9->Sumw2() ;
     586             : 
     587           0 :   Add2ESDsList(h0, 0, !expert,  image) ;
     588           0 :   Add2ESDsList(h1, 1, !expert,  image) ;
     589           0 :   Add2ESDsList(h2, 2,  expert,  !image) ;
     590           0 :   Add2ESDsList(h3, 3, !expert,  !image) ;
     591           0 :   Add2ESDsList(h4, 4,  expert,  image) ;
     592           0 :   Add2ESDsList(h5, 5,  expert,  image) ;
     593           0 :   Add2ESDsList(h6, 6,  expert,  image) ; 
     594           0 :   Add2ESDsList(h7, 7,  expert,  image) ; 
     595           0 :   Add2ESDsList(h8, 8,  expert,  !image) ; 
     596           0 :   Add2ESDsList(h9, 9, !expert,  !image) ;
     597             :   //
     598           0 :   ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line 
     599           0 : }
     600             : 
     601             : 
     602             : //____________________________________________________________________________
     603             : void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
     604             : {
     605             :   //
     606             :   // makes data from Raws
     607             :   //
     608             :   // AliLog::SetClassDebugLevel("AliRawReader",0);
     609             :   // AliLog::SetClassDebugLevel("AliTOFRawStream",0);
     610             :   // AliLog::SetClassDebugLevel("AliTOFDecoderV2",0);
     611           0 :   AliLog::SetGlobalLogLevel(AliLog::kError);
     612             : 
     613           0 :   if (rawReader->GetType()==7) {
     614             :    
     615           0 :     Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
     616           0 :     Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
     617             :     Int_t nFiredMacroEvt = 0.0; 
     618           0 :     Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
     619           0 :     Int_t nHitsDDL[72]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
     620           0 :     for (Int_t j=0;j<72;j++){ 
     621           0 :       nHitsDDL[j]=0;
     622           0 :       if (j<5) ntof[j]=0; 
     623             :     }
     624           0 :     Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
     625           0 :     Int_t volumeID[5];   //(sector,plate,strip,padX,padZ)
     626           0 :     Int_t volumeID2[5];   //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
     627             :     Int_t chIndex=-1;
     628           0 :     Int_t indexCTTM[2]={-1,-1};     
     629           0 :     Int_t indexGeo2CTTM[2]={-1,-1};
     630           0 :     Float_t macropadPhiTimeUPC[fgkFiredMacropadLimit][2];
     631           0 :     for (Int_t ii=0;ii<2;ii++){
     632           0 :       for (Int_t jj=0;jj<fgkFiredMacropadLimit;jj++){        
     633           0 :         macropadPhiTimeUPC[jj][ii]=-999.0; 
     634             :       }
     635             :     }
     636             : 
     637             :     TClonesArray * clonesRawData;
     638           0 :     fTOFRawStream.SetRawReader(rawReader);
     639           0 :     Int_t BCID=rawReader->GetBCID();
     640             :     
     641             :     Int_t nFiredMacropad=0,
     642             :       iFiredMacropad=-1;
     643           0 :     nFiredMacropad=GetNumberOfFiredMacropad(rawReader);
     644             :     
     645             :     //uncomment if needed to apply DeltaBC correction
     646             :     //fTOFRawStream.ApplyBCCorrections(kTRUE);
     647             :     
     648           0 :     if (fDecoderSummary){
     649           0 :       fDecoderSummary->Reset();
     650           0 :     }
     651           0 :     for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
     652           0 :       rawReader->Reset();
     653           0 :       fTOFRawStream.LoadRawDataBuffersV2(iDDL);
     654             :       
     655             :       //* get decoding error counters
     656           0 :       fDecoderSummary = ( (AliTOFDecoderV2*) fTOFRawStream.GetDecoderV2() )->GetDecoderSummaryData();
     657           0 :       if ( (fDecoderSummary) && (fDecoderSummary ->GetErrorDetected()) ) {
     658           0 :         Int_t errorSlotID=(Int_t) fDecoderSummary->GetErrorSlotID();
     659           0 :         FillRawsData(18,iDDL,errorSlotID);
     660           0 :         if (fDecoderSummary -> GetRecoverError() )           
     661           0 :           FillRawsData(18,iDDL,13);
     662           0 :       }     
     663             :       
     664           0 :       clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
     665           0 :       for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
     666           0 :         AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
     667           0 :         Float_t tofRawTime=tofRawDatum->GetTOF()*tdc2ns;
     668             :         
     669           0 :         if (tofRawDatum->GetTOF()){
     670           0 :           equipmentID[0]=iDDL;
     671           0 :           equipmentID[1]=tofRawDatum->GetTRM(); 
     672           0 :           equipmentID[2]=tofRawDatum->GetTRMchain();
     673           0 :           equipmentID[3]=tofRawDatum->GetTDC();
     674           0 :           equipmentID[4]=tofRawDatum->GetTDCchannel();
     675             :           
     676           0 :           if (CheckEquipID(equipmentID)){
     677           0 :             fTOFRawStream.EquipmentId2VolumeId(iDDL, 
     678           0 :                                                tofRawDatum->GetTRM(), 
     679           0 :                                                tofRawDatum->GetTRMchain(),
     680           0 :                                                tofRawDatum->GetTDC(), 
     681           0 :                                                tofRawDatum->GetTDCchannel(), 
     682           0 :                                                volumeID);
     683             :             //LTM data
     684           0 :             if (FilterLTMData(equipmentID)) { //counts LTM hits
     685           0 :               if (equipmentID[2]==1)  //crate left, A-side or C-side
     686           0 :                 FillRawsData(15,equipmentID[0]);
     687             :               else 
     688           0 :                 FillRawsData(15,equipmentID[0]-1); 
     689             :               
     690             :               //retrieve CTTM index (Ltm, bit)
     691           0 :               GetCTTMIndex(equipmentID, indexCTTM);
     692             :               
     693             :               //get BX index within TOF-matching window
     694             :               Int_t indexBC=-1;
     695           0 :               indexBC= TMath::Nint(tofRawTime/24.4);
     696             : 
     697           0 :               Int_t indexCttmChannel=indexCTTM[0]*24+indexCTTM[1];
     698           0 :               FillRawsData(28,indexCttmChannel,indexBC);
     699           0 :               FillRawsData(29,indexCttmChannel,tofRawTime);
     700             :               
     701             :               //increment counter ofr fired macropad
     702           0 :               nFiredMacroEvt++;
     703             :               //fired macropad map (from LTM hits) - only for low multi evts (UPC)
     704           0 :               if ((nFiredMacropad<=fgCutNmaxFiredMacropad)){ 
     705           0 :                 iFiredMacropad++;
     706             :                 //AliInfo(Form("Event found with %i fired macropads in BCID = %i!",nFiredMacropad,BCID));
     707           0 :                 FillRawsData(26,indexCTTM[0],indexCTTM[1]);
     708             :                 Float_t halfSMphi=-999.0;
     709           0 :                 if (indexCTTM[0]<36)
     710           0 :                   halfSMphi=indexCTTM[0]*10.+5.;
     711           0 :                 else  halfSMphi=(indexCTTM[0]-36)*10.+5.;
     712           0 :                 macropadPhiTimeUPC[iFiredMacropad][0]=halfSMphi;
     713           0 :                 macropadPhiTimeUPC[iFiredMacropad][1]=indexBC;
     714           0 :               }
     715           0 :             }
     716             :             
     717             :             //TRM data
     718           0 :             if (CheckVolumeID(volumeID)){  
     719           0 :               volumeID2[0]=volumeID[0];
     720           0 :               volumeID2[1]=volumeID[1];
     721           0 :               volumeID2[2]=volumeID[2];
     722           0 :               volumeID2[3]=volumeID[4];
     723           0 :               volumeID2[4]=volumeID[3];
     724           0 :               chIndex=AliTOFGeometry::GetIndex(volumeID2);
     725             :               
     726             :               //fill hit map according to CTTM numbering
     727           0 :               GetGeo2CTTMIndex(volumeID2, indexGeo2CTTM);
     728           0 :               if ((nFiredMacropad<=fgCutNmaxFiredMacropad)){ 
     729           0 :                 FillRawsData(25,indexGeo2CTTM[0],indexGeo2CTTM[1]);
     730           0 :               }
     731             :               //hits selection
     732           0 :               if (tofRawDatum->GetTOT()){        
     733           0 :                 if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
     734           0 :                     && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
     735           0 :                   ntof[0]++; //counter for tof hits
     736           0 :                   nHitsDDL[iDDL]++; //counter for tof hits per DDL
     737             : 
     738             :                   //fill global spectra for DQM plots
     739           0 :                   FillRawsData(5, tofRawTime) ;//in ns
     740           0 :                   FillRawsData(10, tofRawDatum->GetTOT()*tot2ns) ;//in ns
     741           0 :                   FillRawsData(23, BCID, tofRawTime) ;//in ns
     742             :                   
     743             :                   //fill side-related spectra for experts plots
     744           0 :                   Int_t ddlACside=iDDL/36; // 0 or 1
     745           0 :                   Int_t ddlPerSm=iDDL%4;
     746             :                   
     747           0 :                   if (volumeID2[0]>4 && volumeID2[0]<14){       //O side
     748           0 :                     if (ddlPerSm<2){ //A side
     749           0 :                       ntof[1]++;
     750           0 :                       FillRawsData(6, tofRawTime) ;
     751           0 :                       FillRawsData(11, tofRawDatum->GetTOT()*tot2ns) ;
     752           0 :                     } else {  //C side
     753           0 :                       ntof[3]++;
     754           0 :                       FillRawsData(8, tofRawTime) ;
     755           0 :                       FillRawsData(13, tofRawDatum->GetTOT()*tot2ns) ;
     756             :                     }
     757             :                   } else {                                    
     758           0 :                     if (volumeID2[0]<5 || volumeID2[0]>13){   //I side
     759           0 :                       if (ddlPerSm<2){ //A side
     760           0 :                         ntof[2]++;
     761           0 :                         FillRawsData(7, tofRawTime) ;
     762           0 :                         FillRawsData(12, tofRawDatum->GetTOT()*tot2ns) ;
     763           0 :                       } else {//C side
     764           0 :                         ntof[4]++;
     765           0 :                         FillRawsData(9, tofRawTime) ;
     766           0 :                         FillRawsData(14, tofRawDatum->GetTOT()*tot2ns) ;
     767             :                       }
     768             :                     }   
     769             :                   }
     770             :                   
     771             :                   //compute TRM offset
     772           0 :                   Int_t trm= iDDL*10+(equipmentID[1]-3);
     773           0 :                   FillRawsData(20+ddlACside,trm,tofRawTime);
     774           0 :                   FillRawsData(22,GetStripIndex(volumeID),tofRawTime) ;
     775           0 :                   Short_t fea = volumeID2[4]/12;
     776           0 :                   Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
     777           0 :                   FillRawsData(17,hitmapx,GetStripIndex(volumeID2));
     778           0 :                   FillRawsData(30,hitmapx,GetStripIndex(volumeID2));
     779             :                   
     780           0 :                   if (fCalib.IsChannelEnabled(chIndex,kTRUE,kTRUE))//checks also if efficient and if problematic
     781           0 :                     FillRawsData(24,hitmapx,GetStripIndex(volumeID2));
     782           0 :                 }//noise filter
     783             :               }//end hit selection
     784             :               else { //orphans
     785           0 :                 if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
     786           0 :                     && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
     787           0 :                   FillRawsData(19, tofRawTime) ;//in ns
     788             :               }//end orphans
     789             :             }//end volumeID check
     790             :           }//end equipID check
     791             :         }//end tof check
     792             :       }//loop on raw data
     793           0 :       clonesRawData->Clear();
     794             :     } // DDL Loop
     795             :     
     796           0 :     FillRawsData(32,nFiredMacroEvt);
     797           0 :     for (Int_t j=0;j<5;j++) FillRawsData(j,ntof[j]);
     798           0 :     for (Int_t k=0;k<72;k++) FillRawsData(31, k, nHitsDDL[k]);
     799           0 :     fTOFRawStream.Clear();
     800             :   
     801           0 :     if ((nFiredMacropad<=fgCutNmaxFiredMacropad)){
     802             :       Float_t deltaPhiMacropad=-999.;
     803             :       Float_t deltaTimeMacropad=-999.;
     804           0 :       for (Int_t j=0;j<fgCutNmaxFiredMacropad+1; j++){
     805           0 :         for (Int_t k=j+1;k<fgCutNmaxFiredMacropad+1; k++){
     806           0 :           if ((macropadPhiTimeUPC[j][0]>0.0)&&(macropadPhiTimeUPC[k][0]>0.0)){
     807           0 :             deltaPhiMacropad=TMath::Abs(macropadPhiTimeUPC[j][0]-macropadPhiTimeUPC[k][0]);
     808           0 :             deltaTimeMacropad=TMath::Abs(macropadPhiTimeUPC[j][1]-macropadPhiTimeUPC[k][1]);
     809           0 :             if (deltaPhiMacropad<=180.)
     810           0 :               FillRawsData(27, deltaPhiMacropad,deltaTimeMacropad);
     811             :             else
     812           0 :               FillRawsData(27, TMath::Abs(360.0-deltaPhiMacropad),deltaTimeMacropad);
     813             :           }
     814             :         } 
     815             :       }    
     816           0 :     }//end cut on number of fired macropad
     817           0 :   } else {
     818           0 :     AliDebug(2,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType())); 
     819             :   }
     820             :   
     821             :   //fill reference map for DQM shifter only once in a detector cycle 
     822           0 :   if (fIsSOC) {
     823           0 :     Int_t geoId[5]={-1,-1,-1,-1,-1};// pgeoId=(sm, mod, strip, padZ, padX)
     824           0 :     Int_t detId[5]={-1,-1,-1,-1,-1};//detID=(ddl,trm,tdc, chain,channel)
     825             :     Int_t trmIndex=-1;
     826           0 :     for (Int_t ch = 0; ch <  fCalibData->GetSize(); ch++) {
     827           0 :       AliTOFGeometry::GetVolumeIndices(ch,geoId);
     828           0 :       AliTOFRawStream::Geant2EquipmentId(geoId,detId); 
     829           0 :       if ((detId[1]<0)||(detId[0]<0)) continue;
     830           0 :       trmIndex=(detId[1]-3)+detId[0]*10;
     831             :       
     832           0 :       if ( (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad))
     833           0 :            && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk) ){
     834             :         //fill reference map with info from OCDB
     835           0 :         Short_t fea = geoId[4]/12;
     836           0 :         Float_t hitmapx = geoId[0] + ((Double_t)(3 - fea) + 0.5)*0.25;
     837           0 :         FillRawsData(16,hitmapx, GetStripIndex(geoId));
     838           0 :       }
     839             :     }
     840           0 :     fIsSOC=kFALSE;
     841           0 :   }
     842             :   //enable options for DQM shifter
     843           0 :   EnableDqmShifterOpt(kTRUE);
     844             :   //
     845           0 :   IncEvCountCycleRaws();
     846           0 :   IncEvCountTotalRaws();
     847             :   //
     848           0 : }
     849             : 
     850             : //____________________________________________________________________________
     851             : void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
     852             : {
     853             :     //
     854             :   // Make data from Clusters
     855             :   //
     856             :  
     857           0 :   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
     858           0 :   Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
     859             :   
     860           0 :   Int_t volumeID2[5];//(sm, plate,strip, padZ,padX)
     861             :   //Int_t volumeID[5];//(sm, plate,strip, padX,padZ) 
     862             :     
     863           0 :   TBranch *branch=clustersTree->GetBranch("TOF");
     864           0 :   if (!branch) { 
     865           0 :     AliError("can't get the branch with the TOF clusters !");
     866           0 :     return;
     867             :   }
     868             : 
     869           0 :   static TClonesArray dummy("AliTOFcluster",10000);
     870           0 :   dummy.Clear();
     871           0 :   TClonesArray *clusters=&dummy;
     872           0 :   branch->SetAddress(&clusters);
     873             :   
     874             :   // Import the tree
     875           0 :   clustersTree->GetEvent(0);  
     876             :  
     877           0 :   FillRecPointsData(0,(Int_t)clusters->GetEntriesFast()) ; 
     878             :   
     879           0 :   TIter next(clusters) ; 
     880             :   AliTOFcluster * c ; 
     881           0 :   while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
     882             :    
     883             :       // volumeID2[0] = c->GetDetInd(0);
     884             :       // volumeID2[1] = c->GetDetInd(1);
     885             :       // volumeID2[2] = c->GetDetInd(2);
     886             :       // volumeID2[3] = c->GetDetInd(4); //padX
     887             :       // volumeID2[4] = c->GetDetInd(3); //padZ 
     888             :       
     889           0 :       for (Int_t i=0;i<5;i++){
     890           0 :         volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
     891             :       }
     892             :       //Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
     893           0 :       Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2);
     894           0 :       Int_t iTRM=AliTOFRawStream::Geant2TRM(volumeID2);
     895           0 :       Short_t fea = volumeID2[4]/12;
     896           0 :       Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
     897           0 :       Int_t ddlACside=iDDL/36; // 0 or 1
     898           0 :       Int_t ddlPerSm=iDDL%4;
     899             :       
     900           0 :       if ((c->GetTDCRAW()) && (c->GetTDC()) && (c->GetToT())){
     901           0 :         if (volumeID2[0]>4 && volumeID2[0]<14){       //I side
     902           0 :           if (ddlPerSm<2){ //A side
     903           0 :             FillRecPointsData(1, c->GetTDC()*tdc2ns) ;//in ns
     904           0 :             FillRecPointsData(5, c->GetTDCRAW()*tdc2ns) ;//in ns
     905           0 :             FillRecPointsData(9, c->GetToT()*tot2ns) ;//in ns
     906             :           } else {//C side
     907           0 :             FillRecPointsData(3, c->GetTDC()*tdc2ns) ;//in ns
     908           0 :             FillRecPointsData(7, c->GetTDCRAW()*tdc2ns) ;//in ns
     909           0 :             FillRecPointsData(11, c->GetToT()*tot2ns) ;//in ns
     910             :           }
     911             :         } else {
     912           0 :           if (volumeID2[0]<5 || volumeID2[0]>13){       //O side
     913           0 :             if (ddlPerSm<2){ //A side
     914           0 :               FillRecPointsData(2, c->GetTDC()*tdc2ns) ;//in ns
     915           0 :               FillRecPointsData(6, c->GetTDCRAW()*tdc2ns) ;//in ns
     916           0 :               FillRecPointsData(10, c->GetToT()*tot2ns) ;//in ns
     917             :             } else { //C side
     918           0 :               FillRecPointsData(4, c->GetTDC()*tdc2ns) ;//in ns
     919           0 :               FillRecPointsData(8, c->GetTDCRAW()*tdc2ns) ;//in ns
     920           0 :               FillRecPointsData(12, c->GetToT()*tot2ns) ;//in ns
     921             :             }
     922             :           }
     923             :         }
     924           0 :         FillRecPointsData(13,hitmapx,GetStripIndex(volumeID2));
     925           0 :         FillRecPointsData(14,GetStripIndex(volumeID2), c->GetTDC()*tdc2ns) ;
     926           0 :         Int_t trm= iDDL*10+(iTRM-3);
     927           0 :         if (ddlACside==0) { //A side
     928           0 :           FillRecPointsData(15,trm,c->GetTDC()*tdc2ns);
     929             :         } else {//C side
     930           0 :           FillRecPointsData(16,trm,c->GetTDC()*tdc2ns);
     931             :         }
     932           0 :       }//hit selection
     933             :   }//end while   
     934           0 :   EnableDqmShifterOpt(kFALSE);
     935             :   //
     936           0 :   IncEvCountCycleRecPoints();
     937           0 :   IncEvCountTotalRecPoints();
     938             :   //
     939           0 : }
     940             : 
     941             : //____________________________________________________________________________
     942             : void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
     943             : {
     944             :   //
     945             :   // make QA data from ESDs
     946             :   //  
     947           0 :   const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
     948             :   const Double_t pionMass = 0.13957018; //GeV/c^2
     949             : 
     950           0 :   Int_t ntrk = esd->GetNumberOfTracks() ; 
     951             :   Int_t ntpc=0;
     952             :   Int_t ntofout=0;
     953             :   
     954           0 :     while (ntrk--) {
     955           0 :       AliESDtrack *track=esd->GetTrack(ntrk);
     956           0 :       Double_t tofTime=track->GetTOFsignal();//in ps
     957           0 :       Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
     958           0 :       Double_t tofToT=track->GetTOFsignalToT(); //in ps
     959             :       
     960           0 :       UInt_t status=track->GetStatus();
     961           0 :       if (track->IsOn(AliESDtrack::kTPCrefit)) {
     962           0 :         ntpc++;
     963           0 :         Double_t y=track->Eta();
     964           0 :         if (TMath::Abs(y)<0.9) { //select TOF acceptance
     965           0 :           if ((status&AliESDtrack::kTOFout)!=0)  { //define matching
     966           0 :             ntofout++;
     967           0 :             FillESDsData(1,tofTime*1E-3);
     968           0 :             FillESDsData(2,tofTimeRaw*1E-3); 
     969           0 :             FillESDsData(3,tofToT*1E-3);
     970           0 :             FillESDsData(4,track->Pt());
     971             :             
     972           0 :             Double_t length =track->GetIntegratedLength();
     973           0 :             Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
     974           0 :             Double_t piTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
     975           0 :             FillESDsData(8,tofTime-piTexp);
     976           0 :             FillESDsData(9,length);
     977             :             
     978           0 :             if ((status&AliESDtrack::kTIME)!=0) 
     979           0 :               FillESDsData(5,track->Pt());
     980             :             
     981           0 :             if (tofTime>0)
     982           0 :               FillESDsData(6,track->Pt());
     983           0 :           } //end check on matched tracks
     984             :         } 
     985           0 :       }//end check on TPCrefit
     986             :     }
     987             :     
     988           0 :     FillESDsData(0,ntofout) ;
     989           0 :     if(ntpc>0){
     990           0 :       Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100.; //matching probability
     991           0 :       FillESDsData(7,ratio) ;
     992           0 :     }
     993             :     
     994           0 :     if(ntofout>0) {
     995           0 :         Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100; //matched over propagated to TOF outer radius
     996           0 :         FillESDsData(8,ratio) ;
     997           0 :     }
     998           0 :     EnableDqmShifterOpt(kFALSE);
     999             :     //
    1000           0 :     IncEvCountCycleESDs();
    1001           0 :     IncEvCountTotalESDs();
    1002             :     //
    1003           0 : }
    1004             : 
    1005             : //____________________________________________________________________________ 
    1006             : void AliTOFQADataMakerRec::StartOfDetectorCycle()
    1007             : {
    1008             :   //
    1009             :   //Detector specific actions at start of cycle
    1010           0 :   fCalibData = GetCalibData();
    1011           0 :   fIsSOC=kTRUE;
    1012           0 :   for (int itc=-1;itc<GetNTrigClasses();itc++) {
    1013           0 :     TH1* hist = (TH1*) GetRawsData(30, itc);
    1014           0 :     if (hist) hist->Reset("ICESM");
    1015             :   }    
    1016           0 :   return;
    1017             : }  
    1018             : 
    1019             : //____________________________________________________________________________ 
    1020             : void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
    1021             : {
    1022             :   //Detector specific actions at end of cycle
    1023             :   // do the QA checking
    1024           0 :   ResetEventTrigClasses();
    1025             :   //
    1026           0 :   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
    1027           0 :     if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;     
    1028           0 :     SetEventSpecie(AliRecoParam::ConvertIndex(specie));  
    1029             : 
    1030           0 :     for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
    1031             :       
    1032           0 :       if (fEnableDqmShifterOpt) {
    1033             :         // RS: fetch the histograms for given trigger class
    1034           0 :         TObjArray& arrRW = *GetRawsDataOfTrigClass(itc);
    1035             :         
    1036             :         // Help make the raw qa histogram easier to interpret for the DQM shifter
    1037           0 :         if (!arrRW[ 0] || !arrRW[ 5] || !arrRW[10] || !arrRW[15] || !arrRW[16] || !arrRW[17]) continue;
    1038             :         
    1039           0 :         printf("=========>Processed %i physics raw of specie %s with TrigGlass %d\n",
    1040           0 :                GetEvCountCycleRaws(itc),AliRecoParam::GetEventSpecieName(specie), itc);
    1041             :          
    1042             :         //Double_t monitorPeriodLength=fProcessedRawEventN*600*1E-9;//in s
    1043             :       
    1044           0 :         if (fCalibData){
    1045             :           //set minima and maxima to allow log scale
    1046           0 :           Double_t yTimeMax = ((TH1*)arrRW[5])->GetMaximum()*1.05;
    1047           0 :           Double_t yTotMax = ((TH1*)arrRW[10])->GetMaximum()*1.05;
    1048           0 :           fLineExpTimeMin->SetY2(yTimeMax);
    1049           0 :           fLineExpTimeMax->SetY2(yTimeMax);
    1050           0 :           fLineExpTotMin->SetY2(yTotMax);
    1051           0 :           fLineExpTotMax->SetY2(yTotMax);
    1052             :           //
    1053           0 :           for (Int_t j=0;j<18;j++){
    1054           0 :             if ((j==0)||(j==5)||(j==10)||(j==15)||(j==16)||(j==17)) {
    1055           0 :               TH1* htmp = (TH1*)arrRW[j];
    1056           0 :               htmp->GetXaxis()->SetLabelOffset(0.005);
    1057           0 :               htmp->GetXaxis()->SetLabelSize(0.05);
    1058           0 :               htmp->GetXaxis()->SetTitleOffset(0.8);
    1059           0 :               htmp->GetXaxis()->SetTitleSize(0.05);
    1060           0 :               htmp->GetYaxis()->SetLabelOffset(0.005);
    1061           0 :               htmp->GetYaxis()->SetLabelSize(0.06);
    1062           0 :               htmp->GetYaxis()->SetTitleOffset(0.8);
    1063           0 :               htmp->GetYaxis()->SetTitleSize(0.06);         
    1064           0 :             }
    1065             :           }
    1066             :           //make up for all histos 
    1067           0 :           for(Int_t j=0;j<5;j++) {
    1068           0 :             TH1* htmp = (TH1*)arrRW[j];  
    1069           0 :             if (!htmp) continue;
    1070           0 :             htmp->SetMarkerColor(kBlue);
    1071           0 :             htmp->SetMarkerStyle(8);
    1072           0 :             htmp->SetMarkerSize(0.7);
    1073           0 :           }
    1074           0 :           for(Int_t j=5;j<15;j++) {
    1075           0 :             TH1* htmp = (TH1*)arrRW[j];
    1076           0 :             if (!htmp) continue;
    1077           0 :             htmp->SetLineColor(kBlue);
    1078           0 :             htmp->SetLineWidth(1);
    1079           0 :             htmp->SetMarkerColor(kBlue);
    1080           0 :           }
    1081             :           
    1082           0 :           TH1* htmp =  (TH1*)arrRW[15];  
    1083           0 :           htmp->SetLineColor(kBlue);
    1084           0 :           htmp->SetLineWidth(1);
    1085           0 :           htmp->SetMarkerStyle(8);
    1086           0 :           htmp->SetMarkerSize(0.7);
    1087           0 :           htmp->SetMarkerColor(kBlue);//Option("bar");
    1088             :           //
    1089           0 :           TString title25 = Form("Map of hit pads according to CTTM numbering (Max Fired Macropad = %i)",fgCutNmaxFiredMacropad);
    1090           0 :           TString title26 = Form("Map of hit macropads according to CTTM numbering (Max Fired Macropad = %i)",fgCutNmaxFiredMacropad);
    1091           0 :           TString title27 = Form("#Deltat vs #Delta#Phi of hit macropads (Max Fired Macropad = %i)",fgCutNmaxFiredMacropad);
    1092             :           
    1093             :           TPaveText * pavetmp = 0x0;
    1094           0 :           if ( (htmp=(TH1*)arrRW[16]) ) htmp->SetOption("colz");
    1095           0 :           if ( (htmp=(TH1*)arrRW[17]) ) htmp->SetOption("colz");
    1096           0 :           if ( (htmp=(TH1*)arrRW[18]) ) htmp->SetOption("colz"); 
    1097           0 :           if ( (htmp=(TH1*)arrRW[22]) ) htmp->SetOption("colz"); 
    1098           0 :           if ( (htmp=(TH1*)arrRW[23]) ) htmp->SetOption("colz"); 
    1099           0 :           if ( (htmp=(TH1*)arrRW[24]) ) htmp->SetOption("colz"); 
    1100           0 :           if ( (htmp=(TH1*)arrRW[28]) ) htmp->SetOption("colz"); 
    1101           0 :           if ( (htmp=(TH1*)arrRW[29]) ) htmp->SetOption("colz");
    1102             : 
    1103           0 :           if ( (htmp=(TH1*)arrRW[25]) ) {
    1104           0 :             htmp->SetOption("colz"); 
    1105           0 :             htmp->SetTitle(title25.Data());
    1106             :           }
    1107           0 :           if ( (htmp=(TH1*)arrRW[26]) ) {
    1108           0 :             htmp->SetOption("colz"); 
    1109           0 :             htmp->SetTitle(title26.Data());
    1110             :           }
    1111           0 :           if ( (htmp=(TH1*)arrRW[27]) ){
    1112           0 :             htmp->SetOption("colz"); 
    1113           0 :             htmp->SetTitle(title27.Data());
    1114             :           }
    1115           0 :         }
    1116           0 :         if (GetRawsData(30, itc)) {
    1117           0 :           GetRawsData(30, itc)->Scale(1./24.);
    1118           0 :           TPaveText *phosHoleBox=new TPaveText(13,38,16,53,"b");
    1119           0 :           phosHoleBox->SetFillStyle(0);
    1120           0 :           phosHoleBox->SetFillColor(kWhite);
    1121           0 :           phosHoleBox->SetLineColor(kMagenta);
    1122           0 :           phosHoleBox->SetLineWidth(2);
    1123           0 :           phosHoleBox->AddText("PHOS");      
    1124           0 :           GetRawsData(30, itc)->GetListOfFunctions()->Add(phosHoleBox);
    1125           0 :         } 
    1126           0 :       }//END ENABLE DQM SHIFTER OPT
    1127             :     } // RS: loop over trigger classes
    1128           0 :   } //end for
    1129             :   
    1130           0 :   AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;  
    1131           0 : }
    1132             : //____________________________________________________________________________
    1133             : void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out)
    1134             : {
    1135             :   //
    1136             :   //return appropriate indeces for the theta-phi map
    1137             :   //
    1138             : 
    1139           0 :   Int_t npadX = AliTOFGeometry::NpadX();
    1140           0 :   Int_t npadZ = AliTOFGeometry::NpadZ();
    1141           0 :   Int_t nStripA = AliTOFGeometry::NStripA();
    1142           0 :   Int_t nStripB = AliTOFGeometry::NStripB();
    1143           0 :   Int_t nStripC = AliTOFGeometry::NStripC();
    1144             : 
    1145           0 :   Int_t isector = in[0];
    1146           0 :   Int_t iplate = in[1];
    1147           0 :   Int_t istrip = in[2];
    1148           0 :   Int_t ipadX = in[3]; 
    1149           0 :   Int_t ipadZ = in[4]; 
    1150             :   
    1151             :   Int_t stripOffset = 0;
    1152           0 :   switch (iplate) {
    1153             :   case 0:
    1154             :     stripOffset = 0;
    1155           0 :       break;
    1156             :   case 1:
    1157             :     stripOffset = nStripC;
    1158           0 :     break;
    1159             :   case 2:
    1160           0 :     stripOffset = nStripC+nStripB;
    1161           0 :     break;
    1162             :   case 3:
    1163           0 :     stripOffset = nStripC+nStripB+nStripA;
    1164           0 :     break;
    1165             :   case 4:
    1166           0 :     stripOffset = nStripC+nStripB+nStripA+nStripB;
    1167           0 :     break;
    1168             :   default:
    1169             :     //    AliDebug(2,Form("Wrong plate number in TOF (%d) !",iplate));
    1170             :     break;
    1171             :   };
    1172           0 :   Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
    1173           0 :   Int_t phiindex=npadX*isector+ipadX+1;
    1174           0 :   out[0]=zindex;  
    1175           0 :   out[1]=phiindex;  
    1176             :   
    1177           0 : }
    1178             : 
    1179             : //---------------------------------------------------------------
    1180             : Int_t AliTOFQADataMakerRec::GetStripIndex(const Int_t * const in)
    1181             : {
    1182             :     /* return tof strip index between 0 and 91 */
    1183             : 
    1184           0 :   Int_t nStripA = AliTOFGeometry::NStripA();
    1185           0 :   Int_t nStripB = AliTOFGeometry::NStripB();
    1186           0 :   Int_t nStripC = AliTOFGeometry::NStripC();
    1187             : 
    1188             :   // Int_t isector = in[0];
    1189           0 :   Int_t iplate = in[1];
    1190           0 :   Int_t istrip = in[2];
    1191             :   //Int_t ipadX = in[3]; 
    1192             :   //Int_t ipadZ = in[4]; 
    1193             :   
    1194             :   Int_t stripOffset = 0;
    1195           0 :   switch (iplate) {
    1196             :   case 0:
    1197             :     stripOffset = 0;
    1198           0 :       break;
    1199             :   case 1:
    1200             :     stripOffset = nStripC;
    1201           0 :     break;
    1202             :   case 2:
    1203           0 :     stripOffset = nStripC+nStripB;
    1204           0 :     break;
    1205             :   case 3:
    1206           0 :     stripOffset = nStripC+nStripB+nStripA;
    1207           0 :     break;
    1208             :   case 4:
    1209           0 :     stripOffset = nStripC+nStripB+nStripA+nStripB;
    1210           0 :     break;
    1211             :   default:
    1212             :     //AliDebug(2,Form("Wrong plate number in TOF (%d) !",iplate));
    1213             :       stripOffset=-1;
    1214           0 :       break;
    1215             :   };
    1216             :   
    1217           0 :   if (stripOffset<0 || stripOffset>92) return -1;
    1218             :   else 
    1219           0 :       return (stripOffset+istrip);
    1220             :   
    1221           0 : }
    1222             : //---------------------------------------------------------------
    1223             : Bool_t  AliTOFQADataMakerRec::CheckVolumeID(const Int_t * const volumeID)
    1224             : {
    1225             :     //
    1226             :     //Checks volume ID validity
    1227             :     //   
    1228           0 :     for (Int_t j=0;j<5;j++){
    1229           0 :         if (volumeID[j]<0) {
    1230             :           //AliDebug(2,Form("Invalid detector volume index for volumeID[%i]",j));
    1231           0 :             return kFALSE;
    1232             :         }
    1233             :     }
    1234           0 :     return kTRUE; 
    1235           0 : }
    1236             : 
    1237             : //---------------------------------------------------------------
    1238             : Bool_t  AliTOFQADataMakerRec::CheckEquipID(const Int_t * const equipmentID)
    1239             : {
    1240             :     //
    1241             :     //Checks equipment ID validity    
    1242           0 :    for (Int_t j=0;j<5;j++){
    1243           0 :         if (equipmentID[j]<0) {
    1244             :           // AliDebug(2,Form("Invalid equipment volume index for equipmentID[%i]",j));
    1245           0 :           return kFALSE;
    1246             :         }
    1247             :    }
    1248           0 :    return kTRUE;
    1249           0 : }
    1250             : //---------------------------------------------------------------
    1251             : Bool_t  AliTOFQADataMakerRec::FilterLTMData(const Int_t * const equipmentID) const
    1252             : {
    1253             :   /*It returns kTRUE if data come from LTM.
    1254             :     It thus filters trigger-related signals  */
    1255             : 
    1256             :   Int_t ddl, trm, tdc;
    1257             :   //if (!CheckEquipID(equipmentID)) return kFALSE;
    1258           0 :   ddl = equipmentID[0];
    1259           0 :   trm = equipmentID[1];
    1260           0 :   tdc = equipmentID[3];
    1261             :   
    1262           0 :   if ((ddl%2==1) && (trm==3) && (tdc>11 && tdc<15))
    1263           0 :     return kTRUE;
    1264             :   else 
    1265           0 :     return kFALSE;
    1266             :  
    1267           0 : }
    1268             : //---------------------------------------------------------------
    1269             : Bool_t  AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const
    1270             : {
    1271             :   /*It returns kTRUE if data come from spare 
    1272             :     equipment ID. 
    1273             :     So far only check on TRM 3 crate left is implemented */
    1274             : 
    1275             :   Int_t ddl, trm, tdc;
    1276             :   //if (!CheckEquipID(equipmentID)) return kFALSE;
    1277           0 :   ddl = equipmentID[0];
    1278           0 :   trm = equipmentID[1];
    1279           0 :   tdc = equipmentID[3];
    1280             :   
    1281           0 :   if ((ddl%2==1) && (trm==3) && (tdc>2 && tdc<12))
    1282           0 :     return kTRUE;
    1283             :   else 
    1284           0 :     return kFALSE;
    1285           0 : }
    1286             : 
    1287             : //-----------------------------------------------------------------------------
    1288             : void AliTOFQADataMakerRec::GetGeo2LTMIndex(const Int_t * const detind, Int_t *indexLTM) {
    1289             :   //
    1290             :   // getting LTMmatrix indexes for current digit
    1291             :   //
    1292           0 :   Int_t stripId=GetStripIndex(detind);
    1293             : 
    1294           0 :   if (detind[1]==0 || detind[1]==1 || (detind[1]==2 && detind[2]<=7)) { //A side
    1295           0 :     if (detind[4]<24){ //R
    1296           0 :       indexLTM[0] = detind[0]*2;
    1297           0 :     } else { //L
    1298           0 :       indexLTM[0] = detind[0]*2+1;
    1299             :     }  
    1300           0 :     indexLTM[1]=stripId;
    1301             : 
    1302           0 :   } else { //C side
    1303           0 :     if (detind[4]<24){
    1304           0 :       indexLTM[0] = detind[0]*2+36;
    1305           0 :     } else {
    1306           0 :       indexLTM[0] = (detind[0]*2+1)+36;
    1307             :     }
    1308           0 :     indexLTM[1]=90-stripId; 
    1309             :   }
    1310             :   
    1311             :   // if (indexLTM[0]<36) { //A side
    1312             :   //   if (detind[1] ==0){
    1313             :   //     indexLTM[1] = detind[2];
    1314             :   //   }
    1315             :   //   else if (detind[1] ==1){
    1316             :   //     indexLTM[1] = detind[2]+nStripB;
    1317             :   //   }
    1318             :   //   else if (detind[1] ==2){
    1319             :   //     indexLTM[1] = detind[2]+19*2;
    1320             :   //   }
    1321             :   //   else{
    1322             :   //     AliError("Smth Wrong!!!");
    1323             :   //   }
    1324             :   // }
    1325             :   // else { //C side
    1326             :   //   if (detind[1]==2){
    1327             :   //     if (detind[4]<24)
    1328             :   //    indexLTM[1] = (nStripAL-detind[2])+nStripC+nStripB;
    1329             :   //     else 
    1330             :   //    indexLTM[1] = (nStripAR-detind[2])+nStripC+nStripB;
    1331             :   //   }
    1332             :   //   else if (detind[1] ==3){
    1333             :   //     indexLTM[1] = (nStripB-detind[2])+nStripC;
    1334             :   //   }
    1335             :   //   else if (detind[1] ==4){
    1336             :   //     indexLTM[1] = nStripC-detind[2];
    1337             :   //   }
    1338             :   //   else{
    1339             :   //     AliError("Smth Wrong!!!");
    1340             :   //   }
    1341             :   // }  
    1342           0 : }
    1343             : 
    1344             : //-----------------------------------------------------------------------------
    1345             : void AliTOFQADataMakerRec::GetGeo2CTTMIndex(Int_t *detind, Int_t *indexCTTM) {
    1346             :   //
    1347             :   // Returns CTTM index corresponding to the detector element detind
    1348             :   //
    1349           0 :   GetGeo2LTMIndex(detind,indexCTTM);
    1350           0 :   indexCTTM[1]/=2;
    1351           0 :   return;
    1352             : }
    1353             : 
    1354             : //-------------------------------------------------------------------------
    1355             : Int_t AliTOFQADataMakerRec::GetNumberOfFiredMacropad(AliRawReader * rawReader){
    1356             :   
    1357             :   Int_t nFired=0;
    1358             :   TClonesArray * clonesRawData;  
    1359           0 :   if (!rawReader) return 0;  
    1360           0 :   for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
    1361           0 :     rawReader->Reset();
    1362           0 :     fTOFRawStream.LoadRawDataBuffersV2(iDDL); 
    1363           0 :     clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
    1364           0 :     for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
    1365           0 :       AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);    
    1366           0 :       if (tofRawDatum->GetTOF()){    
    1367           0 :         if ( (tofRawDatum->GetTRM()==3)&&
    1368           0 :              (tofRawDatum->GetTDC()>11)&&
    1369           0 :              (tofRawDatum->GetTDC()<15)) {          
    1370           0 :           nFired+=1;  
    1371           0 :         }
    1372             :       }
    1373             :     }    
    1374             :   }//loop over DDLs
    1375           0 :   return nFired; 
    1376           0 : }
    1377             : 
    1378             : //----------------------------------------------------------------
    1379             : void AliTOFQADataMakerRec::GetCTTMIndex(Int_t *equipid, Int_t *indexCTTM) {
    1380             :   //
    1381             :   // Returns CTTM index corresponding to the equipment id equipid, only for LTM hits
    1382             :   // equipid = (crate, trm, chain, tdc, channel)
    1383             : 
    1384           0 :   if ( (equipid[1]!=3)||(equipid[3]<12) ){
    1385           0 :     indexCTTM[0]=-1;
    1386           0 :     indexCTTM[1]=-1;
    1387           0 :     return;
    1388             :   }  
    1389           0 :   Int_t modStrip2LTM[3][8]={ { 0, 1, 2, 3, 4, 5, 6, 7},
    1390             :                              { 8, 9, 10, 11, 12, 13, 14, 15},
    1391             :                              {16, 17, 18, 19, 20, 21, 22, 23}
    1392             :                             }; 
    1393             : 
    1394           0 :   Int_t DDL2LTMmatrix[72]={0,1,37,36,2,3,39,38,4,5,41,40,6,7,43,42,8,9,45,44,10,11,47,46,12,13,49,48,14,15,51,50,16,17,53,52,18,19,
    1395             :                            55,54,20,21,57,56,22,23,59,58,24,25,61,60,26,27,63,62,28,29,65,64,30,31,67,66,32,33,69,68,34,35,71,70};
    1396             : 
    1397           0 :   Int_t itdc=equipid[3]%12;
    1398             :   Int_t crate=-1;
    1399           0 :   if (equipid[2]==0)
    1400           0 :    crate=equipid[0]-1;
    1401             :   else crate=equipid[0];
    1402             :   
    1403           0 :   indexCTTM[0]=DDL2LTMmatrix[crate];
    1404           0 :   indexCTTM[1]=modStrip2LTM[itdc][equipid[4]];      
    1405             :   return;
    1406           0 : }
    1407             : 
    1408             : //_____________________________________________________________________________
    1409             : void AliTOFQADataMakerRec::ReadHistogramRangeFromFile(const Char_t * filename)
    1410             : {
    1411             :   //
    1412             :   // read histogram ranges from configuration file
    1413             :   //
    1414           0 :   if (!filename) {
    1415           0 :     AliInfo("Config file with histograms ranges not found or invalid -> use default values.");
    1416           0 :     SetDefaultHistogramRange();
    1417           0 :     SetDefaultCutNmaxFiredMacropad();
    1418           0 :     return;
    1419             :   }
    1420             :   
    1421           0 :   std::fstream configFile;
    1422           0 :   configFile.open(filename, std::fstream::in);
    1423           0 :   if (!configFile.is_open()){
    1424           0 :     AliInfo("Cannot open config file with histograms ranges -> use default values.");
    1425           0 :     SetDefaultHistogramRange();
    1426           0 :     return;
    1427             :   }
    1428             :   
    1429             :   //check file size
    1430           0 :   Int_t begin = configFile.tellg();
    1431           0 :   configFile.seekg(0, std::fstream::end); /* end */
    1432           0 :   Int_t end = configFile.tellg();
    1433           0 :   Int_t size = end - begin;
    1434           0 :   configFile.seekg(0, std::fstream::beg); /* rewind file */
    1435           0 :   if (size <= 0){
    1436           0 :     AliInfo(Form("Unexpected EOF of config file with histograms ranges. File size: %d -> use default values", size));
    1437           0 :     SetDefaultHistogramRange();
    1438           0 :     return;
    1439             :   }
    1440             :   
    1441           0 :   Int_t minMulti=9999, maxMulti=-9999;
    1442             :   Int_t nbinsMulti=0,nbinsTime=0;
    1443           0 :   Float_t minTime=9999.0, maxTime=-9999.0;
    1444           0 :   Int_t cutFiredMacropad=0;
    1445           0 :   TString endoflist;
    1446           0 :   while (!configFile.eof()) {
    1447           0 :     configFile >> cutFiredMacropad >> minMulti >> maxMulti >> minTime >> maxTime;
    1448           0 :     configFile >> endoflist;
    1449           0 :     if (endoflist.Contains("end")) break;
    1450             :   }
    1451             : 
    1452             :   //set multiplicity histo ranges
    1453           0 :   if (minMulti>maxMulti){
    1454           0 :     AliInfo("Invalid range for multiplicity histogram set. Changing to default values.");
    1455           0 :     SetDefaultMultiHistogramRange();
    1456             :   } else {
    1457           0 :     nbinsMulti = maxMulti-minMulti;
    1458           0 :     SetNbinsMultiplicityHisto(nbinsMulti);
    1459           0 :     SetMultiplicityHistoRange(minMulti,maxMulti);
    1460             :     //AliInfo(Form("Setting multiplicity histogram ranges to: multMin = %i - multMax = %i - nMultBins = %i", fgRangeMinMultiplicity, fgRangeMaxMultiplicity, fgNbinsMultiplicity));
    1461             :   }
    1462             : 
    1463             :   //set time histo ranges
    1464           0 :   if (minTime>maxTime){
    1465           0 :     AliInfo("Invalid range for time histogram set. Changing to default values.");
    1466           0 :     SetDefaultTimeHistogramRange();
    1467             :   } else {
    1468           0 :     nbinsTime = TMath::Nint((maxTime - minTime)/fgkNbinsWidthTime);//ns
    1469           0 :     maxTime=minTime+nbinsTime*fgkNbinsWidthTime;//ns
    1470           0 :     SetNbinsTimeHisto(nbinsTime);
    1471           0 :     SetTimeHistoRange(minTime,maxTime);
    1472             :     //AliInfo(Form("Setting time histogram ranges to: timeMin = %5.2f ns - timeMax = %5.2f ns - nTimeBins = %i", fgRangeMinTime, fgRangeMaxTime,fgNbinsTime));
    1473             :   } 
    1474             :  
    1475           0 :   if ((cutFiredMacropad>0)&&(cutFiredMacropad<fgkFiredMacropadLimit)){
    1476           0 :     AliInfo("Invalid value for cut on fired macropad. Changing to default values.");
    1477           0 :     SetDefaultCutNmaxFiredMacropad();
    1478             :   } else {
    1479           0 :     SetCutNmaxFiredMacropad(cutFiredMacropad);
    1480             :     //AliInfo(Form("Setting cut on fired macropad to:  = %i",cutFiredMacropad));
    1481             :   } 
    1482           0 :   AliInfo(Form("Setting: multMin = %i - multMax = %i - nMultBins = %i, timeMin = %5.2f ns - timeMax = %5.2f ns - nTimeBins = %i, cutMaxFiredMacropad = %i", 
    1483             :                fgRangeMinMultiplicity, fgRangeMaxMultiplicity, fgNbinsMultiplicity, fgRangeMinTime, fgRangeMaxTime,fgNbinsTime, cutFiredMacropad));
    1484           0 :   configFile.close();
    1485             :   return;
    1486           0 : }
    1487             : 
    1488             : //_____________________________________________________________________________
    1489             : void AliTOFQADataMakerRec::SetDefaultHistogramRange()
    1490             : {
    1491             :   //
    1492             :   // set default histogram ranges (tuned on 2011 pp collisions)
    1493             :   // 
    1494             :   //AliInfo("Setting all histogram ranges to default values.");
    1495           0 :   SetDefaultMultiHistogramRange();
    1496           0 :   SetDefaultTimeHistogramRange();
    1497           0 :   SetDefaultCutNmaxFiredMacropad();
    1498           0 :   return;
    1499             : }
    1500             : 
    1501             : //_____________________________________________________________________________
    1502             : void AliTOFQADataMakerRec::SetDefaultMultiHistogramRange()
    1503             : {
    1504             :   //
    1505             :   // set default histogram ranges (tuned on 2011 pp collisions)
    1506             :   // 
    1507           0 :   SetMultiplicityHistoRange (0, AliTOFQADataMakerRec::fgRangeMaxMultiplicity);
    1508           0 :   SetNbinsMultiplicityHisto(AliTOFQADataMakerRec::fgNbinsMultiplicity);
    1509           0 :   return;
    1510             : }
    1511             : 
    1512             : //_____________________________________________________________________________
    1513             : void AliTOFQADataMakerRec::SetDefaultTimeHistogramRange()
    1514             : {
    1515             :   //
    1516             :   // set default histogram ranges (tuned on 2011 pp collisions)
    1517             :   // 
    1518           0 :   SetNbinsTimeHisto(250);
    1519           0 :   SetTimeHistoRange (0.0,610.);   
    1520           0 :   return;
    1521             : }
    1522             : 
    1523             : //------------------------------------------------------------------
    1524             : void AliTOFQADataMakerRec::SetDefaultCutNmaxFiredMacropad()
    1525             : {
    1526             :   //
    1527             :   // set default cut on fired macropad 
    1528             :   // 
    1529           0 :   SetCutNmaxFiredMacropad(50); 
    1530             :   // AliInfo(Form("Setting cut on fired macropad to default values: NfiredMacropad = %i", fgCutNmaxFiredMacropad));
    1531           0 :   return;
    1532             : }
    1533             : 

Generated by: LCOV version 1.11