Initial check-in of the model classes
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / Model / AliFemtoModelCorrFctn.cxx
CommitLineData
75c432a7 1////////////////////////////////////////////////////////////////////////////////
2/// ///
3/// AliFemtoModelCorrFctn - the base class for correlation function which ///
4/// uses the model framework and weight generation ///
5/// ///
6////////////////////////////////////////////////////////////////////////////////
7#ifdef __ROOT__
8 ClassImp(AliFemtoModelCorrFctn, 1)
9#endif
10
11#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
12#include "AliFemtoModelHiddenInfo.h"
13#include "AliFemtoModelCorrFctn.h"
14
15//_______________________
16AliFemtoModelCorrFctn::AliFemtoModelCorrFctn():
17 fManager(0),
18 fNumeratorTrue(0),
19 fNumeratorFake(0),
20 fDenominator(0)
21{
22 fNumeratorTrue = new TH1D("ModelNumTrue","ModelNumTrue",50,0.0,0.5);
23 fNumeratorFake = new TH1D("ModelNumFake","ModelNumFake",50,0.0,0.5);
24 fDenominator = new TH1D("ModelDen","ModelDen",50,0.0,0.5);
25
26 fNumeratorTrue->Sumw2();
27 fNumeratorFake->Sumw2();
28 fDenominator->Sumw2();
29}
30//_______________________
31AliFemtoModelCorrFctn::AliFemtoModelCorrFctn(const char *title, Int_t aNbins, Double_t aQinvLo, Double_t aQinvHi):
32 fManager(0),
33 fNumeratorTrue(0),
34 fNumeratorFake(0),
35 fDenominator(0)
36{
37 char buf[100];
38 sprintf(buf, "NumTrue%s", title);
39 fNumeratorTrue = new TH1D(buf,buf,aNbins,aQinvLo,aQinvHi);
40 sprintf(buf, "NumFake%s", title);
41 fNumeratorFake = new TH1D(buf,buf,aNbins,aQinvLo,aQinvHi);
42 sprintf(buf, "Den%s", title);
43 fDenominator = new TH1D(buf,buf,aNbins,aQinvLo,aQinvHi);
44
45 fNumeratorTrue->Sumw2();
46 fNumeratorFake->Sumw2();
47 fDenominator->Sumw2();
48}
49//_______________________
50AliFemtoModelCorrFctn::AliFemtoModelCorrFctn(const AliFemtoModelCorrFctn& aCorrFctn) :
51 fManager(0),
52 fNumeratorTrue(0),
53 fNumeratorFake(0),
54 fDenominator(0)
55{
56 if (aCorrFctn.fNumeratorTrue)
57 fNumeratorTrue = new TH1D(*(aCorrFctn.fNumeratorTrue));
58 if (aCorrFctn.fNumeratorFake)
59 fNumeratorFake = new TH1D(*(aCorrFctn.fNumeratorFake));
60 if (aCorrFctn.fDenominator)
61 fDenominator = new TH1D(*(aCorrFctn.fDenominator));
62 fManager = aCorrFctn.fManager;
63}
64//_______________________
65AliFemtoModelCorrFctn::~AliFemtoModelCorrFctn()
66{
67 if (fNumeratorTrue) delete fNumeratorTrue;
68 if (fNumeratorFake) delete fNumeratorFake;
69 if (fDenominator) delete fDenominator;
70}
71//_______________________
72AliFemtoModelCorrFctn& AliFemtoModelCorrFctn::operator=(const AliFemtoModelCorrFctn& aCorrFctn)
73{
74 if (this == &aCorrFctn)
75 return *this;
76
77 if (aCorrFctn.fNumeratorTrue)
78 fNumeratorTrue = new TH1D(*(aCorrFctn.fNumeratorTrue));
79 else
80 fNumeratorTrue = 0;
81 if (aCorrFctn.fNumeratorFake)
82 fNumeratorFake = new TH1D(*(aCorrFctn.fNumeratorFake));
83 else
84 fNumeratorFake = 0;
85 if (aCorrFctn.fDenominator)
86 fDenominator = new TH1D(*(aCorrFctn.fDenominator));
87 else
88 fDenominator = 0;
89 fManager = aCorrFctn.fManager;
90
91 return *this;
92}
93//_______________________
94void AliFemtoModelCorrFctn::ConnectToManager(AliFemtoModelManager *aManager)
95{
96 fManager = aManager;
97}
98
99//_______________________
100AliFemtoString AliFemtoModelCorrFctn::Report()
101{
102 AliFemtoString tStr = "AliFemtoModelCorrFctn report";
103
104 return tStr;
105}
106
107//_______________________
108void AliFemtoModelCorrFctn::AddRealPair(AliFemtoPair* aPair)
109{
110 Double_t weight = fManager->GetWeight(aPair);
111 fNumeratorTrue->Fill(aPair->qInv(), weight);
112}
113//_______________________
114void AliFemtoModelCorrFctn::AddMixedPair(AliFemtoPair* aPair)
115{
116 Double_t weight = fManager->GetWeight(aPair);
117 fNumeratorFake->Fill(aPair->qInv(), weight);
118 fDenominator->Fill(aPair->qInv(), 1.0);
119}
120//_______________________
121void AliFemtoModelCorrFctn::EventBegin(const AliFemtoEvent* aEvent)
122{
123 /* Do nothing */
124}
125//_______________________
126void AliFemtoModelCorrFctn::EventEnd(const AliFemtoEvent* aEvent)
127{
128 /* Do nothing */
129}
130//_______________________
131void AliFemtoModelCorrFctn::Finish()
132{
133 /* Do nothing */
134}
135//_______________________
136void AliFemtoModelCorrFctn::Write()
137{
138 fNumeratorTrue->Write();
139 fNumeratorFake->Write();
140 fDenominator->Write();
141}
142//_______________________
143AliFemtoModelCorrFctn* AliFemtoModelCorrFctn::Clone()
144{
145 AliFemtoModelCorrFctn *tCopy = new AliFemtoModelCorrFctn(*this);
146
147 return tCopy;
148}
149