]>
Commit | Line | Data |
---|---|---|
2eedd4ed | 1 | #include <exception> |
2 | #include "TChain.h" | |
3 | #include "TTree.h" | |
4 | #include "TVector3.h" | |
5 | #include "TCanvas.h" | |
6 | #include "TRandom3.h" | |
7 | #include "TH2.h" | |
8 | #include "TH1.h" | |
9 | #include "TH3.h" | |
10 | ||
11 | #include "AliLog.h" | |
12 | #include "AliAnalysisTask.h" | |
13 | #include "AliAnalysisManager.h" | |
14 | #include "AliAnalysisTaskPi0v2.h" | |
15 | ||
16 | #include "AliESDEvent.h" | |
17 | #include "AliAODEvent.h" | |
18 | #include "AliEventplane.h" | |
19 | #include "AliCentrality.h" | |
20 | #include <iostream> | |
21 | ||
22 | ||
23 | // Author Daniel Lohner (Daniel.Lohner@cern.ch) | |
24 | ||
25 | using namespace std; | |
26 | ||
27 | ClassImp(AliAnalysisTaskPi0v2) | |
28 | ||
29 | ||
30 | //________________________________________________________________________ | |
31 | AliAnalysisTaskPi0v2::AliAnalysisTaskPi0v2(const char *name) : AliAnalysisTaskPi0Reconstruction(name), | |
32 | fNBinsPhi(1) | |
33 | { | |
34 | ||
35 | // Define input and output slots here | |
36 | DefineInput(0, TChain::Class()); | |
37 | DefineOutput(1, TList::Class()); | |
38 | } | |
39 | ||
40 | //________________________________________________________________________ | |
41 | AliAnalysisTaskPi0v2::~AliAnalysisTaskPi0v2(){ | |
42 | ||
43 | } | |
44 | ||
45 | //________________________________________________________________________ | |
46 | void AliAnalysisTaskPi0v2::UserCreateOutputObjects() | |
47 | { | |
48 | // Create histograms | |
49 | ||
50 | AliAnalysisTaskPi0Reconstruction::UserCreateOutputObjects(); | |
51 | ||
52 | TList *fESDList=new TList(); | |
53 | fESDList->SetName("ESD histograms"); | |
54 | fESDList->SetOwner(kTRUE); | |
55 | fOutputList->Add(fESDList); | |
56 | TList *fBGList=new TList(); | |
57 | fBGList->SetName("Background histograms"); | |
58 | fBGList->SetOwner(kTRUE); | |
59 | fOutputList->Add(fBGList); | |
60 | ||
61 | //Adding the histograms to the output container | |
62 | Int_t kGCnXBinsSpectra = Int_t((Pi0MassRange[1]-Pi0MassRange[0])*500); //500 for range 0 - 1 | |
63 | Double_t kGCfirstXBinSpectra = Pi0MassRange[0]; | |
64 | Double_t kGClastXBinSpectra = Pi0MassRange[1]; | |
65 | ||
66 | Int_t kGCnYBinsSpectra = 250; | |
67 | Double_t kGCfirstYBinSpectra = 0.; | |
68 | Double_t kGClastYBinSpectra = 25.; | |
69 | ||
70 | hInvMassPt=new TH2F("ESD_Mother_InvMass_vs_Pt","ESD Invariant Mass vs Pt",kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra,kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra); | |
71 | hInvMassPt->Sumw2(); | |
72 | fESDList->Add(hInvMassPt); | |
73 | hInvMass=new TH1F("ESD_Mother_InvMass","ESD Invariant Mass",kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra); | |
74 | hInvMass->Sumw2(); | |
75 | fESDList->Add(hInvMass); | |
76 | hBGPt=new TH2F("ESD_Background_InvMass_vs_Pt","ESD Invariant Mass vs Pt",kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra,kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra); | |
77 | hBGPt->Sumw2(); | |
78 | fBGList->Add(hBGPt); | |
79 | hBG=new TH1F("ESD_Background_InvMass","ESD Invariant Mass",kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra); | |
80 | hBG->Sumw2(); | |
81 | fBGList->Add(hBG); | |
82 | ||
83 | hInvMassmphi=new TH2F**[fNBinsPhi]; | |
84 | hBGmphi=new TH2F**[fNBinsPhi]; | |
85 | for(Int_t phi=0;phi<fNBinsPhi;phi++){ | |
86 | hInvMassmphi[phi]=new TH2F*[fNCentralityBins]; | |
87 | hBGmphi[phi]=new TH2F*[fNCentralityBins]; | |
88 | for(Int_t m=0;m<fNCentralityBins;m++){ | |
89 | hInvMassmphi[phi][m]=new TH2F(Form("%d%dESD_Mother_InvMass_vs_Pt",phi,m),"ESD Invariant Mass vs Pt",kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra,kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra); | |
90 | hInvMassmphi[phi][m]->Sumw2(); | |
91 | fESDList->Add(hInvMassmphi[phi][m]); | |
92 | hBGmphi[phi][m]=new TH2F(Form("%d%dESD_Background_InvMass_vs_Pt",phi,m),"ESD Invariant Mass vs Pt",kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra,kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra); | |
93 | hBGmphi[phi][m]->Sumw2(); | |
94 | fBGList->Add(hBGmphi[phi][m]); | |
95 | } | |
96 | } | |
97 | ||
98 | hInclv2PtInvMassCentrality=new TH2F*[fNCentralityBins]; | |
99 | ||
100 | for(Int_t m=0;m<fNCentralityBins;m++){ | |
101 | hInclv2PtInvMassCentrality[m]=new TH2F(Form("%dInclv2_vs_MInv_vs_Pt",m),"" , kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra,kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra); | |
102 | hInclv2PtInvMassCentrality[m]->Sumw2(); | |
103 | fESDList->Add(hInclv2PtInvMassCentrality[m]); | |
104 | } | |
105 | ||
106 | // RP Calculation | |
107 | TList *fRPList=new TList(); | |
108 | fRPList->SetName("Reaction Plane"); | |
109 | fRPList->SetOwner(kTRUE); | |
110 | fOutputList->Add(fRPList); | |
111 | ||
112 | hRP=new TH1F("RP" ,"Reaction Plane Angle" , 360, 0, TMath::Pi()); | |
113 | fRPList->Add(hRP); | |
114 | hRPCentrality=new TH2F("RP_Centrality" ,"Reaction Plane Angle" , 20, 0.001,100.001, 180, 0, TMath::Pi()); | |
115 | fRPList->Add(hRPCentrality); | |
116 | hRPSubevents=new TH2F("RP_Subevents" ,"Reaction Plane Angle" , 180, 0, TMath::Pi(), 180, 0, TMath::Pi()); | |
117 | fRPList->Add(hRPSubevents); | |
118 | hRPDeltaRP=new TH2F("DeltaRP_Centrality" ,"Delta Reaction Plane Angle" , 100, -TMath::Pi()/2, TMath::Pi()/2,20,0.001,100.001); | |
119 | fRPList->Add(hRPDeltaRP); | |
120 | hRPCosDeltaRP=new TH2F("Cos(DeltaRP)" ,"" , 20, 0.001,100.001,110,-1.1,1.1); // range -1.1 - 1.1 else cos(0) will go to the overflow bin!!!!! | |
121 | fRPList->Add(hRPCosDeltaRP); | |
122 | ||
123 | // Other | |
124 | TList *fOtherList=new TList(); | |
125 | fOtherList->SetName("Charged"); | |
126 | fOtherList->SetOwner(kTRUE); | |
127 | fOutputList->Add(fOtherList); | |
128 | ||
129 | hChargedPt=new TH1F*[fNCentralityBins]; | |
130 | ||
131 | for(Int_t m=0;m<fNCentralityBins;m++){ | |
132 | hChargedPt[m]=new TH1F(Form("ChargedSpectrum_Pt_%d",m),"Charged Pt",kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra); | |
133 | hChargedPt[m]->Sumw2(); | |
134 | fOtherList->Add(hChargedPt[m]); | |
135 | ||
136 | } | |
137 | ||
138 | // Gamma | |
139 | ||
140 | TList *fGammaList=new TList(); | |
141 | fGammaList->SetName("Gammav2"); | |
142 | fGammaList->SetOwner(kTRUE); | |
143 | fOutputList->Add(fGammaList); | |
144 | ||
145 | hGammav2=new TH2F*[fNCentralityBins]; | |
146 | ||
147 | for(int i=0;i<fNCentralityBins;i++){ | |
148 | hGammav2[i]=new TH2F(Form("%d_Gamma_v2_vs_Pt",i) ,Form("%d_Gamma_v2_vs_Pt",i),kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra,6,0,TMath::Pi()/2); | |
149 | hGammav2[i]->Sumw2(); | |
150 | fGammaList->Add(hGammav2[i]); | |
151 | } | |
152 | ||
153 | PostData(1, fOutputList); | |
154 | } | |
155 | ||
156 | //________________________________________________________________________ | |
157 | void AliAnalysisTaskPi0v2::UserExec(Option_t *) | |
158 | { | |
159 | ||
160 | AliAnalysisTaskPi0Reconstruction::UserExec(""); | |
161 | ||
162 | ||
163 | // Event Selection | |
164 | if(fEventIsSelected){ | |
165 | ||
166 | ProcessChargedParticles(); | |
167 | ||
168 | ProcessGammas(); | |
169 | ||
170 | ProcessPi0s(); | |
171 | ||
172 | ProcessEventPlaneResolution(); | |
173 | ||
174 | } | |
175 | ||
176 | ||
177 | PostData(1, fOutputList); | |
178 | } | |
179 | ||
180 | //________________________________________________________________________ | |
181 | void AliAnalysisTaskPi0v2::ProcessChargedParticles() | |
182 | { | |
183 | AliVParticle *track=0x0; | |
184 | ||
185 | for(Int_t ii=0;ii<fInputEvent->GetNumberOfTracks();ii++){ | |
186 | track=fInputEvent->GetTrack(ii); | |
187 | hChargedPt[fCentralityBin]->Fill(track->Pt()); | |
188 | } | |
189 | } | |
190 | ||
191 | //________________________________________________________________________ | |
192 | void AliAnalysisTaskPi0v2::ProcessGammas(){ | |
193 | ||
194 | // Process Reconstructed Gammas | |
195 | ||
196 | for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){ | |
197 | ||
198 | AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fConversionGammas->At(firstGammaIndex)); | |
199 | ||
200 | // Gamma Phi wrt EP | |
201 | ||
202 | Double_t phiwrt=TMath::ACos(TMath::Abs(TMath::Cos(gamma->Phi()-fEPAngle))); | |
203 | hGammav2[fCentralityBin]->Fill(gamma->Pt(),phiwrt); | |
204 | } | |
205 | ||
206 | } | |
207 | ||
208 | ||
209 | //________________________________________________________________________ | |
210 | void AliAnalysisTaskPi0v2::ProcessPi0s(){ | |
211 | ||
212 | ||
213 | for(Int_t ii=0;ii<fPi0Candidates->GetEntriesFast();ii++){ | |
214 | ||
215 | AliAODConversionMother *pi0cand=dynamic_cast<AliAODConversionMother*>(fPi0Candidates->At(ii)); | |
216 | ||
217 | hInvMassPt->Fill(pi0cand->M() ,pi0cand->Pt()); | |
218 | hInvMass->Fill(pi0cand->M()); | |
219 | ||
220 | hInclv2PtInvMassCentrality[fCentralityBin]->Fill(pi0cand->M(),pi0cand->Pt(),TMath::Cos(2*(pi0cand->Phi()-fEPAngle))); | |
221 | ||
222 | Int_t phibin=GetPhiBin(pi0cand->Phi()-fEPAngle); | |
223 | if(!(phibin<0||phibin>=fNBinsPhi)){ | |
224 | hInvMassmphi[phibin][fCentralityBin]->Fill(pi0cand->M(),pi0cand->Pt());} | |
225 | ||
226 | ||
227 | } | |
228 | ||
229 | ProcessBGPi0s(); | |
230 | } | |
231 | ||
232 | //________________________________________________________________________ | |
233 | void AliAnalysisTaskPi0v2::Terminate(Option_t *) | |
234 | { | |
235 | ||
236 | // Draw result to the screen | |
237 | fOutputList->Print(); | |
238 | // Called once at the end of the query | |
239 | } | |
240 | ||
241 | ||
242 | //________________________________________________________________________ | |
243 | void AliAnalysisTaskPi0v2::ProcessBGPi0s(){ | |
244 | ||
245 | for(Int_t ii=0;ii<fBGPi0s->GetEntriesFast();ii++){ | |
246 | ||
247 | AliAODConversionMother *pi0candidate=dynamic_cast<AliAODConversionMother*>(fBGPi0s->At(ii)); | |
248 | ||
249 | hBGPt->Fill(pi0candidate->M(),pi0candidate->Pt(),pi0candidate->GetWeight()); | |
250 | hBG->Fill(pi0candidate->M(),pi0candidate->GetWeight()); | |
251 | ||
252 | Int_t phibin=GetPhiBin(pi0candidate->Phi()-fEPAngle); | |
253 | if(!(phibin<0||phibin>=fNBinsPhi)){ | |
254 | hBGmphi[phibin][fCentralityBin]->Fill(pi0candidate->M(),pi0candidate->Pt(),pi0candidate->GetWeight()); } | |
255 | } | |
256 | } | |
257 | ||
258 | ||
259 | //________________________________________________________________________ | |
260 | void AliAnalysisTaskPi0v2::ProcessEventPlaneResolution() | |
261 | { | |
262 | AliEventplane *fEP=GetEventPlane(); | |
263 | ||
264 | if(!fEP||!fEP->GetQsub1()||!fEP->GetQsub2()) return; | |
265 | ||
266 | // Subevents for Resolution | |
267 | ||
268 | Double_t fPsiRP1=fEP->GetQsub1()->Phi()/2; | |
269 | Double_t fPsiRP2=fEP->GetQsub2()->Phi()/2; | |
270 | ||
271 | // Calculations for Resolution | |
272 | Double_t fDeltaPsiRP=fPsiRP1-fPsiRP2; | |
273 | ||
274 | // reactionplaneangle + Pi() is the same angle | |
275 | if(TMath::Abs(fDeltaPsiRP)>TMath::Pi()/2){ | |
276 | if(fDeltaPsiRP>0)fDeltaPsiRP-=TMath::Pi(); | |
277 | else fDeltaPsiRP+=TMath::Pi(); | |
278 | } | |
279 | ||
280 | Double_t cos2deltaRP=TMath::Cos(2*fDeltaPsiRP); | |
281 | ||
282 | // FillHistograms | |
283 | hRPSubevents->Fill(fPsiRP1,fPsiRP2); | |
284 | hRP->Fill(fEPAngle); | |
285 | hRPCentrality->Fill(fCentrality,fEPAngle); | |
286 | hRPDeltaRP->Fill(fDeltaPsiRP,fCentrality); | |
287 | //hRPQxQy->Fill(mQx,mQy); | |
288 | hRPCosDeltaRP->Fill(fCentrality,cos2deltaRP); | |
289 | ||
290 | } | |
291 | ||
292 | ||
293 | //________________________________________________________________________ | |
294 | Int_t AliAnalysisTaskPi0v2::GetPhiBin(Double_t phi) | |
295 | { | |
296 | Int_t phibin=-1; | |
297 | ||
298 | ||
299 | if(!(TMath::Abs(phi)>=0&&TMath::Abs(phi)<=2*TMath::Pi())){AliError("phi w.r.t. RP out of defined range");return -1;} | |
300 | ||
301 | Double_t phiwrtrp=TMath::ACos(TMath::Abs(TMath::Cos(phi))); | |
302 | ||
303 | phibin=Int_t(fNBinsPhi*phiwrtrp/(0.5*TMath::Pi())); | |
304 | ||
305 | if(phibin==-1){AliError("Phi Bin not defined");} | |
306 | return phibin; | |
307 | } |