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