1b7ecdb1325955485e8b5c52d0fcb452df6c3f63
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoModelCorrFctnSource.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 ///                                                                          ///
3 /// AliFemtoModelCorrFctnSource - the class for correlation function which   ///
4 /// uses the model framework and weight generation and saves the generated   ///
5 /// emission source                                                          ///
6 /// Authors: Adam Kisiel, kisiel@mps.ohio-state.edu                          ///
7 ///                                                                          ///
8 ////////////////////////////////////////////////////////////////////////////////
9 #ifdef __ROOT__
10   ClassImp(AliFemtoModelCorrFctnSource, 1)
11 #endif
12
13 #include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
14 #include "AliFemtoModelHiddenInfo.h"
15 #include "AliFemtoModelCorrFctnSource.h"
16     
17 //_______________________
18 AliFemtoModelCorrFctnSource::AliFemtoModelCorrFctnSource(): 
19   AliFemtoModelCorrFctn(),
20   fHistROut(0),
21   fHistRSide(0),
22   fHistRLong(0),
23   fHistRStar(0),
24   fHistdNdR(0)
25 {
26   // default constructor
27   char buf[100];
28   char title[100] = "CFSource";
29   sprintf(buf, "%sOut", title);
30   fHistROut = new TH1D(buf,buf,100,-50.0,50.0);
31   sprintf(buf, "%sSide", title);
32   fHistRSide = new TH1D(buf,buf,100,-50.0,50.0);
33   sprintf(buf, "%sLong", title);
34   fHistRLong = new TH1D(buf,buf,100,-50.0,50.0);
35   sprintf(buf, "%sInv", title);
36   fHistRStar = new TH1D(buf,buf,100,-50.0,50.0);
37   sprintf(buf, "%sdNdR", title);
38   fHistdNdR = new TH1D(buf,buf,100,-50.0,50.0);
39
40   fHistROut->Sumw2();
41   fHistRSide->Sumw2();
42   fHistRLong->Sumw2();
43   fHistRStar->Sumw2();
44   fHistdNdR->Sumw2();
45 }
46 //_______________________
47 AliFemtoModelCorrFctnSource::AliFemtoModelCorrFctnSource(const char *title, Int_t aNbins, Double_t aQinvLo, Double_t aQinvHi):
48   AliFemtoModelCorrFctn(title, aNbins, aQinvLo, aQinvHi),
49   fHistROut(0),
50   fHistRSide(0),
51   fHistRLong(0),
52   fHistRStar(0),
53   fHistdNdR(0)
54 {
55   // basic constructor
56   char buf[100];
57   sprintf(buf, "%sOut", title);
58   fHistROut = new TH1D(buf,buf,100,-50.0,50.0);
59   sprintf(buf, "%sSide", title);
60   fHistRSide = new TH1D(buf,buf,100,-50.0,50.0);
61   sprintf(buf, "%sLong", title);
62   fHistRLong = new TH1D(buf,buf,100,-50.0,50.0);
63   sprintf(buf, "%sInv", title);
64   fHistRStar = new TH1D(buf,buf,100,-50.0,50.0);
65   sprintf(buf, "%sdNdR", title);
66   fHistdNdR = new TH1D(buf,buf,100,-50.0,50.0);
67
68   fHistROut->Sumw2();
69   fHistRSide->Sumw2();
70   fHistRLong->Sumw2();
71   fHistRStar->Sumw2();
72   fHistdNdR->Sumw2();
73 }
74 //_______________________
75 AliFemtoModelCorrFctnSource::AliFemtoModelCorrFctnSource(const AliFemtoModelCorrFctnSource& aCorrFctn):
76   AliFemtoModelCorrFctn(aCorrFctn),
77   fHistROut(0),
78   fHistRSide(0),
79   fHistRLong(0),
80   fHistRStar(0),
81   fHistdNdR(0)
82 {
83   // copy constructor
84   fHistROut = new TH1D (*aCorrFctn.fHistROut);
85   fHistRSide = new TH1D(*aCorrFctn.fHistRSide);
86   fHistRLong = new TH1D(*aCorrFctn.fHistRLong);
87   fHistRStar = new TH1D(*aCorrFctn.fHistRStar);
88   fHistdNdR = new TH1D(*aCorrFctn.fHistdNdR);
89 }
90 //_______________________
91 AliFemtoModelCorrFctnSource::~AliFemtoModelCorrFctnSource()
92 {
93   // destructor
94   if (fHistROut) delete fHistROut;
95   if (fHistRSide) delete fHistRSide;
96   if (fHistRLong) delete fHistRLong;
97   if (fHistRStar) delete fHistRStar;
98   if (fHistdNdR) delete fHistdNdR;
99   if (fNumeratorTrue) delete fNumeratorTrue;
100   if (fNumeratorFake) delete fNumeratorFake;
101   if (fDenominator) delete fDenominator;
102 }
103
104 //_______________________
105 AliFemtoModelCorrFctnSource& AliFemtoModelCorrFctnSource::operator=(const AliFemtoModelCorrFctnSource& aCorrFctn)
106 {
107   // assignment operator
108   if (this == &aCorrFctn) 
109     return *this;
110   if (aCorrFctn.fHistROut)
111     fHistROut = new TH1D (*aCorrFctn.fHistROut);
112   else fHistROut = 0;
113   if (aCorrFctn.fHistRSide)
114     fHistRSide = new TH1D(*aCorrFctn.fHistRSide);
115   else fHistRSide = 0;
116   if (aCorrFctn.fHistRLong)
117     fHistRLong = new TH1D(*aCorrFctn.fHistRLong);
118   else fHistRLong = 0;
119   if (aCorrFctn.fHistRStar)
120     fHistRStar = new TH1D(*aCorrFctn.fHistRStar);
121   fHistRStar = 0;
122   if (aCorrFctn.fHistdNdR)
123     fHistdNdR = new TH1D(*aCorrFctn.fHistdNdR);
124   else fHistdNdR = 0;
125
126   return *this;
127 }
128 //_______________________
129 AliFemtoString AliFemtoModelCorrFctnSource::Report()
130 {
131   // construct report
132   AliFemtoString tStr = "AliFemtoModelCorrFctnSource report";
133
134   return tStr;
135 }
136
137 //_______________________
138 void AliFemtoModelCorrFctnSource::AddRealPair(AliFemtoPair* aPair)
139 {
140   // add real (effect) pair
141   AliFemtoModelCorrFctn::AddRealPair(aPair);
142 }
143 //_______________________
144 void AliFemtoModelCorrFctnSource::AddMixedPair(AliFemtoPair* aPair)
145 {
146   // add mixed (background) pair
147   AliFemtoModelCorrFctn::AddMixedPair(aPair);
148   // save the generated positions
149   fHistROut->Fill (fManager->GetWeightGenerator()->GetRStarOut());
150   fHistRSide->Fill(fManager->GetWeightGenerator()->GetRStarSide());
151   fHistRLong->Fill(fManager->GetWeightGenerator()->GetRStarLong());
152   fHistRStar->Fill(fManager->GetWeightGenerator()->GetRStar());
153   fHistdNdR->Fill (fManager->GetWeightGenerator()->GetRStar(),1.0/(fManager->GetWeightGenerator()->GetRStar()*fManager->GetWeightGenerator()->GetRStar()));
154 }
155 //_______________________
156 void AliFemtoModelCorrFctnSource::Write()
157 {
158   // write out all the histograms
159   fHistROut->Write();
160   fHistRSide->Write();
161   fHistRLong->Write();
162   fHistRStar->Write();
163   fHistdNdR->Write();
164   
165   AliFemtoModelCorrFctn::Write();
166 }
167 //________________________
168 TList* AliFemtoModelCorrFctnSource::GetOutputList()
169 {
170   // Prepare the list of objects to be written to the output
171   TList *tOutputList = AliFemtoModelCorrFctn::GetOutputList();
172
173   tOutputList->Add(fHistROut); 
174   tOutputList->Add(fHistRSide);  
175   tOutputList->Add(fHistRLong);  
176   tOutputList->Add(fHistRStar);  
177   tOutputList->Add(fHistdNdR);  
178
179   return tOutputList;
180 }
181 //_______________________
182 AliFemtoModelCorrFctn* AliFemtoModelCorrFctnSource::Clone()
183 {
184   // Clone the correlation function
185   AliFemtoModelCorrFctnSource *tCopy = new AliFemtoModelCorrFctnSource(*this);
186   
187   return tCopy;
188 }
189