]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/totEt/AliAnalysisEtTrackMatchCorrections.cxx
flat friends update
[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     fMinEtCorrection[i] = 0.0;
22     fNeutronCorrection[i] = 0.0;
23     fHadronCorrection[i] = 0.0;
24     fKaonCorrection[i] = 0.0;
25     fSecondaryCorrection[i] = 0.0;
26   }
27 }
28
29 AliAnalysisEtTrackMatchCorrections::AliAnalysisEtTrackMatchCorrections(const TString name, const TF1 &chargedContr, const TF1 &neutralContr, const TF1 &gammaContr, const TF1 &secondaryContr, const TH2F &recoEff,
30                                                                        Double_t meanCharged, Double_t meanNeutral, Double_t meanGammas, Double_t meanSecondary) : TNamed(name,name)
31                                                                                                                                                                 ,fChargedContr(new TF1(chargedContr))
32                                                                                                                                                                 ,fNeutralContr(new TF1(neutralContr))
33                                                                                                                                                                 ,fGammaContr(new TF1(gammaContr))
34                                                                                                                                                                 ,fSecondaryContr(new TF1(secondaryContr))                                                                                       ,fRecoEff(new TH2F(recoEff))
35                                                                       //,fRecoEff(0)
36                                                                                                                                                                 ,fMeanCharged(meanCharged)
37                                                                                                                                                                 ,fMeanNeutral(meanNeutral)
38                                                                                                                                                                 ,fMeanGamma(meanGammas)
39                                                                                                                                                                 ,fMeanSecondary(meanSecondary)
40 {
41   for(int i=0;i<20;i++){
42     fMinEtCorrection[i] = 0.0;
43     fNeutronCorrection[i] = 0.0;
44     fHadronCorrection[i] = 0.0;
45     fKaonCorrection[i] = 0.0;
46     fSecondaryCorrection[i] = 0.0;
47   }
48 }
49
50 //! Copy constructor
51 AliAnalysisEtTrackMatchCorrections::AliAnalysisEtTrackMatchCorrections(const AliAnalysisEtTrackMatchCorrections &obj) : TNamed(obj)
52     ,fChargedContr(new TF1(*(obj.fChargedContr)))
53     ,fNeutralContr(new TF1(*(obj.fNeutralContr)))
54     ,fGammaContr(new TF1(*(obj.fGammaContr)))
55     ,fSecondaryContr(new TF1(*(obj.fSecondaryContr)))
56     ,fRecoEff(new TH2F(*(obj.fRecoEff)))
57     ,fMeanCharged(obj.fMeanCharged)
58     ,fMeanNeutral(obj.fMeanNeutral)
59     ,fMeanGamma(obj.fMeanGamma)
60     ,fMeanSecondary(obj.fMeanSecondary)
61     
62 {
63   for(int i=0;i<20;i++){
64     fMinEtCorrection[i] = obj.fMinEtCorrection[i];
65     fNeutronCorrection[i] = obj.fNeutronCorrection[i];
66     fHadronCorrection[i] = obj.fHadronCorrection[i];
67     fKaonCorrection[i] = obj.fKaonCorrection[i];
68     fSecondaryCorrection[i] = obj.fSecondaryCorrection[i];
69   }
70 }
71
72 //! Destructor
73 AliAnalysisEtTrackMatchCorrections::~AliAnalysisEtTrackMatchCorrections()
74 {
75 //   delete fChargedContr;
76 //   delete fNeutralContr;
77 //   delete fGammaContr;
78 //   delete fSecondaryContr;
79 //   delete fRecoEff;
80 }
81
82 //! Assignment operator
83 AliAnalysisEtTrackMatchCorrections& AliAnalysisEtTrackMatchCorrections::operator=(const AliAnalysisEtTrackMatchCorrections &other)
84 {
85     if (this != &other)
86     {
87         *fChargedContr = *(other.fChargedContr);
88         *fNeutralContr = *(other.fNeutralContr);
89         *fGammaContr = *(other.fGammaContr);
90         ;        *fSecondaryContr = *(other.fSecondaryContr);
91         fMeanCharged = other.fMeanCharged;
92         fMeanNeutral = other.fMeanNeutral;
93         fMeanGamma = other.fMeanGamma;
94         fMeanSecondary = other.fMeanSecondary;
95         
96     }
97     return *this;
98 }
99
100 Double_t AliAnalysisEtTrackMatchCorrections::TrackMatchingEfficiency(Float_t pT, Int_t cent) const{
101   Double_t eff = 1.0;
102   if(fRecoEff) eff =  fRecoEff->GetBinContent(fRecoEff->GetXaxis()->FindBin(pT),fRecoEff->GetYaxis()->FindBin(cent));
103   //cout <<"eff "<<eff<<endl;
104   //cout <<"eff "<<eff<<" bin pT "<<fRecoEff->GetXaxis()->FindBin(pT)<<" bin centrality "<<fRecoEff->GetYaxis()->FindBin(cent)<<endl;
105   if(eff>1e-5){return eff;}
106   else{return 1.0;}
107 }