]>
Commit | Line | Data |
---|---|---|
69fbb331 | 1 | // |
2 | // Class AliRsnCutValue | |
3 | // | |
4 | // General implementation of a single cut strategy, which can be: | |
5 | // - a value contained in a given interval [--> IsBetween() ] | |
6 | // - a value equal to a given reference [--> MatchesValue()] | |
7 | // | |
8 | // In all cases, the reference value(s) is (are) given as data members | |
9 | // and each kind of cut requires a given value type (Int, UInt, Double), | |
10 | // but the cut check procedure is then automatized and chosen thanks to | |
11 | // an enumeration of the implemented cut types. | |
12 | // At the end, the user (or any other point which uses this object) has | |
13 | // to use the method IsSelected() to check if this cut has been passed. | |
14 | // | |
15 | // authors: Martin Vala (martin.vala@cern.ch) | |
16 | // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) | |
17 | // | |
18 | ||
19 | #include <TMath.h> | |
20 | #include <TLorentzVector.h> | |
21 | ||
22 | #include "AliStack.h" | |
23 | #include "AliMCEvent.h" | |
24 | #include "AliRsnDaughter.h" | |
25 | #include "AliRsnMother.h" | |
26 | #include "AliRsnEvent.h" | |
27 | #include "AliRsnValue.h" | |
28 | ||
29 | #include "AliRsnCutValue.h" | |
30 | ||
31 | ClassImp(AliRsnCutValue) | |
32 | ||
33 | //_________________________________________________________________________________________________ | |
34 | AliRsnCutValue::AliRsnCutValue() : | |
35 | AliRsnCut(), | |
36 | fValue(), | |
37 | fPairDef(0x0) | |
38 | { | |
39 | // | |
40 | // Default constructor. | |
41 | // | |
42 | } | |
43 | ||
44 | //_________________________________________________________________________________________________ | |
45 | AliRsnCutValue::AliRsnCutValue | |
46 | (const char *name, ETarget target, Double_t min, Double_t max, AliRsnPairDef *pd) : | |
47 | AliRsnCut(name, target, min, max), | |
48 | fValue(Form("val_%s", name), AliRsnValue::kValueTypes), | |
49 | fPairDef(pd) | |
50 | { | |
51 | // | |
52 | // Main constructor. | |
53 | // | |
54 | } | |
55 | ||
56 | //_________________________________________________________________________________________________ | |
57 | AliRsnCutValue::AliRsnCutValue(const AliRsnCutValue& copy) : | |
58 | AliRsnCut(copy), | |
59 | fValue(copy.fValue), | |
60 | fPairDef(copy.fPairDef) | |
61 | { | |
62 | // | |
63 | // Copy constructor | |
64 | // | |
65 | } | |
66 | ||
67 | //_________________________________________________________________________________________________ | |
68 | AliRsnCutValue& AliRsnCutValue::operator=(const AliRsnCutValue& copy) | |
69 | { | |
70 | // | |
71 | // Assignment operator | |
72 | // | |
73 | ||
74 | (*this) = copy; | |
75 | fValue = copy.fValue; | |
76 | fPairDef = copy.fPairDef; | |
77 | ||
78 | return (*this); | |
79 | } | |
80 | ||
81 | //_________________________________________________________________________________________________ | |
82 | Bool_t AliRsnCutValue::IsSelected(TObject *obj1, TObject * /*obj2*/) | |
83 | { | |
84 | // | |
85 | // Checks the cut. | |
86 | // Calls the appropriate AliRsnValue::Eval() method | |
87 | // depending on the type of passed object. | |
88 | // It is up to the user to be sure that the association is meaningful | |
89 | // | |
90 | ||
91 | AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(obj1); | |
92 | AliRsnMother *mother = dynamic_cast<AliRsnMother*>(obj1); | |
93 | ||
94 | if (daughter) | |
95 | { | |
96 | if (!fValue.Eval(daughter, fEvent)) return kFALSE; | |
97 | fCutValueD = fValue.GetValue(); | |
98 | } | |
99 | else if (mother) | |
100 | { | |
101 | if (!fValue.Eval(mother, fPairDef, fEvent)) return kFALSE; | |
102 | fCutValueD = fValue.GetValue(); | |
103 | } | |
104 | ||
105 | return OkRangeD(); | |
106 | } |