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 //-----------------------------------------------------------------
30 #include <TPaveText.h>
35 #include <TControlBar.h>
36 #include <TRootControlBar.h>
43 #include "AliAnalysisEventCuts.h"
45 ClassImp(AliAnalysisEventCuts)
47 //----------------------------------------//
48 AliAnalysisEventCuts::AliAnalysisEventCuts()
53 //----------------------------------------//
54 AliAnalysisEventCuts::~AliAnalysisEventCuts()
58 //----------------------------------------//
59 void AliAnalysisEventCuts::Reset()
83 //----------------------------------------//
84 void AliAnalysisEventCuts::SetPrimaryVertexXRange(Float_t r1, Float_t r2)
91 //----------------------------------------//
92 void AliAnalysisEventCuts::SetPrimaryVertexYRange(Float_t r1, Float_t r2)
99 //----------------------------------------//
100 void AliAnalysisEventCuts::SetPrimaryVertexZRange(Float_t r1, Float_t r2)
107 //----------------------------------------//
108 void AliAnalysisEventCuts::SetMultiplicityRange(Int_t n1, Int_t n2)
116 //----------------------------------------//
117 Bool_t AliAnalysisEventCuts::IsAccepted(AliESD *esd)
120 if((esd->GetNumberOfTracks() < fMultMin) || (esd->GetNumberOfTracks() > fMultMax))
123 AliInfo(Form("Event rejected due to multiplicity cut"));
126 const AliESDVertex *esdvertex = esd->GetVertex();
127 if((esdvertex->GetXv() < fVxMin) || (esdvertex->GetXv() > fVxMax))
130 AliInfo(Form("Event rejected due to Vx cut"));
133 if((esdvertex->GetYv() < fVyMin) || (esdvertex->GetYv() > fVyMax))
136 AliInfo(Form("Event rejected due to Vy cut"));
139 if((esdvertex->GetZv() < fVzMin) || (esdvertex->GetZv() > fVzMax))
142 AliInfo(Form("Event rejected due to Vz cut"));
151 //----------------------------------------//
152 TPaveText *AliAnalysisEventCuts::GetEventCuts()
154 TCanvas *ccuts = new TCanvas("ccuts","Event cuts",10,10,400,400);
155 ccuts->SetFillColor(10);
156 ccuts->SetHighLightColor(10);
158 TPaveText *pave = new TPaveText(0.01,0.01,0.98,0.98);
159 pave->SetFillColor(5);
162 TLine *l1 = pave->AddLine(0,0.78,1,0.78);
164 TLine *l2 = pave->AddLine(0,0.58,1,0.58);
166 TLine *l3 = pave->AddLine(0,0.38,1,0.38);
168 TLine *l4 = pave->AddLine(0,0.18,1,0.18);
171 sprintf(CutName,"Total number of events: %d",fTotalEvents);
172 TText *t1 = pave->AddText(CutName);
174 t1->SetTextSize(0.04);
175 t1->SetTextAlign(11);
177 sprintf(CutName,"Total number of accepted events: %d",fAcceptedEvents);
178 t1 = pave->AddText(CutName);
180 t1->SetTextSize(0.04);
181 t1->SetTextAlign(11);
183 sprintf(CutName,"Multiplicity range: [%d,%d]",fMultMin,fMultMax);
184 t1 = pave->AddText(CutName);
186 t1->SetTextSize(0.04);
187 t1->SetTextAlign(11);
188 sprintf(CutName,"Events rejected: %d",fMult);
189 t1 = pave->AddText(CutName);
191 t1->SetTextSize(0.04);
192 t1->SetTextAlign(11);
194 sprintf(CutName,"Vx range: [%f,%f]",fVxMin,fVxMax);
195 t1 = pave->AddText(CutName);
197 t1->SetTextSize(0.04);
198 t1->SetTextAlign(11);
199 sprintf(CutName,"Events rejected: %d",fVx);
200 t1 = pave->AddText(CutName);
202 t1->SetTextSize(0.04);
203 t1->SetTextAlign(11);
205 sprintf(CutName,"Vy range: [%f,%f]",fVyMin,fVyMax);
206 t1 = pave->AddText(CutName);
208 t1->SetTextSize(0.04);
209 t1->SetTextAlign(11);
210 sprintf(CutName,"Events rejected: %d",fVy);
211 t1 = pave->AddText(CutName);
213 t1->SetTextSize(0.04);
214 t1->SetTextAlign(11);
216 sprintf(CutName,"Vz range: [%f,%f]",fVzMin,fVzMax);
217 t1 = pave->AddText(CutName);
219 t1->SetTextSize(0.04);
220 t1->SetTextAlign(11);
221 sprintf(CutName,"Events rejected: %d",fVz);
222 t1 = pave->AddText(CutName);
224 t1->SetTextSize(0.04);
225 t1->SetTextAlign(11);
230 //----------------------------------------//
231 void AliAnalysisEventCuts::GetEventStats()
233 AliInfo(Form("Total number of events: %d",fTotalEvents));
234 AliInfo(Form("Total number of accepted events: %d",fAcceptedEvents));
237 //----------------------------------------//
238 void AliAnalysisEventCuts::GetMultStats()
240 AliInfo(Form("Multiplicity range: [%d,%d]",fMultMin,fMultMax));
241 AliInfo(Form("Events rejected: %d",fMult));
244 //----------------------------------------//
245 void AliAnalysisEventCuts::GetVxStats()
247 AliInfo(Form("Vx range: [%f,%f]",fVxMin,fVxMax));
248 AliInfo(Form("Events rejected: %d",fVx));
251 //----------------------------------------//
252 void AliAnalysisEventCuts::GetVyStats()
254 AliInfo(Form("Vy range: [%f,%f]",fVyMin,fVyMax));
255 AliInfo(Form("Events rejected: %d",fVy));
258 //----------------------------------------//
259 void AliAnalysisEventCuts::GetVzStats()
261 AliInfo(Form("Vz range: [%f,%f]",fVzMin,fVzMax));
262 AliInfo(Form("Events rejected: %d",fVz));
265 //----------------------------------------//
266 void AliAnalysisEventCuts::PrintEventCuts()
269 TControlBar *menu1 = new TControlBar("vertical","Event Cuts",10,10);
270 menu1->AddButton("Event statistics","GetEventStats()","Displays the event statistics");
271 menu1->AddButton("Multipicity cut","gAlice->Run()","Events rejected due to multiplicity cut");
272 menu1->AddButton("Vx cut","gAlice->RunLego()","Events rejected due to Vx cut");
273 menu1->AddButton("Vy cut","DrawTopView()","Events rejected due to Vy cut");
274 menu1->AddButton("Vz cut","DrawSideView()","Events rejected due to Vz cut");
277 gROOT->SaveContext(); */
279 //GetEventCuts()->Draw();
281 AliInfo(Form("**************EVENT CUTS**************"));
291 AliInfo(Form("**************************************"));