Lines getting the matched track moved to a method in AliCalorimeterUtils. Lines copie...
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoModelCorrFctnSource.cxx
CommitLineData
ac830a3d 1////////////////////////////////////////////////////////////////////////////////
2/// ///
adecdc37 3/// alifemtomodelcorrfctnsource - the class for correlation function which ///
ac830a3d 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
65423af9 13#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
14#include "AliFemtoModelHiddenInfo.h"
15#include "AliFemtoModelCorrFctnSource.h"
fee52126 16#include "AliFemtoKTPairCut.h"
17#include "AliFemtoAnalysisReactionPlane.h"
ac830a3d 18
19//_______________________
20AliFemtoModelCorrFctnSource::AliFemtoModelCorrFctnSource():
21 AliFemtoModelCorrFctn(),
22 fHistROut(0),
23 fHistRSide(0),
24 fHistRLong(0),
25 fHistRStar(0),
fee52126 26 fHistdNdR(0),
27 fHistNumWS(0),
28 fHistDenWS(0),
29 fUseRPSelection(0)
ac830a3d 30{
d92ed900 31 // default constructor
32 char buf[100];
33 char title[100] = "CFSource";
adecdc37 34 snprintf(buf , 100, "%sOut", title);
d92ed900 35 fHistROut = new TH1D(buf,buf,100,-50.0,50.0);
adecdc37 36 snprintf(buf , 100, "%sSide", title);
d92ed900 37 fHistRSide = new TH1D(buf,buf,100,-50.0,50.0);
adecdc37 38 snprintf(buf , 100, "%sLong", title);
d92ed900 39 fHistRLong = new TH1D(buf,buf,100,-50.0,50.0);
adecdc37 40 snprintf(buf , 100, "%sInv", title);
d92ed900 41 fHistRStar = new TH1D(buf,buf,100,-50.0,50.0);
adecdc37 42 snprintf(buf , 100, "%sdNdR", title);
d92ed900 43 fHistdNdR = new TH1D(buf,buf,100,-50.0,50.0);
44
adecdc37 45 snprintf(buf , 100, "%sNWS", title);
fee52126 46 fHistNumWS = new TH2D(buf,buf,50,0.0,0.5,100,0.0,2.0);
adecdc37 47 snprintf(buf , 100, "%sDWS", title);
fee52126 48 fHistDenWS = new TH2D(buf,buf,50,0.0,0.5,100,0.0,2.0);
49
d92ed900 50 fHistROut->Sumw2();
51 fHistRSide->Sumw2();
52 fHistRLong->Sumw2();
53 fHistRStar->Sumw2();
54 fHistdNdR->Sumw2();
ac830a3d 55}
56//_______________________
57AliFemtoModelCorrFctnSource::AliFemtoModelCorrFctnSource(const char *title, Int_t aNbins, Double_t aQinvLo, Double_t aQinvHi):
58 AliFemtoModelCorrFctn(title, aNbins, aQinvLo, aQinvHi),
59 fHistROut(0),
60 fHistRSide(0),
61 fHistRLong(0),
62 fHistRStar(0),
fee52126 63 fHistdNdR(0),
64 fHistNumWS(0),
65 fHistDenWS(0),
66 fUseRPSelection(0)
ac830a3d 67{
d92ed900 68 // basic constructor
ac830a3d 69 char buf[100];
adecdc37 70 snprintf(buf , 100, "%sOut", title);
ac830a3d 71 fHistROut = new TH1D(buf,buf,100,-50.0,50.0);
adecdc37 72 snprintf(buf , 100, "%sSide", title);
ac830a3d 73 fHistRSide = new TH1D(buf,buf,100,-50.0,50.0);
adecdc37 74 snprintf(buf , 100, "%sLong", title);
ac830a3d 75 fHistRLong = new TH1D(buf,buf,100,-50.0,50.0);
adecdc37 76 snprintf(buf , 100, "%sInv", title);
ac830a3d 77 fHistRStar = new TH1D(buf,buf,100,-50.0,50.0);
adecdc37 78 snprintf(buf , 100, "%sdNdR", title);
ac830a3d 79 fHistdNdR = new TH1D(buf,buf,100,-50.0,50.0);
80
adecdc37 81 snprintf(buf , 100, "%sNWS", title);
fee52126 82 fHistNumWS = new TH2D(buf,buf,50,0.0,0.5,100,0.0,2.0);
adecdc37 83 snprintf(buf , 100, "%sDWS", title);
fee52126 84 fHistDenWS = new TH2D(buf,buf,50,0.0,0.5,100,0.0,2.0);
85
ac830a3d 86 fHistROut->Sumw2();
87 fHistRSide->Sumw2();
88 fHistRLong->Sumw2();
89 fHistRStar->Sumw2();
90 fHistdNdR->Sumw2();
91}
92//_______________________
93AliFemtoModelCorrFctnSource::AliFemtoModelCorrFctnSource(const AliFemtoModelCorrFctnSource& aCorrFctn):
94 AliFemtoModelCorrFctn(aCorrFctn),
95 fHistROut(0),
96 fHistRSide(0),
97 fHistRLong(0),
98 fHistRStar(0),
fee52126 99 fHistdNdR(0),
100 fHistNumWS(0),
101 fHistDenWS(0),
102 fUseRPSelection(0)
ac830a3d 103{
d92ed900 104 // copy constructor
ac830a3d 105 fHistROut = new TH1D (*aCorrFctn.fHistROut);
106 fHistRSide = new TH1D(*aCorrFctn.fHistRSide);
107 fHistRLong = new TH1D(*aCorrFctn.fHistRLong);
108 fHistRStar = new TH1D(*aCorrFctn.fHistRStar);
109 fHistdNdR = new TH1D(*aCorrFctn.fHistdNdR);
fee52126 110 fHistNumWS = new TH2D(*aCorrFctn.fHistNumWS);
111 fHistDenWS = new TH2D(*aCorrFctn.fHistDenWS);
112
113 fUseRPSelection = aCorrFctn.fUseRPSelection;
ac830a3d 114}
115//_______________________
116AliFemtoModelCorrFctnSource::~AliFemtoModelCorrFctnSource()
117{
d92ed900 118 // destructor
ac830a3d 119 if (fHistROut) delete fHistROut;
120 if (fHistRSide) delete fHistRSide;
121 if (fHistRLong) delete fHistRLong;
122 if (fHistRStar) delete fHistRStar;
123 if (fHistdNdR) delete fHistdNdR;
fee52126 124 if (fHistNumWS) delete fHistNumWS;
125 if (fHistDenWS) delete fHistDenWS;
ac830a3d 126 if (fNumeratorTrue) delete fNumeratorTrue;
127 if (fNumeratorFake) delete fNumeratorFake;
128 if (fDenominator) delete fDenominator;
129}
130
131//_______________________
132AliFemtoModelCorrFctnSource& AliFemtoModelCorrFctnSource::operator=(const AliFemtoModelCorrFctnSource& aCorrFctn)
133{
d92ed900 134 // assignment operator
ac830a3d 135 if (this == &aCorrFctn)
136 return *this;
137 if (aCorrFctn.fHistROut)
138 fHistROut = new TH1D (*aCorrFctn.fHistROut);
139 else fHistROut = 0;
140 if (aCorrFctn.fHistRSide)
141 fHistRSide = new TH1D(*aCorrFctn.fHistRSide);
142 else fHistRSide = 0;
143 if (aCorrFctn.fHistRLong)
144 fHistRLong = new TH1D(*aCorrFctn.fHistRLong);
145 else fHistRLong = 0;
146 if (aCorrFctn.fHistRStar)
147 fHistRStar = new TH1D(*aCorrFctn.fHistRStar);
148 fHistRStar = 0;
149 if (aCorrFctn.fHistdNdR)
150 fHistdNdR = new TH1D(*aCorrFctn.fHistdNdR);
151 else fHistdNdR = 0;
fee52126 152 if (aCorrFctn.fHistNumWS)
153 fHistNumWS = new TH2D(*aCorrFctn.fHistNumWS);
154 else fHistNumWS = 0;
155 if (aCorrFctn.fHistDenWS)
156 fHistDenWS = new TH2D(*aCorrFctn.fHistDenWS);
157 else fHistDenWS = 0;
158
159 fUseRPSelection = aCorrFctn.fUseRPSelection;
ac830a3d 160
161 return *this;
162}
163//_______________________
164AliFemtoString AliFemtoModelCorrFctnSource::Report()
165{
d92ed900 166 // construct report
ac830a3d 167 AliFemtoString tStr = "AliFemtoModelCorrFctnSource report";
168
169 return tStr;
170}
171
172//_______________________
173void AliFemtoModelCorrFctnSource::AddRealPair(AliFemtoPair* aPair)
174{
d92ed900 175 // add real (effect) pair
fee52126 176// if (fPairCut){
177// if (!(fPairCut->Pass(aPair))) return;
178// }
179 if (fPairCut){
180 if (fUseRPSelection) {
181 AliFemtoKTPairCut *ktc = dynamic_cast<AliFemtoKTPairCut *>(fPairCut);
182 if (!ktc) {
183 cout << "RP aware cut requested, but not connected to the CF" << endl;
184 if (!(fPairCut->Pass(aPair))) return;
185 }
186 else {
187 AliFemtoAnalysisReactionPlane *arp = dynamic_cast<AliFemtoAnalysisReactionPlane *> (HbtAnalysis());
188 if (!arp) {
189 cout << "RP aware cut requested, but not connected to the CF" << endl;
190 if (!(fPairCut->Pass(aPair))) return;
191 }
1f4d1e46 192 else if (!(ktc->Pass(aPair, arp->GetCurrentReactionPlane()))) return;
fee52126 193 }
194 }
195 else
196 if (!(fPairCut->Pass(aPair))) return;
197 }
198
ac830a3d 199 AliFemtoModelCorrFctn::AddRealPair(aPair);
fee52126 200
ac830a3d 201}
202//_______________________
203void AliFemtoModelCorrFctnSource::AddMixedPair(AliFemtoPair* aPair)
204{
d92ed900 205 // add mixed (background) pair
fee52126 206// if (fPairCut){
207// if (!(fPairCut->Pass(aPair))) return;
208// }
209 if (fPairCut){
210 if (fUseRPSelection) {
211 AliFemtoKTPairCut *ktc = dynamic_cast<AliFemtoKTPairCut *>(fPairCut);
212 if (!ktc) {
213 cout << "RP aware cut requested, but not connected to the CF" << endl;
214 if (!(fPairCut->Pass(aPair))) return;
215 }
216 else {
217 AliFemtoAnalysisReactionPlane *arp = dynamic_cast<AliFemtoAnalysisReactionPlane *> (HbtAnalysis());
218 if (!arp) {
219 cout << "RP aware cut requested, but not connected to the CF" << endl;
220 if (!(fPairCut->Pass(aPair))) return;
221 }
1f4d1e46 222 else if (!(ktc->Pass(aPair, arp->GetCurrentReactionPlane()))) return;
fee52126 223 }
224 }
225 else
226 if (!(fPairCut->Pass(aPair))) return;
227 }
228
ac830a3d 229 AliFemtoModelCorrFctn::AddMixedPair(aPair);
d92ed900 230 // save the generated positions
fee52126 231 if (aPair->KStar() < 0.2) {
232 fHistROut->Fill (fManager->GetWeightGenerator()->GetRStarOut());
233 fHistRSide->Fill(fManager->GetWeightGenerator()->GetRStarSide());
234 fHistRLong->Fill(fManager->GetWeightGenerator()->GetRStarLong());
235 fHistRStar->Fill(fManager->GetWeightGenerator()->GetRStar());
236 fHistdNdR->Fill (fManager->GetWeightGenerator()->GetRStar(),1.0/(fManager->GetWeightGenerator()->GetRStar()*fManager->GetWeightGenerator()->GetRStar()));
237 }
238
239 fHistDenWS->Fill(aPair->QInv(), 1.0);
240 Double_t weight = fManager->GetWeight(aPair);
241 fHistNumWS->Fill(aPair->QInv(), weight);
ac830a3d 242}
243//_______________________
244void AliFemtoModelCorrFctnSource::Write()
245{
d92ed900 246 // write out all the histograms
ac830a3d 247 fHistROut->Write();
248 fHistRSide->Write();
249 fHistRLong->Write();
250 fHistRStar->Write();
251 fHistdNdR->Write();
fee52126 252 fHistNumWS->Write();
253 fHistDenWS->Write();
254
ac830a3d 255 AliFemtoModelCorrFctn::Write();
256}
0b3bd1ac 257//________________________
258TList* AliFemtoModelCorrFctnSource::GetOutputList()
259{
260 // Prepare the list of objects to be written to the output
261 TList *tOutputList = AliFemtoModelCorrFctn::GetOutputList();
262
263 tOutputList->Add(fHistROut);
264 tOutputList->Add(fHistRSide);
265 tOutputList->Add(fHistRLong);
266 tOutputList->Add(fHistRStar);
267 tOutputList->Add(fHistdNdR);
fee52126 268 tOutputList->Add(fHistDenWS);
269 tOutputList->Add(fHistNumWS);
0b3bd1ac 270
271 return tOutputList;
272}
ac830a3d 273//_______________________
65423af9 274AliFemtoModelCorrFctn* AliFemtoModelCorrFctnSource::Clone()
ac830a3d 275{
d92ed900 276 // Clone the correlation function
ac830a3d 277 AliFemtoModelCorrFctnSource *tCopy = new AliFemtoModelCorrFctnSource(*this);
278
279 return tCopy;
280}
281
fee52126 282void AliFemtoModelCorrFctnSource::SetUseRPSelection(unsigned short aRPSel)
283{
284 fUseRPSelection = aRPSel;
285}