1 /**************************************************************************
2 * Author: Panos Christakoglou. *
3 * Contributors are mentioned in the code where appropriate. *
5 * Permission to use, copy, modify and distribute this software and its *
6 * documentation strictly for non-commercial purposes is hereby granted *
7 * without fee, provided that the above copyright notice appears in all *
8 * copies and that both the copyright notice and this permission notice *
9 * appear in the supporting documentation. The authors make no claims *
10 * about the suitability of this software for any purpose. It is *
11 * provided "as is" without express or implied warranty. *
12 **************************************************************************/
16 //-----------------------------------------------------------------
17 // AliAnalysisEventCuts class
18 // This is the class to deal with the event and track level cuts
19 // Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
20 //-----------------------------------------------------------------
25 #include <TPaveText.h>
33 #include "AliAnalysisEventCuts.h"
35 ClassImp(AliAnalysisEventCuts)
37 //----------------------------------------//
38 AliAnalysisEventCuts::AliAnalysisEventCuts()
40 //Default constructor which calls the Reset method.
44 //----------------------------------------//
45 AliAnalysisEventCuts::~AliAnalysisEventCuts()
50 //----------------------------------------//
51 void AliAnalysisEventCuts::Reset()
53 //Sets dummy values to every private member.
76 //----------------------------------------//
77 void AliAnalysisEventCuts::SetPrimaryVertexXRange(Float_t r1, Float_t r2)
79 //Sets the primary vertex x range.
85 //----------------------------------------//
86 void AliAnalysisEventCuts::SetPrimaryVertexYRange(Float_t r1, Float_t r2)
88 //Sets the primary vertex y range.
94 //----------------------------------------//
95 void AliAnalysisEventCuts::SetPrimaryVertexZRange(Float_t r1, Float_t r2)
97 //Sets the primary vertex z range.
103 //----------------------------------------//
104 void AliAnalysisEventCuts::SetMultiplicityRange(Int_t n1, Int_t n2)
106 //Sets the multiplicity range.
113 //----------------------------------------//
114 Bool_t AliAnalysisEventCuts::IsAccepted(AliESD *esd)
116 //Returns true if the events is accepted otherwise false.
118 if((esd->GetNumberOfTracks() < fMultMin) || (esd->GetNumberOfTracks() > fMultMax))
121 AliInfo(Form("Event rejected due to multiplicity cut"));
124 const AliESDVertex *esdvertex = esd->GetVertex();
125 if((esdvertex->GetXv() < fVxMin) || (esdvertex->GetXv() > fVxMax))
128 AliInfo(Form("Event rejected due to Vx cut"));
131 if((esdvertex->GetYv() < fVyMin) || (esdvertex->GetYv() > fVyMax))
134 AliInfo(Form("Event rejected due to Vy cut"));
137 if((esdvertex->GetZv() < fVzMin) || (esdvertex->GetZv() > fVzMax))
140 AliInfo(Form("Event rejected due to Vz cut"));
149 //----------------------------------------//
150 TPaveText *AliAnalysisEventCuts::GetEventCuts()
152 //Shows a TPaveText with all the event cut stats.
153 TCanvas *ccuts = new TCanvas("ccuts","Event cuts",10,10,400,400);
154 ccuts->SetFillColor(10);
155 ccuts->SetHighLightColor(10);
157 TPaveText *pave = new TPaveText(0.01,0.01,0.98,0.98);
158 pave->SetFillColor(5);
161 TLine *l1 = pave->AddLine(0,0.78,1,0.78);
163 TLine *l2 = pave->AddLine(0,0.58,1,0.58);
165 TLine *l3 = pave->AddLine(0,0.38,1,0.38);
167 TLine *l4 = pave->AddLine(0,0.18,1,0.18);
170 sprintf(cutName,"Total number of events: %d",fTotalEvents);
171 TText *t1 = pave->AddText(cutName);
173 t1->SetTextSize(0.04);
174 t1->SetTextAlign(11);
176 sprintf(cutName,"Total number of accepted events: %d",fAcceptedEvents);
177 t1 = pave->AddText(cutName);
179 t1->SetTextSize(0.04);
180 t1->SetTextAlign(11);
182 sprintf(cutName,"Multiplicity range: [%d,%d]",fMultMin,fMultMax);
183 t1 = pave->AddText(cutName);
185 t1->SetTextSize(0.04);
186 t1->SetTextAlign(11);
187 sprintf(cutName,"Events rejected: %d",fMult);
188 t1 = pave->AddText(cutName);
190 t1->SetTextSize(0.04);
191 t1->SetTextAlign(11);
193 sprintf(cutName,"Vx range: [%f,%f]",fVxMin,fVxMax);
194 t1 = pave->AddText(cutName);
196 t1->SetTextSize(0.04);
197 t1->SetTextAlign(11);
198 sprintf(cutName,"Events rejected: %d",fVx);
199 t1 = pave->AddText(cutName);
201 t1->SetTextSize(0.04);
202 t1->SetTextAlign(11);
204 sprintf(cutName,"Vy range: [%f,%f]",fVyMin,fVyMax);
205 t1 = pave->AddText(cutName);
207 t1->SetTextSize(0.04);
208 t1->SetTextAlign(11);
209 sprintf(cutName,"Events rejected: %d",fVy);
210 t1 = pave->AddText(cutName);
212 t1->SetTextSize(0.04);
213 t1->SetTextAlign(11);
215 sprintf(cutName,"Vz range: [%f,%f]",fVzMin,fVzMax);
216 t1 = pave->AddText(cutName);
218 t1->SetTextSize(0.04);
219 t1->SetTextAlign(11);
220 sprintf(cutName,"Events rejected: %d",fVz);
221 t1 = pave->AddText(cutName);
223 t1->SetTextSize(0.04);
224 t1->SetTextAlign(11);
229 //----------------------------------------//
230 void AliAnalysisEventCuts::GetEventStats()
232 //Returns the total event stats.
233 //fTotalEvents is the total number of events.
234 //fAcceptedEvents is the total number of accepted events.
235 AliInfo(Form("Total number of events: %d",fTotalEvents));
236 AliInfo(Form("Total number of accepted events: %d",fAcceptedEvents));
239 //----------------------------------------//
240 void AliAnalysisEventCuts::GetMultStats()
242 //Gets the multiplicity statistics.
243 //Prints the percentage of events rejected due to this cut.
244 AliInfo(Form("Multiplicity range: [%d,%d]",fMultMin,fMultMax));
245 AliInfo(Form("Events rejected: %d",fMult));
248 //----------------------------------------//
249 void AliAnalysisEventCuts::GetVxStats()
251 //Gets the Vx statistics.
252 //Prints the percentage of events rejected due to this cut.
253 AliInfo(Form("Vx range: [%f,%f]",fVxMin,fVxMax));
254 AliInfo(Form("Events rejected: %d",fVx));
257 //----------------------------------------//
258 void AliAnalysisEventCuts::GetVyStats()
260 //Gets the Vy statistics.
261 //Prints the percentage of events rejected due to this cut.
262 AliInfo(Form("Vy range: [%f,%f]",fVyMin,fVyMax));
263 AliInfo(Form("Events rejected: %d",fVy));
266 //----------------------------------------//
267 void AliAnalysisEventCuts::GetVzStats()
269 //Gets the Vz statistics.
270 //Prints the percentage of events rejected due to this cut.
271 AliInfo(Form("Vz range: [%f,%f]",fVzMin,fVzMax));
272 AliInfo(Form("Events rejected: %d",fVz));
275 //----------------------------------------//
276 void AliAnalysisEventCuts::PrintEventCuts()
278 //Prints the event stats.
279 //GetEventCuts()->Draw();
281 AliInfo(Form("**************EVENT CUTS**************"));
291 AliInfo(Form("**************************************"));