]>
Commit | Line | Data |
---|---|---|
e2bafbbc | 1 | // |
2 | // Class AliRsnCutMgr | |
3 | // | |
4 | // The cut manager: contains a complete set of cut definitions | |
5 | // to be applied to all possible targets (one for each target), | |
6 | // in order to ease the set-up procedure of cuts and allow to | |
7 | // pass them at once to each object which must use them | |
8 | // | |
9 | // author: Martin Vala (martin.vala@cern.ch) | |
10 | // | |
11 | ||
06351446 | 12 | #include "AliLog.h" |
13 | ||
14 | #include "AliRsnDaughter.h" | |
e2bafbbc | 15 | #include "AliRsnEvent.h" |
06351446 | 16 | #include "AliRsnCutSet.h" |
17 | #include "AliRsnCutMgr.h" | |
18 | ||
e2bafbbc | 19 | ClassImp (AliRsnCutMgr) |
06351446 | 20 | |
e2bafbbc | 21 | //_____________________________________________________________________________ |
22 | AliRsnCutMgr::AliRsnCutMgr() : | |
23 | TNamed("defaultName", "defaultTitle") | |
06351446 | 24 | { |
e2bafbbc | 25 | // |
26 | // Constructor without arguments. | |
27 | // | |
06351446 | 28 | |
e2bafbbc | 29 | Int_t i; |
30 | for (i = 0; i < AliRsnCut::kLastCutTarget; i++) { | |
31 | fCutSets[i] = 0; | |
32 | } | |
06351446 | 33 | } |
34 | ||
e2bafbbc | 35 | //_____________________________________________________________________________ |
36 | AliRsnCutMgr::AliRsnCutMgr (const char *name, const char *title) : | |
37 | TNamed (name, title) | |
06351446 | 38 | { |
e2bafbbc | 39 | // |
40 | // Constructor with name and title. | |
41 | // | |
06351446 | 42 | |
e2bafbbc | 43 | Int_t i; |
44 | for (i = 0; i < AliRsnCut::kLastCutTarget; i++) { | |
45 | fCutSets[i] = 0; | |
46 | } | |
06351446 | 47 | } |
48 | ||
e2bafbbc | 49 | //_____________________________________________________________________________ |
06351446 | 50 | AliRsnCutMgr::~AliRsnCutMgr() |
51 | { | |
e2bafbbc | 52 | // |
53 | // Destructor. | |
54 | // Deletes all cut definitions. | |
55 | // | |
06351446 | 56 | |
e2bafbbc | 57 | Int_t i; |
58 | for (i = 0; i < AliRsnCut::kLastCutTarget; i++) { | |
59 | delete fCutSets[i]; | |
60 | } | |
06351446 | 61 | } |
62 | ||
e2bafbbc | 63 | //_____________________________________________________________________________ |
64 | void AliRsnCutMgr::SetCutSet (AliRsnCut::ETarget type, AliRsnCutSet* cutset) | |
06351446 | 65 | { |
e2bafbbc | 66 | // |
67 | // Assign a cut set to a given target | |
68 | // | |
06351446 | 69 | |
e2bafbbc | 70 | if (!fCutSets[type]) fCutSets[type] = (AliRsnCutSet*) cutset->Clone(); |
71 | AliDebug (AliLog::kDebug, Form ("DatasetName %s", fCutSets[type]->GetName())); | |
72 | } | |
06351446 | 73 | |
e2bafbbc | 74 | //_____________________________________________________________________________ |
75 | Bool_t AliRsnCutMgr::IsSelected ( AliRsnCut::ETarget type,TObject *obj ) | |
06351446 | 76 | { |
e2bafbbc | 77 | // |
78 | // Check if a given object passes the cuts defined for it. | |
79 | // The target of the check is here a TObject, in order to allo generality | |
80 | // but then the kind of cut to be used is defined as first argument, and | |
81 | // in the single cut it will be checked if it is appropriate for passed target | |
82 | // | |
06351446 | 83 | |
e2bafbbc | 84 | AliDebug (AliLog::kDebug, "<-"); |
85 | if (!fCutSets[type]) return kTRUE; | |
86 | ||
87 | switch (type) { | |
88 | case AliRsnCut::kParticle: | |
89 | return fCutSets[type]->IsSelected (type, (AliRsnDaughter*)obj); | |
90 | break; | |
91 | case AliRsnCut::kPair: | |
92 | return fCutSets[type]->IsSelected (type, (AliRsnPairParticle*)obj); | |
93 | break; | |
94 | case AliRsnCut::kEvent: | |
95 | return fCutSets[type]->IsSelected (type, (AliRsnEvent*)obj); | |
96 | break; | |
97 | default: | |
98 | AliWarning ("Wrong target selected."); | |
99 | return kTRUE; | |
100 | break; | |
101 | } | |
102 | ||
103 | return kTRUE; | |
06351446 | 104 | } |