1 #include "AliEventCut.h"
2 //________________________________
3 ///////////////////////////////////////////////////////////
5 // class AliRunAnalysis
10 ///////////////////////////////////////////////////////////
12 #include <TObjArray.h>
15 #include "AliEventBaseCut.h"
20 AliEventCut::AliEventCut():
26 /*********************************************************/
27 AliEventCut::AliEventCut(const AliEventCut& in):
29 fBaseCuts(in.fBaseCuts)
32 fBaseCuts.SetOwner(kTRUE);
34 /*********************************************************/
36 AliEventCut::~AliEventCut()
41 /*********************************************************/
43 Bool_t AliEventCut::Rejected(AliAOD* aod) const
45 //returns kTRUE if rejected
48 Error("Pass","Pointer to AOD is NULL. Not passed the cut");
52 TIter iter(&fBaseCuts);
53 AliEventBaseCut* becut;
54 while (( becut = (AliEventBaseCut*)iter() ))
56 if (becut->Rejected(aod)) return kTRUE;
60 /*********************************************************/
61 void AliEventCut::AddBasePartCut(AliEventBaseCut* ebcut)
66 Error("AddBasePartCut","Pointer to base cut is NULL");
70 if (ebcut->GetProperty() != AliEventBaseCut::kNone)
72 if (FindCut(ebcut->GetProperty()))
74 Warning("AddBasePartCut","Cut with this property is already in the list of base cuts");
78 fBaseCuts.Add(ebcut->Clone());
81 /*********************************************************/
83 AliEventBaseCut* AliEventCut::FindCut(AliEventBaseCut::EEventCutProperty prop)
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++)
89 AliEventBaseCut* bcut = (AliEventBaseCut*)fBaseCuts.At(i);
90 if (bcut->GetProperty() == prop)
91 return bcut; //we found the cut we were searching for
94 return 0x0; //we did not found this cut
97 /*********************************************************/
99 void AliEventCut::SetNChargedRange(Int_t min,Int_t max,Double_t etamin,Double_t etamax)
101 //Sets renge of number of charged particles
102 AliNChargedCut* cut = dynamic_cast<AliNChargedCut*>(FindCut(AliEventBaseCut::kNChargedCut));
105 cut->SetRange(min,max);
106 cut->SetEtaRange(etamin,etamax);
108 else fBaseCuts.Add(new AliNChargedCut(min,max,etamin,etamax));
110 /*********************************************************/
112 void AliEventCut::SetVertexXRange(Int_t min,Int_t max)
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));
119 /*********************************************************/
121 void AliEventCut::SetVertexYRange(Int_t min,Int_t max)
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));
128 /*********************************************************/
130 void AliEventCut::SetVertexZRange(Int_t min,Int_t max)
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));
137 /*********************************************************/
138 /*********************************************************/
139 /*********************************************************/
141 ClassImp(AliEventEmptyCut)