]>
Commit | Line | Data |
---|---|---|
f1d945a1 | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | #define AliFlowAnalysisWithMCEventPlane_cxx | |
17 | ||
18 | #include "Riostream.h" //needed as include | |
19 | #include "TFile.h" //needed as include | |
20 | #include "TProfile.h" //needed as include | |
21 | #include "TComplex.h" //needed as include | |
28ca24ad | 22 | #include "TList.h" |
f1d945a1 | 23 | |
24 | class TH1F; | |
25 | ||
26 | #include "AliFlowCommonConstants.h" //needed as include | |
27 | #include "AliFlowEventSimple.h" | |
28 | #include "AliFlowTrackSimple.h" | |
29 | #include "AliFlowCommonHist.h" | |
30 | #include "AliFlowCommonHistResults.h" | |
31 | #include "AliFlowAnalysisWithMCEventPlane.h" | |
32 | ||
33 | class AliFlowVector; | |
34 | ||
35 | // AliFlowAnalysisWithMCEventPlane: | |
36 | // Description: Maker to analyze Flow from the generated MC reaction plane. | |
37 | // This class is used to get the real value of the flow | |
38 | // to compare the other methods to when analysing simulated events | |
39 | // author: N. van der Kolk (kolk@nikhef.nl) | |
40 | ||
41 | ClassImp(AliFlowAnalysisWithMCEventPlane) | |
42 | ||
43 | //----------------------------------------------------------------------- | |
44 | ||
45 | AliFlowAnalysisWithMCEventPlane::AliFlowAnalysisWithMCEventPlane(): | |
0092f3c2 | 46 | fQsum(NULL), |
f1d945a1 | 47 | fQ2sum(0), |
48 | fEventNumber(0), | |
f1d945a1 | 49 | fDebug(kFALSE), |
28ca24ad | 50 | fHistList(NULL), |
8232a5ec | 51 | fCommonHists(NULL), |
52 | fCommonHistsRes(NULL), | |
53 | fHistProFlow(NULL), | |
54 | fHistRP(NULL) | |
f1d945a1 | 55 | |
56 | { | |
57 | ||
58 | // Constructor. | |
28ca24ad | 59 | fHistList = new TList(); |
60 | ||
0092f3c2 | 61 | fQsum = new TVector2; // flow vector sum |
f1d945a1 | 62 | } |
63 | ||
64 | ||
65 | //----------------------------------------------------------------------- | |
66 | ||
67 | ||
68 | AliFlowAnalysisWithMCEventPlane::~AliFlowAnalysisWithMCEventPlane() | |
69 | { | |
70 | //destructor | |
28ca24ad | 71 | delete fHistList; |
0092f3c2 | 72 | delete fQsum; |
f1d945a1 | 73 | } |
74 | ||
75 | ||
76 | //----------------------------------------------------------------------- | |
77 | void AliFlowAnalysisWithMCEventPlane::Init() { | |
78 | ||
79 | //Define all histograms | |
80 | cout<<"---Analysis with the real MC Event Plane---"<<endl; | |
81 | ||
00731146 | 82 | Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt(); |
83 | Double_t dPtMin = AliFlowCommonConstants::GetPtMin(); | |
84 | Double_t dPtMax = AliFlowCommonConstants::GetPtMax(); | |
f1d945a1 | 85 | |
9d062fe3 | 86 | fCommonHists = new AliFlowCommonHist("AliFlowCommonHistMCEP"); |
87 | fHistList->Add(fCommonHists); | |
88 | fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsMCEP"); | |
89 | fHistList->Add(fCommonHistsRes); | |
90 | ||
91 | fHistProFlow = new TProfile("FlowPro_VPt_MCEP","FlowPro_VPt_MCEP",iNbinsPt,dPtMin,dPtMax); | |
f1d945a1 | 92 | fHistProFlow->SetXTitle("Pt"); |
93 | fHistProFlow->SetYTitle("v2 (%)"); | |
28ca24ad | 94 | fHistList->Add(fHistProFlow); |
f1d945a1 | 95 | |
9d062fe3 | 96 | fHistRP = new TH1F("Flow_RP_MCEP","Flow_RP_MCEP",100,0.,3.14); |
f1d945a1 | 97 | fHistRP->SetXTitle("Reaction Plane Angle"); |
98 | fHistRP->SetYTitle("Counts"); | |
28ca24ad | 99 | fHistList->Add(fHistRP); |
f1d945a1 | 100 | |
101 | ||
102 | fEventNumber = 0; //set number of events to zero | |
103 | ||
104 | } | |
105 | ||
106 | //----------------------------------------------------------------------- | |
107 | ||
00731146 | 108 | void AliFlowAnalysisWithMCEventPlane::Make(AliFlowEventSimple* anEvent, Double_t aRP) { |
f1d945a1 | 109 | |
110 | //Calculate v2 from the MC reaction plane | |
8232a5ec | 111 | if (anEvent) { |
f1d945a1 | 112 | |
113 | //fill control histograms | |
8232a5ec | 114 | fCommonHists->FillControlHistograms(anEvent); |
f1d945a1 | 115 | |
116 | //get the Q vector from the FlowEvent | |
00731146 | 117 | AliFlowVector vQ = anEvent->GetQ(); |
118 | //cout<<"vQ.Mod() = " << vQ.Mod() << endl; | |
f1d945a1 | 119 | //for chi calculation: |
00731146 | 120 | *fQsum += vQ; |
f1d945a1 | 121 | //cout<<"fQsum.Mod() = "<<fQsum.Mod()<<endl; |
00731146 | 122 | fQ2sum += vQ.Mod2(); |
9d062fe3 | 123 | //cout<<"fQ2sum = "<<fQ2sum<<endl; |
f1d945a1 | 124 | |
00731146 | 125 | fHistRP->Fill(aRP); |
f1d945a1 | 126 | |
127 | //calculate flow | |
128 | //loop over the tracks of the event | |
00731146 | 129 | Int_t iNumberOfTracks = anEvent->NumberOfTracks(); |
130 | for (Int_t i=0;i<iNumberOfTracks;i++) | |
f1d945a1 | 131 | { |
00731146 | 132 | AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ; |
133 | if (pTrack){ | |
134 | if (pTrack->UseForDifferentialFlow()) { | |
135 | Double_t dPhi = pTrack->Phi(); | |
136 | //if (dPhi<0.) dPhi+=2*TMath::Pi(); | |
f1d945a1 | 137 | //calculate flow v2: |
00731146 | 138 | Double_t dv2 = TMath::Cos(2*(dPhi-aRP)); |
139 | Double_t dPt = pTrack->Pt(); | |
f1d945a1 | 140 | //fill histogram |
00731146 | 141 | fHistProFlow->Fill(dPt,100*dv2); |
f1d945a1 | 142 | } |
143 | }//track selected | |
144 | }//loop over tracks | |
145 | ||
146 | fEventNumber++; | |
147 | cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl; | |
148 | } | |
149 | } | |
150 | ||
151 | //-------------------------------------------------------------------- | |
152 | void AliFlowAnalysisWithMCEventPlane::Finish() { | |
153 | ||
154 | //*************make histograms etc. | |
155 | if (fDebug) cout<<"AliFlowAnalysisWithMCEventPlane::Terminate()"<<endl; | |
156 | ||
00731146 | 157 | Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt(); |
9d062fe3 | 158 | |
159 | ||
88e00a8a | 160 | TH1F* fHistPtDiff = fCommonHists->GetHistPtDiff(); |
00731146 | 161 | Double_t dV = 0.; |
162 | Double_t dErrV = 0.; | |
163 | Double_t dSum = 0.; | |
164 | for(Int_t b=0;b<iNbinsPt;b++){ | |
165 | Double_t dv2pro = 0.; | |
9d062fe3 | 166 | Double_t dErrdifcomb = 0.; |
f1d945a1 | 167 | if(fHistProFlow) { |
00731146 | 168 | dv2pro = fHistProFlow->GetBinContent(b); |
9d062fe3 | 169 | dErrdifcomb = fHistProFlow->GetBinError(b); //in case error from profile is correct |
f1d945a1 | 170 | //fill TH1D |
00731146 | 171 | fCommonHistsRes->FillDifferentialFlow(b, dv2pro, dErrdifcomb); |
f1d945a1 | 172 | if (fHistPtDiff){ |
173 | //integrated flow | |
00731146 | 174 | Double_t dYield = fHistPtDiff->GetBinContent(b); |
175 | dV += dv2pro/100*dYield ; | |
176 | dSum += dYield; | |
f1d945a1 | 177 | //error on integrated flow |
00731146 | 178 | dErrV += dYield*dYield*(dErrdifcomb/100)*(dErrdifcomb/100); |
f1d945a1 | 179 | } |
9d062fe3 | 180 | } else { cout<<"fHistProFlow is NULL"<<endl; } |
f1d945a1 | 181 | } |
9d062fe3 | 182 | if (dSum != 0. ) { |
183 | dV /= dSum; //because pt distribution should be normalised | |
184 | dErrV /= dSum*dSum; | |
185 | dErrV = TMath::Sqrt(dErrV); } | |
00731146 | 186 | cout<<"dV is "<<dV<<" +- "<<dErrV<<endl; |
187 | fCommonHistsRes->FillIntegratedFlow(dV,dErrV); | |
28ca24ad | 188 | |
f1d945a1 | 189 | cout<<".....finished"<<endl; |
9d062fe3 | 190 | } |
f1d945a1 | 191 | |
192 | ||
9d062fe3 | 193 |