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

/* $Id: $ */

/////////////////////////////////////////////////////////////
// class to average D meson -hadron correlations
//
// Author: A. Rossi, andrea.rossi@cern.ch
/////////////////////////////////////////////////////////////
#include "AliHFDhadronCorrSystUnc.h"
#include <TMath.h>
#include <TH1D.h>
#include <TCanvas.h>
#include <TGraphAsymmErrors.h>

class AliHFDmesonCorrAverage : public TNamed {
  

 public:
  
  AliHFDmesonCorrAverage();
  AliHFDmesonCorrAverage(const char* name);
  ~AliHFDmesonCorrAverage();
  
  
  Bool_t InitSystematicUncertainty(Int_t system=-1,Int_t year=-1);
  void SetIncludeDzero(Bool_t inclDzero){fincludeDzero=inclDzero;}
  void SetIncludeDstar(Bool_t inclDstar){fincludeDstar=inclDstar;}
  void SetIncludeDplus(Bool_t inclDplus){fincludeDplus=inclDplus;}
  
  void SetDzeroHisto(TH1D *h){fhDzero=(TH1D*)h->Clone("hInputDzero");}
  void SetDplusHisto(TH1D *h){fhDplus=(TH1D*)h->Clone("hInputDplus");}
  void SetDstarHisto(TH1D *h){fhDstar=(TH1D*)h->Clone("hInputDstar");}
  void SetArithmeticAverage(Bool_t averType){fArithmeticAverage=averType;}  
  void SetMethod(Int_t method){fmethod=method;}
  void SetSystem(Int_t sys,Int_t year){fsys=sys;fyear=year;}
  void SetMomentumRanges(Double_t minptD,Double_t maxptD,Double_t minptAsso,Double_t maxptAsso){fptminD=minptD;fptmaxD=maxptD;fptminAsso=minptAsso;fptmaxAsso=maxptAsso;}
  void CalculateAverage();  
  TH1D *GetAverageHisto(){return fhDaverage;}
  void InitAverageHisto(TH1D *h);
  TH1D *ReflectHisto(TH1D *h);
  TH1D *GetWeightsUsedDzero(){
    return fhUsedWeightsDzero;
  }
  TH1D *GetWeightsUsedDstar(){
    return fhUsedWeightsDstar;
  }
  TH1D *GetWeightsUsedDplus(){
    return fhUsedWeightsDplus;
  }
  void SetDzeroSystUnc(AliHFDhadronCorrSystUnc *sys){fSystDzero=(AliHFDhadronCorrSystUnc*)sys->Clone("fSystDzero");}
  void SetDplusSystUnc(AliHFDhadronCorrSystUnc *sys){fSystDplus=(AliHFDhadronCorrSystUnc*)sys->Clone("fSystDplus");}
  void SetDstarSystUnc(AliHFDhadronCorrSystUnc *sys){fSystDstar=(AliHFDhadronCorrSystUnc*)sys->Clone("fSystDstar");}

  void SetSystAreAlreadySet(Bool_t syst){fSystAlreadySet=syst;}
  AliHFDhadronCorrSystUnc* GetAverageSystUncertainty(){return fSystDaverage;}
 private:
  void SetWeights();


  AliHFDhadronCorrSystUnc *fSystDzero;     // Dzero syst unc
  AliHFDhadronCorrSystUnc *fSystDstar;     // Dzero syst unc
  AliHFDhadronCorrSystUnc *fSystDplus;     // Dzero syst unc
  AliHFDhadronCorrSystUnc *fSystDaverage;   // Average syst unc
  Bool_t fincludeDzero;                    //flag to include Dzero
  Bool_t fincludeDstar;                    // flag to include Dstar 
  Bool_t fincludeDplus;                    // flag to include Dplus
  Int_t fmethod;                     // flag to use abs uncertainty (first digit (unit)=0) or rel uncertainty (first digit=1) and stat only (second digit=0) or stat+uncorr syst (2nd digit =1)
  Double_t fptminD;                        // min D pt
  Double_t fptmaxD;                        // max D pt
  Double_t fptminAsso;                        // min associated track pt
  Double_t fptmaxAsso;                        // max associated pt
  TH1D *fhDzero;                           //  Dzero input histo
  TH1D *fhDstar;                           //  Dstar input histo
  TH1D *fhDplus;                           //  Dplus input histo
  TH1D *fhDaverage;                         // D average
  TGraphAsymmErrors *fgrTotSystAverage;        // 
  TGraphAsymmErrors *fgrFDSystAverage;        // 
  TGraphAsymmErrors *fgrNonFDSystAverage;        // 
  Double_t *fweightsDzeroStat;                       // Dzero weights used
  Double_t *fweightsDstarStat;                       // Dstar weights used
  Double_t *fweightsDplusStat;                       // Dplus weights used
  Double_t *fweightsDzeroSystYield;                       // Dzero weights used
  Double_t *fweightsDstarSystYield;                       // Dstar weights used
  Double_t *fweightsDplusSystYield;                       // Dplus weights used
  Double_t *fweightsDzeroSystBkg;                       // Dzero weights used
  Double_t *fweightsDstarSystBkg;                       // Dstar weights used
  Double_t *fweightsDplusSystBkg;                       // Dplus weights used
  Int_t   fnbinsphi;                        // nbins phi
  Int_t	  fsys;					//system (0=pp, 1=pPb)
  Int_t	  fyear;				// year  (2010 for pp@7 TeV, 2013 for pPb@5.02 TeV)
  Bool_t fSystAlreadySet;                       // Set it to kTRUE when systematic uncertainties from external files are set
  Bool_t fArithmeticAverage;                   // flag to perform arithmetic average
  TH1D *fhUsedWeightsDzero;                    // histogram with final weights used for Dzero
  TH1D *fhUsedWeightsDstar;                   // histogram with final weights used for Dstar
  TH1D *fhUsedWeightsDplus;                   // histogram with final weights used for Dplus

  ClassDef(AliHFDmesonCorrAverage,3); //class for averaging D meson -hadron correlations
};


#endif
 AliHFDmesonCorrAverage.h:1
 AliHFDmesonCorrAverage.h:2
 AliHFDmesonCorrAverage.h:3
 AliHFDmesonCorrAverage.h:4
 AliHFDmesonCorrAverage.h:5
 AliHFDmesonCorrAverage.h:6
 AliHFDmesonCorrAverage.h:7
 AliHFDmesonCorrAverage.h:8
 AliHFDmesonCorrAverage.h:9
 AliHFDmesonCorrAverage.h:10
 AliHFDmesonCorrAverage.h:11
 AliHFDmesonCorrAverage.h:12
 AliHFDmesonCorrAverage.h:13
 AliHFDmesonCorrAverage.h:14
 AliHFDmesonCorrAverage.h:15
 AliHFDmesonCorrAverage.h:16
 AliHFDmesonCorrAverage.h:17
 AliHFDmesonCorrAverage.h:18
 AliHFDmesonCorrAverage.h:19
 AliHFDmesonCorrAverage.h:20
 AliHFDmesonCorrAverage.h:21
 AliHFDmesonCorrAverage.h:22
 AliHFDmesonCorrAverage.h:23
 AliHFDmesonCorrAverage.h:24
 AliHFDmesonCorrAverage.h:25
 AliHFDmesonCorrAverage.h:26
 AliHFDmesonCorrAverage.h:27
 AliHFDmesonCorrAverage.h:28
 AliHFDmesonCorrAverage.h:29
 AliHFDmesonCorrAverage.h:30
 AliHFDmesonCorrAverage.h:31
 AliHFDmesonCorrAverage.h:32
 AliHFDmesonCorrAverage.h:33
 AliHFDmesonCorrAverage.h:34
 AliHFDmesonCorrAverage.h:35
 AliHFDmesonCorrAverage.h:36
 AliHFDmesonCorrAverage.h:37
 AliHFDmesonCorrAverage.h:38
 AliHFDmesonCorrAverage.h:39
 AliHFDmesonCorrAverage.h:40
 AliHFDmesonCorrAverage.h:41
 AliHFDmesonCorrAverage.h:42
 AliHFDmesonCorrAverage.h:43
 AliHFDmesonCorrAverage.h:44
 AliHFDmesonCorrAverage.h:45
 AliHFDmesonCorrAverage.h:46
 AliHFDmesonCorrAverage.h:47
 AliHFDmesonCorrAverage.h:48
 AliHFDmesonCorrAverage.h:49
 AliHFDmesonCorrAverage.h:50
 AliHFDmesonCorrAverage.h:51
 AliHFDmesonCorrAverage.h:52
 AliHFDmesonCorrAverage.h:53
 AliHFDmesonCorrAverage.h:54
 AliHFDmesonCorrAverage.h:55
 AliHFDmesonCorrAverage.h:56
 AliHFDmesonCorrAverage.h:57
 AliHFDmesonCorrAverage.h:58
 AliHFDmesonCorrAverage.h:59
 AliHFDmesonCorrAverage.h:60
 AliHFDmesonCorrAverage.h:61
 AliHFDmesonCorrAverage.h:62
 AliHFDmesonCorrAverage.h:63
 AliHFDmesonCorrAverage.h:64
 AliHFDmesonCorrAverage.h:65
 AliHFDmesonCorrAverage.h:66
 AliHFDmesonCorrAverage.h:67
 AliHFDmesonCorrAverage.h:68
 AliHFDmesonCorrAverage.h:69
 AliHFDmesonCorrAverage.h:70
 AliHFDmesonCorrAverage.h:71
 AliHFDmesonCorrAverage.h:72
 AliHFDmesonCorrAverage.h:73
 AliHFDmesonCorrAverage.h:74
 AliHFDmesonCorrAverage.h:75
 AliHFDmesonCorrAverage.h:76
 AliHFDmesonCorrAverage.h:77
 AliHFDmesonCorrAverage.h:78
 AliHFDmesonCorrAverage.h:79
 AliHFDmesonCorrAverage.h:80
 AliHFDmesonCorrAverage.h:81
 AliHFDmesonCorrAverage.h:82
 AliHFDmesonCorrAverage.h:83
 AliHFDmesonCorrAverage.h:84
 AliHFDmesonCorrAverage.h:85
 AliHFDmesonCorrAverage.h:86
 AliHFDmesonCorrAverage.h:87
 AliHFDmesonCorrAverage.h:88
 AliHFDmesonCorrAverage.h:89
 AliHFDmesonCorrAverage.h:90
 AliHFDmesonCorrAverage.h:91
 AliHFDmesonCorrAverage.h:92
 AliHFDmesonCorrAverage.h:93
 AliHFDmesonCorrAverage.h:94
 AliHFDmesonCorrAverage.h:95
 AliHFDmesonCorrAverage.h:96
 AliHFDmesonCorrAverage.h:97
 AliHFDmesonCorrAverage.h:98
 AliHFDmesonCorrAverage.h:99
 AliHFDmesonCorrAverage.h:100
 AliHFDmesonCorrAverage.h:101
 AliHFDmesonCorrAverage.h:102
 AliHFDmesonCorrAverage.h:103
 AliHFDmesonCorrAverage.h:104
 AliHFDmesonCorrAverage.h:105