]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/totEt/AliAnalysisEtTrackMatchCorrections.cxx
Merge branch 'TPCdev'
[u/mrichter/AliRoot.git] / PWGLF / totEt / AliAnalysisEtTrackMatchCorrections.cxx
1
2
3 #include "AliAnalysisEtTrackMatchCorrections.h"
4
5 ClassImp(AliAnalysisEtTrackMatchCorrections);
6
7 AliAnalysisEtTrackMatchCorrections::AliAnalysisEtTrackMatchCorrections() : TNamed("TMCorr","TMCorr")
8     ,fChargedContr(new TF1)
9     ,fNeutralContr(new TF1)
10     ,fGammaContr(new TF1)
11     ,fSecondaryContr(new TF1)
12                                                                          ,fRecoEff(0)
13     ,fMeanCharged(0)
14     ,fMeanNeutral(0)
15     ,fMeanGamma(0)
16     ,fMeanSecondary(0)
17                                                                       // ,fNeutronCorrection(0)
18 {
19   //fNeutronCorrection[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
20   for(int i=0;i<20;i++){
21     fNeutronCorrection[i] = 0.0;
22     fHadronCorrection[i] = 0.0;
23     fKaonCorrection[i] = 0.0;
24     fSecondaryCorrection[i] = 0.0;
25   }
26 }
27
28 AliAnalysisEtTrackMatchCorrections::AliAnalysisEtTrackMatchCorrections(const TString name, const TF1 &chargedContr, const TF1 &neutralContr, const TF1 &gammaContr, const TF1 &secondaryContr, const TH2F &recoEff,
29                                                                        Double_t meanCharged, Double_t meanNeutral, Double_t meanGammas, Double_t meanSecondary) : TNamed(name,name)
30                                                                                                                                                                 ,fChargedContr(new TF1(chargedContr))
31                                                                                                                                                                 ,fNeutralContr(new TF1(neutralContr))
32                                                                                                                                                                 ,fGammaContr(new TF1(gammaContr))
33                                                                                                                                                                 ,fSecondaryContr(new TF1(secondaryContr))                                                                                       ,fRecoEff(new TH2F(recoEff))
34                                                                       //,fRecoEff(0)
35                                                                                                                                                                 ,fMeanCharged(meanCharged)
36                                                                                                                                                                 ,fMeanNeutral(meanNeutral)
37                                                                                                                                                                 ,fMeanGamma(meanGammas)
38                                                                                                                                                                 ,fMeanSecondary(meanSecondary)
39 {}
40
41 //! Copy constructor
42 AliAnalysisEtTrackMatchCorrections::AliAnalysisEtTrackMatchCorrections(const AliAnalysisEtTrackMatchCorrections &obj) : TNamed(obj)
43     ,fChargedContr(new TF1(*(obj.fChargedContr)))
44     ,fNeutralContr(new TF1(*(obj.fNeutralContr)))
45     ,fGammaContr(new TF1(*(obj.fGammaContr)))
46     ,fSecondaryContr(new TF1(*(obj.fSecondaryContr)))
47     ,fRecoEff(new TH2F(*(obj.fRecoEff)))
48     ,fMeanCharged(obj.fMeanCharged)
49     ,fMeanNeutral(obj.fMeanNeutral)
50     ,fMeanGamma(obj.fMeanGamma)
51     ,fMeanSecondary(obj.fMeanSecondary)
52     
53 {}
54
55 //! Destructor
56 AliAnalysisEtTrackMatchCorrections::~AliAnalysisEtTrackMatchCorrections()
57 {
58 //   delete fChargedContr;
59 //   delete fNeutralContr;
60 //   delete fGammaContr;
61 //   delete fSecondaryContr;
62 //   delete fRecoEff;
63 }
64
65 //! Assignment operator
66 AliAnalysisEtTrackMatchCorrections& AliAnalysisEtTrackMatchCorrections::operator=(const AliAnalysisEtTrackMatchCorrections &other)
67 {
68     if (this != &other)
69     {
70         *fChargedContr = *(other.fChargedContr);
71         *fNeutralContr = *(other.fNeutralContr);
72         *fGammaContr = *(other.fGammaContr);
73         ;        *fSecondaryContr = *(other.fSecondaryContr);
74         fMeanCharged = other.fMeanCharged;
75         fMeanNeutral = other.fMeanNeutral;
76         fMeanGamma = other.fMeanGamma;
77         fMeanSecondary = other.fMeanSecondary;
78         
79     }
80     return *this;
81 }
82
83 Double_t AliAnalysisEtTrackMatchCorrections::TrackMatchingEfficiency(Float_t pT, Int_t cent) const{
84   Double_t eff = 1.0;
85   if(fRecoEff) eff =  fRecoEff->GetBinContent(fRecoEff->GetXaxis()->FindBin(pT),fRecoEff->GetYaxis()->FindBin(cent));
86   //cout <<"eff "<<eff<<endl;
87   //cout <<"eff "<<eff<<" bin pT "<<fRecoEff->GetXaxis()->FindBin(pT)<<" bin centrality "<<fRecoEff->GetYaxis()->FindBin(cent)<<endl;
88   if(eff>1e-5){return eff;}
89   else{return 1.0;}
90 }