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()
55 //Sets dummy values to every private member.
64 fVzFlagType = "default";
81 //----------------------------------------//
82 void AliAnalysisEventCuts::SetPrimaryVertexXRange(Float_t r1, Float_t r2)
84 //Sets the primary vertex x range.
90 //----------------------------------------//
91 void AliAnalysisEventCuts::SetPrimaryVertexYRange(Float_t r1, Float_t r2)
93 //Sets the primary vertex y range.
99 //----------------------------------------//
100 void AliAnalysisEventCuts::SetPrimaryVertexZRange(Float_t r1, Float_t r2)
102 //Sets the primary vertex z range.
108 //----------------------------------------//
109 void AliAnalysisEventCuts::SetMultiplicityRange(Int_t n1, Int_t n2)
111 //Sets the multiplicity range.
118 //----------------------------------------//
119 Bool_t AliAnalysisEventCuts::IsAccepted(AliESD *esd)
121 //Returns true if the events is accepted otherwise false.
123 if((esd->GetNumberOfTracks() < fMultMin) || (esd->GetNumberOfTracks() > fMultMax)) {
126 AliInfo(Form("Event rejected due to multiplicity cut"));
129 const AliESDVertex *esdvertex = esd->GetVertex();
130 TString vertexname = esdvertex->GetName();
131 if((esdvertex->GetXv() < fVxMin) || (esdvertex->GetXv() > fVxMax)) {
134 AliInfo(Form("Event rejected due to Vx cut"));
137 if((esdvertex->GetYv() < fVyMin) || (esdvertex->GetYv() > fVyMax)) {
140 AliInfo(Form("Event rejected due to Vy cut"));
143 if((esdvertex->GetZv() < fVzMin) || (esdvertex->GetZv() > fVzMax)) {
146 AliInfo(Form("Event rejected due to Vz cut"));
149 if((fFlagVzType == 1)&&(vertexname == "default")) {
152 AliInfo(Form("Event rejected due to Vz flag cut"));
161 //----------------------------------------//
162 TPaveText *AliAnalysisEventCuts::GetEventCuts()
164 //Shows a TPaveText with all the event cut stats.
165 TCanvas *ccuts = new TCanvas("ccuts","Event cuts",10,10,400,400);
166 ccuts->SetFillColor(10);
167 ccuts->SetHighLightColor(10);
169 TPaveText *pave = new TPaveText(0.01,0.01,0.98,0.98);
170 pave->SetFillColor(5);
173 TLine *l1 = pave->AddLine(0,0.78,1,0.78);
175 TLine *l2 = pave->AddLine(0,0.58,1,0.58);
177 TLine *l3 = pave->AddLine(0,0.38,1,0.38);
179 TLine *l4 = pave->AddLine(0,0.18,1,0.18);
182 sprintf(cutName,"Total number of events: %d",fTotalEvents);
183 TText *t1 = pave->AddText(cutName);
185 t1->SetTextSize(0.04);
186 t1->SetTextAlign(11);
188 sprintf(cutName,"Total number of accepted events: %d",fAcceptedEvents);
189 t1 = pave->AddText(cutName);
191 t1->SetTextSize(0.04);
192 t1->SetTextAlign(11);
194 sprintf(cutName,"Multiplicity range: [%d,%d]",fMultMin,fMultMax);
195 t1 = pave->AddText(cutName);
197 t1->SetTextSize(0.04);
198 t1->SetTextAlign(11);
199 sprintf(cutName,"Events rejected: %d",fMult);
200 t1 = pave->AddText(cutName);
202 t1->SetTextSize(0.04);
203 t1->SetTextAlign(11);
205 sprintf(cutName,"Vx range: [%f,%f]",fVxMin,fVxMax);
206 t1 = pave->AddText(cutName);
208 t1->SetTextSize(0.04);
209 t1->SetTextAlign(11);
210 sprintf(cutName,"Events rejected: %d",fVx);
211 t1 = pave->AddText(cutName);
213 t1->SetTextSize(0.04);
214 t1->SetTextAlign(11);
216 sprintf(cutName,"Vy range: [%f,%f]",fVyMin,fVyMax);
217 t1 = pave->AddText(cutName);
219 t1->SetTextSize(0.04);
220 t1->SetTextAlign(11);
221 sprintf(cutName,"Events rejected: %d",fVy);
222 t1 = pave->AddText(cutName);
224 t1->SetTextSize(0.04);
225 t1->SetTextAlign(11);
227 sprintf(cutName,"Vz range: [%f,%f]",fVzMin,fVzMax);
228 t1 = pave->AddText(cutName);
230 t1->SetTextSize(0.04);
231 t1->SetTextAlign(11);
232 sprintf(cutName,"Events rejected: %d",fVz);
233 t1 = pave->AddText(cutName);
235 t1->SetTextSize(0.04);
236 t1->SetTextAlign(11);
241 //----------------------------------------//
242 void AliAnalysisEventCuts::GetEventStats()
244 //Returns the total event stats.
245 //fTotalEvents is the total number of events.
246 //fAcceptedEvents is the total number of accepted events.
247 AliInfo(Form("Total number of events: %d",fTotalEvents));
248 AliInfo(Form("Total number of accepted events: %d",fAcceptedEvents));
251 //----------------------------------------//
252 void AliAnalysisEventCuts::GetMultStats()
254 //Gets the multiplicity statistics.
255 //Prints the percentage of events rejected due to this cut.
256 AliInfo(Form("Multiplicity range: [%d,%d]",fMultMin,fMultMax));
257 AliInfo(Form("Events rejected: %d",fMult));
260 //----------------------------------------//
261 void AliAnalysisEventCuts::GetVxStats()
263 //Gets the Vx statistics.
264 //Prints the percentage of events rejected due to this cut.
265 AliInfo(Form("Vx range: [%f,%f]",fVxMin,fVxMax));
266 AliInfo(Form("Events rejected: %d",fVx));
269 //----------------------------------------//
270 void AliAnalysisEventCuts::GetVyStats()
272 //Gets the Vy statistics.
273 //Prints the percentage of events rejected due to this cut.
274 AliInfo(Form("Vy range: [%f,%f]",fVyMin,fVyMax));
275 AliInfo(Form("Events rejected: %d",fVy));
278 //----------------------------------------//
279 void AliAnalysisEventCuts::GetVzStats()
281 //Gets the Vz statistics.
282 //Prints the percentage of events rejected due to this cut.
283 AliInfo(Form("Vz range: [%f,%f]",fVzMin,fVzMax));
284 AliInfo(Form("Events rejected: %d",fVz));
285 AliInfo(Form("Events rejected (Vz flag): %d",fVzFlag));
288 //----------------------------------------//
289 void AliAnalysisEventCuts::PrintEventCuts()
291 //Prints the event stats.
292 //GetEventCuts()->Draw();
294 AliInfo(Form("**************EVENT CUTS**************"));
296 if(fFlagMult) GetMultStats();
297 if(fFlagVx) GetVxStats();
298 if(fFlagVy) GetVyStats();
299 if((fFlagVz)||(fFlagVzType)) GetVzStats();
300 AliInfo(Form("**************************************"));