]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/AliEventCut.cxx
Base Particle Cuts moved to the separate file. Property eneum defined namespace of...
[u/mrichter/AliRoot.git] / ANALYSIS / AliEventCut.cxx
CommitLineData
b26900d0 1#include "AliEventCut.h"
2//________________________________
3///////////////////////////////////////////////////////////
4//
5// class AliRunAnalysis
6//
7//
8//
9//
10///////////////////////////////////////////////////////////
11
12#include <TObjArray.h>
13//#include <TIter.h>
14
b4fb427e 15#include "AliEventBaseCut.h"
b26900d0 16
0d8a4589 17ClassImp(AliEventCut)
18
19
b26900d0 20AliEventCut::AliEventCut():
0d8a4589 21 fBaseCuts(10)
b26900d0 22{
23//costructor
24
25}
26/*********************************************************/
0d8a4589 27AliEventCut::AliEventCut(const AliEventCut& in):
28 TObject(in),
29 fBaseCuts(in.fBaseCuts)
30{
31 //cpy ctor
32 fBaseCuts.SetOwner(kTRUE);
33}
34/*********************************************************/
b26900d0 35
36AliEventCut::~AliEventCut()
37{
38//costructor
b26900d0 39}
40
41/*********************************************************/
42
cea0a066 43Bool_t AliEventCut::Rejected(AliAOD* aod) const
b26900d0 44{
45 //returns kTRUE if rejected
a5556ea5 46 if (aod == 0x0)
47 {
48 Error("Pass","Pointer to AOD is NULL. Not passed the cut");
49 return kFALSE;
50 }
51
0d8a4589 52 TIter iter(&fBaseCuts);
b4fb427e 53 AliEventBaseCut* becut;
54 while (( becut = (AliEventBaseCut*)iter() ))
b26900d0 55 {
cea0a066 56 if (becut->Rejected(aod)) return kTRUE;
b26900d0 57 }
58 return kFALSE;
59}
a94c0b01 60/*********************************************************/
61void AliEventCut::AddBasePartCut(AliEventBaseCut* ebcut)
62{
63//Adds a base cut
64 if (ebcut == 0x0)
65 {
66 Error("AddBasePartCut","Pointer to base cut is NULL");
67 return;
68 }
69
41d658c5 70 if (ebcut->GetProperty() != AliEventBaseCut::kNone)
a94c0b01 71 {
72 if (FindCut(ebcut->GetProperty()))
73 {
74 Warning("AddBasePartCut","Cut with this property is already in the list of base cuts");
75 }
76 }
77
78 fBaseCuts.Add(ebcut->Clone());
79
80}
81/*********************************************************/
82
41d658c5 83AliEventBaseCut* AliEventCut::FindCut(AliEventBaseCut::EEventCutProperty prop)
a94c0b01 84{
85//Finds and returns pointer to the cut with given property
86 Int_t n = fBaseCuts.GetEntries();
87 for (Int_t i = 0; i<n; i++)
88 {
89 AliEventBaseCut* bcut = (AliEventBaseCut*)fBaseCuts.At(i);
90 if (bcut->GetProperty() == prop)
91 return bcut; //we found the cut we were searching for
92 }
93
94 return 0x0; //we did not found this cut
95
96}
97/*********************************************************/
98
99void AliEventCut::SetNChargedRange(Int_t min,Int_t max,Double_t etamin,Double_t etamax)
100{
101 //Sets renge of number of charged particles
41d658c5 102 AliNChargedCut* cut = dynamic_cast<AliNChargedCut*>(FindCut(AliEventBaseCut::kNChargedCut));
a94c0b01 103 if(cut)
104 {
105 cut->SetRange(min,max);
106 cut->SetEtaRange(etamin,etamax);
107 }
108 else fBaseCuts.Add(new AliNChargedCut(min,max,etamin,etamax));
109}
2d544686 110/*********************************************************/
111
0a4cc279 112void AliEventCut::SetVertexXRange(Double_t min, Double_t max)
2d544686 113{
114 //Sets range of z coordinate of a primary vertex
115 AliEventBaseCut* cut = FindCut(AliEventBaseCut::kPrimVertexXCut);
116 if (cut) cut->SetRange(min,max);
117 else fBaseCuts.Add(new AliPrimVertexXCut(min,max));
118}
119/*********************************************************/
0d8a4589 120
0a4cc279 121void AliEventCut::SetVertexYRange(Double_t min, Double_t max)
2d544686 122{
123 //Sets range of z coordinate of a primary vertex
124 AliEventBaseCut* cut = FindCut(AliEventBaseCut::kPrimVertexYCut);
125 if (cut) cut->SetRange(min,max);
126 else fBaseCuts.Add(new AliPrimVertexYCut(min,max));
127}
128/*********************************************************/
129
0a4cc279 130void AliEventCut::SetVertexZRange(Double_t min, Double_t max)
2d544686 131{
132 //Sets range of z coordinate of a primary vertex
133 AliEventBaseCut* cut = FindCut(AliEventBaseCut::kPrimVertexZCut);
134 if (cut) cut->SetRange(min,max);
135 else fBaseCuts.Add(new AliPrimVertexZCut(min,max));
136}
0d8a4589 137/*********************************************************/
138/*********************************************************/
139/*********************************************************/
140
b4fb427e 141ClassImp(AliEventEmptyCut)