]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnGammaMonitor.cxx
Lines getting the matched track moved to a method in AliCalorimeterUtils. Lines copie...
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoCorrFctnGammaMonitor.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 //                                                                            //
3 // AliFemtoGammaMonitor - A correlation function that analyzes            //
4 // two particle correlations with respect to the azimuthal angle (phi)        //
5 // and pseudorapidity (eta) difference                                        //
6 //                                                                            //
7 // Authors: Adam Kisiel Adam.Kisiel@cern.ch                                   //
8 //                                                                            //
9 ////////////////////////////////////////////////////////////////////////////////
10
11 #include "AliFemtoCorrFctnGammaMonitor.h"
12 //#include "AliFemtoHisto.hh"
13 #include <cstdio>
14 #include <TMath.h>
15
16 #ifdef __ROOT__ 
17 ClassImp(AliFemtoCorrFctnGammaMonitor)
18 #endif
19
20 //____________________________
21 AliFemtoCorrFctnGammaMonitor::AliFemtoCorrFctnGammaMonitor(char* title, const int& aMinvBins=20, const int& aDThetaBins=20):
22   AliFemtoCorrFctn(),
23   fNumPMinvDTheta(0),
24   fDenPMinvDTheta(0),
25   fNumNMinvDTheta(0),
26   fDenNMinvDTheta(0)
27 {
28   // set up numerator
29   char tTitNumD[101] = "NumPMinvTheta";
30   strncat(tTitNumD,title, 100);
31   fNumPMinvDTheta = new TH2D(tTitNumD,title,aMinvBins,0.0,0.2,aDThetaBins,0.0,0.2);
32   // set up denominator
33   char tTitDenD[101] = "DenPMinvTheta";
34   strncat(tTitDenD,title, 100);
35   fDenPMinvDTheta = new TH2D(tTitDenD,title,aMinvBins,0.0,0.2,aDThetaBins,0.0,0.2);
36
37   // set up numerator
38   char tTitNumR[101] = "NumNMinvTheta";
39   strncat(tTitNumR,title, 100);
40   fNumNMinvDTheta = new TH2D(tTitNumR,title,aMinvBins,0.0,0.2,aDThetaBins,0.0,0.2);
41   // set up denominator
42   char tTitDenR[101] = "DenNMinvTheta";
43   strncat(tTitDenR,title, 100);
44   fDenNMinvDTheta = new TH2D(tTitDenR,title,aMinvBins,0.0,0.2,aDThetaBins,0.0,0.2);
45
46   // to enable error bar calculation...
47   fNumPMinvDTheta->Sumw2();
48   fDenPMinvDTheta->Sumw2();
49   fNumNMinvDTheta->Sumw2();
50   fDenNMinvDTheta->Sumw2();
51 }
52
53 //____________________________
54 AliFemtoCorrFctnGammaMonitor::AliFemtoCorrFctnGammaMonitor(const AliFemtoCorrFctnGammaMonitor& aCorrFctn) :
55   AliFemtoCorrFctn(),
56   fNumPMinvDTheta(0),
57   fDenPMinvDTheta(0),
58   fNumNMinvDTheta(0),
59   fDenNMinvDTheta(0)
60 {
61   // copy constructor
62   if (aCorrFctn.fNumPMinvDTheta)
63     fNumPMinvDTheta = new TH2D(*aCorrFctn.fNumPMinvDTheta);
64   else
65     fNumPMinvDTheta = 0;
66   if (aCorrFctn.fDenPMinvDTheta)
67     fDenPMinvDTheta = new TH2D(*aCorrFctn.fDenPMinvDTheta);
68   else
69     fDenPMinvDTheta = 0;
70
71   if (aCorrFctn.fNumNMinvDTheta)
72     fNumNMinvDTheta = new TH2D(*aCorrFctn.fNumNMinvDTheta);
73   else
74     fNumNMinvDTheta = 0;
75   if (aCorrFctn.fDenNMinvDTheta)
76     fDenNMinvDTheta = new TH2D(*aCorrFctn.fDenNMinvDTheta);
77   else
78     fDenNMinvDTheta = 0;
79
80 }
81 //____________________________
82 AliFemtoCorrFctnGammaMonitor::~AliFemtoCorrFctnGammaMonitor(){
83   // destructor
84   delete fNumPMinvDTheta;
85   delete fDenPMinvDTheta;
86   delete fNumNMinvDTheta;
87   delete fDenNMinvDTheta;
88 }
89 //_________________________
90 AliFemtoCorrFctnGammaMonitor& AliFemtoCorrFctnGammaMonitor::operator=(const AliFemtoCorrFctnGammaMonitor& aCorrFctn)
91 {
92   // assignment operator
93   if (this == &aCorrFctn)
94     return *this;
95
96   if (aCorrFctn.fNumPMinvDTheta)
97     fNumPMinvDTheta = new TH2D(*aCorrFctn.fNumPMinvDTheta);
98   else
99     fNumPMinvDTheta = 0;
100   if (aCorrFctn.fDenPMinvDTheta)
101     fDenPMinvDTheta = new TH2D(*aCorrFctn.fDenPMinvDTheta);
102   else
103     fDenPMinvDTheta = 0;
104
105   if (aCorrFctn.fNumNMinvDTheta)
106     fNumNMinvDTheta = new TH2D(*aCorrFctn.fNumNMinvDTheta);
107   else
108     fNumNMinvDTheta = 0;
109   if (aCorrFctn.fDenNMinvDTheta)
110     fDenNMinvDTheta = new TH2D(*aCorrFctn.fDenNMinvDTheta);
111   else
112     fDenNMinvDTheta = 0;
113
114
115   return *this;
116 }
117 //_________________________
118 void AliFemtoCorrFctnGammaMonitor::Finish(){
119   // here is where we should normalize, fit, etc...
120   // we should NOT Draw() the histos (as I had done it below),
121   // since we want to insulate ourselves from root at this level
122   // of the code.  Do it instead at root command line with browser.
123   //  mShareNumerator->Draw();
124   //mShareDenominator->Draw();
125   //mRatio->Draw();
126
127 }
128
129 //____________________________
130 AliFemtoString AliFemtoCorrFctnGammaMonitor::Report(){
131   // create report
132   string stemp = "Gamma Monitor Function Report:\n";
133   char ctemp[100];
134   snprintf(ctemp , 100, "Number of entries in numerator:\t%E\n",fNumPMinvDTheta->GetEntries());
135   stemp += ctemp;
136   snprintf(ctemp , 100, "Number of entries in denominator:\t%E\n",fDenPMinvDTheta->GetEntries());
137   stemp += ctemp;
138   //  stemp += mCoulombWeight->Report();
139   AliFemtoString returnThis = stemp;
140   return returnThis;
141 }
142 //____________________________
143 void AliFemtoCorrFctnGammaMonitor::AddRealPair( AliFemtoPair* pair){
144   // add real (effect) pair
145   double me = 0.000511;
146
147   double theta1 = pair->Track1()->Track()->P().Theta();
148   double theta2 = pair->Track2()->Track()->P().Theta();
149   double dtheta = TMath::Abs(theta1 - theta2);
150
151   double e1 = TMath::Sqrt(me*me + pair->Track1()->Track()->P().Mag2());
152   double e2 = TMath::Sqrt(me*me + pair->Track2()->Track()->P().Mag2());
153
154   double minv = 2*me*me + 2*(e1*e2 - 
155                              pair->Track1()->Track()->P().x()*pair->Track2()->Track()->P().x() -
156                              pair->Track1()->Track()->P().y()*pair->Track2()->Track()->P().y() -
157                              pair->Track1()->Track()->P().z()*pair->Track2()->Track()->P().z());
158
159   if (pair->KSide()>0.0) 
160     fNumPMinvDTheta->Fill(minv, dtheta);
161   else
162     fNumNMinvDTheta->Fill(minv, dtheta);
163 }
164 //____________________________
165 void AliFemtoCorrFctnGammaMonitor::AddMixedPair( AliFemtoPair* pair){
166   // add mixed (background) pair
167   double me = 0.000511;
168
169   double theta1 = pair->Track1()->Track()->P().Theta();
170   double theta2 = pair->Track2()->Track()->P().Theta();
171   double dtheta = TMath::Abs(theta1 - theta2);
172
173   double e1 = TMath::Sqrt(me*me + pair->Track1()->Track()->P().Mag2());
174   double e2 = TMath::Sqrt(me*me + pair->Track2()->Track()->P().Mag2());
175
176   double minv = 2*me*me + 2*(e1*e2 - 
177                              pair->Track1()->Track()->P().x()*pair->Track2()->Track()->P().x() -
178                              pair->Track1()->Track()->P().y()*pair->Track2()->Track()->P().y() -
179                              pair->Track1()->Track()->P().z()*pair->Track2()->Track()->P().z());
180
181   if (pair->KSide()>0.0) 
182     fDenPMinvDTheta->Fill(minv, dtheta);
183   else
184     fDenNMinvDTheta->Fill(minv, dtheta);
185 }
186
187
188 void AliFemtoCorrFctnGammaMonitor::WriteHistos()
189 {
190   // Write out result histograms
191   fNumPMinvDTheta->Write();
192   fDenPMinvDTheta->Write();
193   fNumNMinvDTheta->Write();
194   fDenNMinvDTheta->Write();
195 }
196
197 TList* AliFemtoCorrFctnGammaMonitor::GetOutputList()
198 {
199   // Prepare the list of objects to be written to the output
200   TList *tOutputList = new TList();
201
202   tOutputList->Add(fNumPMinvDTheta);
203   tOutputList->Add(fDenPMinvDTheta);
204   tOutputList->Add(fNumNMinvDTheta);
205   tOutputList->Add(fDenNMinvDTheta);
206
207   return tOutputList;
208 }