Printouts hidden under AliDebugs
[u/mrichter/AliRoot.git] / PWG4 / omega3pi / AliAnalysisTaskOmegaPi0PiPi.cxx
CommitLineData
f60ddabc 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: Boris Polishchuk (Boris.Polishchuk@cern.ch) *
5 * *
6 * Permission to use, copy, modify and distribute this software and its *
7 * documentation strictly for non-commercial purposes is hereby granted *
8 * without fee, provided that the above copyright notice appears in all *
9 * copies and that both the copyright notice and this permission notice *
10 * appear in the supporting documentation. The authors make no claims *
11 * about the suitability of this software for any purpose. It is *
12 * provided "as is" without express or implied warranty. *
13 **************************************************************************/
14
15////////////////////////////////////////////////////////////////////////////
16//------------------------------------------------------------------------//
17// Class used to do omega(782) -> pi0 pi+ pi- analysis. //
18//------------------------------------------------------------------------//
19////////////////////////////////////////////////////////////////////////////
20
21#include "AliAnalysisTaskOmegaPi0PiPi.h"
22#include "TList.h"
23#include "TH1.h"
24#include "TH2.h"
25#include "AliESDEvent.h"
26#include "TRefArray.h"
27#include "TLorentzVector.h"
28#include "AliESDCaloCluster.h"
29#include "AliESDv0.h"
30#include "AliESDtrack.h"
829e60b8 31#include "AliLog.h"
f60ddabc 32
33ClassImp(AliAnalysisTaskOmegaPi0PiPi)
34
35AliAnalysisTaskOmegaPi0PiPi::AliAnalysisTaskOmegaPi0PiPi() :
36 AliAnalysisTaskSE(),fOutputContainer(0x0),fhM2piSel(0x0),fhDxy(0x0),fhMggSel(0x0),
37 fhImpXY(0x0),fhM3pi0to2(0x0),fhM3pi2to4(0x0),fhM3pi4to6(0x0),fhM3pi6to8(0x0),
38 fhM3pi8to10(0x0),fhM3pi10to12(0x0),fhM3pi12(0x0),fhM3pi0to8(0x0)
39{
40 //Default constructor.
41}
42
43
44AliAnalysisTaskOmegaPi0PiPi::AliAnalysisTaskOmegaPi0PiPi(const char* name) :
45 AliAnalysisTaskSE(name),fOutputContainer(0x0),fhM2piSel(0x0),fhDxy(0x0),fhMggSel(0x0),
46 fhImpXY(0x0),fhM3pi0to2(0x0),fhM3pi2to4(0x0),fhM3pi4to6(0x0),fhM3pi6to8(0x0),
47 fhM3pi8to10(0x0),fhM3pi10to12(0x0),fhM3pi12(0x0),fhM3pi0to8(0x0)
48{
49 //Constructor used to create a named task.
50
51 DefineOutput(1,TList::Class());
52}
53
54
55AliAnalysisTaskOmegaPi0PiPi::~AliAnalysisTaskOmegaPi0PiPi()
56{
57 //Destructor
58
59 if(fOutputContainer){
60 fOutputContainer->Delete() ;
61 delete fOutputContainer ;
62 }
63}
64
65
66void AliAnalysisTaskOmegaPi0PiPi::UserCreateOutputObjects()
67{
68 //Allocates histograms and puts it to the output container.
69
70 fOutputContainer = new TList();
71
72 fhM2piSel = new TH1F("hM2pi_sel","V0 inv. mass, Dxy<2cm",100,0.,1.);
73 fOutputContainer->Add(fhM2piSel);
74
75 fhDxy = new TH1F("hDxy","Distance from V0 to primary vertex in XY-plane", 500, 0.,500.);
76 fOutputContainer->Add(fhDxy);
77
78 fhMggSel = new TH1F("hMgg_sel","Inv. mass of two clusters, pT>1GeV",100,0.,0.3);
79 fOutputContainer->Add(fhMggSel);
80
81 fhImpXY = new TH1F("hImpXY","Impact parameters in XY-plane",1000,0.,1.);
82 fOutputContainer->Add(fhImpXY);
83
84
85 //M(3pi) vs pT(3pi), ptrack < 2GeV
86 fhM3pi0to2 = new TH2F("hM3pi_0_2","pTrack: 0-2GeV",100,0.,10., 200,0.4,1.);
87 fOutputContainer->Add(fhM3pi0to2);
88
89 //M(3pi) vs pT(3pi), 2GeV < ptrack < 4GeV
90 fhM3pi2to4 = new TH2F("hM3pi_2_4","pTrack: 2-4GeV",100,0.,10., 200,0.4,1.);
91 fOutputContainer->Add(fhM3pi2to4);
92
93 //M(3pi) vs pT(3pi), 4GeV < ptrack < 6GeV
94 fhM3pi4to6 = new TH2F("hM3pi_4_6","pTrack: 4-6GeV",100,0.,10., 200,0.4,1.);
95 fOutputContainer->Add(fhM3pi4to6);
96
97 //M(3pi) vs pT(3pi), 6GeV < ptrack < 8GeV
98 fhM3pi6to8 = new TH2F("hM3pi_6_8","pTrack: 6-8GeV",100,0.,10., 200,0.4,1.);
99 fOutputContainer->Add(fhM3pi6to8);
100
101 //M(3pi) vs pT(3pi), 8GeV < ptrack < 10GeV
102 fhM3pi8to10 = new TH2F("hM3pi_8_10","pTrack: 8-10GeV",100,0.,10., 200,0.4,1.);
103 fOutputContainer->Add(fhM3pi8to10);
104
105 //M(3pi) vs pT(3pi), 10GeV < ptrack < 12GeV
106 fhM3pi10to12 = new TH2F("hM3pi_10_12","pTrack: 10-12GeV",100,0.,10., 200,0.4,1.);
107 fOutputContainer->Add(fhM3pi10to12);
108
109 //M(3pi) vs pT(3pi), ptrack > 12GeV
110 fhM3pi12 = new TH2F("hM3pi_12","pTrack>12GeV",100,0.,10., 200,0.4,1.);
111 fOutputContainer->Add(fhM3pi12);
112
113 //M(3pi) vs pT(3pi), ptrack < 8GeV
114 fhM3pi0to8 = new TH2F("hM3pi_0_8","pTrack: 0-8GeV",100,0.,10., 200,0.4,1.);
115 fOutputContainer->Add(fhM3pi0to8);
116
117}
118
119
120void AliAnalysisTaskOmegaPi0PiPi::UserExec(Option_t* /* option */)
121{
122 //Main function that does all the job.
123
f60ddabc 124 AliVEvent* event = InputEvent();
125 AliESDEvent* esd = (AliESDEvent*)event ;
126
127 Double_t v[3] ; //vertex ;
128 esd->GetVertex()->GetXYZ(v) ;
129 TVector3 vtx(v);
829e60b8 130
131 AliDebug(2,Form("Vertex: (%.3f,%.3f,%.3f)\n",vtx.X(),vtx.Y(),vtx.Z()));
f60ddabc 132
133 TRefArray * caloClustersArr = new TRefArray();
134 esd->GetPHOSClusters(caloClustersArr);
135
136 const Int_t kNumberOfTracks = esd->GetNumberOfTracks();
137 const Int_t kNumberOfV0s = esd->GetNumberOfV0s();
829e60b8 138
139 AliDebug(2,Form("Tracks: %d. V0s: %d\n",kNumberOfTracks,kNumberOfV0s));
f60ddabc 140
141 Float_t xyImp,zImp,imp1,imp2;
142
143 const Int_t kNumberOfPhosClusters = caloClustersArr->GetEntries() ;
829e60b8 144 AliDebug(2,Form("CaloClusters: %d\n", kNumberOfPhosClusters));
f60ddabc 145 if(kNumberOfPhosClusters<2) return;
146
147 TLorentzVector pc1; //4-momentum of PHOS cluster 1
148 TLorentzVector pc2; //4-momentum of PHOS cluster 2
149 TLorentzVector pc12;
150
151 TLorentzVector ppos; //4-momentum of positive track
152 TLorentzVector pneg; //4-momentum of negative track
153 TLorentzVector ptr12;
154
155 TLorentzVector pomega;
156 Double_t etrack;
157 Double_t p1,p2; // 3-momentum of tracks
158
159 const Double_t kMpi = 0.1396;
160
161 for(Int_t iClu=0; iClu<kNumberOfPhosClusters; iClu++) {
162 AliESDCaloCluster *c1 = (AliESDCaloCluster *) caloClustersArr->At(iClu);
163 c1->GetMomentum(pc1,v);
164
165 for (Int_t jClu=iClu; jClu<kNumberOfPhosClusters; jClu++) {
166 AliESDCaloCluster *c2 = (AliESDCaloCluster *) caloClustersArr->At(jClu);
167 if(c2->IsEqual(c1)) continue;
168 c2->GetMomentum(pc2,v);
169
170 pc12 = pc1+pc2;
829e60b8 171 AliDebug(2,Form("pc12.M(): %.3f\n",pc12.M()));
f60ddabc 172
173 if(pc12.M()<0.115 || pc12.M()>0.155) continue; //not a pi0 candidate!
174 if(pc12.Pt()<1.) continue; //pT(pi0) > 1GeV
175
176 fhMggSel->Fill(pc12.M());
177
178 for(Int_t iTrack=0; iTrack<kNumberOfTracks; iTrack++) {
179 AliESDtrack* tr1 = esd->GetTrack(iTrack);
180 p1 = tr1->P();
181 tr1->GetImpactParameters(xyImp,zImp);
182 imp1 = TMath::Abs(xyImp);
183 fhImpXY->Fill(imp1);
184 Short_t charge = tr1->Charge();
185 if(imp1>0.004) continue; // not from the primary vertex!
186
187 etrack = TMath::Sqrt(p1*p1 + kMpi*kMpi);
188 ppos.SetPxPyPzE(tr1->Px(),tr1->Py(),tr1->Pz(),etrack);
189
190 for(Int_t jTrack=iTrack; jTrack<kNumberOfTracks; jTrack++) {
191 AliESDtrack* tr2 = esd->GetTrack(jTrack);
192 p2 = tr2->P();
193 if(tr2->Charge()==charge) continue; //same sign track (WRONG!!)
194 tr2->GetImpactParameters(xyImp,zImp);
195 imp2=TMath::Abs(xyImp);
196 if(imp2>0.004) continue; // not from the primary vertex!
197
198 etrack = TMath::Sqrt(p2*p2 + kMpi*kMpi);
199 pneg.SetPxPyPzE(tr2->Px(),tr2->Py(),tr2->Pz(),etrack);
200
201 ptr12 = ppos + pneg;
202
203// printf("ptr12.M()=%.3f, xyImp1=%f, xyImp2=%f, ch1=%d, ch2=%d,
204// p1=%.3f, p2=%.3f, m1=%.3f, m2=%.3f\n",
205// ptr12.M(),imp1,imp2,tr1->Charge(),tr2->Charge(),
206// tr1->P(),tr2->P(),tr1->M(),tr2->M());
207
208 pomega = pc12 + ptr12;
829e60b8 209 AliDebug(2,Form("pomega.M(): %f\n",pomega.M()));
f60ddabc 210
211 if( p1<2. && p2<2. )
212 fhM3pi0to2->Fill(pomega.Pt(),pomega.M());
213
214 if( (p1>=2. && p1<4.) && (p2>=2. && p2<4.) )
215 fhM3pi2to4->Fill(pomega.Pt(),pomega.M());
216
217 if( (p1>=4. && p1<6.) && (p2>=4. && p2<6.) )
218 fhM3pi4to6->Fill(pomega.Pt(),pomega.M());
219
220 if( (p1>=6. && p1<8.) && (p2>=6. && p2<8.) )
221 fhM3pi6to8->Fill(pomega.Pt(),pomega.M());
222
223 if( (p1>=8. && p1<10.) && (p2>=8. && p2<10.) )
224 fhM3pi8to10->Fill(pomega.Pt(),pomega.M());
225
226 if( (p1>=10. && p1<12.) && (p2>=10. && p2<12.) )
227 fhM3pi10to12->Fill(pomega.Pt(),pomega.M());
228
229 if( (p1>=12.) && (p2>=12.) )
230 fhM3pi12->Fill(pomega.Pt(),pomega.M());
231
232 if( p1<8. && p2<8. )
233 fhM3pi0to8->Fill(pomega.Pt(),pomega.M());
234
235 }
236 }
237
238 for(Int_t iVert=0; iVert<kNumberOfV0s; iVert++) {
239 AliESDv0* v0 = esd->GetV0(iVert);
240 AliESDtrack* ptrack = esd->GetTrack(v0->GetPindex()); //positive track
241 AliESDtrack* ntrack = esd->GetTrack(v0->GetNindex()); //negative track
242
243 etrack = TMath::Sqrt(ptrack->P()*ptrack->P() + kMpi*kMpi);
244 ppos.SetPxPyPzE(ptrack->Px(),ptrack->Py(),ptrack->Pz(),etrack);
245
246 etrack = TMath::Sqrt(ntrack->P()*ntrack->P() + kMpi*kMpi);
247 pneg.SetPxPyPzE(ntrack->Px(),ntrack->Py(),ntrack->Pz(),etrack);
248
249 ptr12 = ppos + pneg;
250
251 Double_t dx = vtx.X() - v0->Xv();
252 Double_t dy = vtx.Y() - v0->Yv();
253 Double_t dxy = TMath::Sqrt(dx*dx + dy*dy);
254 fhDxy->Fill(dxy);
829e60b8 255
256 AliDebug(2,Form("V0: dxy=%.3f\n",dxy));
f60ddabc 257
258 if(dxy<2.) fhM2piSel->Fill(ptr12.M());
259 }
260
261 }
262 }
263
264 delete caloClustersArr;
265 PostData(1,fOutputContainer);
266}