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
38 AliError("Object is NULL");
42 // checks if the object is correct by dynamic casting
46 fDaughter = dynamic_cast<AliRsnDaughter*>(object);
53 AliError(Form("[%s] Target mismatch: expected 'AliRsnDaughter', passed '%s'", GetName(), object->ClassName()));
59 fMother = dynamic_cast<AliRsnMother*>(object);
65 AliError(Form("[%s] Target mismatch: expected 'AliRsnMother', passed '%s'", GetName(), object->ClassName()));
72 fEvent = dynamic_cast<AliRsnEvent*>(object);
77 AliError(Form("[%s] Target mismatch: expected 'AliRsnEvent', passed '%s'", GetName(), object->ClassName()));
89 //______________________________________________________________________________
90 Char_t AliRsnTarget::GetTargetTypeChar() const
93 // Returns a single character identifying the cut target type.
98 case kDaughter: return 'D';
99 case kMother: return 'M';
100 case kEvent: return 'E';
105 //______________________________________________________________________________
106 const char* AliRsnTarget::GetTargetTypeName() const
109 // Returns a string with the name of the cut target type-
114 case kDaughter: return "Daughter";
115 case kMother: return "Mother";
116 case kEvent: return "Event";
117 default: return "Undefined";