]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnPairFractions.cxx
Correlation function for pair fraction calculations from MC + correction to the bug...
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / AliFemtoUser / AliFemtoCorrFctnPairFractions.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 //                                                                            //
3 // AliFemtoCorrFctnPairFractions - A correlation function that analyzes            //
4 // two particle correlations with respect to the azimuthal angle (phi)        //
5 // and pseudorapidity (eta) difference                                        //
6 //                                                                            //
7 // Authors: Malgorzata Janik, majanik@cern.ch                                   //
8 //                                                                            //
9 ////////////////////////////////////////////////////////////////////////////////
10
11 #include "AliFemtoCorrFctnPairFractions.h"
12 #include "AliFemtoModelHiddenInfo.h"
13 //#include "AliFemtoHisto.hh"
14 #include <cstdio>
15 #include <TMath.h>
16
17 #ifdef __ROOT__ 
18 ClassImp(AliFemtoCorrFctnPairFractions)
19 #endif
20   
21 #define PIH 1.57079632679489656
22 #define PIT 6.28318530717958623
23
24 //____________________________
25 AliFemtoCorrFctnPairFractions::AliFemtoCorrFctnPairFractions(char* title):
26 AliFemtoCorrFctn(),
27   fPairFractions(0),
28   fphiL(0),
29   fphiT(0)
30 {
31
32   //fphiL = (-(int)(aPhiBins/4)+0.5)*2.*TMath::Pi()/aPhiBins;
33   //fphiT = 2*TMath::Pi()+(-(int)(aPhiBins/4)+0.5)*2.*TMath::Pi()/aPhiBins;
34
35   TString  hname  = "hPairFraction"; hname+= title;
36   TString  htitle = "Pair Fraction "; htitle+= title;
37   fPairFractions = new TH1F(hname.Data(),htitle.Data(), 7, 0, 7);
38   fPairFractions->GetXaxis()->SetBinLabel(1,"#pi#pi, MC");
39   fPairFractions->GetXaxis()->SetBinLabel(2,"KK, MC");
40   fPairFractions->GetXaxis()->SetBinLabel(3,"pp, MC");
41   fPairFractions->GetXaxis()->SetBinLabel(4,"#pi K, MC");
42   fPairFractions->GetXaxis()->SetBinLabel(5,"#pi p, MC");
43   fPairFractions->GetXaxis()->SetBinLabel(6,"Kp, MC");
44   fPairFractions->GetXaxis()->SetBinLabel(7,"Other, MC");
45
46
47   // to enable error bar calculation...
48
49   fPairFractions->Sumw2();
50   fPairFractions->Sumw2();
51 }
52
53 //____________________________
54 AliFemtoCorrFctnPairFractions::AliFemtoCorrFctnPairFractions(const AliFemtoCorrFctnPairFractions& aCorrFctn) :
55   AliFemtoCorrFctn(),
56   fPairFractions(0),
57   fphiL(0),
58   fphiT(0)
59 {
60   // copy constructor
61   if (aCorrFctn.fPairFractions)
62     fPairFractions = new TH1F(*aCorrFctn.fPairFractions);
63   else
64     fPairFractions = 0;
65
66  if (aCorrFctn.fPairFractions)
67     fPairFractions = new TH1F(*aCorrFctn.fPairFractions);
68   else
69     fPairFractions = 0;
70
71   fphiL = aCorrFctn.fphiL;
72   fphiT = aCorrFctn.fphiT;
73
74
75 }
76 //____________________________
77 AliFemtoCorrFctnPairFractions::~AliFemtoCorrFctnPairFractions(){
78   // destructor
79   delete fPairFractions;
80   delete fPairFractions;
81 }
82 //_________________________
83 AliFemtoCorrFctnPairFractions& AliFemtoCorrFctnPairFractions::operator=(const AliFemtoCorrFctnPairFractions& aCorrFctn)
84 {
85   // assignment operator
86   if (this == &aCorrFctn)
87     return *this;
88
89   if (aCorrFctn.fPairFractions)
90     fPairFractions = new TH1F(*aCorrFctn.fPairFractions);
91   else
92     fPairFractions = 0;
93
94   
95   fphiL = aCorrFctn.fphiL;
96   fphiT = aCorrFctn.fphiT;
97
98   return *this;
99 }
100 //_________________________
101 void AliFemtoCorrFctnPairFractions::Finish(){
102   // here is where we should normalize, fit, etc...
103   // we should NOT Draw() the histos (as I had done it below),
104   // since we want to insulate ourselves from root at this level
105   // of the code.  Do it instead at root command line with browser.
106   //  mShareNumerator->Draw();
107   // mShareDenominator->Draw();
108   // mRatio->Draw();
109
110 }
111
112 //____________________________
113 AliFemtoString AliFemtoCorrFctnPairFractions::Report(){
114   // create report
115   string stemp = "Pair Fractions Correlation Function Report:\n";
116   char ctemp[100];
117   snprintf(ctemp , 100, "Number of entries in numerator:\t%E\n",fPairFractions->GetEntries());
118   stemp += ctemp;
119   snprintf(ctemp , 100, "Number of entries in denominator:\t%E\n",fPairFractions->GetEntries());
120   stemp += ctemp;
121   //  stemp += mCoulombWeight->Report();
122   AliFemtoString returnThis = stemp;
123   return returnThis;
124 }
125 //____________________________
126 void AliFemtoCorrFctnPairFractions::AddRealPair( AliFemtoPair* pair){
127   // add real (effect) pair
128
129   //Applying pair cuts
130   if (fPairCut)
131     if (!fPairCut->Pass(pair)) return;
132
133
134
135   Int_t pdg1=0;
136   AliFemtoModelHiddenInfo *info1 = ( AliFemtoModelHiddenInfo *) pair->Track1()->GetHiddenInfo();
137   if(info1)pdg1 = info1->GetPDGPid();
138
139   Int_t pdg2=0;
140   AliFemtoModelHiddenInfo *info2 = ( AliFemtoModelHiddenInfo *) pair->Track2()->GetHiddenInfo();
141   if(info2)pdg2 = info2->GetPDGPid();
142
143   if(abs(pdg1)==211 && abs(pdg2)==211) //pi pi
144       fPairFractions->Fill(0.5);
145   else if(abs(pdg1)==321 && abs(pdg2)==321)// K K
146       fPairFractions->Fill(1.5);
147   else if(abs(pdg1)==2212 && abs(pdg2)==2212)// p p
148       fPairFractions->Fill(2.5);
149   else if(abs(pdg1)==211 && abs(pdg2)==321)// pi K
150       fPairFractions->Fill(3.5);
151   else if(abs(pdg1)==211 && abs(pdg2)==2212)// pi p
152       fPairFractions->Fill(4.5);
153   else if(abs(pdg1)==321 && abs(pdg2)==2212)//K p
154       fPairFractions->Fill(5.5);
155   else //other
156       fPairFractions->Fill(6.5);
157
158   /*double phi1 = pair->Track1()->Track()->P().Phi();
159   double phi2 = pair->Track2()->Track()->P().Phi();
160   double eta1 = pair->Track1()->Track()->P().PseudoRapidity();
161   double eta2 = pair->Track2()->Track()->P().PseudoRapidity();
162
163   double phi1 = pair->Track1()->FourMomentum().Phi();
164   double phi2 = pair->Track2()->FourMomentum().Phi();
165   double eta1 = pair->Track1()->FourMomentum().PseudoRapidity();
166   double eta2 = pair->Track2()->FourMomentum().PseudoRapidity();
167
168   double dphi = phi1 - phi2;
169   while (dphi<fphiL) dphi+=PIT;
170   while (dphi>fphiT) dphi-=PIT;
171
172   double deta = eta1 - eta2;
173
174    double px1 = pair->Track1()->Track()->P().x();
175    double py1 = pair->Track1()->Track()->P().y();
176    double px2 = pair->Track2()->Track()->P().x();
177    double py2 = pair->Track2()->Track()->P().y();
178    double pt1 = TMath::Hypot(px1, py1);
179    double pt2 = TMath::Hypot(px2, py2);
180
181
182    double PionMass = 0.13956995;*/
183  
184 }
185 //____________________________
186 void AliFemtoCorrFctnPairFractions::AddMixedPair( AliFemtoPair* pair){
187   // add mixed (background) pair
188   if (fPairCut)
189     if (!fPairCut->Pass(pair)) return;
190
191 }
192
193
194 void AliFemtoCorrFctnPairFractions::WriteHistos()
195 {
196   // Write out result histograms
197   fPairFractions->Write();
198 }
199
200 TList* AliFemtoCorrFctnPairFractions::GetOutputList()
201 {
202   // Prepare the list of objects to be written to the output
203   TList *tOutputList = new TList();
204
205   tOutputList->Add(fPairFractions);
206
207
208   return tOutputList;
209
210 }