Fixes in order to treat correctly event and sub-event header extensions.
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoModelBPLCMSCorrFctn.cxx
CommitLineData
65423af9 1////////////////////////////////////////////////////////////////////////////////
2/// ///
3/// AliFemtoModelBPLCMSCorrFctn - the class for correlation function which ///
4/// uses the model framework and weight generation and calculated the 3D ///
5/// correlation function in the Bertsh-Pratt LCMS system ///
6/// Authors: Adam Kisiel, kisiel@mps.ohio-state.edu ///
7/// ///
8////////////////////////////////////////////////////////////////////////////////
9#include "AliFemtoModelBPLCMSCorrFctn.h"
cc5faabc 10#include "AliFemtoPair.h"
11#include "AliFemtoModelManager.h"
65423af9 12#include <cstdio>
13
14#ifdef __ROOT__
15ClassImp(AliFemtoModelBPLCMSCorrFctn)
16#endif
17
18//____________________________
19AliFemtoModelBPLCMSCorrFctn::AliFemtoModelBPLCMSCorrFctn(char* title, const int& nbins, const float& QLo, const float& QHi)
20 :
cc5faabc 21 AliFemtoModelCorrFctn(title, nbins, QLo, QHi),
22 fNumerator3DTrue(0),
23 fNumerator3DFake(0),
24 fDenominator3D(0),
65423af9 25 fQinvHisto(0)
26{
27
cc5faabc 28 // set up true numerator
29 char TitNumT[100] = "Num3DTrue";
30 strcat(TitNumT,title);
31 fNumerator3DTrue = new TH3D(TitNumT,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
32 // set up fake numerator
33 char TitNumF[100] = "Num3DFake";
34 strcat(TitNumF,title);
35 fNumerator3DFake = new TH3D(TitNumF,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
65423af9 36 // set up denominator
cc5faabc 37 char TitDen[100] = "Den3D";
65423af9 38 strcat(TitDen,title);
cc5faabc 39 fDenominator3D = new TH3D(TitDen,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
65423af9 40 // set up ave qInv
41 char TitQinv[100] = "Qinv";
42 strcat(TitQinv,title);
43 fQinvHisto = new TH3D(TitQinv,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
44
45 // to enable error bar calculation...
cc5faabc 46 fNumerator3DTrue->Sumw2();
47 fNumerator3DFake->Sumw2();
48 fDenominator3D->Sumw2();
65423af9 49}
50
51AliFemtoModelBPLCMSCorrFctn::AliFemtoModelBPLCMSCorrFctn(const AliFemtoModelBPLCMSCorrFctn& aCorrFctn) :
cc5faabc 52 AliFemtoModelCorrFctn(aCorrFctn),
53 fNumerator3DTrue(0),
54 fNumerator3DFake(0),
55 fDenominator3D(0),
65423af9 56 fQinvHisto(0)
57{
cc5faabc 58 fNumerator3DTrue = new TH3D(*aCorrFctn.fNumerator3DTrue);
59 fNumerator3DFake = new TH3D(*aCorrFctn.fNumerator3DFake);
60 fDenominator3D = new TH3D(*aCorrFctn.fDenominator3D);
61 fQinvHisto = new TH3D(*aCorrFctn.fQinvHisto);
65423af9 62}
63//____________________________
cc5faabc 64AliFemtoModelBPLCMSCorrFctn::~AliFemtoModelBPLCMSCorrFctn()
65{
66 if (fNumeratorTrue) delete fNumeratorTrue;
67 if (fNumeratorFake) delete fNumeratorFake;
68 if (fDenominator) delete fDenominator;
69 delete fNumerator3DTrue;
70 delete fNumerator3DFake;
71 delete fDenominator3D;
65423af9 72 delete fQinvHisto;
73}
74//_________________________
75AliFemtoModelBPLCMSCorrFctn& AliFemtoModelBPLCMSCorrFctn::operator=(const AliFemtoModelBPLCMSCorrFctn& aCorrFctn)
76{
77 if (this == &aCorrFctn)
78 return *this;
cc5faabc 79 if (fNumerator3DTrue) delete fNumerator3DTrue;
80 fNumerator3DTrue = new TH3D(*aCorrFctn.fNumerator3DTrue);
81 if (fNumerator3DFake) delete fNumerator3DFake;
82 fNumerator3DFake = new TH3D(*aCorrFctn.fNumerator3DFake);
83 if (fDenominator3D) delete fDenominator3D;
84 fDenominator3D = new TH3D(*aCorrFctn.fDenominator3D);
65423af9 85 if (fQinvHisto) delete fQinvHisto;
86 fQinvHisto = new TH3D(*aCorrFctn.fQinvHisto);
87
88 return *this;
89}
90
91//_________________________
cc5faabc 92void AliFemtoModelBPLCMSCorrFctn::Write(){
93 AliFemtoModelCorrFctn::Write();
94 fNumerator3DTrue->Write();
95 fNumerator3DFake->Write();
96 fDenominator3D->Write();
65423af9 97 fQinvHisto->Write();
98}
99
100//_________________________
101void AliFemtoModelBPLCMSCorrFctn::Finish(){
102 fQinvHisto->Divide(fDenominator);
103}
104
105//____________________________
106AliFemtoString AliFemtoModelBPLCMSCorrFctn::Report(){
cc5faabc 107 string stemp = "LCMS Frame Bertsch-Pratt 3D Model Correlation Function Report:\n";
65423af9 108 char ctemp[100];
cc5faabc 109 sprintf(ctemp,"Number of entries in numerator:\t%E\n",fNumeratorTrue->GetEntries());
65423af9 110 stemp += ctemp;
111 sprintf(ctemp,"Number of entries in denominator:\t%E\n",fDenominator->GetEntries());
112 stemp += ctemp;
65423af9 113 /* if (fCorrection)
114 {
115 float radius = fCorrection->GetRadius();
116 sprintf(ctemp,"Coulomb correction used radius of\t%E\n",radius);
117 }
118 else
119 {
120 sprintf(ctemp,"No Coulomb Correction applied to this CorrFctn\n");
121 }
122 stemp += ctemp;
123 */
124
65423af9 125 //
126 AliFemtoString returnThis = stemp;
127 return returnThis;
128}
129//____________________________
130void AliFemtoModelBPLCMSCorrFctn::AddRealPair( AliFemtoPair* pair){
cc5faabc 131 Double_t weight = fManager->GetWeight(pair);
65423af9 132
cc5faabc 133 double qOut = fabs(pair->QOutCMS());
134 double qSide = fabs(pair->QSideCMS());
135 double qLong = fabs(pair->QLongCMS());
65423af9 136
cc5faabc 137 fNumerator3DTrue->Fill(qOut, qSide, qLong, weight);
138 fNumeratorTrue->Fill(pair->QInv(), weight);
65423af9 139}
140//____________________________
141void AliFemtoModelBPLCMSCorrFctn::AddMixedPair( AliFemtoPair* pair){
cc5faabc 142 Double_t weight = fManager->GetWeight(pair);
65423af9 143
cc5faabc 144 double qOut = fabs(pair->QOutCMS());
145 double qSide = fabs(pair->QSideCMS());
146 double qLong = fabs(pair->QLongCMS());
65423af9 147
cc5faabc 148 fNumerator3DFake->Fill(qOut, qSide, qLong, weight);
149 fDenominator3D->Fill(qOut, qSide, qLong, 1.0);
150 fNumeratorFake->Fill(pair->QInv(), weight);
151 fDenominator->Fill(pair->QInv(), 1.0);
65423af9 152
65423af9 153}
cc5faabc 154//_______________________
155AliFemtoModelCorrFctn* AliFemtoModelBPLCMSCorrFctn::Clone()
156{
157 // Clone the correlation function
158 AliFemtoModelBPLCMSCorrFctn *tCopy = new AliFemtoModelBPLCMSCorrFctn(*this);
159
160 return tCopy;
161}