]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctn3DLCMSSpherical.cxx
Adding model correlation functions.
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoModelCorrFctn3DLCMSSpherical.cxx
1 ///////////////////////////////////////////////////////////////////////////
2 //                                                                       //
3 // AliFemtoModelCorrFctn3DLCMSSpherical: a class to calculate 3D correlation //
4 // for pairs of identical particles, binned in spherical coordinates.    //
5 // In analysis the function should be first created in a macro, then     //
6 // added to the analysis, and at the end of the macro the procedure to   //
7 // write out histograms should be called.                                //
8 //                                                                       //
9 ///////////////////////////////////////////////////////////////////////////
10
11 #include "AliFemtoModelCorrFctn3DLCMSSpherical.h"
12 #include "AliFemtoModelManager.h"
13 #include <TMath.h>
14 #include <cstdio>
15
16 #ifdef __ROOT__ 
17 ClassImp(AliFemtoModelCorrFctn3DLCMSSpherical)
18 #endif
19
20 //____________________________
21   AliFemtoModelCorrFctn3DLCMSSpherical::AliFemtoModelCorrFctn3DLCMSSpherical(char* title, const int& nqbins, const float& QLo, const float& QHi, const int& nphibins, const int& ncthetabins):
22   fTrueNumeratorSph(0),
23   fFakeNumeratorSph(0),
24   fDenominatorSph(0),
25   fPairCut(0x0)
26 {
27   // set up numerator
28   char tTitNum[100] = "NumTrue";
29   strcat(tTitNum,title);
30   fTrueNumeratorSph = new TH3D(tTitNum,title,nqbins,QLo,QHi,nphibins,-TMath::Pi(),TMath::Pi(),ncthetabins,-1.0,1.0);
31   // set up numerator
32   char tTitNumF[100] = "NumFake";
33   strcat(tTitNumF,title);
34   fFakeNumeratorSph = new TH3D(tTitNumF,title,nqbins,QLo,QHi,nphibins,-TMath::Pi(),TMath::Pi(),ncthetabins,-1.0,1.0);
35   // set up denominator
36   char tTitDen[100] = "Den";
37   strcat(tTitDen,title);
38   fDenominatorSph = new TH3D(tTitDen,title,nqbins,QLo,QHi,nphibins,-TMath::Pi(),TMath::Pi(),ncthetabins,-1.0,1.0);
39
40   // to enable error bar calculation...
41   fTrueNumeratorSph->Sumw2();
42   fFakeNumeratorSph->Sumw2();
43   fDenominatorSph->Sumw2();
44 }
45
46 AliFemtoModelCorrFctn3DLCMSSpherical::AliFemtoModelCorrFctn3DLCMSSpherical(const AliFemtoModelCorrFctn3DLCMSSpherical& aCorrFctn) :
47   AliFemtoModelCorrFctn(),
48   fTrueNumeratorSph(0),
49   fFakeNumeratorSph(0),
50   fDenominatorSph(0),
51   fPairCut(0x0)
52 {
53   // Copy constructor
54   fTrueNumeratorSph = new TH3D(*aCorrFctn.fTrueNumeratorSph);
55   fFakeNumeratorSph = new TH3D(*aCorrFctn.fFakeNumeratorSph);
56   fDenominatorSph = new TH3D(*aCorrFctn.fDenominatorSph);
57   fPairCut = aCorrFctn.fPairCut;
58 }
59 //____________________________
60 AliFemtoModelCorrFctn3DLCMSSpherical::~AliFemtoModelCorrFctn3DLCMSSpherical(){
61   // Destructor
62   delete fTrueNumeratorSph;
63   delete fFakeNumeratorSph;
64   delete fDenominatorSph;
65 }
66 //_________________________
67 AliFemtoModelCorrFctn3DLCMSSpherical& AliFemtoModelCorrFctn3DLCMSSpherical::operator=(const AliFemtoModelCorrFctn3DLCMSSpherical& aCorrFctn)
68 {
69   // assignment operator
70   if (this == &aCorrFctn)
71     return *this;
72
73   if (fTrueNumeratorSph) delete fTrueNumeratorSph;
74   fTrueNumeratorSph = new TH3D(*aCorrFctn.fTrueNumeratorSph);
75   if (fFakeNumeratorSph) delete fFakeNumeratorSph;
76   fFakeNumeratorSph = new TH3D(*aCorrFctn.fFakeNumeratorSph);
77   if (fDenominatorSph) delete fDenominatorSph;
78   fDenominatorSph = new TH3D(*aCorrFctn.fDenominatorSph);
79   
80   fPairCut = aCorrFctn.fPairCut;
81   
82   return *this;
83 }
84
85 //_________________________
86 void AliFemtoModelCorrFctn3DLCMSSpherical::WriteOutHistos(){
87   // Write out all histograms to file
88   fTrueNumeratorSph->Write();
89   fFakeNumeratorSph->Write();
90   fDenominatorSph->Write();
91 }
92 //______________________________
93 TList* AliFemtoModelCorrFctn3DLCMSSpherical::GetOutputList()
94 {
95   // Prepare the list of objects to be written to the output
96   TList *tOutputList = new TList();
97
98   tOutputList->Add(fTrueNumeratorSph); 
99   tOutputList->Add(fFakeNumeratorSph); 
100   tOutputList->Add(fDenominatorSph);  
101
102   return tOutputList;
103 }
104
105 //_________________________
106 void AliFemtoModelCorrFctn3DLCMSSpherical::Finish(){
107   // here is where we should normalize, fit, etc...
108 }
109
110 //____________________________
111 AliFemtoString AliFemtoModelCorrFctn3DLCMSSpherical::Report(){
112   // Construct the report
113   string stemp = "LCMS Frame Spherical 3D Model Correlation Function Report:\n";
114   char ctemp[100];
115   sprintf(ctemp,"Number of entries in numerator:\t%E\n",fTrueNumeratorSph->GetEntries());
116   stemp += ctemp;
117   sprintf(ctemp,"Number of entries in denominator:\t%E\n",fDenominatorSph->GetEntries());
118   stemp += ctemp;
119
120   if (fPairCut){
121     sprintf(ctemp,"Here is the PairCut specific to this CorrFctn\n");
122     stemp += ctemp;
123     stemp += fPairCut->Report();
124   }
125   else{
126     sprintf(ctemp,"No PairCut specific to this CorrFctn\n");
127     stemp += ctemp;
128   }
129
130   //  
131   AliFemtoString returnThis = stemp;
132   return returnThis;
133 }
134 //____________________________
135 void AliFemtoModelCorrFctn3DLCMSSpherical::AddRealPair( AliFemtoPair* pair){
136   // perform operations on real pairs
137   if (fPairCut){
138     if (!(fPairCut->Pass(pair))) return;
139   }
140
141   Double_t weight = fManager->GetWeight(pair);
142
143
144   double tKO = (pair->QOutCMS());
145   double tKS = (pair->QSideCMS());
146   double tKL = (pair->QLongCMS());
147
148   double tKR = sqrt(tKO*tKO + tKS*tKS + tKL*tKL);
149   double tKC;
150   if ( fabs(tKR) < 1e-10 ) tKC = 0.0;
151   else tKC=tKL/tKR;
152   double tKP=atan2(tKS,tKO);
153
154   fTrueNumeratorSph->Fill(tKR,tKP,tKC,weight);
155 }
156 //____________________________
157 void AliFemtoModelCorrFctn3DLCMSSpherical::AddMixedPair( AliFemtoPair* pair){
158   // perform operations on mixed pairs
159   if (fPairCut){
160     if (!(fPairCut->Pass(pair))) return;
161   }
162
163   Double_t weight = fManager->GetWeight(pair);
164
165   double tKO = (pair->QOutCMS());
166   double tKS = (pair->QSideCMS());
167   double tKL = (pair->QLongCMS());
168
169   double tKR = sqrt(tKO*tKO + tKS*tKS + tKL*tKL);
170   double tKC;
171   if ( fabs(tKR) < 1e-10 ) tKC = 0.0;
172   else tKC=tKL/tKR;
173   double tKP=atan2(tKS,tKO);
174
175   fFakeNumeratorSph->Fill(tKR,tKP,tKC,weight);
176   fDenominatorSph->Fill(tKR,tKP,tKC);
177 }
178
179