]>
Commit | Line | Data |
---|---|---|
1 | #include "AliEventCut.h" | |
2 | ||
3 | /////////////////////////////////////////////////////////// | |
4 | // | |
5 | // class AliEventCut | |
6 | // | |
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 | /////////////////////////////////////////////////////////// | |
13 | ||
14 | #include "AliEventBaseCut.h" | |
15 | ||
16 | ClassImp(AliEventCut) | |
17 | ||
18 | AliEventCut::AliEventCut(): | |
19 | fBaseCuts(10) | |
20 | { | |
21 | //costructor | |
22 | ||
23 | } | |
24 | /*********************************************************/ | |
25 | AliEventCut::AliEventCut(const AliEventCut& in): | |
26 | TObject(in), | |
27 | fBaseCuts(in.fBaseCuts) | |
28 | { | |
29 | //cpy ctor | |
30 | fBaseCuts.SetOwner(kTRUE); | |
31 | } | |
32 | /*********************************************************/ | |
33 | ||
34 | AliEventCut::~AliEventCut() | |
35 | { | |
36 | //costructor | |
37 | } | |
38 | ||
39 | /*********************************************************/ | |
40 | ||
41 | Bool_t AliEventCut::Rejected(AliAOD* aod) const | |
42 | { | |
43 | //returns kTRUE if rejected | |
44 | if (aod == 0x0) | |
45 | { | |
46 | Error("Pass","Pointer to AOD is NULL. Not passed the cut"); | |
47 | return kFALSE; | |
48 | } | |
49 | ||
50 | TIter iter(&fBaseCuts); | |
51 | AliEventBaseCut* becut; | |
52 | while (( becut = (AliEventBaseCut*)iter() )) | |
53 | { | |
54 | if (becut->Rejected(aod)) return kTRUE; | |
55 | } | |
56 | return kFALSE; | |
57 | } | |
58 | /*********************************************************/ | |
59 | void 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 | ||
68 | if (ebcut->GetProperty() != AliEventBaseCut::kNone) | |
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 | ||
81 | AliEventBaseCut* AliEventCut::FindCut(AliEventBaseCut::EEventCutProperty prop) | |
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 | ||
97 | void AliEventCut::SetNChargedRange(Int_t min,Int_t max,Double_t etamin,Double_t etamax) | |
98 | { | |
99 | //Sets renge of number of charged particles | |
100 | AliNChargedCut* cut = dynamic_cast<AliNChargedCut*>(FindCut(AliEventBaseCut::kNChargedCut)); | |
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 | } | |
108 | /*********************************************************/ | |
109 | ||
110 | void AliEventCut::SetVertexXRange(Double_t min, Double_t max) | |
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 | /*********************************************************/ | |
118 | ||
119 | void AliEventCut::SetVertexYRange(Double_t min, Double_t max) | |
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 | ||
128 | void AliEventCut::SetVertexZRange(Double_t min, Double_t max) | |
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 | } | |
135 | /*********************************************************/ | |
136 | /*********************************************************/ | |
137 | /*********************************************************/ | |
138 | ||
139 | ClassImp(AliEventEmptyCut) |