1 #include "AliEventCut.h"
3 ///////////////////////////////////////////////////////////
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
12 ///////////////////////////////////////////////////////////
14 #include "AliEventBaseCut.h"
18 AliEventCut::AliEventCut():
24 /*********************************************************/
25 AliEventCut::AliEventCut(const AliEventCut& in):
27 fBaseCuts(in.fBaseCuts)
30 fBaseCuts.SetOwner(kTRUE);
32 /*********************************************************/
34 AliEventCut::~AliEventCut()
39 /*********************************************************/
41 Bool_t AliEventCut::Rejected(AliAOD* aod) const
43 //returns kTRUE if rejected
46 Error("Pass","Pointer to AOD is NULL. Not passed the cut");
50 TIter iter(&fBaseCuts);
51 AliEventBaseCut* becut;
52 while (( becut = (AliEventBaseCut*)iter() ))
54 if (becut->Rejected(aod)) return kTRUE;
58 /*********************************************************/
59 void AliEventCut::AddBasePartCut(AliEventBaseCut* ebcut)
64 Error("AddBasePartCut","Pointer to base cut is NULL");
68 if (ebcut->GetProperty() != AliEventBaseCut::kNone)
70 if (FindCut(ebcut->GetProperty()))
72 Warning("AddBasePartCut","Cut with this property is already in the list of base cuts");
76 fBaseCuts.Add(ebcut->Clone());
79 /*********************************************************/
81 AliEventBaseCut* AliEventCut::FindCut(AliEventBaseCut::EEventCutProperty prop)
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++)
87 AliEventBaseCut* bcut = (AliEventBaseCut*)fBaseCuts.At(i);
88 if (bcut->GetProperty() == prop)
89 return bcut; //we found the cut we were searching for
92 return 0x0; //we did not found this cut
95 /*********************************************************/
97 void AliEventCut::SetNChargedRange(Int_t min,Int_t max,Double_t etamin,Double_t etamax)
99 //Sets renge of number of charged particles
100 AliNChargedCut* cut = dynamic_cast<AliNChargedCut*>(FindCut(AliEventBaseCut::kNChargedCut));
103 cut->SetRange(min,max);
104 cut->SetEtaRange(etamin,etamax);
106 else fBaseCuts.Add(new AliNChargedCut(min,max,etamin,etamax));
108 /*********************************************************/
110 void AliEventCut::SetVertexXRange(Double_t min, Double_t max)
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));
117 /*********************************************************/
119 void AliEventCut::SetVertexYRange(Double_t min, Double_t max)
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));
126 /*********************************************************/
128 void AliEventCut::SetVertexZRange(Double_t min, Double_t max)
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));
135 /*********************************************************/
136 /*********************************************************/
137 /*********************************************************/
139 ClassImp(AliEventEmptyCut)