]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnCutMgr.cxx
Renamed classes: these with old name are removed and newly named will be added in...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutMgr.cxx
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
12 #include "AliLog.h"
13
14 #include "AliRsnDaughter.h"
15 #include "AliRsnEvent.h"
16 #include "AliRsnCutSet.h"
17 #include "AliRsnCutMgr.h"
18
19 ClassImp (AliRsnCutMgr)
20
21 //_____________________________________________________________________________
22 AliRsnCutMgr::AliRsnCutMgr() :
23   TNamed("defaultName", "defaultTitle")
24 {
25 //
26 // Constructor without arguments.
27 //
28
29     Int_t i;
30     for (i = 0; i < AliRsnCut::kLastCutTarget; i++) {
31         fCutSets[i] = 0;
32     }
33 }
34
35 //_____________________________________________________________________________
36 AliRsnCutMgr::AliRsnCutMgr (const char *name, const char *title) :
37   TNamed (name, title)
38 {
39 //
40 // Constructor with name and title.
41 //
42
43     Int_t i;
44     for (i = 0; i < AliRsnCut::kLastCutTarget; i++) {
45         fCutSets[i] = 0;
46     }
47 }
48
49 //_____________________________________________________________________________
50 AliRsnCutMgr::~AliRsnCutMgr()
51 {
52 //
53 // Destructor.
54 // Deletes all cut definitions.
55 //
56
57     Int_t i;
58     for (i = 0; i < AliRsnCut::kLastCutTarget; i++) {
59         delete fCutSets[i];
60     }
61 }
62
63 //_____________________________________________________________________________
64 void AliRsnCutMgr::SetCutSet (AliRsnCut::ETarget type, AliRsnCutSet* cutset)
65 {
66 //
67 // Assign a cut set to a given target
68 //
69
70     if (!fCutSets[type]) fCutSets[type] = (AliRsnCutSet*) cutset->Clone();
71     AliDebug (AliLog::kDebug, Form ("DatasetName %s", fCutSets[type]->GetName()));
72 }
73
74 //_____________________________________________________________________________
75 Bool_t AliRsnCutMgr::IsSelected ( AliRsnCut::ETarget type,TObject *obj )
76 {
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 //
83
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;
104 }