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 fVerboseOff(0), fVxMin(0), fVxMax(0),
43 fMultMin(0), fMultMax(0),
45 fMult(0), fVx(0), fVy(0), fVz(0),
46 fVzFlag(0), fTotalEvents(0),
47 fAcceptedEvents(0), fFlagMult(0),
48 fFlagVx(0), fFlagVy(0), fFlagVz(0),
50 //Default constructor which calls the Reset method.
54 //----------------------------------------//
55 AliAnalysisEventCuts::~AliAnalysisEventCuts()
60 //----------------------------------------//
61 void AliAnalysisEventCuts::Reset()
65 //Sets dummy values to every private member.
74 fVzFlagType = "default";
91 //----------------------------------------//
92 void AliAnalysisEventCuts::SetPrimaryVertexXRange(Float_t r1, Float_t r2)
94 //Sets the primary vertex x range.
100 //----------------------------------------//
101 void AliAnalysisEventCuts::SetPrimaryVertexYRange(Float_t r1, Float_t r2)
103 //Sets the primary vertex y range.
109 //----------------------------------------//
110 void AliAnalysisEventCuts::SetPrimaryVertexZRange(Float_t r1, Float_t r2)
112 //Sets the primary vertex z range.
118 //----------------------------------------//
119 void AliAnalysisEventCuts::SetMultiplicityRange(Int_t n1, Int_t n2)
121 //Sets the multiplicity range.
128 //----------------------------------------//
129 Bool_t AliAnalysisEventCuts::IsAccepted(AliESD *esd)
131 //Returns true if the events is accepted otherwise false.
133 if((esd->GetNumberOfTracks() < fMultMin) || (esd->GetNumberOfTracks() > fMultMax)) {
136 AliInfo(Form("Event rejected due to multiplicity cut"));
139 const AliESDVertex *esdvertex = esd->GetVertex();
140 TString vertexname = esdvertex->GetName();
141 if((esdvertex->GetXv() < fVxMin) || (esdvertex->GetXv() > fVxMax)) {
144 AliInfo(Form("Event rejected due to Vx cut"));
147 if((esdvertex->GetYv() < fVyMin) || (esdvertex->GetYv() > fVyMax)) {
150 AliInfo(Form("Event rejected due to Vy cut"));
153 if((esdvertex->GetZv() < fVzMin) || (esdvertex->GetZv() > fVzMax)) {
156 AliInfo(Form("Event rejected due to Vz cut"));
159 if((fFlagVzType == 1)&&(vertexname == "default")) {
162 AliInfo(Form("Event rejected due to Vz flag cut"));
171 //----------------------------------------//
172 TPaveText *AliAnalysisEventCuts::GetEventCuts()
174 //Shows a TPaveText with all the event cut stats.
175 TCanvas *ccuts = new TCanvas("ccuts","Event cuts",10,10,400,400);
176 ccuts->SetFillColor(10);
177 ccuts->SetHighLightColor(10);
179 TPaveText *pave = new TPaveText(0.01,0.01,0.98,0.98);
180 pave->SetFillColor(5);
183 TLine *l1 = pave->AddLine(0,0.78,1,0.78);
185 TLine *l2 = pave->AddLine(0,0.58,1,0.58);
187 TLine *l3 = pave->AddLine(0,0.38,1,0.38);
189 TLine *l4 = pave->AddLine(0,0.18,1,0.18);
192 sprintf(cutName,"Total number of events: %d",fTotalEvents);
193 TText *t1 = pave->AddText(cutName);
195 t1->SetTextSize(0.04);
196 t1->SetTextAlign(11);
198 sprintf(cutName,"Total number of accepted events: %d",fAcceptedEvents);
199 t1 = pave->AddText(cutName);
201 t1->SetTextSize(0.04);
202 t1->SetTextAlign(11);
204 sprintf(cutName,"Multiplicity range: [%d,%d]",fMultMin,fMultMax);
205 t1 = pave->AddText(cutName);
207 t1->SetTextSize(0.04);
208 t1->SetTextAlign(11);
209 sprintf(cutName,"Events rejected: %d",fMult);
210 t1 = pave->AddText(cutName);
212 t1->SetTextSize(0.04);
213 t1->SetTextAlign(11);
215 sprintf(cutName,"Vx range: [%f,%f]",fVxMin,fVxMax);
216 t1 = pave->AddText(cutName);
218 t1->SetTextSize(0.04);
219 t1->SetTextAlign(11);
220 sprintf(cutName,"Events rejected: %d",fVx);
221 t1 = pave->AddText(cutName);
223 t1->SetTextSize(0.04);
224 t1->SetTextAlign(11);
226 sprintf(cutName,"Vy range: [%f,%f]",fVyMin,fVyMax);
227 t1 = pave->AddText(cutName);
229 t1->SetTextSize(0.04);
230 t1->SetTextAlign(11);
231 sprintf(cutName,"Events rejected: %d",fVy);
232 t1 = pave->AddText(cutName);
234 t1->SetTextSize(0.04);
235 t1->SetTextAlign(11);
237 sprintf(cutName,"Vz range: [%f,%f]",fVzMin,fVzMax);
238 t1 = pave->AddText(cutName);
240 t1->SetTextSize(0.04);
241 t1->SetTextAlign(11);
242 sprintf(cutName,"Events rejected: %d",fVz);
243 t1 = pave->AddText(cutName);
245 t1->SetTextSize(0.04);
246 t1->SetTextAlign(11);
251 //----------------------------------------//
252 void AliAnalysisEventCuts::GetEventStats()
254 //Returns the total event stats.
255 //fTotalEvents is the total number of events.
256 //fAcceptedEvents is the total number of accepted events.
257 AliInfo(Form("Total number of events: %d",fTotalEvents));
258 AliInfo(Form("Total number of accepted events: %d",fAcceptedEvents));
261 //----------------------------------------//
262 void AliAnalysisEventCuts::GetMultStats()
264 //Gets the multiplicity statistics.
265 //Prints the percentage of events rejected due to this cut.
266 AliInfo(Form("Multiplicity range: [%d,%d]",fMultMin,fMultMax));
267 AliInfo(Form("Events rejected: %d",fMult));
270 //----------------------------------------//
271 void AliAnalysisEventCuts::GetVxStats()
273 //Gets the Vx statistics.
274 //Prints the percentage of events rejected due to this cut.
275 AliInfo(Form("Vx range: [%f,%f]",fVxMin,fVxMax));
276 AliInfo(Form("Events rejected: %d",fVx));
279 //----------------------------------------//
280 void AliAnalysisEventCuts::GetVyStats()
282 //Gets the Vy statistics.
283 //Prints the percentage of events rejected due to this cut.
284 AliInfo(Form("Vy range: [%f,%f]",fVyMin,fVyMax));
285 AliInfo(Form("Events rejected: %d",fVy));
288 //----------------------------------------//
289 void AliAnalysisEventCuts::GetVzStats()
291 //Gets the Vz statistics.
292 //Prints the percentage of events rejected due to this cut.
293 AliInfo(Form("Vz range: [%f,%f]",fVzMin,fVzMax));
294 AliInfo(Form("Events rejected: %d",fVz));
295 AliInfo(Form("Events rejected (Vz flag): %d",fVzFlag));
298 //----------------------------------------//
299 void AliAnalysisEventCuts::PrintEventCuts()
301 //Prints the event stats.
302 //GetEventCuts()->Draw();
304 AliInfo(Form("**************EVENT CUTS**************"));
306 if(fFlagMult) GetMultStats();
307 if(fFlagVx) GetVxStats();
308 if(fFlagVy) GetVyStats();
309 if((fFlagVz)||(fFlagVzType)) GetVzStats();
310 AliInfo(Form("**************************************"));