ROOT logo
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

//_________________________________________________________________________
// Class for bad channels & bad runs identification
// Author: Olga Driga (SUBATECH)

#ifndef ALICALOCELLSQA_H
#define ALICALOCELLSQA_H

// --- ROOT system ---
#include <TObjArray.h>
#include <TH1D.h>
#include <TH1F.h>
#include <TH2F.h>
class AliLog;

// --- AliRoot header files ---
#include <AliVCaloCells.h>
#include <AliVCluster.h>

class AliCaloCellsQA : public TObject {

public:

  // detectors
  enum {
    kEMCAL = 0,
    kPHOS  = 1
// ,kDCAL  = 2      // not yet implemented
  };

  AliCaloCellsQA();
  AliCaloCellsQA(Int_t nmods, Int_t det = kEMCAL, Int_t startRunNumber = 100000, Int_t endRunNumber = 200000);

  virtual ~AliCaloCellsQA();

  virtual void ActivateFullAnalysis();
  virtual void InitSummaryHistograms(Int_t nbins = 400, Double_t emax = 4.,
                                     Int_t nbinsh = 100, Double_t emaxh = 300.,
                                     Int_t nbinst = 250, Double_t tmin =-0.1e-6, Double_t tmax = 0.15e-6);
  virtual void InitTransientFindCurrentRun(Int_t runNumber);
  virtual void Fill(Int_t runNumber, TObjArray *clusArray, AliVCaloCells *cells, Double_t vertexXYZ[3]);  // main method

  // getters
  virtual Int_t      GetDetector()     { return fDetector; }
  virtual Int_t      GetNMods()        { return fNMods; }
  virtual Double_t   GetClusElowMin()  { return fClusElowMin; }
  virtual Double_t   GetClusEhighMin() { return fClusEhighMin; }
  virtual Double_t   GetPi0EClusMin()  { return fPi0EClusMin; }
  virtual Bool_t     GetFullAnalysis() { return fkFullAnalysis; }

  virtual TObjArray* GetListOfHistos() { return fListOfHistos; }

  // setters
  virtual void SetClusterEnergyCuts(Double_t pi0EClusMin = 0.5, Double_t ElowMin = 0.3, Double_t EhighMin = 1.0);
  virtual void SetBinningParameters(Int_t nbins1 = 100, Int_t nbins2 = 250, Int_t nbins3x = 200, Int_t nbins3y = 30,
                                    Double_t xmax1 = 5., Double_t xmax2 = 0.5, Double_t xmax3 = 20.);

protected:

  virtual void    Init(Int_t nmods, Int_t det, Int_t startRunNumber, Int_t endRunNumber);
  virtual void    InitTransientMembers(Int_t run);
  virtual void    InitHistosForRun(Int_t run);

  virtual void    FillCellsInCluster(TObjArray *clusArray, AliVCaloCells *cells);
  virtual void    FillJustCells(AliVCaloCells *cells);
  virtual void    FillPi0Mass(TObjArray *clusArray, Double_t vertexXYZ[3]);

  virtual Int_t   CheckClusterGetSM(AliVCluster* clus);
  virtual Int_t   GetSM(Int_t absId);
  virtual Bool_t  IsCellLocalMaximum(Int_t c, AliVCluster* clus, AliVCaloCells* cells);
  virtual Bool_t  IsCellLocalMaximum(Int_t absId, AliVCaloCells* cells);
  virtual void    AbsIdToSMEtaPhi(Int_t absId, Int_t &sm, Int_t &eta, Int_t &phi);

private:

  AliCaloCellsQA(const AliCaloCellsQA &);
  AliCaloCellsQA & operator = (const AliCaloCellsQA &);

private:

  // changeable parameters
  Int_t     fDetector;                  // kEMCAL or kPHOS
  Int_t     fNMods;                     // maximum supermodule number + 1 (4 or 10)
  Double_t  fClusElowMin;               // minimum cluster energy cut for low energy per run histograms
  Double_t  fClusEhighMin;              // minimum cluster energy cut for high energy per run histograms
  Double_t  fPi0EClusMin;               // minimum cluster energy cut for pi0 mass histograms
  Bool_t    fkFullAnalysis;             // flag to activate all available histograms

  // changeable binning parameters
  Int_t     fNBinsECells;               // number of bins in hECells
  Int_t     fNBinsPi0Mass;              // number of bins in hPi0Mass
  Int_t     fNBinsXNCellsInCluster;     // number of bins in hNCellsInCluster, X axis
  Int_t     fNBinsYNCellsInCluster;     // number of bins in hNCellsInCluster, Y axis
  Double_t  fXMaxECells;                // X axis maximum in hECells
  Double_t  fXMaxPi0Mass;               // X axis maximum in hPi0Mass
  Double_t  fXMaxNCellsInCluster;       // X axis maximum in hNCellsInCluster

  // internal parameters
  Int_t     fRunNumbers[1000];          // already encountered runs
  Int_t     fNRuns;                     // number of encountered runs
  Int_t     fRI;                        //! current (cached) run index

  // internal parameters, used for coding convenience
  Int_t     fAbsIdMin;                  // minimum absId number (0/EMCAL, 1/PHOS)
  Int_t     fAbsIdMax;                  // maximum absId number + 1

  TObjArray  *fListOfHistos;            // array with all the histograms


  /* All the histograms below are present in fListOfHistos.
   *
   * NOTE: strictly speaking, the transient members below are not necessary, but the
   * caching mechanism used in this class boosts the analysis speed considerably
   * (no searching for a histogram by its name is performed in each event).
   */

  TH1D *fhNEventsProcessedPerRun;             //! number of processed events per run

  // current run histograms; X axis -- cell absId number;
  TH1F *fhCellLocMaxNTimesInClusterElow;      //! number of times cell was local maximum in a low energy cluster
  TH1F *fhCellLocMaxNTimesInClusterEhigh;     //! number of times cell was local maximum in a high energy cluster
  TH1F *fhCellLocMaxETotalClusterElow;        //! total cluster energy for local maximum cell, low energy
  TH1F *fhCellLocMaxETotalClusterEhigh;       //! total cluster energy for local maximum cell, high energy
  TH1F *fhCellNonLocMaxNTimesInClusterElow;   //! number of times cell wasn't local maximum in a low energy cluster
  TH1F *fhCellNonLocMaxNTimesInClusterEhigh;  //! number of times cell wasn't local maximum in a high energy cluster
  TH1F *fhCellNonLocMaxETotalClusterElow;     //! total cluster energy for not local maximum cell, low energy
  TH1F *fhCellNonLocMaxETotalClusterEhigh;    //! total cluster energy for not local maximum cell, high energy

  // current run, per supermodule histograms; the maximum number of supermodules is 10
  TH1F *fhECells[10];                         //! cell amplitude distribution
  TH1F *fhPi0Mass[10][10];                    //! pi0 mass spectrum
  TH2F *fhNCellsInCluster[10];                //! distribution of number of cells in cluster vs cluster energy

  // summary histograms: cells spectra at different conditions; X axis -- cell absId number
  TH2F *fhCellAmplitude;                      //! amplitude distribution per cell
  TH2F *fhCellAmplitudeEhigh;                 //! amplitude distribution per cell, high energies
  TH2F *fhCellAmplitudeNonLocMax;             //! amplitude distribution per not a local maximum cell
  TH2F *fhCellAmplitudeEhighNonLocMax;        //! amplitude distribution per not a local maximum cell, high energies
  TH2F *fhCellTime;                           //! time distribution per cell

  ClassDef(AliCaloCellsQA,2)
};

#endif
 AliCaloCellsQA.h:1
 AliCaloCellsQA.h:2
 AliCaloCellsQA.h:3
 AliCaloCellsQA.h:4
 AliCaloCellsQA.h:5
 AliCaloCellsQA.h:6
 AliCaloCellsQA.h:7
 AliCaloCellsQA.h:8
 AliCaloCellsQA.h:9
 AliCaloCellsQA.h:10
 AliCaloCellsQA.h:11
 AliCaloCellsQA.h:12
 AliCaloCellsQA.h:13
 AliCaloCellsQA.h:14
 AliCaloCellsQA.h:15
 AliCaloCellsQA.h:16
 AliCaloCellsQA.h:17
 AliCaloCellsQA.h:18
 AliCaloCellsQA.h:19
 AliCaloCellsQA.h:20
 AliCaloCellsQA.h:21
 AliCaloCellsQA.h:22
 AliCaloCellsQA.h:23
 AliCaloCellsQA.h:24
 AliCaloCellsQA.h:25
 AliCaloCellsQA.h:26
 AliCaloCellsQA.h:27
 AliCaloCellsQA.h:28
 AliCaloCellsQA.h:29
 AliCaloCellsQA.h:30
 AliCaloCellsQA.h:31
 AliCaloCellsQA.h:32
 AliCaloCellsQA.h:33
 AliCaloCellsQA.h:34
 AliCaloCellsQA.h:35
 AliCaloCellsQA.h:36
 AliCaloCellsQA.h:37
 AliCaloCellsQA.h:38
 AliCaloCellsQA.h:39
 AliCaloCellsQA.h:40
 AliCaloCellsQA.h:41
 AliCaloCellsQA.h:42
 AliCaloCellsQA.h:43
 AliCaloCellsQA.h:44
 AliCaloCellsQA.h:45
 AliCaloCellsQA.h:46
 AliCaloCellsQA.h:47
 AliCaloCellsQA.h:48
 AliCaloCellsQA.h:49
 AliCaloCellsQA.h:50
 AliCaloCellsQA.h:51
 AliCaloCellsQA.h:52
 AliCaloCellsQA.h:53
 AliCaloCellsQA.h:54
 AliCaloCellsQA.h:55
 AliCaloCellsQA.h:56
 AliCaloCellsQA.h:57
 AliCaloCellsQA.h:58
 AliCaloCellsQA.h:59
 AliCaloCellsQA.h:60
 AliCaloCellsQA.h:61
 AliCaloCellsQA.h:62
 AliCaloCellsQA.h:63
 AliCaloCellsQA.h:64
 AliCaloCellsQA.h:65
 AliCaloCellsQA.h:66
 AliCaloCellsQA.h:67
 AliCaloCellsQA.h:68
 AliCaloCellsQA.h:69
 AliCaloCellsQA.h:70
 AliCaloCellsQA.h:71
 AliCaloCellsQA.h:72
 AliCaloCellsQA.h:73
 AliCaloCellsQA.h:74
 AliCaloCellsQA.h:75
 AliCaloCellsQA.h:76
 AliCaloCellsQA.h:77
 AliCaloCellsQA.h:78
 AliCaloCellsQA.h:79
 AliCaloCellsQA.h:80
 AliCaloCellsQA.h:81
 AliCaloCellsQA.h:82
 AliCaloCellsQA.h:83
 AliCaloCellsQA.h:84
 AliCaloCellsQA.h:85
 AliCaloCellsQA.h:86
 AliCaloCellsQA.h:87
 AliCaloCellsQA.h:88
 AliCaloCellsQA.h:89
 AliCaloCellsQA.h:90
 AliCaloCellsQA.h:91
 AliCaloCellsQA.h:92
 AliCaloCellsQA.h:93
 AliCaloCellsQA.h:94
 AliCaloCellsQA.h:95
 AliCaloCellsQA.h:96
 AliCaloCellsQA.h:97
 AliCaloCellsQA.h:98
 AliCaloCellsQA.h:99
 AliCaloCellsQA.h:100
 AliCaloCellsQA.h:101
 AliCaloCellsQA.h:102
 AliCaloCellsQA.h:103
 AliCaloCellsQA.h:104
 AliCaloCellsQA.h:105
 AliCaloCellsQA.h:106
 AliCaloCellsQA.h:107
 AliCaloCellsQA.h:108
 AliCaloCellsQA.h:109
 AliCaloCellsQA.h:110
 AliCaloCellsQA.h:111
 AliCaloCellsQA.h:112
 AliCaloCellsQA.h:113
 AliCaloCellsQA.h:114
 AliCaloCellsQA.h:115
 AliCaloCellsQA.h:116
 AliCaloCellsQA.h:117
 AliCaloCellsQA.h:118
 AliCaloCellsQA.h:119
 AliCaloCellsQA.h:120
 AliCaloCellsQA.h:121
 AliCaloCellsQA.h:122
 AliCaloCellsQA.h:123
 AliCaloCellsQA.h:124
 AliCaloCellsQA.h:125
 AliCaloCellsQA.h:126
 AliCaloCellsQA.h:127
 AliCaloCellsQA.h:128
 AliCaloCellsQA.h:129
 AliCaloCellsQA.h:130
 AliCaloCellsQA.h:131
 AliCaloCellsQA.h:132
 AliCaloCellsQA.h:133
 AliCaloCellsQA.h:134
 AliCaloCellsQA.h:135
 AliCaloCellsQA.h:136
 AliCaloCellsQA.h:137
 AliCaloCellsQA.h:138
 AliCaloCellsQA.h:139
 AliCaloCellsQA.h:140
 AliCaloCellsQA.h:141
 AliCaloCellsQA.h:142
 AliCaloCellsQA.h:143
 AliCaloCellsQA.h:144
 AliCaloCellsQA.h:145
 AliCaloCellsQA.h:146