]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnDirectYlm.cxx
changes in the PID of protons + new config for the proton femtoscopy train
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / AliFemtoUser / AliFemtoModelCorrFctnDirectYlm.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 ///                                                                          ///
3 /// AliFemtoModelCorrFctnDirectYlm - 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(AliFemtoModelCorrFctnDirectYlm, 1)
11 #endif
12
13 #include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
14 #include "AliFemtoModelHiddenInfo.h"
15 #include "AliFemtoModelCorrFctnDirectYlm.h"
16     
17 //_______________________
18 AliFemtoModelCorrFctnDirectYlm::AliFemtoModelCorrFctnDirectYlm(): 
19   AliFemtoModelCorrFctn(),
20   fCYlmTrue(0),
21   fCYlmFake(0),
22   fUseLCMS(0)
23 {
24   // default constructor
25
26   fCYlmTrue = new AliFemtoCorrFctnDirectYlm();
27   fCYlmFake = new AliFemtoCorrFctnDirectYlm();
28   fCYlmTrue->SetUseLCMS(fUseLCMS);
29   fCYlmFake->SetUseLCMS(fUseLCMS);
30 }
31 //_______________________
32 AliFemtoModelCorrFctnDirectYlm::AliFemtoModelCorrFctnDirectYlm(const char *title, Int_t aMaxL, Int_t aNbins, Double_t aQinvLo, Double_t aQinvHi, int aUseLCMS=0):
33   AliFemtoModelCorrFctn(title, aNbins, aQinvLo, aQinvHi),
34   fCYlmTrue(0),
35   fCYlmFake(0),
36   fUseLCMS(aUseLCMS)
37 {
38   // basic constructor
39   char fname[1000];
40   snprintf(fname, 1000, "%s%s", title, "True");
41   fCYlmTrue = new AliFemtoCorrFctnDirectYlm(fname, aMaxL, aNbins, aQinvLo, aQinvHi, fUseLCMS);
42   snprintf(fname, 1000, "%s%s", title, "Fake");
43   fCYlmFake = new AliFemtoCorrFctnDirectYlm(fname, aMaxL, aNbins, aQinvLo, aQinvHi, fUseLCMS);
44 }
45 //_______________________
46 AliFemtoModelCorrFctnDirectYlm::AliFemtoModelCorrFctnDirectYlm(const AliFemtoModelCorrFctnDirectYlm& aCorrFctn):
47   AliFemtoModelCorrFctn(aCorrFctn),
48   fCYlmTrue(new AliFemtoCorrFctnDirectYlm(*(aCorrFctn.fCYlmTrue))),
49   fCYlmFake(new AliFemtoCorrFctnDirectYlm(*(aCorrFctn.fCYlmFake))),
50   fUseLCMS(0)
51 {
52   // copy constructor
53   fUseLCMS = aCorrFctn.fUseLCMS;
54 //   fCYlmTrue = dynamic_cast<AliFemtoCorrFctnDirectYlm*>(aCorrFctn.fCYlmTrue->Clone());
55 //   fCYlmFake = dynamic_cast<AliFemtoCorrFctnDirectYlm*>(aCorrFctn.fCYlmFake->Clone());
56 }
57 //_______________________
58 AliFemtoModelCorrFctnDirectYlm::~AliFemtoModelCorrFctnDirectYlm()
59 {
60   // destructor
61   if (fCYlmTrue) delete fCYlmTrue;
62   if (fCYlmFake) delete fCYlmFake;
63   if (fNumeratorTrue) delete fNumeratorTrue;
64   if (fNumeratorFake) delete fNumeratorFake;
65   if (fDenominator) delete fDenominator;
66 }
67
68 //_______________________
69 AliFemtoModelCorrFctnDirectYlm& AliFemtoModelCorrFctnDirectYlm::operator=(const AliFemtoModelCorrFctnDirectYlm& aCorrFctn)
70 {
71   // assignment operator
72   if (this != &aCorrFctn) {
73
74     fUseLCMS = aCorrFctn.fUseLCMS;
75     
76     if (fCYlmTrue) delete fCYlmTrue;
77     if (aCorrFctn.fCYlmTrue)
78       fCYlmTrue = new AliFemtoCorrFctnDirectYlm(*aCorrFctn.fCYlmTrue);
79     else fCYlmTrue = 0;
80     
81     if (fCYlmFake) delete fCYlmFake;
82     if (aCorrFctn.fCYlmFake)
83       fCYlmFake = new AliFemtoCorrFctnDirectYlm(*aCorrFctn.fCYlmFake);
84     else fCYlmFake = 0;
85     
86     if (fNumeratorTrue) delete fNumeratorTrue;
87     if (aCorrFctn.fNumeratorTrue)
88       fNumeratorTrue = new TH1D(*aCorrFctn.fNumeratorTrue);
89     else
90       fNumeratorTrue = 0;
91     
92     if (fNumeratorFake) delete fNumeratorFake;
93     if (aCorrFctn.fNumeratorFake)
94       fNumeratorFake = new TH1D(*aCorrFctn.fNumeratorFake);
95     else
96       fNumeratorFake = 0;
97     
98     if (fDenominator) delete fDenominator;
99     if (aCorrFctn.fDenominator)
100       fDenominator = new TH1D(*aCorrFctn.fDenominator);
101     else
102       fDenominator = 0;
103   }
104
105   return *this;
106 }
107 //_______________________
108 AliFemtoString AliFemtoModelCorrFctnDirectYlm::Report()
109 {
110   // construct report
111   AliFemtoString tStr = "AliFemtoModelCorrFctnDirectYlm report";
112
113   return tStr;
114 }
115
116 //_______________________
117 void AliFemtoModelCorrFctnDirectYlm::AddRealPair(AliFemtoPair* aPair)
118 {
119   // add real (effect) pair
120   if (fPairCut)
121     if (!(fPairCut->Pass(aPair))) return;
122
123   Double_t weight = fManager->GetWeight(aPair);
124   
125   if (fUseLCMS)
126     fCYlmTrue->AddRealPair(aPair->QOutCMS(), aPair->QSideCMS(), aPair->QLongCMS(), weight);
127   else
128     fCYlmTrue->AddRealPair(aPair->KOut(), aPair->KSide(), aPair->KLong(), weight);
129 }
130 //_______________________
131 void AliFemtoModelCorrFctnDirectYlm::AddMixedPair(AliFemtoPair* aPair)
132 {
133   // add mixed (background) pair
134   if (fPairCut)
135     if (!(fPairCut->Pass(aPair))) return;
136
137   Double_t weight = fManager->GetWeight(aPair);
138
139   if (fUseLCMS) {
140     fCYlmTrue->AddMixedPair(aPair->QOutCMS(), aPair->QSideCMS(), aPair->QLongCMS(), 1.0);
141     fCYlmFake->AddRealPair(aPair->QOutCMS(), aPair->QSideCMS(), aPair->QLongCMS(), weight);
142     fCYlmFake->AddMixedPair(aPair->QOutCMS(), aPair->QSideCMS(), aPair->QLongCMS(), 1.0);
143   }
144   else {
145     fCYlmTrue->AddMixedPair(aPair->KOut(), aPair->KSide(), aPair->KLong(), 1.0);
146     fCYlmFake->AddRealPair(aPair->KOut(), aPair->KSide(), aPair->KLong(), weight);
147     fCYlmFake->AddMixedPair(aPair->KOut(), aPair->KSide(), aPair->KLong(), 1.0);
148   }
149 }
150 //_______________________
151 void AliFemtoModelCorrFctnDirectYlm::Write()
152 {
153   // write out all the histograms
154   
155   fCYlmTrue->Write();
156   fCYlmFake->Write();
157 }
158 //_______________________
159 TList* AliFemtoModelCorrFctnDirectYlm::GetOutputList()
160 {
161   // Prepare the list of objects to be written to the output
162   TList *tOutputList = AliFemtoModelCorrFctn::GetOutputList();
163   tOutputList->Clear();
164
165   TList *tListCfTrue = fCYlmTrue->GetOutputList();
166     
167   TIter nextListCfTrue(tListCfTrue);
168   while (TObject *obj = nextListCfTrue()) {
169     tOutputList->Add(obj);
170   }
171
172   TList *tListCfFake = fCYlmFake->GetOutputList();
173     
174   TIter nextListCfFake(tListCfFake);
175   while (TObject *obj = nextListCfFake()) {
176     tOutputList->Add(obj);
177   }
178 //   tOutputList->Add(fCYlmTrue->GetOutputList());
179 //   tOutputList->Add(fCYlmFake->GetOutputList());
180
181   return tOutputList;
182 }
183 //_______________________
184 AliFemtoModelCorrFctn* AliFemtoModelCorrFctnDirectYlm::Clone()
185 {
186   // Clone the correlation function
187   AliFemtoModelCorrFctnDirectYlm *tCopy = new AliFemtoModelCorrFctnDirectYlm(*this);
188   
189   return tCopy;
190 }
191 //_______________________
192 void AliFemtoModelCorrFctnDirectYlm::Finish()
193 {
194   fCYlmTrue->Finish();
195   fCYlmFake->Finish();
196 }
197 //_______________________
198 void AliFemtoModelCorrFctnDirectYlm::SetUseLCMS(int aUseLCMS)
199 {
200   fUseLCMS = aUseLCMS;
201   fCYlmTrue->SetUseLCMS(fUseLCMS);
202   fCYlmFake->SetUseLCMS(fUseLCMS);
203 }
204 //_______________________
205 int  AliFemtoModelCorrFctnDirectYlm::GetUseLCMS()
206 {
207   return fUseLCMS;
208 }
209