LCOV - code coverage report
Current view: top level - MUON/MUONrec - AliMUONTrackerQADataMakerRec.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 17 1014 1.7 %
Date: 2016-06-14 17:26:59 Functions: 3 34 8.8 %

          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             : // $Id: AliMUONTrackerQADataMakerRec.cxx 35760 2009-10-21 21:45:42Z ivana $
      17             : 
      18             : // --- MUON header files ---
      19             : #include "AliMUONTrackerQADataMakerRec.h"
      20             : 
      21             : #include "AliCDBManager.h"
      22             : #include "AliCodeTimer.h"
      23             : #include "AliDAQ.h"
      24             : #include "AliESDEvent.h"
      25             : #include "AliESDMuonTrack.h"
      26             : #include "AliLog.h"
      27             : #include "AliMUON2DMap.h"
      28             : #include "AliMUONCalibParamND.h"
      29             : #include "AliMUONCalibrationData.h"
      30             : #include "AliMUONConstants.h"  
      31             : #include "AliMUONDigitMaker.h"
      32             : #include "AliMUONESDInterface.h"
      33             : #include "AliMUONLogger.h"
      34             : #include "AliMUONQADataMakerRec.h"
      35             : #include "AliMUONQAIndices.h"
      36             : #include "AliMUONQAMappingCheck.h"
      37             : #include "AliMUONTrack.h"
      38             : #include "AliMUONTrackParam.h"
      39             : #include "AliMUONTrackerData.h"
      40             : #include "AliMUONTrackerDataMaker.h"
      41             : #include "AliMUONVCluster.h"
      42             : #include "AliMUONVClusterStore.h"
      43             : #include "AliMUONVDigit.h"
      44             : #include "AliMUONVDigit.h"
      45             : #include "AliMUONVDigitStore.h"
      46             : #include "AliMpBusPatch.h"
      47             : #include "AliMpConstants.h"
      48             : #include "AliMpDDL.h"
      49             : #include "AliMpDDLStore.h"
      50             : #include "AliMpDEIterator.h"
      51             : #include "AliMpDEManager.h"
      52             : #include "AliMpDetElement.h"
      53             : #include "AliMpManuIterator.h"
      54             : #include "AliQAv1.h"
      55             : #include "AliRawReader.h"
      56             : #include "AliRawEventHeaderBase.h"
      57             : #include <Riostream.h>
      58             : #include <TH1F.h> 
      59             : #include <TH1I.h> 
      60             : #include <TH2F.h>
      61             : #include <TMath.h>
      62             : #include <TObjArray.h>
      63             : #include <TPaveText.h>
      64             : 
      65             : //-----------------------------------------------------------------------------
      66             : /// \class AliMUONTrackerQADataMakerRec
      67             : ///
      68             : /// Quality assurance data (histo) maker for MUON tracker
      69             : ///
      70             : ///
      71             : /// Note that all the methods of this class shoud not be called when eventSpecie is AliRecoParam::kCalib !
      72             : ///
      73             : /// \author C. Finck, D. Stocco, L. Aphecetche
      74             : 
      75             : /// \cond CLASSIMP
      76          18 : ClassImp(AliMUONTrackerQADataMakerRec)
      77             : /// \endcond
      78             :            
      79             : namespace
      80             : {
      81             :   Double_t ProtectedSqrt(Double_t x)
      82             :   {
      83           0 :     return ( x > 0.0 ? TMath::Sqrt(x) : 0.0 );
      84             :   }
      85             :   
      86             : }
      87             : 
      88             : //____________________________________________________________________________ 
      89             : AliMUONTrackerQADataMakerRec::AliMUONTrackerQADataMakerRec(AliQADataMakerRec* master) : 
      90           2 : AliMUONVQADataMakerRec(master),
      91           2 : fDigitStore(0x0),
      92           6 : fDigitMaker(new AliMUONDigitMaker(kTRUE)),
      93           2 : fClusterStore(0x0),
      94           8 : fCalibrationData(new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun())),
      95           2 : fLogger(0x0),
      96           2 : fBusPatchConfig(0x0),
      97           2 : fBPxmin(0),
      98           2 : fBPxmax(0),
      99           2 : fBPnbins(0),
     100           2 : fTrackerDataMakerArray(0x0),
     101           2 : fTrackerCalDataArray(0x0),
     102           2 : fTrackerRecDataArray(0x0),
     103           2 : fMappingCheckRecPointsArray(0x0)
     104          10 : {
     105             :   /// ctor
     106           4 : }
     107             : 
     108             : //__________________________________________________________________
     109             : AliMUONTrackerQADataMakerRec::~AliMUONTrackerQADataMakerRec()
     110           0 : {
     111             :   /// dtor
     112           0 :   delete fDigitStore;
     113           0 :   delete fDigitMaker;
     114           0 :   delete fClusterStore;
     115           0 :   delete fCalibrationData;
     116           0 :   delete fMappingCheckRecPointsArray;
     117           0 :   if (fLogger)
     118             :   {
     119           0 :     if ( fLogger->NumberOfEntries() != 0 ) 
     120             :     {
     121           0 :       AliError("Some unprocessed logged errors are still there... Please check");
     122             :     }
     123           0 :     delete fLogger;    
     124             :   }
     125           0 :   delete fTrackerDataMakerArray;
     126           0 :   delete fTrackerCalDataArray;
     127           0 :   delete fTrackerRecDataArray;
     128           0 :   delete fBusPatchConfig;  
     129           0 : }
     130             : 
     131             : //____________________________________________________________________________ 
     132             : void AliMUONTrackerQADataMakerRec::InsertTrackerData(Int_t specie, 
     133             :                                                      TObjArray** list,
     134             :                                                      TObject* object, 
     135             :                                                      Int_t indexNumber,
     136             :                                                      Bool_t replace)
     137             : {
     138             :   /// Insert an object to a given list
     139             :   
     140           0 :   TIter next(list[specie]);
     141             :   TObject* o;
     142             :   TObject* old(0x0);
     143             :   Bool_t alreadyThere(kFALSE);
     144             :   
     145           0 :   while ( ( o = next() ) && !alreadyThere )
     146             :   {
     147           0 :     TString classname(o->ClassName());
     148           0 :     if ( classname.Contains("TrackerData") ) 
     149             :     {
     150           0 :       if ( !strcmp(object->GetName(),o->GetName()) ) 
     151             :       {
     152             :         alreadyThere = kTRUE;
     153             :         old = o;
     154           0 :       }
     155             :     }
     156           0 :   }
     157           0 :   if ( (!alreadyThere && object) || (alreadyThere && replace) )
     158             :   {
     159           0 :     delete old;
     160           0 :     AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s to the list of qa objects",object->GetName()));
     161           0 :     TNamed* named = static_cast<TNamed*>(object);
     162           0 :     named->SetName(Form("%s_%s",AliRecoParam::GetEventSpecieName(specie),object->GetName()));
     163           0 :     object->SetBit(AliQAv1::GetExpertBit());
     164           0 :     list[specie]->AddAt(object,indexNumber);
     165           0 :   }
     166           0 : }
     167             : 
     168             : //____________________________________________________________________________ 
     169             : void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleESDs(Int_t, TObjArray**)
     170             : {
     171             :   /// Normalize ESD histograms
     172             :   //
     173             :   Bool_t firstFill = kTRUE;
     174             :   //
     175           0 :   for (int itc=-1;itc<Master()->GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
     176             :     //
     177           0 :     TH1* hESDnClustersPerTr = Master()->GetESDsData(AliMUONQAIndices::kESDnClustersPerTrack, itc);
     178           0 :     if (! hESDnClustersPerTr) continue;
     179           0 :     Double_t nTracks = hESDnClustersPerTr->GetEntries();
     180           0 :     if (nTracks <= 0) continue;
     181             :     //
     182           0 :     if (firstFill) { AliCodeTimerAuto("",0); firstFill = kFALSE;}
     183             :   
     184           0 :     TH1* hESDnClustersPerCh = Master()->GetESDsData(AliMUONQAIndices::kESDnClustersPerCh,itc);
     185           0 :     TH1* hESDnClustersPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDnClustersPerDE,itc);
     186           0 :     TH1* hESDClusterChargePerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDClusterChargePerChMean,itc);
     187           0 :     TH1* hESDClusterChargePerChSigma = Master()->GetESDsData(AliMUONQAIndices::kESDClusterChargePerChSigma,itc);
     188           0 :     TH1* hESDClusterSizePerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDClusterSizePerChMean,itc);
     189           0 :     TH1* hESDClusterSizePerChSigma = Master()->GetESDsData(AliMUONQAIndices::kESDClusterSizePerChSigma,itc);
     190           0 :     TH1* hESDResidualXPerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDResidualXPerChMean,itc);
     191           0 :     TH1* hESDResidualXPerChSigma = Master()->GetESDsData(AliMUONQAIndices::kESDResidualXPerChSigma,itc);
     192           0 :     TH1* hESDResidualYPerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDResidualYPerChMean,itc);
     193           0 :     TH1* hESDResidualYPerChSigma = Master()->GetESDsData(AliMUONQAIndices::kESDResidualYPerChSigma,itc);
     194           0 :     TH1* hESDLocalChi2XPerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2XPerChMean,itc);
     195           0 :     TH1* hESDLocalChi2YPerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2YPerChMean,itc);
     196           0 :     TH1* hESDLocalChi2PerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2PerChMean,itc);
     197           0 :     TH1* hESDClusterChargePerDE = Master()->GetESDsData(AliMUONQAIndices::kESDClusterChargePerDE,itc);
     198           0 :     TH1* hESDClusterSizePerDE = Master()->GetESDsData(AliMUONQAIndices::kESDClusterSizePerDE,itc);
     199           0 :     TH1* hESDResidualXPerDEMean = Master()->GetESDsData(AliMUONQAIndices::kESDResidualXPerDEMean,itc);
     200           0 :     TH1* hESDResidualXPerDESigma = Master()->GetESDsData(AliMUONQAIndices::kESDResidualXPerDESigma,itc);
     201           0 :     TH1* hESDResidualYPerDEMean = Master()->GetESDsData(AliMUONQAIndices::kESDResidualYPerDEMean,itc);
     202           0 :     TH1* hESDResidualYPerDESigma = Master()->GetESDsData(AliMUONQAIndices::kESDResidualYPerDESigma,itc);
     203           0 :     TH1* hESDLocalChi2XPerDEMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2XPerDEMean,itc);
     204           0 :     TH1* hESDLocalChi2YPerDEMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2YPerDEMean,itc);
     205           0 :     TH1* hESDLocalChi2PerDEMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2PerDEMean,itc);
     206           0 :     TH1* hESDnTotClustersPerCh = Master()->GetESDsData(AliMUONQAIndices::kESDnTotClustersPerCh,itc);
     207           0 :     TH1* hESDnTotClustersPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDnTotClustersPerDE,itc);
     208           0 :     TH1* hESDnTotFullClustersPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDnTotFullClustersPerDE,itc);
     209           0 :     TH1* hESDSumClusterChargePerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumClusterChargePerDE,itc);
     210           0 :     TH1* hESDSumClusterSizePerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumClusterSizePerDE,itc);
     211           0 :     TH1* hESDSumResidualXPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumResidualXPerDE,itc);
     212           0 :     TH1* hESDSumResidualYPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumResidualYPerDE,itc);
     213           0 :     TH1* hESDSumResidualX2PerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumResidualX2PerDE,itc);
     214           0 :     TH1* hESDSumResidualY2PerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumResidualY2PerDE,itc);
     215           0 :     TH1* hESDSumLocalChi2XPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumLocalChi2XPerDE,itc);
     216           0 :     TH1* hESDSumLocalChi2YPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumLocalChi2YPerDE,itc);
     217           0 :     TH1* hESDSumLocalChi2PerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumLocalChi2PerDE,itc);
     218             :     //  
     219           0 :     if (hESDnClustersPerCh && hESDnTotClustersPerCh) {
     220           0 :       hESDnClustersPerCh->Reset(); 
     221           0 :       hESDnClustersPerCh->Add(hESDnTotClustersPerCh, 1./nTracks);
     222           0 :     }
     223           0 :     if (hESDnClustersPerDE && hESDnTotClustersPerDE) {
     224           0 :       hESDnClustersPerDE->Reset();      
     225           0 :       hESDnClustersPerDE->Add(hESDnTotClustersPerDE, 1./nTracks);
     226           0 :     }
     227             :     //
     228             :     // loop over chambers
     229           0 :     for (Int_t iCh = 0; iCh < AliMUONConstants::NTrackingCh(); iCh++) {
     230             :       //
     231             :       double sigmaCharge=0,sigmaSize=0,sigmaResidualX=0,sigmaResidualY=0,sigmaLocalChi2X=0,sigmaLocalChi2Y=0,sigmaLocalChi2=0;
     232             :       //
     233           0 :       TH1* hESDClusterChargeInCh = Master()->GetESDsData(AliMUONQAIndices::kESDClusterChargeInCh+iCh,itc);
     234           0 :       if (hESDClusterChargeInCh) {
     235           0 :         sigmaCharge = hESDClusterChargeInCh->GetRMS();
     236           0 :         if (hESDClusterChargePerChMean) { 
     237           0 :           hESDClusterChargePerChMean->SetBinContent(iCh+1, hESDClusterChargeInCh->GetMean());
     238           0 :           hESDClusterChargePerChMean->SetBinError(iCh+1, hESDClusterChargeInCh->GetMeanError());
     239           0 :         }
     240           0 :         if (hESDClusterChargePerChSigma) {
     241           0 :           hESDClusterChargePerChSigma->SetBinContent(iCh+1, sigmaCharge);
     242           0 :           hESDClusterChargePerChSigma->SetBinError(iCh+1, hESDClusterChargeInCh->GetRMSError());
     243           0 :         }    
     244             :       }
     245             :       //
     246           0 :       TH1* hESDClusterSizeInCh = Master()->GetESDsData(AliMUONQAIndices::kESDClusterSizeInCh+iCh,itc);
     247           0 :       if (hESDClusterSizeInCh) {
     248           0 :         sigmaSize = hESDClusterSizeInCh->GetRMS();
     249           0 :         if (hESDClusterSizePerChMean) {
     250           0 :           hESDClusterSizePerChMean->SetBinContent(iCh+1, hESDClusterSizeInCh->GetMean());
     251           0 :           hESDClusterSizePerChMean->SetBinError(iCh+1, hESDClusterSizeInCh->GetMeanError());
     252           0 :         }
     253           0 :         if (hESDClusterSizePerChSigma) {
     254           0 :           hESDClusterSizePerChSigma->SetBinContent(iCh+1, sigmaSize);
     255           0 :           hESDClusterSizePerChSigma->SetBinError(iCh+1, hESDClusterSizeInCh->GetRMSError());
     256           0 :         }
     257             :       }    
     258             :       //
     259           0 :       TH1* hESDResidualXInCh = Master()->GetESDsData(AliMUONQAIndices::kESDResidualXInCh+iCh,itc);
     260           0 :       if (hESDResidualXInCh) {
     261           0 :         sigmaResidualX = hESDResidualXInCh->GetRMS();
     262           0 :         if (hESDResidualXPerChMean) {
     263           0 :           hESDResidualXPerChMean->SetBinContent(iCh+1, hESDResidualXInCh->GetMean());
     264           0 :           hESDResidualXPerChMean->SetBinError(iCh+1, hESDResidualXInCh->GetMeanError());
     265           0 :         }
     266           0 :         if (hESDResidualXPerChSigma) {
     267           0 :           hESDResidualXPerChSigma->SetBinContent(iCh+1, sigmaResidualX);
     268           0 :           hESDResidualXPerChSigma->SetBinError(iCh+1, hESDResidualXInCh->GetRMSError());
     269           0 :         }
     270             :       }
     271             :       //
     272           0 :       TH1* hESDResidualYInCh = Master()->GetESDsData(AliMUONQAIndices::kESDResidualYInCh+iCh,itc);
     273           0 :       if (hESDResidualYInCh) {
     274           0 :         sigmaResidualY = hESDResidualYInCh->GetRMS();
     275           0 :         if (hESDResidualYPerChMean) {
     276           0 :           hESDResidualYPerChMean->SetBinContent(iCh+1, hESDResidualYInCh->GetMean());
     277           0 :           hESDResidualYPerChMean->SetBinError(iCh+1, hESDResidualYInCh->GetMeanError());
     278           0 :         }
     279           0 :         if (hESDResidualYPerChSigma) {
     280           0 :           hESDResidualYPerChSigma->SetBinContent(iCh+1, sigmaResidualY);
     281           0 :           hESDResidualYPerChSigma->SetBinError(iCh+1, hESDResidualYInCh->GetRMSError());
     282           0 :         }
     283             :       }
     284             :       //      
     285           0 :       TH1* hESDLocalChi2XInCh = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2XInCh+iCh,itc);
     286           0 :       if (hESDLocalChi2XInCh) {
     287           0 :         sigmaLocalChi2X = hESDLocalChi2XInCh->GetRMS();
     288           0 :         if (hESDLocalChi2XPerChMean) {
     289           0 :           hESDLocalChi2XPerChMean->SetBinContent(iCh+1, hESDLocalChi2XInCh->GetMean());
     290           0 :           hESDLocalChi2XPerChMean->SetBinError(iCh+1, hESDLocalChi2XInCh->GetMeanError());
     291           0 :         }
     292             :       }
     293             :       //
     294           0 :       TH1* hESDLocalChi2YInCh = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2YInCh+iCh,itc);
     295           0 :       if (hESDLocalChi2YInCh) {
     296           0 :         sigmaLocalChi2Y = hESDLocalChi2YInCh->GetRMS();
     297           0 :         if (hESDLocalChi2YPerChMean) {
     298           0 :           hESDLocalChi2YPerChMean->SetBinContent(iCh+1, hESDLocalChi2YInCh->GetMean());
     299           0 :           hESDLocalChi2YPerChMean->SetBinError(iCh+1, hESDLocalChi2YInCh->GetMeanError());
     300           0 :         }    
     301             :       }
     302             :       //
     303           0 :       TH1* hESDLocalChi2InCh = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2InCh+iCh,itc);
     304           0 :       if (hESDLocalChi2InCh) {
     305           0 :         sigmaLocalChi2 = hESDLocalChi2InCh->GetRMS();
     306           0 :         if (hESDLocalChi2PerChMean) {
     307           0 :           hESDLocalChi2PerChMean->SetBinContent(iCh+1, hESDLocalChi2InCh->GetMean());
     308           0 :           hESDLocalChi2PerChMean->SetBinError(iCh+1, hESDLocalChi2InCh->GetMeanError());
     309           0 :         }
     310             :       }
     311             :       //
     312             :       // loop over DE into chamber iCh
     313           0 :       AliMpDEIterator it;
     314           0 :       it.First(iCh);
     315           0 :       while ( !it.IsDone()) {
     316             :         
     317           0 :         Int_t iDE = it.CurrentDEId();
     318             :         
     319           0 :         Double_t nClusters = hESDnTotClustersPerDE ? hESDnTotClustersPerDE->GetBinContent(iDE+1) : 0;
     320           0 :         if (nClusters > 1) {
     321             :           
     322           0 :           if (hESDClusterChargePerDE && hESDSumClusterChargePerDE) {
     323           0 :             hESDClusterChargePerDE->SetBinContent(iDE+1, hESDSumClusterChargePerDE->GetBinContent(iDE+1)/nClusters);
     324           0 :             hESDClusterChargePerDE->SetBinError(iDE+1, sigmaCharge/TMath::Sqrt(nClusters));
     325             :           }
     326             :         
     327           0 :           if (hESDResidualXPerDEMean && hESDResidualXPerDESigma && hESDSumResidualXPerDE && hESDSumResidualX2PerDE) {
     328           0 :             Double_t meanResX = hESDSumResidualXPerDE->GetBinContent(iDE+1)/nClusters;
     329           0 :             hESDResidualXPerDEMean->SetBinContent(iDE+1, meanResX);
     330           0 :             hESDResidualXPerDEMean->SetBinError(iDE+1, sigmaResidualX/TMath::Sqrt(nClusters));
     331             :             //
     332           0 :             hESDResidualXPerDESigma->SetBinContent(iDE+1, ProtectedSqrt(hESDSumResidualX2PerDE->GetBinContent(iDE+1)/nClusters - meanResX*meanResX));
     333           0 :             hESDResidualXPerDESigma->SetBinError(iDE+1, sigmaResidualX/TMath::Sqrt(2.*nClusters));
     334           0 :           }
     335             :           //        
     336           0 :           if (hESDResidualYPerDEMean && hESDResidualYPerDESigma && hESDSumResidualYPerDE && hESDSumResidualY2PerDE) {
     337           0 :             Double_t meanResY = hESDSumResidualYPerDE->GetBinContent(iDE+1)/nClusters;
     338           0 :             hESDResidualYPerDEMean->SetBinContent(iDE+1, meanResY);
     339           0 :             hESDResidualYPerDEMean->SetBinError(iDE+1, sigmaResidualY/TMath::Sqrt(nClusters));
     340           0 :             hESDResidualYPerDESigma->SetBinContent(iDE+1, ProtectedSqrt(hESDSumResidualY2PerDE->GetBinContent(iDE+1)/nClusters - meanResY*meanResY));
     341           0 :             hESDResidualYPerDESigma->SetBinError(iDE+1, sigmaResidualY/TMath::Sqrt(2.*nClusters));
     342           0 :           }
     343             :           //
     344           0 :           if (hESDLocalChi2XPerDEMean && hESDSumLocalChi2XPerDE) {
     345           0 :             hESDLocalChi2XPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2XPerDE->GetBinContent(iDE+1)/nClusters);
     346           0 :             hESDLocalChi2XPerDEMean->SetBinError(iDE+1, sigmaLocalChi2X/TMath::Sqrt(nClusters));
     347             :           }
     348             :           //
     349           0 :           if (hESDLocalChi2YPerDEMean && hESDSumLocalChi2YPerDE) {
     350           0 :             hESDLocalChi2YPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2YPerDE->GetBinContent(iDE+1)/nClusters);
     351           0 :             hESDLocalChi2YPerDEMean->SetBinError(iDE+1, sigmaLocalChi2Y/TMath::Sqrt(nClusters));
     352             :           }
     353             :           //
     354           0 :           if (hESDLocalChi2PerDEMean && hESDSumLocalChi2PerDE) {
     355           0 :             hESDLocalChi2PerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2PerDE->GetBinContent(iDE+1)/nClusters);
     356           0 :             hESDLocalChi2PerDEMean->SetBinError(iDE+1, sigmaLocalChi2/TMath::Sqrt(nClusters));
     357             :           }
     358             :         } 
     359             :         else {
     360           0 :           if (hESDClusterChargePerDE && hESDClusterChargeInCh && hESDSumClusterChargePerDE) {
     361           0 :             hESDClusterChargePerDE->SetBinContent(iDE+1, hESDSumClusterChargePerDE->GetBinContent(iDE+1));
     362           0 :             hESDClusterChargePerDE->SetBinError(iDE+1, hESDClusterChargeInCh->GetXaxis()->GetXmax());
     363             :           }
     364             :           //
     365           0 :           if (hESDResidualXPerDEMean && hESDResidualXPerDESigma && hESDSumResidualXPerDE && hESDResidualXInCh) {
     366           0 :             hESDResidualXPerDEMean->SetBinContent(iDE+1, hESDSumResidualXPerDE->GetBinContent(iDE+1));
     367           0 :             hESDResidualXPerDEMean->SetBinError(iDE+1, hESDResidualXInCh->GetXaxis()->GetXmax());
     368           0 :             hESDResidualXPerDESigma->SetBinContent(iDE+1, 0.);
     369           0 :             hESDResidualXPerDESigma->SetBinError(iDE+1, hESDResidualXInCh->GetXaxis()->GetXmax());
     370             :           }
     371             :           //
     372           0 :           if (hESDResidualYPerDEMean && hESDResidualYPerDESigma && hESDSumResidualYPerDE && hESDResidualYInCh) {
     373           0 :             hESDResidualYPerDEMean->SetBinContent(iDE+1, hESDSumResidualYPerDE->GetBinContent(iDE+1));
     374           0 :             hESDResidualYPerDEMean->SetBinError(iDE+1, hESDResidualYInCh->GetXaxis()->GetXmax());
     375           0 :             hESDResidualYPerDESigma->SetBinContent(iDE+1, 0.);
     376           0 :             hESDResidualYPerDESigma->SetBinError(iDE+1, hESDResidualYInCh->GetXaxis()->GetXmax());
     377             :           }
     378             :           //
     379           0 :           if (hESDLocalChi2XPerDEMean && hESDSumLocalChi2XPerDE && hESDLocalChi2XInCh) {        
     380           0 :             hESDLocalChi2XPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2XPerDE->GetBinContent(iDE+1));
     381           0 :             hESDLocalChi2XPerDEMean->SetBinError(iDE+1, hESDLocalChi2XInCh->GetXaxis()->GetXmax());
     382             :           }
     383             :           //
     384           0 :           if (hESDLocalChi2YPerDEMean && hESDSumLocalChi2YPerDE && hESDLocalChi2YInCh) {
     385           0 :             hESDLocalChi2YPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2YPerDE->GetBinContent(iDE+1));
     386           0 :             hESDLocalChi2YPerDEMean->SetBinError(iDE+1, hESDLocalChi2YInCh->GetXaxis()->GetXmax());
     387             :           }
     388             :           //
     389           0 :           if (hESDLocalChi2PerDEMean && hESDSumLocalChi2PerDE && hESDLocalChi2InCh) {
     390           0 :             hESDLocalChi2PerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2PerDE->GetBinContent(iDE+1));
     391           0 :             hESDLocalChi2PerDEMean->SetBinError(iDE+1, hESDLocalChi2InCh->GetXaxis()->GetXmax());
     392             :           }
     393             :         }
     394             :       
     395           0 :         Double_t nFullClusters = hESDnTotFullClustersPerDE ? hESDnTotFullClustersPerDE->GetBinContent(iDE+1) : 0;
     396           0 :         if (nFullClusters > 1) {
     397           0 :           if (hESDClusterSizePerDE && hESDSumClusterSizePerDE) {        
     398           0 :             hESDClusterSizePerDE->SetBinContent(iDE+1, hESDSumClusterSizePerDE->GetBinContent(iDE+1)/nFullClusters);
     399           0 :             hESDClusterSizePerDE->SetBinError(iDE+1, sigmaSize/TMath::Sqrt(nFullClusters));
     400             :           }
     401             :         }
     402             :         else {
     403           0 :           if (hESDClusterSizePerDE && hESDSumClusterSizePerDE) {
     404           0 :             hESDClusterSizePerDE->SetBinContent(iDE+1, hESDSumClusterSizePerDE->GetBinContent(iDE+1));
     405           0 :             hESDClusterSizePerDE->SetBinError(iDE+1, hESDClusterSizeInCh->GetXaxis()->GetXmax());
     406             :           }
     407             :         }
     408             :         
     409           0 :         it.Next();
     410             :       } // while
     411             :       
     412           0 :     } // iCh loop
     413             : 
     414           0 :   } // trigger classes loop
     415             : 
     416           0 : }
     417             :   
     418             : //____________________________________________________________________________ 
     419             : void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t specie, TObjArray** list)
     420             : {
     421             :   /// Normalize RecPoints histograms
     422             :   //
     423             :   Bool_t firstFill=kTRUE, needIns0=kTRUE, needIns1=kTRUE;
     424             :   //
     425           0 :   for (int itc=-1;itc<Master()->GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class 
     426             : 
     427           0 :     TH1* hTrackerClusterChargePerChMean = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChMean,itc);
     428           0 :     if (!hTrackerClusterChargePerChMean) continue;
     429             :     //
     430           0 :     if (firstFill) { AliCodeTimerAuto("",0); firstFill = kFALSE;}
     431             : 
     432           0 :     TH1* hTrackerClusterChargePerChSigma = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChSigma,itc);
     433           0 :     TH1* hTrackerClusterMultiplicityPerChMean = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerChMean,itc);
     434           0 :     TH1* hTrackerClusterMultiplicityPerChSigma = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerChSigma,itc);
     435           0 :     TH1* hTrackerClusterChargePerDEMean = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerDEMean,itc);
     436           0 :     TH1* hTrackerClusterMultiplicityPerDEMean = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerDEMean,itc);
     437             :   
     438             :     // loop over chambers
     439           0 :     for (Int_t iCh = 0; iCh < AliMUONConstants::NTrackingCh(); iCh++) {
     440             :     
     441           0 :       TH1* hTrackerClusterChargePerChamber = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChamber+iCh,itc);
     442             :       Double_t sigmaCharge = 0;
     443           0 :       if (hTrackerClusterChargePerChamber) {
     444           0 :         sigmaCharge = hTrackerClusterChargePerChamber->GetRMS();
     445           0 :         hTrackerClusterChargePerChMean->SetBinContent(iCh+1, hTrackerClusterChargePerChamber->GetMean());
     446           0 :         hTrackerClusterChargePerChMean->SetBinError(iCh+1,   hTrackerClusterChargePerChamber->GetMeanError());
     447             :         //
     448           0 :         if (hTrackerClusterChargePerChSigma) {
     449           0 :           hTrackerClusterChargePerChSigma->SetBinContent(iCh+1, sigmaCharge);
     450           0 :           hTrackerClusterChargePerChSigma->SetBinError(iCh+1, hTrackerClusterChargePerChamber->GetRMSError());
     451           0 :         }
     452             :       }
     453             :       //
     454           0 :       TH1* hTrackerClusterMultiplicityPerChamber = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerChamber+iCh,itc);
     455             :       Double_t sigmaSize = 0;
     456           0 :       if (hTrackerClusterMultiplicityPerChamber) {
     457           0 :         sigmaSize = hTrackerClusterMultiplicityPerChamber->GetRMS();
     458           0 :         if (hTrackerClusterMultiplicityPerChMean) {
     459           0 :           hTrackerClusterMultiplicityPerChMean->SetBinContent(iCh+1, hTrackerClusterMultiplicityPerChamber->GetMean());
     460           0 :           hTrackerClusterMultiplicityPerChMean->SetBinError(iCh+1, hTrackerClusterMultiplicityPerChamber->GetMeanError());
     461           0 :         }
     462           0 :         if (hTrackerClusterMultiplicityPerChSigma) {
     463           0 :           hTrackerClusterMultiplicityPerChSigma->SetBinContent(iCh+1, sigmaSize);
     464           0 :           hTrackerClusterMultiplicityPerChSigma->SetBinError(iCh+1, hTrackerClusterMultiplicityPerChamber->GetRMSError());
     465           0 :         }
     466             :       }
     467             :       //
     468             :       // loop over DE into chamber iCh
     469           0 :       AliMpDEIterator it;
     470           0 :       it.First(iCh);
     471           0 :       while ( !it.IsDone()) {
     472             :       
     473           0 :         Int_t iDE = it.CurrentDEId();
     474             :       
     475           0 :         TH1* hTrackerClusterChargePerDE = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerDE+iDE,itc);
     476           0 :         if (hTrackerClusterChargePerDEMean && hTrackerClusterChargePerDE) {
     477           0 :           hTrackerClusterChargePerDEMean->SetBinContent(iDE+1, hTrackerClusterChargePerDE->GetMean());
     478           0 :           Double_t nClusters = hTrackerClusterChargePerDE->GetEntries();
     479           0 :           if (nClusters > 1) hTrackerClusterChargePerDEMean->SetBinError(iDE+1, sigmaCharge/TMath::Sqrt(nClusters));
     480           0 :           else hTrackerClusterChargePerDEMean->SetBinError(iDE+1, hTrackerClusterChargePerChamber ? 
     481           0 :                                                            hTrackerClusterChargePerChamber->GetXaxis()->GetXmax() : 0);
     482           0 :         }
     483           0 :         TH1* hTrackerClusterMultiplicityPerDE = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerDE+iDE,itc);
     484           0 :         if (hTrackerClusterMultiplicityPerDEMean && hTrackerClusterMultiplicityPerDE) {
     485           0 :           hTrackerClusterMultiplicityPerDEMean->SetBinContent(iDE+1, hTrackerClusterMultiplicityPerDE->GetMean());
     486           0 :           Double_t nClusters = hTrackerClusterMultiplicityPerDE->GetEntries();
     487           0 :           if (nClusters > 1) hTrackerClusterMultiplicityPerDEMean->SetBinError(iDE+1, sigmaSize/TMath::Sqrt(nClusters));
     488           0 :           else hTrackerClusterMultiplicityPerDEMean->SetBinError(iDE+1, hTrackerClusterMultiplicityPerChamber ? 
     489           0 :                                                                  hTrackerClusterMultiplicityPerChamber->GetXaxis()->GetXmax() : 0);
     490           0 :         }
     491           0 :         it.Next();
     492             :       }
     493           0 :     }
     494             :   
     495           0 :     if (needIns0 && MappingCheckRecPoints(specie) ) { // RS: I guess this should not be in the itc loop, do this only once
     496           0 :       InsertTrackerData(specie,list,MappingCheckRecPoints(specie)->CreateData("RecPoints"),AliMUONQAIndices::kTrackerRecPoints,kTRUE);    
     497             :       needIns0 = kFALSE;
     498           0 :     }
     499             :     
     500           0 :     if ( TrackerRecData(specie) ) {
     501             :       /// put the trackerdata in the pipeline
     502           0 :       if (needIns1) { // RS: I guess this should not be in the itc loop, do this only once
     503           0 :         InsertTrackerData(specie,list,TrackerRecData(specie),AliMUONQAIndices::kTrackerData);
     504             :         needIns1 = kFALSE;
     505           0 :       }
     506           0 :       TH1* hbp = GetRecPointsData(AliMUONQAIndices::kTrackerBusPatchOccupancy,itc);
     507           0 :       TH1* hnevents = GetRecPointsData(AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed,itc);
     508           0 :       TH1* hddl = GetRecPointsData(AliMUONQAIndices::kTrackerDDLOccupancy,itc);
     509           0 :       TH1* hddlevents = GetRecPointsData(AliMUONQAIndices::kTrackerDDLNofEventsUsed,itc);
     510             :     
     511           0 :       if (itc==-1 && (!hbp || !hnevents || !hddl || !hddlevents)) { //RS: produce error only for trigger-blind class
     512           0 :         AliError(Form("Missing some histograms : cannot work : hbp=%p hnevents=%p hddl=%p hddlevents=%p",hbp,hnevents,hddl,hddlevents));
     513           0 :         continue; // return; // RS: the histos might be booked for some trigger class only
     514             :       }
     515             :       //
     516           0 :       ProjectTrackerData(TrackerRecData(specie),*hbp,*hnevents,*hddl,*hddlevents);    
     517           0 :     }
     518             :     else {
     519           0 :       AliError(Form("TrackerRecData is null for specie %s",AliRecoParam::GetEventSpecieName(specie)));
     520             :     }
     521           0 :   } //  RS: loop over eventual clones per trigger class
     522           0 : }
     523             : 
     524             : //____________________________________________________________________________ 
     525             : void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleDigits(Int_t specie, TObjArray** list)
     526             : {
     527             :   /// create digits histograms in digits subdir
     528             :   
     529           0 :   if ( TrackerCalData(specie) )
     530             :   {
     531           0 :     AliCodeTimerAuto("",0);
     532             :     
     533             :     /// put the trackerdata in the pipeline
     534           0 :     InsertTrackerData(specie,list,TrackerCalData(specie),AliMUONQAIndices::kTrackerData);
     535             :     //
     536           0 :     for (int itc=-1;itc<Master()->GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class 
     537             :       //    
     538           0 :       TH1* hbp = GetDigitsData(AliMUONQAIndices::kTrackerBusPatchOccupancy, itc);
     539           0 :       TH1* hnevents = GetDigitsData(AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed, itc);
     540           0 :       TH1* hddl = GetDigitsData(AliMUONQAIndices::kTrackerDDLOccupancy, itc);
     541           0 :       TH1* hddlevents = GetDigitsData(AliMUONQAIndices::kTrackerDDLNofEventsUsed, itc);
     542             :     
     543           0 :       if ( (!hbp || !hnevents || !hddl || !hddlevents) ) 
     544             :       { 
     545           0 :         if (itc==-1)
     546             :         {
     547             :           // report error only for trigger-blind class
     548           0 :           AliError(Form("Missing some histograms : cannot work : hbp=%p hnevents=%p hddl=%p hddlevents=%p",hbp,hnevents,hddl,hddlevents));
     549           0 :           continue; //return; // RS
     550             :         }
     551             :         else
     552             :         {
     553           0 :           continue;
     554             :         }
     555             :       }
     556             :       //    
     557           0 :       ProjectTrackerData(TrackerCalData(specie), *hbp,*hnevents,*hddl,*hddlevents);    
     558           0 :     } //  RS: loop over eventual clones per trigger class 
     559           0 :   }
     560           0 : }
     561             : 
     562             : //____________________________________________________________________________ 
     563             : AliMUONQADataMakerRec* AliMUONTrackerQADataMakerRec::Master() const
     564             : {
     565             :   /// Get our master
     566           0 :   return static_cast<AliMUONQADataMakerRec*>(fMaster); 
     567             : }
     568             : 
     569             : //____________________________________________________________________________ 
     570             : void AliMUONTrackerQADataMakerRec::ProjectTrackerData(AliMUONVTrackerData* data, 
     571             :                                                       TH1& hbp,
     572             :                                                       TH1& hnevents,
     573             :                                                       TH1& hddl,
     574             :                                                       TH1& hddlevents)
     575             : {
     576             :   /// Project tracker data into shifter-friendly histograms
     577             :   
     578           0 :   AliCodeTimerAuto(Form("%s",data->Name()),0);
     579             :   
     580             :   /// project the tracerdata into buspatch occupancies (for the experts)
     581           0 :   hbp.Reset();
     582           0 :   hbp.SetStats(kFALSE);
     583             :   
     584           0 :   TIter nextBP(AliMpDDLStore::Instance()->CreateBusPatchIterator());
     585             :   AliMpBusPatch* bp(0x0);
     586             :   Int_t occDim = 2;
     587             :   
     588           0 :   while ( ( bp = static_cast<AliMpBusPatch*>(nextBP())) )
     589             :   {
     590           0 :     Int_t busPatchId = bp->GetId();
     591           0 :     Int_t bin = hbp.FindBin(busPatchId);
     592           0 :     if ( data->HasBusPatch(busPatchId) )
     593             :     {
     594           0 :       hbp.SetBinContent(bin,data->BusPatch(busPatchId,occDim)*100.0); // occupancy, in percent
     595             :     }
     596             :   }
     597             :   
     598             :   /// log the readout errors (for the shifter)
     599           0 :   hnevents.Reset();
     600           0 :   hnevents.SetStats(kFALSE);
     601           0 :   hnevents.SetBinContent(1,data->NumberOfEvents(-1));
     602             :   
     603             :   /// project tracker data into DDL occupancies (for the shifter)
     604           0 :   hddl.Reset();
     605           0 :   hddl.SetStats(kFALSE);
     606           0 :   hddlevents.Reset();
     607           0 :   hddlevents.SetStats(kFALSE);
     608             :   
     609           0 :   const Int_t nddls = AliDAQ::NumberOfDdls("MUONTRK");
     610           0 :   const Int_t offset = AliDAQ::DdlIDOffset("MUONTRK");
     611             :   
     612           0 :   for ( Int_t iddl = 0; iddl < nddls; ++iddl )
     613             :   {
     614           0 :     AliMpDDL* ddl = AliMpDDLStore::Instance()->GetDDL(iddl);
     615             :     
     616           0 :     Int_t ddlId = offset + ddl->GetId();
     617             :     Int_t npads = 0;
     618             :     
     619           0 :     Int_t nevents = data->NumberOfEvents(iddl);
     620             :     
     621           0 :     hddlevents.Fill(ddlId,nevents);
     622             :     
     623             :     Double_t occ(0.0);
     624             :     
     625           0 :     if ( nevents > 0 )
     626             :     {
     627           0 :       for ( Int_t ide = 0; ide < ddl->GetNofDEs(); ++ide )
     628             :       {
     629           0 :         Int_t de = ddl->GetDEId(ide);
     630             :         
     631           0 :         npads += TMath::Nint(data->DetectionElement(de,3));
     632             :         
     633           0 :         occ +=  data->DetectionElement(de,4);
     634             :       }
     635             :       
     636           0 :       if ( npads > 0 )
     637             :       {
     638           0 :         occ = occ/npads/nevents;
     639           0 :       }
     640             :       else 
     641             :       {
     642             :         occ = 0.0;
     643             :       }
     644             :     }
     645             :     
     646           0 :     hddl.Fill(ddlId,100.0*occ); // occ in percent
     647             :   }
     648             :   
     649           0 :   TPaveText* text = new TPaveText(0.50,0.8,0.9,0.9,"NDC");
     650             :   
     651           0 :   text->AddText(Form("MCH RUN %d - %d events",AliCDBManager::Instance()->GetRun(),data->NumberOfEvents(-1)));
     652             : 
     653           0 :   hddl.GetListOfFunctions()->Add(text);
     654           0 : }
     655             : 
     656             : //____________________________________________________________________________ 
     657             : void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleRaws(Int_t specie, TObjArray** list)
     658             : {
     659             :   /// create Raws histograms in Raws subdir
     660             :   
     661           0 :   if ( TrackerDataMaker(specie) && TrackerDataMaker(specie)->Data() ) 
     662             :   {
     663           0 :     AliCodeTimerAuto("",0);
     664             :     
     665             :     /// put the trackerdata in the pipeline
     666           0 :     InsertTrackerData(specie,list,TrackerDataMaker(specie)->Data(),AliMUONQAIndices::kTrackerData);
     667           0 :     TrackerDataMaker(specie)->SetOwnerOfData(kFALSE); // now that it's attached to list, list will take care of the deletion
     668             :     //    
     669           0 :     for (int itc=-1;itc<Master()->GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
     670             : 
     671           0 :       TH1* hbp = GetRawsData(AliMUONQAIndices::kTrackerBusPatchOccupancy, itc);
     672           0 :       TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed, itc);
     673           0 :       TH1* hddl = GetRawsData(AliMUONQAIndices::kTrackerDDLOccupancy, itc);
     674           0 :       TH1* hddlevents = GetRawsData(AliMUONQAIndices::kTrackerDDLNofEventsUsed, itc);
     675             :       //
     676           0 :       if (!hbp || !hnevents || !hddl || !hddlevents) {
     677           0 :         if (itc==-1) AliError(Form("Missing some histograms : cannot work : hbp=%p hnevents=%p hddl=%p hddlevents=%p",hbp,hnevents,hddl,hddlevents));
     678           0 :         continue; // return; // RS
     679             :       }
     680             :       //
     681           0 :       ProjectTrackerData(TrackerDataMaker(specie)->Data(), *hbp,*hnevents,*hddl,*hddlevents);
     682             :       //
     683           0 :       FillReadoutStatus(*fLogger,TrackerDataMaker(specie)->Data(), itc);      
     684           0 :     } // RS: loop over eventual clones per trigger class
     685             :     //
     686           0 :   }    
     687           0 : }
     688             : 
     689             : //____________________________________________________________________________ 
     690             : void AliMUONTrackerQADataMakerRec::FillReadoutStatus(AliMUONLogger& log, AliMUONVTrackerData* data, Int_t trigCl)
     691             : {
     692             :   // RS: I am not sure if this part is valid for looping over trigger classes (loggers are not cloned)
     693           0 :   if (trigCl!=-1) return; // For the moment only trigCl==-1 will be processed (i.e. trigger-blind histos)
     694             : 
     695           0 :   log.ResetItr();
     696             : 
     697           0 :   TString msg;
     698           0 :   Int_t occurence;
     699             :   
     700           0 :   TH1* hparity = GetRawsData(AliMUONQAIndices::kTrackerBusPatchParityErrors, trigCl);
     701             : 
     702           0 :   TH1* htoken = GetRawsData(AliMUONQAIndices::kTrackerBusPatchTokenLostErrors, trigCl);
     703             : 
     704           0 :   TH1* hpadding = GetRawsData(AliMUONQAIndices::kTrackerBusPatchPaddingErrors, trigCl);
     705             :   
     706           0 :   TH1* hrostatus = GetRawsData(AliMUONQAIndices::kTrackerReadoutStatus, trigCl);
     707             :     
     708           0 :   TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofPhysicsEventsSeen, trigCl);
     709             : 
     710             :   //
     711           0 :   if (!hparity || !htoken || !hpadding || !hrostatus || !hnevents) return;
     712             :     
     713           0 :   Int_t nevents = TMath::Nint(hnevents->GetBinContent(1));
     714             :   
     715           0 :   if ( !nevents ) 
     716             :   {
     717           0 :     TPaveText* text = new TPaveText(0,0,0.99,0.99,"NDC");
     718           0 :     text->AddText("FATAL : 0 event seen ? That's NOT normal...");
     719           0 :     text->SetFillColor(2); // red = FATAL
     720           0 :     hrostatus->GetListOfFunctions()->Delete();
     721           0 :     hrostatus->GetListOfFunctions()->Add(text);
     722             :     return;
     723             :   }
     724             :   
     725           0 :   hparity->Reset();
     726           0 :   htoken->Reset();
     727           0 :   hpadding->Reset();
     728           0 :   hrostatus->Reset();
     729             :   
     730             :   /////////////////////////////////////////////////////////////////
     731             :   /// Start by counting the number of errors
     732             :   /////////////////////////////////////////////////////////////////
     733             :   
     734           0 :   while ( log.Next(msg,occurence) )
     735             :   {
     736           0 :     AliDebug(1,Form("msg=%s occurence=%d",msg.Data(),occurence));
     737             :              
     738           0 :     if ( msg.Contains("token") )
     739             :     {
     740           0 :       Int_t dsp(-1),iddl(-1),ecode(-1);
     741             :       
     742           0 :       sscanf(msg.Data(),"Lost token error detected with address 0x%10X of DDL %10d and code %10d.",
     743             :              &dsp,&iddl,&ecode);
     744           0 :       Int_t localBP = ((dsp >> 16)- 4)*5 + 1;
     745           0 :       Int_t buspatch = localBP + iddl*100;
     746             :       
     747             :       // Let's try to get all the suspected bus patches (i.e. one full FRT, as currently
     748             :       // we don't have more precise information to locate the faulty bus patch(es)).
     749             :       
     750           0 :       AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(buspatch,kFALSE);
     751           0 :       if (bp)
     752             :       {
     753           0 :         Int_t frt = bp->GetFrtId();
     754           0 :         AliMpDDL* ddl = AliMpDDLStore::Instance()->GetDDL(bp->GetDdlId());
     755           0 :         Int_t* b = new Int_t[ddl->GetMaxDsp()];
     756           0 :         ddl->GetBusPerDsp(b);
     757             :         Int_t nbus(0);
     758           0 :         for ( Int_t i = 0; i < ddl->GetNofFrts() && !nbus; ++i ) 
     759             :         {
     760           0 :           if ( ddl->GetFrtId(i) == frt ) 
     761             :           {
     762           0 :             nbus = b[i];
     763           0 :           }
     764             :         }
     765           0 :         if (nbus<=0) 
     766             :         {
     767           0 :           AliError("GOT NBUS<=0 ! THAT IS BAD ! CHECK !");
     768             :           nbus=1;
     769           0 :         }
     770           0 :         delete[] b;
     771             :       
     772           0 :         while (nbus) {
     773           0 :           htoken->Fill(buspatch+nbus-1,occurence);
     774           0 :           --nbus;
     775             :         }
     776           0 :       }
     777           0 :       hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofTokenLostErrors,occurence);
     778           0 :     }
     779             :     
     780           0 :     if ( msg.Contains("Parity") )
     781             :     {
     782           0 :       Int_t buspatch;
     783           0 :       sscanf(msg.Data(),"Parity error in buspatch %d (0x%X).",&buspatch,&buspatch);
     784           0 :       hparity->Fill(buspatch,occurence);      
     785           0 :       hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofParityErrors,occurence);
     786           0 :     }
     787             :     
     788           0 :     if ( msg.Contains("Glitch") ) 
     789             :     {
     790           0 :       hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofGlitchErrors,occurence);      
     791             :     }
     792             :     
     793           0 :     if ( msg.Contains("Padding") )
     794             :     {
     795           0 :       Int_t block, dsp, buspatch;      
     796           0 :       sscanf(msg.Data(),"Padding word error for iBlock %d, iDsp %d, iBus %d.",&block,&dsp,&buspatch);
     797           0 :       hpadding->Fill(buspatch,occurence);
     798           0 :       hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofPaddingErrors,occurence);      
     799           0 :     }
     800             :   }
     801             :   
     802             :   /////////////////////////////////////////////////////////////////
     803             :   ///
     804             :   /// Then make the status about number of missing bus patches
     805             :   ///
     806             :   /////////////////////////////////////////////////////////////////
     807             : 
     808             :   Int_t nofBusPatchesNotInConfig(0);
     809             :     
     810           0 :   for ( int i = 1; i <= fBusPatchConfig->GetNbinsX(); ++i )
     811             :   {
     812           0 :     Double_t buspatchId = fBusPatchConfig->GetBinCenter(i);
     813           0 :     if ( TMath::Nint(buspatchId) != i ) 
     814             :     {
     815           0 :       AliError(Form("buspathId=%e i=%d",buspatchId,i));
     816             :     }
     817           0 :     Double_t content = fBusPatchConfig->GetBinContent(i);
     818             :     
     819           0 :     if ( content <= 0. /* no content */
     820           0 :         && 
     821           0 :         AliMpDDLStore::Instance()->GetBusPatch(i,kFALSE) /* but a valid bus patch */ )
     822             :     {
     823           0 :       ++nofBusPatchesNotInConfig;
     824           0 :     }    
     825             :   }
     826             :   
     827           0 :   Double_t nbuspatches = fBusPatchConfig->GetEntries();
     828             :   
     829           0 :   Int_t bin = hrostatus->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromConfig);
     830           0 :   hrostatus->SetBinContent(bin,nofBusPatchesNotInConfig*nevents/nbuspatches);
     831             :   
     832             :   Double_t nofBusPatchesNotInData(0);
     833             :   
     834           0 :   TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
     835             :   AliMpBusPatch* bp;
     836             :   
     837           0 :   while ( ( bp = static_cast<AliMpBusPatch*>(next()) ) )
     838             :   {
     839           0 :     if ( !data->HasBusPatch(bp->GetId()) ) ++nofBusPatchesNotInData;
     840             :   }
     841             :   
     842           0 :   bin = hrostatus->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromDataStream);
     843           0 :   hrostatus->SetBinContent(bin,nofBusPatchesNotInData*nevents/nbuspatches);
     844           0 : }
     845             : 
     846             : //____________________________________________________________________________ 
     847             : void AliMUONTrackerQADataMakerRec::FillEventSize(AliRawReader* rawReader)
     848             : {
     849             :   /// Fill event size histogram(s)
     850             :   // RS: substituted explicit histo filling by QA framework filling accounting for cloned histos
     851             :   
     852           0 :   FillRawsData(AliMUONQAIndices::kTrackerNofPhysicsEventsSeen,0.0);
     853             :   
     854           0 :   Int_t offset = AliDAQ::DdlIDOffset("MUONTRK");
     855             :   
     856           0 :   for ( int i = 0; i < AliDAQ::NumberOfDdls("MUONTRK"); ++i )
     857             :   {
     858           0 :     rawReader->Reset();
     859           0 :     rawReader->Select("MUONTRK",i,i);
     860           0 :     if (rawReader->ReadHeader() )
     861             :     {
     862           0 :       UInt_t ddlsize = rawReader->GetEquipmentSize();
     863           0 :       FillRawsData(AliMUONQAIndices::kTrackerDDLEventSize,i+offset,ddlsize);
     864           0 :       FillRawsData(AliMUONQAIndices::kTrackerDDLNofEventsSeen,i+offset);
     865           0 :     }      
     866             :   }
     867           0 :   rawReader->Reset();
     868           0 : }
     869             : 
     870             : //____________________________________________________________________________ 
     871             : void AliMUONTrackerQADataMakerRec::InitCommon()
     872             : {  
     873           0 :   if (!fBusPatchConfig)
     874             :   {
     875             :     Int_t bpmin(999999);
     876             :     Int_t bpmax(0);
     877             :     
     878           0 :     TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
     879             :     AliMpBusPatch* bp(0x0);
     880           0 :     while ( ( bp = static_cast<AliMpBusPatch*>(next())) )
     881             :     {
     882           0 :       bpmin = TMath::Min(bpmin,bp->GetId());
     883           0 :       bpmax = TMath::Max(bpmax,bp->GetId());
     884             :     }
     885             :     
     886           0 :     fBPxmin = bpmin-0.5;
     887           0 :     fBPxmax = bpmax+0.5;
     888           0 :     fBPnbins = TMath::Nint(fBPxmax-fBPxmin);
     889             :         
     890           0 :     AliMUONVStore* config = fCalibrationData->Config();
     891             :     
     892           0 :     if (config)
     893             :     {
     894           0 :       fBusPatchConfig = new TH1F("hTrackerBusPatchConfig","Configuration of bus patches",fBPnbins,fBPxmin,fBPxmax);
     895           0 :       fBusPatchConfig->SetDirectory(0);
     896             :     }
     897             :     else
     898             :     {
     899           0 :       AliWarning("Tracker configuration not found. Will not be able to cut on low occupancies");
     900             :     }
     901             :     
     902           0 :     next.Reset();
     903           0 :     while ( ( bp = static_cast<AliMpBusPatch*>(next())) )
     904             :     {
     905           0 :       if ( config ) 
     906             :       {
     907             :         Int_t nofManusInConfig(0);
     908             :       
     909           0 :         for ( Int_t imanu = 0; imanu < bp->GetNofManus(); ++imanu )
     910             :         {
     911           0 :           Int_t manuId = bp->GetManuId(imanu);
     912           0 :           if ( config->FindObject(bp->GetDEId(),manuId)) ++nofManusInConfig;
     913             :         }
     914             :         
     915           0 :         if ( nofManusInConfig > 0 )
     916             :         {
     917           0 :           fBusPatchConfig->Fill(bp->GetId(),1.0);
     918             :         }
     919             :         else
     920             :         {
     921           0 :           fBusPatchConfig->Fill(bp->GetId(),0.0);          
     922             :         }
     923           0 :       }      
     924             :       else // no config, we assume all is there...
     925             :       {
     926           0 :         fBusPatchConfig->Fill(bp->GetId());
     927             :       }
     928             :     }
     929           0 :   }
     930           0 : }
     931             : 
     932             : //____________________________________________________________________________ 
     933             : void AliMUONTrackerQADataMakerRec::BookHistograms(AliQAv1::TASKINDEX_t task)
     934             : {
     935           0 :   AliCodeTimerAuto("",0);
     936             : 
     937           0 :   InitCommon();
     938             :   
     939             :   const Bool_t expert   = kTRUE ; 
     940             :   const Bool_t saveCorr = kTRUE ; 
     941             :   const Bool_t image    = kTRUE ; 
     942             :   
     943           0 :   TH1* hbp = new TH1F("hTrackerBusPatchOccupancy","Occupancy of bus patches",fBPnbins,fBPxmin,fBPxmax);
     944             :   
     945           0 :   Master()->Add2List(hbp,AliMUONQAIndices::kTrackerBusPatchOccupancy, task, expert, !image, !saveCorr);
     946             :   
     947           0 :   TH1* h = new TH1F("hTrackerBusPatchParityErrors","Number of parity errors per bus patch",fBPnbins,fBPxmin,fBPxmax);
     948             :   
     949           0 :   Master()->Add2List(h,AliMUONQAIndices::kTrackerBusPatchParityErrors,task,expert,!image,!saveCorr);
     950             :   
     951           0 :   h = new TH1F("hTrackerBusPatchTokenLostErrors","Number of token lost errors per bus patch",fBPnbins,fBPxmin,fBPxmax);
     952           0 :   Master()->Add2List(h,AliMUONQAIndices::kTrackerBusPatchTokenLostErrors,task,expert,!image,!saveCorr);
     953             :   
     954           0 :   h = new TH1F("hTrackerBusPatchPaddingErrors","Number of padding errors per bus patch",fBPnbins,fBPxmin,fBPxmax);
     955             :   
     956           0 :   Master()->Add2List(h,AliMUONQAIndices::kTrackerBusPatchPaddingErrors,task,expert,!image,!saveCorr);
     957             :   
     958             :   
     959             :   TH1* hnevents(0x0);
     960             :   
     961           0 :   if ( task == AliQAv1::kRAWS )
     962             :   {
     963             :     // for raw data, we differentiate events seen from events used to be able to detect
     964             :     // severe decoder errors that lead to no event decoded (i.e. zero event used) even if
     965             :     // events are there (i.e non-zero event seen).
     966           0 :     hnevents = new TH1F("hTrackerNofPhysicsEventsSeen","Number of physics events seen",1,-0.5,0.5);
     967             :     // this one will count the number of physics event the rawdatamaker is *seeing*
     968           0 :     TAxis* a = hnevents->GetXaxis();
     969           0 :     a->SetBinLabel(1,"NPhysicsEvents");
     970           0 :     hnevents->SetStats(kFALSE);
     971           0 :     Master()->Add2List(hnevents,AliMUONQAIndices::kTrackerNofPhysicsEventsSeen,task,expert,!image,!saveCorr);
     972           0 :   }
     973             :   
     974           0 :   hnevents = new TH1F("hTrackerNofGoodPhysicsEventsUsed","Number of good physics events used",1,-0.5,0.5);
     975             :   // this one will get its content from the TrackerData, i.e. it will count the number of *good* physics events *used*
     976             :   // (i.e. not empty and with no fatal readout error)
     977           0 :   TAxis* a = hnevents->GetXaxis();
     978           0 :   a->SetBinLabel(1,"NGoodPhysicsEvents");
     979           0 :   hnevents->SetStats(kFALSE);  
     980             : 
     981           0 :   Master()->Add2List(hnevents,AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed,task,expert,!image,!saveCorr);
     982             : 
     983           0 :   Master()->Add2List(static_cast<TH1*>(fBusPatchConfig->Clone()),AliMUONQAIndices::kTrackerBusPatchConfig, task,expert, !image, !saveCorr);
     984             : 
     985           0 :   Int_t nbins = AliDAQ::NumberOfDdls("MUONTRK");
     986           0 :   const Int_t offset = AliDAQ::DdlIDOffset("MUONTRK");
     987             :   
     988           0 :   Double_t xmin = offset - 0.5;
     989           0 :   Double_t xmax  = offset + nbins - 0.5;
     990             :   
     991           0 :   TString what(AliQAv1::GetTaskName(task));
     992             :   
     993           0 :   h = new TH1F(Form("hTrackerDDL%sOccupancy",what.Data()),Form(";DDLId;DDL Occupancy in %% (from %s)",what.Data()),nbins,xmin,xmax);
     994             :   
     995           0 :   Master()->Add2List(h,AliMUONQAIndices::kTrackerDDLOccupancy,task,expert,!image,!saveCorr);
     996             : 
     997           0 :   if ( task == AliQAv1::kRAWS )
     998             :   {
     999             :     // see above the comment about why we have event seen vs used for raw data.
    1000           0 :     h = new TH1F("hTrackerDDLNofEventsSeen","Number of events seen by DDL;DDLId",nbins,xmin,xmax);
    1001           0 :     Master()->Add2List(h,AliMUONQAIndices::kTrackerDDLNofEventsSeen,task,expert,!image,!saveCorr);
    1002             :   }
    1003             :   
    1004           0 :   h = new TH1F("hTrackerDDLNofEventsUsed","Number of events used by DDL;DDLId",nbins,xmin,xmax);
    1005           0 :   Master()->Add2List(h,AliMUONQAIndices::kTrackerDDLNofEventsUsed,task,expert,!image,!saveCorr);
    1006             :   
    1007           0 : }
    1008             : 
    1009             : //____________________________________________________________________________ 
    1010             : void AliMUONTrackerQADataMakerRec::InitRaws()
    1011             : {
    1012             :   /// create monitor objects for RAWS
    1013             :         
    1014           0 :   TrackerDataMaker(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE);
    1015             :   
    1016             :   /// Book histograms that are common to Raws and Digits
    1017           0 :   BookHistograms(AliQAv1::kRAWS);
    1018             :   
    1019             :   /// Now the Raws specific parts
    1020           0 :   TH1* h = new TH1F("hTrackerReadoutStatus","Readout status (x events)",7,-0.5,6.5);
    1021           0 :   h->SetStats(kFALSE);
    1022             :   
    1023           0 :   TAxis* a = h->GetXaxis();
    1024             :   
    1025           0 :   a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofGlitchErrors),"Glitch errors");
    1026           0 :   a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofTokenLostErrors),"Token lost errors");
    1027           0 :   a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofParityErrors),"Parity errors");
    1028           0 :   a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofPaddingErrors),"Padding errors");
    1029             :   
    1030           0 :   a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofEmptyEvents),"Empty events");
    1031             :   
    1032           0 :   a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromConfig),"Not readout bus patches");
    1033           0 :   a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromDataStream),"Missing bus patches");
    1034             : 
    1035           0 :   TH1* h1 = static_cast<TH1*>(h->Clone("hTrackerReadoutStatusPerEvent"));
    1036           0 :   h1->SetTitle("Readout status per event");
    1037           0 :   h1->GetYaxis()->SetTitle("Percentage");
    1038             :   
    1039             :   // The QA shifter will only see the summary plot below
    1040             : 
    1041           0 :   Add2RawsList(h,AliMUONQAIndices::kTrackerReadoutStatus,kTRUE,kFALSE,kFALSE);    
    1042           0 :   Add2RawsList(h1,AliMUONQAIndices::kTrackerReadoutStatusPerEvent,kFALSE,kTRUE,kFALSE);  
    1043             : 
    1044             :   // Lastly the event size histograms
    1045             :   
    1046           0 :   Int_t nbins = AliDAQ::NumberOfDdls("MUONTRK");
    1047           0 :   const Int_t offset = AliDAQ::DdlIDOffset("MUONTRK");
    1048             :   
    1049           0 :   Double_t xmin = offset - 0.5;
    1050           0 :   Double_t xmax  = offset + nbins - 0.5;
    1051             :   
    1052           0 :   h = new TH1F("hTrackerDDLEventSize","DDL event size (bytes);DDL Id;Data size (bytes)",nbins,xmin,xmax);  
    1053           0 :   h->SetStats(kFALSE);
    1054           0 :   Add2RawsList(h,AliMUONQAIndices::kTrackerDDLEventSize,kTRUE,kFALSE,kFALSE);
    1055             : 
    1056           0 :   h = new TH1F("hTrackerDDLMeanEventSize","DDL mean event size (KB) per event;DDL Id;Mean Event size (KB)",nbins,xmin,xmax);  
    1057           0 :   h->SetStats(kFALSE);
    1058           0 :   Add2RawsList(h,AliMUONQAIndices::kTrackerDDLEventSizePerEvent,kFALSE,kTRUE,kFALSE);
    1059             :     
    1060           0 :   Add2RawsList(new TH1F("hTrackerIsThere","tracker is there",1,0,1),AliMUONQAIndices::kTrackerIsThere,kTRUE,kFALSE,kFALSE);
    1061             :   //
    1062             :   //ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line  DONE at parent level
    1063           0 : }
    1064             : 
    1065             : //__________________________________________________________________
    1066             : void AliMUONTrackerQADataMakerRec::InitDigits() 
    1067             : {
    1068             :   /// create monitor objects for DIGITS
    1069             :   
    1070           0 :   AliCodeTimerAuto("",0);
    1071             : 
    1072           0 :   if ( GetRecoParam()->TryRecover() )
    1073             :   {
    1074           0 :     fDigitMaker->SetTryRecover(kTRUE);
    1075             :   }
    1076             :   else
    1077             :   {
    1078           0 :     fDigitMaker->SetTryRecover(kFALSE);    
    1079             :   }
    1080             :   
    1081           0 :   TrackerCalData(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE);
    1082             :   
    1083             :   /// Book histograms that are common to Raws and Digits
    1084           0 :   BookHistograms(AliQAv1::kDIGITSR);
    1085             :   //
    1086             :   //ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line  DONE at parent level
    1087           0 : } 
    1088             : 
    1089             : //____________________________________________________________________________ 
    1090             : void AliMUONTrackerQADataMakerRec::InitRecPoints()
    1091             : {
    1092             :   /// create Reconstructed Points histograms in RecPoints subdir for the
    1093             :   /// MUON tracker subsystem.
    1094             :   const Bool_t expert   = kTRUE ; 
    1095             :   const Bool_t image    = kTRUE ; 
    1096             :   
    1097           0 :   AliCodeTimerAuto("",0);
    1098             : 
    1099           0 :   TrackerRecData(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE);
    1100             :   
    1101           0 :   BookHistograms(AliQAv1::kRECPOINTS);
    1102             :   
    1103             :   TH1I *h1I;
    1104             :   TH1F *h1F;
    1105             :   TH2F *h2F;
    1106             :   
    1107             :   // histograms per chamber
    1108           0 :   Int_t nCh = AliMpConstants::NofTrackingChambers();
    1109           0 :   for ( Int_t i = 0; i < nCh; ++i ) 
    1110             :   {
    1111           0 :     h1I = new TH1I(Form("hTrackerClusterMultiplicityForChamber%d",i+1), Form("cluster size distribution in chamber %d;size (n_{pads};Counts)",i+1), 100,0,100);
    1112           0 :     Add2RecPointsList(h1I,AliMUONQAIndices::kTrackerClusterMultiplicityPerChamber+i, expert, !image);
    1113             :     
    1114           0 :     h1I = new TH1I(Form("hTrackerClusterChargeForChamber%d",i+1), Form("cluster charge distribution in chamber %d;charge (fC);Counts",i+1), 100,0,1000);
    1115           0 :     Add2RecPointsList(h1I,AliMUONQAIndices::kTrackerClusterChargePerChamber+i, expert, !image);
    1116             :     
    1117           0 :     Float_t rMax = AliMUONConstants::Rmax(i/2);
    1118           0 :     h2F = new TH2F(Form("hTrackerClusterHitMapForChamber%d",i+1), Form("cluster position distribution in chamber %d;X (cm);Y (cm)",i+1), 100, -rMax, rMax, 100, -rMax, rMax);
    1119           0 :     Add2RecPointsList(h2F, AliMUONQAIndices::kTrackerClusterHitMapPerChamber+i, expert, !image);
    1120             :   }
    1121             :   
    1122             :   // summary histograms per chamber
    1123           0 :   h1I = new TH1I("hTrackerNumberOfClustersPerChamber", "Number of clusters per chamber;chamber ID;n_{clusters}", nCh,-0.5,nCh-0.5);
    1124           0 :   Add2RecPointsList(h1I,AliMUONQAIndices::kTrackerNumberOfClustersPerChamber, !expert, image);
    1125             :   
    1126           0 :   h1F = new TH1F("hTrackerClusterMultiplicityPerChMean", "cluster mean size per chamber;chamber ID;<size> (n_{pads})", nCh,-0.5,nCh-0.5);
    1127           0 :   h1F->SetOption("P");
    1128           0 :   h1F->SetMarkerStyle(kFullDotMedium);
    1129           0 :   h1F->SetMarkerColor(kRed);
    1130           0 :   Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterMultiplicityPerChMean, !expert, image);
    1131             :   
    1132           0 :   h1F = new TH1F("hTrackerClusterMultiplicityPerChSigma", "cluster size dispersion per chamber;chamber ID;#sigma_{size} (n_{pads})", nCh,-0.5,nCh-0.5);
    1133           0 :   h1F->SetOption("P");
    1134           0 :   h1F->SetMarkerStyle(kFullDotMedium);
    1135           0 :   h1F->SetMarkerColor(kRed);
    1136           0 :   Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterMultiplicityPerChSigma, !expert, image);
    1137             :   
    1138           0 :   h1F = new TH1F("hTrackerClusterChargePerChMean", "cluster mean charge per chamber;chamber ID;<charge> (fC)", nCh,-0.5,nCh-0.5);
    1139           0 :   h1F->SetOption("P");
    1140           0 :   h1F->SetMarkerStyle(kFullDotMedium);
    1141           0 :   h1F->SetMarkerColor(kRed);
    1142           0 :   Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterChargePerChMean, !expert, image);
    1143             :   
    1144           0 :   h1F = new TH1F("hTrackerClusterChargePerChSigma", "cluster charge dispersion per chamber;chamber ID;#sigma_{charge} (fC)", nCh,-0.5,nCh-0.5);
    1145           0 :   h1F->SetOption("P");
    1146           0 :   h1F->SetMarkerStyle(kFullDotMedium);
    1147           0 :   h1F->SetMarkerColor(kRed);
    1148           0 :   Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterChargePerChSigma, !expert, image);
    1149             :   
    1150             :   // histograms per DE
    1151             :   Int_t ndes(0);
    1152           0 :   AliMpDEIterator it;
    1153           0 :   it.First();
    1154           0 :   while ( !it.IsDone())
    1155             :   {
    1156           0 :     Int_t detElemId = it.CurrentDEId();
    1157             :     
    1158           0 :     if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger )
    1159             :     {
    1160           0 :       ndes = TMath::Max(ndes,detElemId);
    1161             :       
    1162           0 :       h1I = new TH1I(Form("hTrackerClusterMultiplicityForDE%04d",detElemId), Form("cluster size distribution in detection element %d;size (n_{pads})",detElemId), 100,0,100);
    1163           0 :       Add2RecPointsList(h1I,AliMUONQAIndices::kTrackerClusterMultiplicityPerDE+detElemId, expert, !image);
    1164             :       
    1165           0 :       h1I = new TH1I(Form("hTrackerClusterChargeForDE%04d",detElemId), Form("cluster charge distribution in detection element %d;charge (fC)",detElemId), 100,0,1000);
    1166           0 :       Add2RecPointsList(h1I,AliMUONQAIndices::kTrackerClusterChargePerDE+detElemId, expert, !image);
    1167             :     }
    1168             :     
    1169           0 :     it.Next();
    1170             :   }
    1171             :   
    1172             :   // summary histograms per DE
    1173           0 :   h1I = new TH1I("hTrackerNumberOfClustersPerDE", "Number of clusters per detection element;DetElem ID;n_{clusters}", ndes+1,-0.5,ndes+0.5);
    1174           0 :   Add2RecPointsList(h1I, AliMUONQAIndices::kTrackerNumberOfClustersPerDE, !expert, image);
    1175             :   
    1176           0 :   h1F = new TH1F("hTrackerClusterMultiplicityPerDEMean", "cluster mean size per DE;DetElem ID;<size> (n_{pads})", ndes+1,-0.5,ndes+0.5);
    1177           0 :   h1F->SetOption("P");
    1178           0 :   h1F->SetMarkerStyle(kFullDotMedium);
    1179           0 :   h1F->SetMarkerColor(kRed);
    1180           0 :   Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterMultiplicityPerDEMean, !expert, image);
    1181             :   
    1182           0 :   h1F = new TH1F("hTrackerClusterChargePerDEMean", "cluster mean charge per DE;DetElem ID;<charge> (fC)", ndes+1,-0.5,ndes+0.5);
    1183           0 :   h1F->SetOption("P");
    1184           0 :   h1F->SetMarkerStyle(kFullDotMedium);
    1185           0 :   h1F->SetMarkerColor(kRed);
    1186           0 :   Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterChargePerDEMean, !expert, image);
    1187             :   
    1188           0 :   MappingCheckRecPoints(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE);
    1189             :   //
    1190             :   //ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line  DONE at parent level
    1191           0 : }
    1192             : 
    1193             : //____________________________________________________________________________ 
    1194             : void AliMUONTrackerQADataMakerRec::InitESDs()
    1195             : {
    1196             :   ///create ESDs histograms in ESDs subdir
    1197             :   
    1198             :   const Bool_t expert   = kTRUE ; 
    1199             :   const Bool_t image    = kTRUE ; 
    1200             :   
    1201           0 :   Int_t nCh = AliMUONConstants::NTrackingCh();
    1202             :   Int_t nDE = 1100;
    1203             :   
    1204             :   // track info
    1205           0 :   TH1F* hESDnTracks = new TH1F("hESDnTracks", "number of tracks;n_{tracks}", 20, 0., 20.);
    1206           0 :   Add2ESDsList(hESDnTracks, AliMUONQAIndices::kESDnTracks, !expert, image);
    1207             : 
    1208           0 :   TH1F* hESDMatchTrig = new TH1F("hESDMatchTrig", "number of tracks matched with trigger;n_{tracks}", 20, 0., 20.);
    1209           0 :   Add2ESDsList(hESDMatchTrig, AliMUONQAIndices::kESDMatchTrig, !expert, image);
    1210             :   
    1211           0 :   TH1F* hESDMomentum = new TH1F("hESDMomentum", "momentum distribution;p (GeV/c)", 300, 0., 300);
    1212           0 :   Add2ESDsList(hESDMomentum, AliMUONQAIndices::kESDMomentum, !expert, image);
    1213             : 
    1214           0 :   TH1F* hESDPt = new TH1F("hESDPt", "transverse momentum distribution;p_{t} (GeV/c)", 200, 0., 50);
    1215           0 :   Add2ESDsList(hESDPt, AliMUONQAIndices::kESDPt, !expert, image);
    1216             : 
    1217           0 :   TH1F* hESDRapidity = new TH1F("hESDRapidity", "rapidity distribution;rapidity", 200, -4.5, -2.);
    1218           0 :   Add2ESDsList(hESDRapidity, AliMUONQAIndices::kESDRapidity, !expert, image);
    1219             : 
    1220           0 :   TH1F* hESDChi2 = new TH1F("hESDChi2", "normalized #chi^{2} distribution;#chi^{2} / ndf", 500, 0., 50.);
    1221           0 :   Add2ESDsList(hESDChi2, AliMUONQAIndices::kESDChi2, !expert, image);
    1222             :   
    1223           0 :   TH1F* hESDProbChi2 = new TH1F("hESDProbChi2", "distribution of probability of #chi^{2};prob(#chi^{2})", 100, 0., 1.);
    1224           0 :   Add2ESDsList(hESDProbChi2, AliMUONQAIndices::kESDProbChi2, !expert, image);
    1225             :   
    1226           0 :   TH1F* hESDThetaX = new TH1F("hESDThetaX", "#theta_{X} distribution;#theta_{X} (degree)", 360, -180., 180);
    1227           0 :   Add2ESDsList(hESDThetaX, AliMUONQAIndices::kESDThetaX, !expert, image);
    1228             :   
    1229           0 :   TH1F* hESDThetaY = new TH1F("hESDThetaY", "#theta_{Y} distribution;#theta_{Y} (degree)", 360, -180., 180);
    1230           0 :   Add2ESDsList(hESDThetaY, AliMUONQAIndices::kESDThetaY, !expert, image);
    1231             :   
    1232             :   // cluster info
    1233           0 :   for (Int_t i = 0; i < nCh; i++) {
    1234           0 :     Float_t rMax = AliMUONConstants::Rmax(i/2);
    1235           0 :     TH2F* hESDClusterHitMap = new TH2F(Form("hESDClusterHitMap%d",i+1), Form("cluster position distribution in chamber %d;X (cm);Y (cm)",i+1),
    1236           0 :                                        100, -rMax, rMax, 100, -rMax, rMax);
    1237           0 :     Add2ESDsList(hESDClusterHitMap, AliMUONQAIndices::kESDClusterHitMap+i, expert, !image);
    1238             :   }
    1239             :   
    1240           0 :   TH1F* hESDnClustersPerTrack = new TH1F("hESDnClustersPerTrack", "number of associated clusters per track;n_{clusters}", 20, 0., 20.);
    1241           0 :   Add2ESDsList(hESDnClustersPerTrack, AliMUONQAIndices::kESDnClustersPerTrack, !expert, image);
    1242             :   
    1243           0 :   TH1F* hESDnClustersPerCh = new TH1F("hESDnClustersPerCh", "averaged number of clusters per chamber per track;chamber ID;<n_{clusters}>", nCh, -0.5, nCh-0.5);
    1244           0 :   hESDnClustersPerCh->SetFillColor(kRed);
    1245           0 :   Add2ESDsList(hESDnClustersPerCh, AliMUONQAIndices::kESDnClustersPerCh, !expert, image);
    1246             :   
    1247           0 :   TH1F* hESDnClustersPerDE = new TH1F("hESDnClustersPerDE", "averaged number of clusters per DE per track;DetElem ID;<n_{clusters}>", nDE+1, -0.5, nDE+0.5);
    1248           0 :   hESDnClustersPerDE->SetFillColor(kRed);
    1249           0 :   Add2ESDsList(hESDnClustersPerDE, AliMUONQAIndices::kESDnClustersPerDE, !expert, image);
    1250             :   
    1251           0 :   for (Int_t i = 0; i < nCh; i++) {
    1252           0 :     TH1F* hESDClusterChargeInCh = new TH1F(Form("hESDClusterChargeInCh%d",i+1), Form("cluster charge distribution in chamber %d;charge (fC)",i+1), 100, 0., 1000.);
    1253           0 :     Add2ESDsList(hESDClusterChargeInCh, AliMUONQAIndices::kESDClusterChargeInCh+i, expert, !image);
    1254             :   }
    1255             :   
    1256           0 :   TH1F* hESDClusterChargePerChMean = new TH1F("hESDClusterChargePerChMean", "cluster mean charge per chamber;chamber ID;<charge> (fC)", nCh, -0.5, nCh-0.5);
    1257           0 :   hESDClusterChargePerChMean->SetOption("P");
    1258           0 :   hESDClusterChargePerChMean->SetMarkerStyle(kFullDotMedium);
    1259           0 :   hESDClusterChargePerChMean->SetMarkerColor(kRed);
    1260           0 :   Add2ESDsList(hESDClusterChargePerChMean, AliMUONQAIndices::kESDClusterChargePerChMean, !expert, image);
    1261             :   
    1262           0 :   TH1F* hESDClusterChargePerChSigma = new TH1F("hESDClusterChargePerChSigma", "cluster charge dispersion per chamber;chamber ID;#sigma_{charge} (fC)", nCh, -0.5, nCh-0.5);
    1263           0 :   hESDClusterChargePerChSigma->SetOption("P");
    1264           0 :   hESDClusterChargePerChSigma->SetMarkerStyle(kFullDotMedium);
    1265           0 :   hESDClusterChargePerChSigma->SetMarkerColor(kRed);
    1266           0 :   Add2ESDsList(hESDClusterChargePerChSigma, AliMUONQAIndices::kESDClusterChargePerChSigma, !expert, image);
    1267             :   
    1268           0 :   TH1F* hESDClusterChargePerDE = new TH1F("hESDClusterChargePerDE", "cluster mean charge per DE;DetElem ID;<charge> (fC)", nDE+1, -0.5, nDE+0.5);
    1269           0 :   hESDClusterChargePerDE->SetOption("P");
    1270           0 :   hESDClusterChargePerDE->SetMarkerStyle(kFullDotMedium);
    1271           0 :   hESDClusterChargePerDE->SetMarkerColor(kRed);
    1272           0 :   Add2ESDsList(hESDClusterChargePerDE, AliMUONQAIndices::kESDClusterChargePerDE, !expert, image);
    1273             :   
    1274           0 :   for (Int_t i = 0; i < nCh; i++) {
    1275           0 :     TH1F* hESDClusterSizeInCh = new TH1F(Form("hESDClusterSizeInCh%d",i+1), Form("cluster size distribution in chamber %d;size (n_{pads})",i+1), 200, 0., 200.);
    1276           0 :     Add2ESDsList(hESDClusterSizeInCh, AliMUONQAIndices::kESDClusterSizeInCh+i, expert, !image);
    1277             :   }
    1278             :   
    1279           0 :   TH1F* hESDClusterSizePerChMean = new TH1F("hESDClusterSizePerChMean", "cluster mean size per chamber;chamber ID;<size> (n_{pads})", nCh, -0.5, nCh-0.5);
    1280           0 :   hESDClusterSizePerChMean->SetOption("P");
    1281           0 :   hESDClusterSizePerChMean->SetMarkerStyle(kFullDotMedium);
    1282           0 :   hESDClusterSizePerChMean->SetMarkerColor(kRed);
    1283           0 :   Add2ESDsList(hESDClusterSizePerChMean, AliMUONQAIndices::kESDClusterSizePerChMean, !expert, image);
    1284             :   
    1285           0 :   TH1F* hESDClusterSizePerChSigma = new TH1F("hESDClusterSizePerChSigma", "cluster size dispersion per chamber;chamber ID;#sigma_{size} (n_{pads})", nCh, -0.5, nCh-0.5);
    1286           0 :   hESDClusterSizePerChSigma->SetOption("P");
    1287           0 :   hESDClusterSizePerChSigma->SetMarkerStyle(kFullDotMedium);
    1288           0 :   hESDClusterSizePerChSigma->SetMarkerColor(kRed);
    1289           0 :   Add2ESDsList(hESDClusterSizePerChSigma, AliMUONQAIndices::kESDClusterSizePerChSigma, !expert, image);
    1290             :   
    1291           0 :   TH1F* hESDClusterSizePerDE = new TH1F("hESDClusterSizePerDE", "cluster mean size per DE;DetElem ID;<size> (n_{pads})", nDE+1, -0.5, nDE+0.5);
    1292           0 :   hESDClusterSizePerDE->SetOption("P");
    1293           0 :   hESDClusterSizePerDE->SetMarkerStyle(kFullDotMedium);
    1294           0 :   hESDClusterSizePerDE->SetMarkerColor(kRed);
    1295           0 :   Add2ESDsList(hESDClusterSizePerDE, AliMUONQAIndices::kESDClusterSizePerDE, !expert, image);
    1296             :   
    1297             :   // cluster - track info
    1298           0 :   for (Int_t i = 0; i < nCh; i++) {
    1299           0 :     TH1F* hESDResidualXInCh = new TH1F(Form("hESDResidualXInCh%d",i+1), Form("cluster-track residual-X distribution in chamber %d;#Delta_{X} (cm)",i+1), 1000, -5., 5.);
    1300           0 :     Add2ESDsList(hESDResidualXInCh, AliMUONQAIndices::kESDResidualXInCh+i, expert, !image);
    1301             :     
    1302           0 :     TH1F* hESDResidualYInCh = new TH1F(Form("hESDResidualYInCh%d",i+1), Form("cluster-track residual-Y distribution in chamber %d;#Delta_{Y} (cm)",i+1), 1000, -1., 1.);
    1303           0 :     Add2ESDsList(hESDResidualYInCh, AliMUONQAIndices::kESDResidualYInCh+i, expert, !image);
    1304             :     
    1305           0 :     TH1F* hESDLocalChi2XInCh = new TH1F(Form("hESDLocalChi2XInCh%d",i+1), Form("local chi2-X distribution in chamber %d;local #chi^{2}_{X}",i+1), 1000, 0., 25);
    1306           0 :     Add2ESDsList(hESDLocalChi2XInCh, AliMUONQAIndices::kESDLocalChi2XInCh+i, expert, !image);
    1307             :     
    1308           0 :     TH1F* hESDLocalChi2YInCh = new TH1F(Form("hESDLocalChi2YInCh%d",i+1), Form("local chi2-Y distribution in chamber %d;local #chi^{2}_{Y}",i+1), 1000, 0., 25);
    1309           0 :     Add2ESDsList(hESDLocalChi2YInCh, AliMUONQAIndices::kESDLocalChi2YInCh+i, expert, !image);
    1310             :     
    1311           0 :     TH1F* hESDLocalChi2InCh = new TH1F(Form("hESDLocalChi2InCh%d",i+1), Form("local chi2 (~0.5*(#chi^{2}_{X}+#chi^{2}_{Y})) distribution in chamber %d;local #chi^{2}",i+1), 1000, 0., 25);
    1312           0 :     Add2ESDsList(hESDLocalChi2InCh, AliMUONQAIndices::kESDLocalChi2InCh+i, expert, !image);
    1313             :   }
    1314             :   
    1315           0 :   TH1F* hESDResidualXPerChMean = new TH1F("hESDResidualXPerChMean", "cluster-track residual-X per Ch: mean;chamber ID;<#Delta_{X}> (cm)", nCh, -0.5, nCh-0.5);
    1316           0 :   hESDResidualXPerChMean->SetOption("P");
    1317           0 :   hESDResidualXPerChMean->SetMarkerStyle(kFullDotMedium);
    1318           0 :   hESDResidualXPerChMean->SetMarkerColor(kRed);
    1319           0 :   Add2ESDsList(hESDResidualXPerChMean, AliMUONQAIndices::kESDResidualXPerChMean, !expert, image);
    1320             :   
    1321           0 :   TH1F* hESDResidualYPerChMean = new TH1F("hESDResidualYPerChMean", "cluster-track residual-Y per Ch: mean;chamber ID;<#Delta_{Y}> (cm)", nCh, -0.5, nCh-0.5);
    1322           0 :   hESDResidualYPerChMean->SetOption("P");
    1323           0 :   hESDResidualYPerChMean->SetMarkerStyle(kFullDotMedium);
    1324           0 :   hESDResidualYPerChMean->SetMarkerColor(kRed);
    1325           0 :   Add2ESDsList(hESDResidualYPerChMean, AliMUONQAIndices::kESDResidualYPerChMean, !expert, image);
    1326             :   
    1327           0 :   TH1F* hESDResidualXPerChSigma = new TH1F("hESDResidualXPerChSigma", "cluster-track residual-X per Ch: sigma;chamber ID;#sigma_{X} (cm)", nCh, -0.5, nCh-0.5);
    1328           0 :   hESDResidualXPerChSigma->SetOption("P");
    1329           0 :   hESDResidualXPerChSigma->SetMarkerStyle(kFullDotMedium);
    1330           0 :   hESDResidualXPerChSigma->SetMarkerColor(kRed);
    1331           0 :   Add2ESDsList(hESDResidualXPerChSigma, AliMUONQAIndices::kESDResidualXPerChSigma, !expert, image);
    1332             :   
    1333           0 :   TH1F* hESDResidualYPerChSigma = new TH1F("hESDResidualYPerChSigma", "cluster-track residual-Y per Ch: sigma;chamber ID;#sigma_{Y} (cm)", nCh, -0.5, nCh-0.5);
    1334           0 :   hESDResidualYPerChSigma->SetOption("P");
    1335           0 :   hESDResidualYPerChSigma->SetMarkerStyle(kFullDotMedium);
    1336           0 :   hESDResidualYPerChSigma->SetMarkerColor(kRed);
    1337           0 :   Add2ESDsList(hESDResidualYPerChSigma, AliMUONQAIndices::kESDResidualYPerChSigma, !expert, image);
    1338             :   
    1339           0 :   TH1F* hESDLocalChi2XPerChMean = new TH1F("hESDLocalChi2XPerCh", "local chi2-X per Ch: mean;chamber ID;<local #chi^{2}_{X}>", nCh, -0.5, nCh-0.5);
    1340           0 :   hESDLocalChi2XPerChMean->SetOption("P");
    1341           0 :   hESDLocalChi2XPerChMean->SetMarkerStyle(kFullDotMedium);
    1342           0 :   hESDLocalChi2XPerChMean->SetMarkerColor(kRed);
    1343           0 :   Add2ESDsList(hESDLocalChi2XPerChMean, AliMUONQAIndices::kESDLocalChi2XPerChMean, !expert, image);
    1344             :   
    1345           0 :   TH1F* hESDLocalChi2YPerChMean = new TH1F("hESDLocalChi2YPerCh", "local chi2-Y per Ch: mean;chamber ID;<local #chi^{2}_{Y}>", nCh, -0.5, nCh-0.5);
    1346           0 :   hESDLocalChi2YPerChMean->SetOption("P");
    1347           0 :   hESDLocalChi2YPerChMean->SetMarkerStyle(kFullDotMedium);
    1348           0 :   hESDLocalChi2YPerChMean->SetMarkerColor(kRed);
    1349           0 :   Add2ESDsList(hESDLocalChi2YPerChMean, AliMUONQAIndices::kESDLocalChi2YPerChMean, !expert, image);
    1350             :   
    1351           0 :   TH1F* hESDLocalChi2PerChMean = new TH1F("hESDLocalChi2PerCh", "local chi2 (~0.5*(#chi^{2}_{X}+#chi^{2}_{Y})) per Ch: mean;chamber ID;<local #chi^{2}>", nCh, -0.5, nCh-0.5);
    1352           0 :   hESDLocalChi2PerChMean->SetOption("P");
    1353           0 :   hESDLocalChi2PerChMean->SetMarkerStyle(kFullDotMedium);
    1354           0 :   hESDLocalChi2PerChMean->SetMarkerColor(kRed);
    1355           0 :   Add2ESDsList(hESDLocalChi2PerChMean, AliMUONQAIndices::kESDLocalChi2PerChMean, !expert, image);
    1356             :   
    1357           0 :   TH1F* hESDResidualXPerDEMean = new TH1F("hESDResidualXPerDEMean", "cluster-track residual-X per DE: mean;DetElem ID;<#Delta_{X}> (cm)", nDE+1, -0.5, nDE+0.5);
    1358           0 :   hESDResidualXPerDEMean->SetOption("P");
    1359           0 :   hESDResidualXPerDEMean->SetMarkerStyle(kFullDotMedium);
    1360           0 :   hESDResidualXPerDEMean->SetMarkerColor(kRed);
    1361           0 :   Add2ESDsList(hESDResidualXPerDEMean, AliMUONQAIndices::kESDResidualXPerDEMean, !expert, image);
    1362             :   
    1363           0 :   TH1F* hESDResidualYPerDEMean = new TH1F("hESDResidualYPerDEMean", "cluster-track residual-Y per DE: mean;DetElem ID;<#Delta_{Y}> (cm)", nDE+1, -0.5, nDE+0.5);
    1364           0 :   hESDResidualYPerDEMean->SetOption("P");
    1365           0 :   hESDResidualYPerDEMean->SetMarkerStyle(kFullDotMedium);
    1366           0 :   hESDResidualYPerDEMean->SetMarkerColor(kRed);
    1367           0 :   Add2ESDsList(hESDResidualYPerDEMean, AliMUONQAIndices::kESDResidualYPerDEMean, !expert, image);
    1368             :   
    1369           0 :   TH1F* hESDResidualXPerDESigma = new TH1F("hESDResidualXPerDESigma", "cluster-track residual-X per DE: sigma;DetElem ID;#sigma_{X} (cm)", nDE+1, -0.5, nDE+0.5);
    1370           0 :   hESDResidualXPerDESigma->SetOption("P");
    1371           0 :   hESDResidualXPerDESigma->SetMarkerStyle(kFullDotMedium);
    1372           0 :   hESDResidualXPerDESigma->SetMarkerColor(kRed);
    1373           0 :   Add2ESDsList(hESDResidualXPerDESigma, AliMUONQAIndices::kESDResidualXPerDESigma, !expert, image);
    1374             :   
    1375           0 :   TH1F* hESDResidualYPerDESigma = new TH1F("hESDResidualYPerDESigma", "cluster-track residual-Y per DE: sigma;DetElem ID;#sigma_{Y} (cm)", nDE+1, -0.5, nDE+0.5);
    1376           0 :   hESDResidualYPerDESigma->SetOption("P");
    1377           0 :   hESDResidualYPerDESigma->SetMarkerStyle(kFullDotMedium);
    1378           0 :   hESDResidualYPerDESigma->SetMarkerColor(kRed);
    1379           0 :   Add2ESDsList(hESDResidualYPerDESigma, AliMUONQAIndices::kESDResidualYPerDESigma, !expert, image);
    1380             :   
    1381           0 :   TH1F* hESDLocalChi2XPerDEMean = new TH1F("hESDLocalChi2XPerDE", "local chi2-X per DE: mean;DetElem ID;<local #chi^{2}_{X}>", nDE+1, -0.5, nDE+0.5);
    1382           0 :   hESDLocalChi2XPerDEMean->SetOption("P");
    1383           0 :   hESDLocalChi2XPerDEMean->SetMarkerStyle(kFullDotMedium);
    1384           0 :   hESDLocalChi2XPerDEMean->SetMarkerColor(kRed);
    1385           0 :   Add2ESDsList(hESDLocalChi2XPerDEMean, AliMUONQAIndices::kESDLocalChi2XPerDEMean, !expert, image);
    1386             :   
    1387           0 :   TH1F* hESDLocalChi2YPerDEMean = new TH1F("hESDLocalChi2YPerDE", "local chi2-Y per DE: mean;DetElem ID;<local #chi^{2}_{Y}>", nDE+1, -0.5, nDE+0.5);
    1388           0 :   hESDLocalChi2YPerDEMean->SetOption("P");
    1389           0 :   hESDLocalChi2YPerDEMean->SetMarkerStyle(kFullDotMedium);
    1390           0 :   hESDLocalChi2YPerDEMean->SetMarkerColor(kRed);
    1391           0 :   Add2ESDsList(hESDLocalChi2YPerDEMean, AliMUONQAIndices::kESDLocalChi2YPerDEMean, !expert, image);
    1392             :   
    1393           0 :   TH1F* hESDLocalChi2PerDEMean = new TH1F("hESDLocalChi2PerDE", "local chi2 (~0.5*(#chi^{2}_{X}+#chi^{2}_{Y})) per DE: mean;DetElem ID;<local #chi^{2}>", nDE+1, -0.5, nDE+0.5);
    1394           0 :   hESDLocalChi2PerDEMean->SetOption("P");
    1395           0 :   hESDLocalChi2PerDEMean->SetMarkerStyle(kFullDotMedium);
    1396           0 :   hESDLocalChi2PerDEMean->SetMarkerColor(kRed);
    1397           0 :   Add2ESDsList(hESDLocalChi2PerDEMean, AliMUONQAIndices::kESDLocalChi2PerDEMean, !expert, image);
    1398             :   
    1399             :   // intermediate histograms
    1400           0 :   TH1F* hESDnTotClustersPerCh = new TH1F("hESDnTotClustersPerCh", "total number of associated clusters per chamber;chamber ID;#Sigma(n_{clusters})", nCh, -0.5, nCh-0.5);
    1401           0 :   Add2ESDsList(hESDnTotClustersPerCh, AliMUONQAIndices::kESDnTotClustersPerCh, expert, !image);
    1402           0 :   TH1F* hESDnTotClustersPerDE = new TH1F("hESDnTotClustersPerDE", "total number of associated clusters per DE;DetElem ID;#Sigma(n_{clusters})", nDE+1, -0.5, nDE+0.5);
    1403           0 :   Add2ESDsList(hESDnTotClustersPerDE, AliMUONQAIndices::kESDnTotClustersPerDE, expert, !image);
    1404           0 :   TH1F* hESDnTotFullClustersPerDE = new TH1F("hESDnTotFullClustersPerDE", "total number of associated clusters containing pad info per DE;DetElem ID;#Sigma(n_{full clusters})", nDE+1, -0.5, nDE+0.5);
    1405           0 :   Add2ESDsList(hESDnTotFullClustersPerDE, AliMUONQAIndices::kESDnTotFullClustersPerDE, expert, !image);
    1406           0 :   TH1F* hESDSumClusterChargePerDE = new TH1F("hESDSumClusterChargePerDE", "sum of cluster charge per DE;DetElem ID;#Sigma(charge) (fC)", nDE+1, -0.5, nDE+0.5);
    1407           0 :   Add2ESDsList(hESDSumClusterChargePerDE, AliMUONQAIndices::kESDSumClusterChargePerDE, expert, !image);
    1408           0 :   TH1F* hESDSumClusterSizePerDE = new TH1F("hESDSumClusterSizePerDE", "sum of cluster size per DE;DetElem ID;#Sigma(size) (n_{pads})", nDE+1, -0.5, nDE+0.5);
    1409           0 :   Add2ESDsList(hESDSumClusterSizePerDE, AliMUONQAIndices::kESDSumClusterSizePerDE, expert, !image);
    1410           0 :   TH1F* hESDSumResidualXPerDE = new TH1F("hESDSumResidualXPerDE", "sum of cluster-track residual-X per DE;DetElem ID;#Sigma(#Delta_{X}) (cm)", nDE+1, -0.5, nDE+0.5);
    1411           0 :   Add2ESDsList(hESDSumResidualXPerDE, AliMUONQAIndices::kESDSumResidualXPerDE, expert, !image);
    1412           0 :   TH1F* hESDSumResidualYPerDE = new TH1F("hESDSumResidualYPerDE", "sum of cluster-track residual-Y per DE;DetElem ID;#Sigma(#Delta_{Y}) (cm)", nDE+1, -0.5, nDE+0.5);
    1413           0 :   Add2ESDsList(hESDSumResidualYPerDE, AliMUONQAIndices::kESDSumResidualYPerDE, expert, !image);
    1414           0 :   TH1F* hESDSumResidualX2PerDE = new TH1F("hESDSumResidualX2PerDE", "sum of cluster-track residual-X**2 per DE;DetElem ID;#Sigma(#Delta_{X}^{2}) (cm^{2})", nDE+1, -0.5, nDE+0.5);
    1415           0 :   Add2ESDsList(hESDSumResidualX2PerDE, AliMUONQAIndices::kESDSumResidualX2PerDE, expert, !image);
    1416           0 :   TH1F* hESDSumResidualY2PerDE = new TH1F("hESDSumResidualY2PerDE", "sum of cluster-track residual-Y**2 per DE;DetElem ID;#Sigma(#Delta_{Y}^{2}) (cm^{2})", nDE+1, -0.5, nDE+0.5);
    1417           0 :   Add2ESDsList(hESDSumResidualY2PerDE, AliMUONQAIndices::kESDSumResidualY2PerDE, expert, !image);
    1418           0 :   TH1F* hESDSumLocalChi2XPerDE = new TH1F("hESDSumLocalChi2XPerDE", "sum of local chi2-X per DE;DetElem ID;#Sigma(local #chi^{2}_{X})", nDE+1, -0.5, nDE+0.5);
    1419           0 :   Add2ESDsList(hESDSumLocalChi2XPerDE, AliMUONQAIndices::kESDSumLocalChi2XPerDE, expert, !image);
    1420           0 :   TH1F* hESDSumLocalChi2YPerDE = new TH1F("hESDSumLocalChi2YPerDE", "sum of local chi2-Y per DE;DetElem ID;#Sigma(local #chi^{2}_{Y})", nDE+1, -0.5, nDE+0.5);
    1421           0 :   Add2ESDsList(hESDSumLocalChi2YPerDE, AliMUONQAIndices::kESDSumLocalChi2YPerDE, expert, !image);
    1422           0 :   TH1F* hESDSumLocalChi2PerDE = new TH1F("hESDSumLocalChi2PerDE", "sum of local chi2 (~0.5*(#chi^{2}_{X}+#chi^{2}_{Y})) per DE;DetElem ID;#Sigma(local #chi^{2})", nDE+1, -0.5, nDE+0.5);
    1423           0 :   Add2ESDsList(hESDSumLocalChi2PerDE, AliMUONQAIndices::kESDSumLocalChi2PerDE, expert, !image);
    1424             :   //
    1425             :   //ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line  DONE at parent level
    1426           0 : }
    1427             : 
    1428             : //____________________________________________________________________________
    1429             : void AliMUONTrackerQADataMakerRec::MakeRaws(AliRawReader* rawReader)
    1430             : {
    1431             :         /// make QA for rawdata tracker
    1432             :         
    1433           0 :   AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0);
    1434             : 
    1435             :   /// forces init
    1436           0 :   GetRawsData(AliMUONQAIndices::kTrackerBusPatchOccupancy);
    1437             :   
    1438           0 :   AliMUONTrackerDataMaker* dm = static_cast<AliMUONTrackerDataMaker*>(TrackerDataMaker(AliRecoParam::AConvert(Master()->GetEventSpecie())));
    1439             : 
    1440           0 :   dm->SetRawReader(rawReader);
    1441             :         
    1442           0 :   Int_t eventType = rawReader->GetType();
    1443             :   
    1444           0 :   if (eventType == AliRawEventHeaderBase::kPhysicsEvent ) 
    1445             :   {
    1446           0 :     dm->ProcessEvent();
    1447             :     
    1448           0 :     FillEventSize(rawReader);
    1449             :         
    1450           0 :     if ( dm->LastEventWasEmpty() )
    1451             :     {
    1452           0 :       FillRawsData(AliMUONQAIndices::kTrackerReadoutStatus,1.0*AliMUONQAIndices::kTrackerRawNofEmptyEvents);
    1453             :     }    
    1454             :   }
    1455             :   //
    1456           0 : }
    1457             : 
    1458             : //__________________________________________________________________
    1459             : void AliMUONTrackerQADataMakerRec::MakeDigits(TTree* digitsTree)         
    1460             : {
    1461             :   /// makes data from Digits
    1462           0 :   AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0);
    1463             :   
    1464             :   /// forces init
    1465             : 
    1466           0 :   GetDigitsData(AliMUONQAIndices::kTrackerBusPatchOccupancy);
    1467             : 
    1468           0 :   if (!fDigitStore)
    1469           0 :     fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
    1470           0 :   fDigitStore->Connect(*digitsTree, false);
    1471           0 :   digitsTree->GetEvent(0);
    1472             :   
    1473           0 :   TIter next(fDigitStore->CreateIterator());
    1474             :   
    1475             :   AliMUONVDigit* dig = 0x0;
    1476             :   
    1477           0 :   AliMUON2DMap oneEventData(true);
    1478             :   
    1479           0 :   while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
    1480             :   {
    1481           0 :     if ( dig->IsTracker() )
    1482             :     {
    1483           0 :       if ( dig->Charge() > 0.0 )
    1484             :       {
    1485             :         
    1486           0 :         Int_t detElemId = dig->DetElemId();
    1487           0 :         Int_t manuId = dig->ManuId();
    1488             :         
    1489           0 :         AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(oneEventData.FindObject(detElemId,manuId));
    1490           0 :         if (!param)
    1491             :         {
    1492           0 :           param = new AliMUONCalibParamND(1,AliMpConstants::ManuNofChannels(),detElemId,manuId,
    1493           0 :                                           AliMUONVCalibParam::InvalidFloatValue());
    1494           0 :           oneEventData.Add(param);
    1495             :         }
    1496           0 :         param->SetValueAsDouble(dig->ManuChannel(),0,dig->Charge());
    1497           0 :       }
    1498             :     }
    1499             :   }
    1500           0 :   TrackerCalData(AliRecoParam::AConvert(Master()->GetEventSpecie()))->Add(oneEventData);
    1501             :   //
    1502           0 : }
    1503             : 
    1504             : //____________________________________________________________________________
    1505             : void AliMUONTrackerQADataMakerRec::MakeRecPoints(TTree* clustersTree)
    1506             : {
    1507             :         /// Fill histograms related to tracker clusters 
    1508             :         
    1509             :         // First things first : do we have clusters in the TreeR ?
    1510             :         // In "normal" production mode, it should be perfectly normal
    1511             :         // *not* to have them.
    1512             :         // But if for some reason we de-activated the combined tracking,
    1513             :         // then we have clusters in TreeR, so let's take that opportunity
    1514             :         // to QA them...
    1515             :         
    1516           0 :   AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0);
    1517             :   // Forces init by requesting an histogram
    1518           0 :   GetRecPointsData(AliMUONQAIndices::kTrackerBusPatchOccupancy); 
    1519             : 
    1520           0 :         if (!fClusterStore)
    1521             :         {
    1522           0 :           AliCodeTimerAuto("ClusterStore creation",1);
    1523           0 :                 fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
    1524           0 :                 if (!fClusterStore) 
    1525             :                 {
    1526           0 :                         return;
    1527             :                 }
    1528           0 :         }
    1529             :         
    1530           0 :         fClusterStore->Connect(*clustersTree,kFALSE);
    1531           0 :         clustersTree->GetEvent(0);
    1532             : 
    1533           0 :         TIter next(fClusterStore->CreateIterator());
    1534             :         AliMUONVCluster* cluster;
    1535             :         
    1536           0 :   AliMUONQAMappingCheck* mcr = MappingCheckRecPoints(AliRecoParam::AConvert(Master()->GetEventSpecie()));
    1537             :   
    1538           0 :   if ( mcr ) mcr->NewEvent();
    1539             :   
    1540           0 :   AliMUON2DMap oneEventData(true);
    1541             :   
    1542           0 :         while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) )
    1543             :         {
    1544           0 :                 Int_t detElemId = cluster->GetDetElemId();
    1545           0 :                 Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
    1546             :                 
    1547           0 :                 FillRecPointsData(AliMUONQAIndices::kTrackerNumberOfClustersPerDE,detElemId);
    1548           0 :                 FillRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerDE+detElemId,cluster->GetCharge());
    1549           0 :                 FillRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerDE+detElemId,cluster->GetNDigits());
    1550             : 
    1551           0 :                 FillRecPointsData(AliMUONQAIndices::kTrackerNumberOfClustersPerChamber,chamberId);
    1552           0 :                 FillRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChamber+chamberId,cluster->GetCharge());
    1553           0 :                 FillRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerChamber+chamberId,cluster->GetNDigits());
    1554           0 :                 FillRecPointsData(AliMUONQAIndices::kTrackerClusterHitMapPerChamber+chamberId,cluster->GetX(),cluster->GetY());
    1555             :                 
    1556           0 :     if ( mcr ) mcr->Store(*cluster);
    1557             :     
    1558           0 :     for ( int i = 0; i < cluster->GetNDigits(); ++i ) 
    1559             :     {
    1560           0 :       UInt_t digitId = cluster->GetDigitId(i);
    1561             :       
    1562           0 :       Int_t manuId = AliMUONVDigit::ManuId(digitId);
    1563           0 :       Int_t manuChannel = AliMUONVDigit::ManuChannel(digitId);
    1564             :       
    1565           0 :       AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(oneEventData.FindObject(detElemId,manuId));
    1566           0 :       if (!param)
    1567             :       {
    1568           0 :         param = new AliMUONCalibParamND(1,AliMpConstants::ManuNofChannels(),detElemId,manuId,AliMUONVCalibParam::InvalidFloatValue());
    1569           0 :         oneEventData.Add(param);
    1570             :       }
    1571           0 :       param->SetValueAsDouble(manuChannel,0,1.0);
    1572             :     }
    1573             :         }
    1574             :         
    1575           0 :   TrackerRecData(AliRecoParam::AConvert(Master()->GetEventSpecie()))->Add(oneEventData);    
    1576             : 
    1577           0 :   fClusterStore->Clear();
    1578             :   //
    1579           0 : }
    1580             : 
    1581             : //____________________________________________________________________________
    1582             : void AliMUONTrackerQADataMakerRec::MakeESDs(AliESDEvent* esd)
    1583             : {
    1584             :   /// make QA data from ESDs
    1585             : 
    1586           0 :   AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0);
    1587             :    
    1588             :   // load ESD event in the interface
    1589           0 :   if (!AliMUONESDInterface::GetTracker()) {
    1590           0 :     if (GetRecoParam()) AliMUONESDInterface::ResetTracker(GetRecoParam(), kFALSE);
    1591           0 :     else AliError("Unable to get recoParam: use default ones for residual calculation");
    1592             :   }
    1593             :   
    1594             :   
    1595             :   Int_t nTrkTracks = 0, nTrackMatchTrig = 0;
    1596             :   
    1597             :   // loop over tracks
    1598           0 :   Int_t nTracks = (Int_t) esd->GetNumberOfMuonTracks(); 
    1599           0 :   for (Int_t iTrack = 0; iTrack < nTracks; ++iTrack) {
    1600             :     
    1601             :     // get the ESD track and skip "ghosts"
    1602           0 :     AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack);
    1603           0 :     if (!esdTrack->ContainTrackerData()) continue;
    1604           0 :     nTrkTracks++;
    1605             :     
    1606             :     // get corresponding MUON track
    1607           0 :     AliMUONTrack track;
    1608           0 :     AliMUONESDInterface::ESDToMUON(*esdTrack, track);
    1609             :     
    1610           0 :     if (esdTrack->ContainTriggerData()) nTrackMatchTrig++;
    1611             :     
    1612           0 :     FillESDsData(AliMUONQAIndices::kESDMomentum,esdTrack->P());
    1613           0 :     FillESDsData(AliMUONQAIndices::kESDPt,esdTrack->Pt());
    1614           0 :     FillESDsData(AliMUONQAIndices::kESDRapidity,esdTrack->Y());
    1615           0 :     FillESDsData(AliMUONQAIndices::kESDChi2,track.GetNormalizedChi2());
    1616           0 :     FillESDsData(AliMUONQAIndices::kESDProbChi2,TMath::Prob(track.GetGlobalChi2(),track.GetNDF()));
    1617           0 :     FillESDsData(AliMUONQAIndices::kESDThetaX,esdTrack->GetThetaXUncorrected() / TMath::Pi() * 180.);
    1618           0 :     FillESDsData(AliMUONQAIndices::kESDThetaY,esdTrack->GetThetaYUncorrected() / TMath::Pi() * 180.);
    1619           0 :     FillESDsData(AliMUONQAIndices::kESDnClustersPerTrack,track.GetNClusters());
    1620             :     
    1621             :     // loop over clusters
    1622           0 :     AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>(track.GetTrackParamAtCluster()->First());
    1623           0 :     while (trackParam) {
    1624             :       
    1625           0 :       AliMUONVCluster* cluster = trackParam->GetClusterPtr();
    1626           0 :       Int_t chId = cluster->GetChamberId();
    1627           0 :       Int_t deID = cluster->GetDetElemId();
    1628           0 :       Double_t residualX = cluster->GetX() - trackParam->GetNonBendingCoor();
    1629           0 :       Double_t residualY = cluster->GetY() - trackParam->GetBendingCoor();
    1630           0 :       Double_t sigmaResidualX2 = cluster->GetErrX2() - trackParam->GetCovariances()(0,0);
    1631           0 :       Double_t sigmaResidualY2 = cluster->GetErrY2() - trackParam->GetCovariances()(2,2);
    1632           0 :       Double_t localChi2X = (sigmaResidualX2 > 0.) ? residualX*residualX/sigmaResidualX2 : 0.;
    1633           0 :       Double_t localChi2Y = (sigmaResidualY2 > 0.) ? residualY*residualY/sigmaResidualY2 : 0.;
    1634           0 :       Double_t localChi2 = 0.5 * trackParam->GetLocalChi2();
    1635             :       
    1636           0 :       FillESDsData(AliMUONQAIndices::kESDClusterHitMap+chId,cluster->GetX(), cluster->GetY());
    1637             :       
    1638           0 :       FillESDsData(AliMUONQAIndices::kESDnTotClustersPerCh,chId);
    1639           0 :       FillESDsData(AliMUONQAIndices::kESDnTotClustersPerDE,deID);
    1640             :       
    1641           0 :       FillESDsData(AliMUONQAIndices::kESDClusterChargeInCh+chId,cluster->GetCharge());
    1642           0 :       FillESDsData(AliMUONQAIndices::kESDSumClusterChargePerDE,deID, cluster->GetCharge());
    1643             :       
    1644           0 :       if (cluster->GetNDigits() > 0) { // discard clusters with pad not stored in ESD
    1645           0 :         FillESDsData(AliMUONQAIndices::kESDnTotFullClustersPerDE,deID);
    1646           0 :         FillESDsData(AliMUONQAIndices::kESDClusterSizeInCh+chId,cluster->GetNDigits());
    1647           0 :         FillESDsData(AliMUONQAIndices::kESDSumClusterSizePerDE,deID, cluster->GetNDigits());
    1648             :       }
    1649             :       
    1650           0 :       FillESDsData(AliMUONQAIndices::kESDResidualXInCh+chId,residualX);
    1651           0 :       FillESDsData(AliMUONQAIndices::kESDResidualYInCh+chId,residualY);
    1652           0 :       FillESDsData(AliMUONQAIndices::kESDSumResidualXPerDE,deID, residualX);
    1653           0 :       FillESDsData(AliMUONQAIndices::kESDSumResidualYPerDE,deID, residualY);
    1654           0 :       FillESDsData(AliMUONQAIndices::kESDSumResidualX2PerDE,deID, residualX*residualX);
    1655           0 :       FillESDsData(AliMUONQAIndices::kESDSumResidualY2PerDE,deID, residualY*residualY);
    1656             :       
    1657           0 :       FillESDsData(AliMUONQAIndices::kESDLocalChi2XInCh+chId,localChi2X);
    1658           0 :       FillESDsData(AliMUONQAIndices::kESDLocalChi2YInCh+chId,localChi2Y);
    1659           0 :       FillESDsData(AliMUONQAIndices::kESDLocalChi2InCh+chId,localChi2);
    1660           0 :       FillESDsData(AliMUONQAIndices::kESDSumLocalChi2XPerDE,deID, localChi2X);
    1661           0 :       FillESDsData(AliMUONQAIndices::kESDSumLocalChi2YPerDE,deID, localChi2Y);
    1662           0 :       FillESDsData(AliMUONQAIndices::kESDSumLocalChi2PerDE,deID, localChi2);
    1663             :       
    1664           0 :       trackParam = static_cast<AliMUONTrackParam*>(track.GetTrackParamAtCluster()->After(trackParam));
    1665             :       
    1666             :     }
    1667             :     
    1668           0 :   }
    1669             : 
    1670           0 :   FillESDsData(AliMUONQAIndices::kESDnTracks,nTrkTracks);
    1671           0 :   FillESDsData(AliMUONQAIndices::kESDMatchTrig,nTrackMatchTrig);
    1672             :   //
    1673           0 : }
    1674             : 
    1675             : //____________________________________________________________________________ 
    1676             : AliMUONVTrackerData* AliMUONTrackerQADataMakerRec::GetTrackerData() const
    1677             : { 
    1678             :   /// Return tracker data
    1679             :   
    1680           0 :   return TrackerDataMaker(AliRecoParam::AConvert(Master()->GetEventSpecie()))->Data(); 
    1681             : }
    1682             : 
    1683             : //____________________________________________________________________________ 
    1684             : void
    1685             : AliMUONTrackerQADataMakerRec::ResetDetectorRaws(TObjArray* list)
    1686             : {
    1687             :   /// Reset those histograms that must be reset (and only those), plus
    1688             :   /// the trackerdata itself.
    1689             :   
    1690           0 :   TIter next(list);
    1691             :   TObject* o;
    1692           0 :   while ( ( o = next() ) )
    1693             :   {
    1694           0 :     TH1* h = dynamic_cast<TH1*>(o);
    1695           0 :     if (h)
    1696             :     {
    1697           0 :       TString hn(h->GetName());
    1698             :       
    1699           0 :       if ( !hn.Contains("TrackerBusPatchConfig") )
    1700             :       {
    1701           0 :         AliDebug(1,Form("Resetting %s",hn.Data()));
    1702             : 
    1703           0 :         h->Reset();
    1704             :       }
    1705             :       else
    1706             :       {
    1707           0 :         AliDebug(1,Form("Will not reset histogram %s",hn.Data()));          
    1708             :       }
    1709             :       continue;
    1710           0 :     }
    1711             :     // RS account for the case when this histos were cloned per trigger class
    1712           0 :     TObjArray* harr = dynamic_cast<TObjArray*>(o);
    1713           0 :     if (harr) {
    1714           0 :       TString hn(harr->GetName());
    1715           0 :       if ( !hn.Contains("TrackerBusPatchConfig") ) {
    1716             : 
    1717           0 :         AliDebug(1,Form("Resetting clones of %s",hn.Data()));
    1718             : 
    1719           0 :         TIter nextCl(harr);
    1720             :         TH1* hc = 0;
    1721           0 :         while ( (hc=dynamic_cast<TH1*>(nextCl())) ) hc->Reset();
    1722           0 :       }
    1723             :       else {
    1724           0 :         AliDebug(1,Form("Will not reset clones of histogram %s",hn.Data()));  
    1725             :       }
    1726             :       continue;
    1727           0 :     }
    1728             :     //
    1729           0 :     AliMUONVTrackerData* d = dynamic_cast<AliMUONVTrackerData*>(o);
    1730           0 :     if (d) {
    1731           0 :       AliDebug(1,Form("Resetting %s",d->GetName()));
    1732           0 :       d->Clear();
    1733             :     }
    1734             :     else {
    1735           0 :       AliError(Form("Found an object of class %s. Do not know how to reset.",o->ClassName()));
    1736             :     }
    1737           0 :   }
    1738             : 
    1739           0 :   fLogger->Clear();
    1740           0 : }
    1741             : 
    1742             : //____________________________________________________________________________ 
    1743             : TObjArray* AliMUONTrackerQADataMakerRec::GetArray(TObjArray*& array, Bool_t create)
    1744             : {
    1745             :   /// Get (or create) the array
    1746             : 
    1747           0 :   if ( ! array ) 
    1748             :   {
    1749           0 :     if ( create ) 
    1750             :     {
    1751           0 :       array = new TObjArray(AliRecoParam::kNSpecies);
    1752           0 :     }
    1753             :   }
    1754             :   
    1755           0 :   return array;
    1756           0 : }
    1757             : 
    1758             : //____________________________________________________________________________ 
    1759             : AliMUONVTrackerDataMaker* 
    1760             : AliMUONTrackerQADataMakerRec::TrackerDataMaker(Int_t specieIndex)  const
    1761             : {
    1762             :   /// const version of the getter
    1763           0 :   if ( fTrackerDataMakerArray )
    1764             :   {
    1765           0 :     return static_cast<AliMUONVTrackerDataMaker*>(fTrackerDataMakerArray->At(specieIndex));
    1766             :   }
    1767           0 :   return 0x0;
    1768           0 : }
    1769             : 
    1770             : //____________________________________________________________________________ 
    1771             : AliMUONVTrackerDataMaker* 
    1772             : AliMUONTrackerQADataMakerRec::TrackerDataMaker(Int_t specieIndex, Bool_t create)
    1773             : {
    1774             :   /// Get (or create) TrackerDataMaker object for a given specie
    1775             :   
    1776           0 :   TObjArray* array = GetArray(fTrackerDataMakerArray,create);
    1777             :   TObject* o(0x0);
    1778             :   
    1779           0 :   if ( array ) 
    1780             :   {
    1781           0 :     array->SetOwner(kTRUE);
    1782           0 :     o = array->At(specieIndex);
    1783           0 :     if (!o && create)
    1784             :     {
    1785             :       
    1786           0 :       AliMUONTrackerDataMaker* dm = new AliMUONTrackerDataMaker(0x0,
    1787           0 :                                                                 AliCDBManager::Instance()->GetRun(),
    1788             :                                                                 0x0,
    1789             :                                                                 "",
    1790             :                                                                 "",
    1791             :                                                                 kFALSE,
    1792             :                                                                 0.0,0.0);
    1793             :       
    1794           0 :       if (!fLogger) fLogger = new AliMUONLogger(-1); // note that we share the logger between species... should not be a big deal though
    1795           0 :       dm->EnableErrorLogger(fLogger);
    1796           0 :       dm->Data()->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level    
    1797           0 :       dm->Data()->SetName("RawCharges");
    1798           0 :       dm->SetRunning(kTRUE);
    1799             : 
    1800           0 :       o = dm;
    1801           0 :       array->AddAt(o,specieIndex);      
    1802           0 :     }
    1803             :   }
    1804           0 :   return static_cast<AliMUONVTrackerDataMaker*>(o);
    1805           0 : }
    1806             : 
    1807             : //____________________________________________________________________________ 
    1808             : AliMUONVTrackerData* 
    1809             : AliMUONTrackerQADataMakerRec::TrackerCalData(Int_t specieIndex, Bool_t create)
    1810             : {
    1811           0 :   TObjArray* array = GetArray(fTrackerCalDataArray,create);
    1812             :   TObject* o(0x0);
    1813             :   
    1814           0 :   if (array)
    1815             :   {
    1816           0 :     o = array->At(specieIndex);
    1817           0 :     if (!o && create)
    1818             :     {
    1819           0 :       AliMUONTrackerData* data = new AliMUONTrackerData("CalCharges","Calibrated charges (fC)",1);
    1820           0 :       data->SetDimensionName(0,"charge");
    1821           0 :       data->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level
    1822           0 :       o=data;
    1823           0 :       array->AddAt(o,specieIndex);
    1824           0 :     }
    1825             :   }
    1826           0 :   return static_cast<AliMUONVTrackerData*>(o);
    1827           0 : }
    1828             : 
    1829             : //____________________________________________________________________________ 
    1830             : AliMUONVTrackerData* 
    1831             : AliMUONTrackerQADataMakerRec::TrackerRecData(Int_t specieIndex, Bool_t create)
    1832             : {
    1833           0 :   TObjArray* array = GetArray(fTrackerRecDataArray,create);
    1834             :   TObject* o(0x0);
    1835             :   
    1836           0 :   if (array)
    1837             :   {
    1838           0 :     o = array->At(specieIndex);
    1839           0 :     if (!o && create)
    1840             :     {
    1841           0 :       AliMUONTrackerData* data = new AliMUONTrackerData("RecCharges","Calibrated charges (fC) for digits belonging to a reconstructed cluster",1);
    1842           0 :       data->SetDimensionName(0,"one");
    1843           0 :       data->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level
    1844           0 :       o=data;
    1845           0 :       array->AddAt(o,specieIndex);
    1846           0 :     }
    1847             :   }
    1848           0 :   return static_cast<AliMUONVTrackerData*>(o);
    1849           0 : }
    1850             : 
    1851             : //____________________________________________________________________________ 
    1852             : AliMUONQAMappingCheck* 
    1853             : AliMUONTrackerQADataMakerRec::MappingCheckRecPoints(Int_t specieIndex, Bool_t create)
    1854             : {
    1855           0 :   TObjArray* array = GetArray(fMappingCheckRecPointsArray,create);
    1856             :   TObject* o(0x0);
    1857             :   
    1858           0 :   if (array)
    1859             :   {
    1860           0 :     o = array->At(specieIndex);
    1861           0 :     array->SetOwner(kTRUE);
    1862           0 :     if (!o && create)
    1863             :     {
    1864           0 :       AliMUONQAMappingCheck* mcheck = new AliMUONQAMappingCheck(RunNumber()); 
    1865           0 :       o=mcheck;
    1866           0 :       array->AddAt(o,specieIndex);
    1867           0 :     }
    1868             :   }
    1869           0 :   return static_cast<AliMUONQAMappingCheck*>(o);
    1870           0 : }

Generated by: LCOV version 1.11