2 // *** Class AliRsnTarget ***
4 // Base class used wherever it is needed to check the class type of
5 // an object (daughter, mother, event) which could be used for
6 // cut checking or value computing.
7 // Since most of these operation are implemented into classes that
8 // operate on any of such objects, then this class helps in making sure
9 // that the object being processed corresponds to what is expected.
14 #include "AliRsnDaughter.h"
15 #include "AliRsnMother.h"
17 #include "AliRsnTarget.h"
19 ClassImp(AliRsnTarget)
21 AliRsnEvent* AliRsnTarget::fgCurrentEvent = 0x0;
23 const Double_t AliRsnTarget::fgkVeryBig = 1E+10;
24 const Double_t AliRsnTarget::fgkVerySmall = 1E-10;
26 //_____________________________________________________________________________
27 Bool_t AliRsnTarget::TargetOK(TObject *object)
30 // This method compares the target type stored as data member
31 // with the type of the object passed as argument, and returns
32 // kTRUE or kFALSE depending if they match or not.
35 // fails by default if a NULL pointer is passed
37 AliError("Object is NULL");
41 // checks if the object is correct by dynamic casting
42 switch (fTargetType) {
44 fDaughter = dynamic_cast<AliRsnDaughter*>(object);
50 AliError(Form("[%s] Target mismatch: expected 'AliRsnDaughter', passed '%s'", GetName(), object->ClassName()));
56 fMother = dynamic_cast<AliRsnMother*>(object);
61 AliError(Form("[%s] Target mismatch: expected 'AliRsnMother', passed '%s'", GetName(), object->ClassName()));
68 fEvent = dynamic_cast<AliRsnEvent*>(object);
72 AliError(Form("[%s] Target mismatch: expected 'AliRsnEvent', passed '%s'", GetName(), object->ClassName()));
84 //______________________________________________________________________________
85 Char_t AliRsnTarget::GetTargetTypeChar() const
88 // Returns a single character identifying the cut target type.
91 switch (fTargetType) {
92 case kDaughter: return 'D';
93 case kMother: return 'M';
94 case kEvent: return 'E';
99 //______________________________________________________________________________
100 const char* AliRsnTarget::GetTargetTypeName() const
103 // Returns a string with the name of the cut target type-
106 switch (fTargetType) {
107 case kDaughter: return "Daughter";
108 case kMother: return "Mother";
109 case kEvent: return "Event";
110 default: return "Undefined";