ROOT logo
#ifndef ALIHADCORRTASK_H
#define ALIHADCORRTASK_H

// $Id$

class TClonesArray;
class TList;
class TH1;
class TH2;
class AliEmcalParticle;
class TString;

#include "AliAnalysisTaskEmcal.h"

class AliHadCorrTask : public AliAnalysisTaskEmcal {

 public:
  AliHadCorrTask();
  AliHadCorrTask(const char *name, Bool_t histo=kFALSE); 
  virtual ~AliHadCorrTask();

  void                   UserCreateOutputObjects();

  void                   SetEexcl(Double_t Emin)                 { fEexclCell      = Emin ; }
  void                   SetEtaMatch(Double_t eta)               { fEtaMatch       = eta  ; }
  void                   SetHadCorr(Double_t c)                  { fHadCorr        = c    ; }
  void                   SetOutClusName(const char *n)           { fOutCaloName    = n    ; }
  void                   SetPhiMatch(Double_t phi)               { fPhiMatch       = phi  ; }
  void                   SetTrackClus(Int_t c)                   { fDoTrackClus    = c    ; }
  void                   SetDoExact(Bool_t d)                    { fDoExact        = d    ; }

 protected:
  Double_t               ApplyHadCorrOneTrack(AliEmcalParticle *emccluster, Double_t hadCorr);
  Double_t               ApplyHadCorrAllTracks(AliEmcalParticle *emccluster, Double_t hadCorr);
  void                   DoMatchedTracksLoop(AliEmcalParticle *emccluster, Double_t &totalTrkP, Int_t &Nmatches, Double_t &trkPMCfrac, Int_t &NMCmatches);
  void                   DoTrackLoop();
  Double_t               GetEtaSigma(Int_t pbin)                   const;
  UInt_t                 GetMomBin(Double_t pt)                    const;
  Double_t               GetPhiMean(Int_t pbin, Int_t centbin)     const;
  Double_t               GetPhiSigma(Int_t pbin, Int_t centbin)    const;
  Bool_t                 Run()                                          ;
  void                   ExecOnce()                                     ;

  // Task configuration
  TString                fOutCaloName;               // name of output clusters
  Double_t               fPhiMatch;                  // phi match value (pp=0.050)
  Double_t               fEtaMatch;                  // eta match value (pp=0.025)
  Int_t                  fDoTrackClus;               // loop over tracks first
  Double_t               fHadCorr;                   // hadronic correction (fraction)
  Double_t               fEexclCell;                 // energy/cell that we cannot subtract from the clusters
  Bool_t                 fDoExact;                   // do exact correction (embedding only) 

  // Service fields (non-streamed)
  Bool_t                 fEsdMode;                   //!ESD/AOD mode
  TClonesArray          *fOutClusters;               //!output cluster collection

  // QA plots
  TH2                   *fHistMatchEtaPhi[8][9][2];  //!deta vs. dphi of matched cluster-track pairs
  TH2                   *fHistMatchEtaPhiAll;        //!deta vs. dphi of matched cluster-track pairs
  TH2                   *fHistMatchEtaPhiAllTr;      //!deta vs. dphi of all cluster-track pairs (tr loop)
  TH2                   *fHistMatchEtaPhiAllCl;      //!deta vs. dphi of all cluster-track pairs (cl loop)
  TH2                   *fHistMatchEvsP[4];          //!cluster energy vs. track momentum of matched pairs
  TH2                   *fHistNMatchEnergy[4];       //!n matches vs. cluster energy
  TH2                   *fHistNCellsEnergy[4][4];    //!n cells vs. cluster energy
  TH2                   *fHistMatchdRvsEP[4];        //!matching distance vs. E/P
  TH1                   *fHistNclusvsCent;           //!n clusters vs. centrality
  TH1                   *fHistNclusMatchvsCent;      //!n clusters matched to some track vs. centrality
  TH1                   *fHistEbefore;               //!average energy of clusters before correction vs. centrality
  TH1                   *fHistEafter;                //!average energy of clusters after correction vs. centrality
  TH2                   *fHistEoPCent;               //!E/P vs. centrality
  TH2                   *fHistNMatchCent;            //!n matches vs. centraity
  TH2                   *fHistNClusMatchCent;        //!n clusters macthed to some track (tracks allowed to match more than one cluster)
  TH1                   *fHistEsubPch[8];            //!Esub vs. total momentum of matched tracks (only 1 match)
  TH2                   *fHistEsubPchRat[8];         //!Esub/momentum of matched tracks vs. total momentum of matched tracks (only 1 match)
  TH2                   *fHistEsubPchRatAll[8];      //!Esub/momentum of matched tracks vs. total momentum of matched tracks (all number of matches)
  TH2                   *fHistEmbTrackMatchesOversub[4];    //!Over-subtracted energy / cluster energy with embedded track matches (non-embedded matches < 5%)
  TH2                   *fHistNonEmbTrackMatchesOversub[4]; //!Over-subtracted energy / cluster energy with non-embedded track matches (embedded matches < 5%)
  TH2                   *fHistOversubMCClusters[4];         //!Over-subtracted energy / cluster energy (cluster MC energy fraction > 95%)
  TH2                   *fHistOversubNonMCClusters[4];      //!Over-subtracted energy / cluster energy (cluster MC energy fraction < 5%)
  TH2                   *fHistOversub[4];                   //!Over-subtracted energy / cluster energy

 private:
  AliHadCorrTask(const AliHadCorrTask&);            // not implemented
  AliHadCorrTask &operator=(const AliHadCorrTask&); // not implemented

  ClassDef(AliHadCorrTask, 14) // Hadronic correction task
};
#endif
 AliHadCorrTask.h:1
 AliHadCorrTask.h:2
 AliHadCorrTask.h:3
 AliHadCorrTask.h:4
 AliHadCorrTask.h:5
 AliHadCorrTask.h:6
 AliHadCorrTask.h:7
 AliHadCorrTask.h:8
 AliHadCorrTask.h:9
 AliHadCorrTask.h:10
 AliHadCorrTask.h:11
 AliHadCorrTask.h:12
 AliHadCorrTask.h:13
 AliHadCorrTask.h:14
 AliHadCorrTask.h:15
 AliHadCorrTask.h:16
 AliHadCorrTask.h:17
 AliHadCorrTask.h:18
 AliHadCorrTask.h:19
 AliHadCorrTask.h:20
 AliHadCorrTask.h:21
 AliHadCorrTask.h:22
 AliHadCorrTask.h:23
 AliHadCorrTask.h:24
 AliHadCorrTask.h:25
 AliHadCorrTask.h:26
 AliHadCorrTask.h:27
 AliHadCorrTask.h:28
 AliHadCorrTask.h:29
 AliHadCorrTask.h:30
 AliHadCorrTask.h:31
 AliHadCorrTask.h:32
 AliHadCorrTask.h:33
 AliHadCorrTask.h:34
 AliHadCorrTask.h:35
 AliHadCorrTask.h:36
 AliHadCorrTask.h:37
 AliHadCorrTask.h:38
 AliHadCorrTask.h:39
 AliHadCorrTask.h:40
 AliHadCorrTask.h:41
 AliHadCorrTask.h:42
 AliHadCorrTask.h:43
 AliHadCorrTask.h:44
 AliHadCorrTask.h:45
 AliHadCorrTask.h:46
 AliHadCorrTask.h:47
 AliHadCorrTask.h:48
 AliHadCorrTask.h:49
 AliHadCorrTask.h:50
 AliHadCorrTask.h:51
 AliHadCorrTask.h:52
 AliHadCorrTask.h:53
 AliHadCorrTask.h:54
 AliHadCorrTask.h:55
 AliHadCorrTask.h:56
 AliHadCorrTask.h:57
 AliHadCorrTask.h:58
 AliHadCorrTask.h:59
 AliHadCorrTask.h:60
 AliHadCorrTask.h:61
 AliHadCorrTask.h:62
 AliHadCorrTask.h:63
 AliHadCorrTask.h:64
 AliHadCorrTask.h:65
 AliHadCorrTask.h:66
 AliHadCorrTask.h:67
 AliHadCorrTask.h:68
 AliHadCorrTask.h:69
 AliHadCorrTask.h:70
 AliHadCorrTask.h:71
 AliHadCorrTask.h:72
 AliHadCorrTask.h:73
 AliHadCorrTask.h:74
 AliHadCorrTask.h:75
 AliHadCorrTask.h:76
 AliHadCorrTask.h:77
 AliHadCorrTask.h:78
 AliHadCorrTask.h:79
 AliHadCorrTask.h:80
 AliHadCorrTask.h:81
 AliHadCorrTask.h:82
 AliHadCorrTask.h:83
 AliHadCorrTask.h:84
 AliHadCorrTask.h:85
 AliHadCorrTask.h:86
 AliHadCorrTask.h:87
 AliHadCorrTask.h:88