//
// *** Class AliRsnCutValue ***
//
-// This cut implementation can be used to cut generically on
+// This cut implementation can be used to cut generically on
// any value which can be computed from AliRsnValue class.
// Since that value is implemented always as a Double_t one,
// then this cut operates only with the Double_t data members
// author: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
//
+#include "AliRsnValue.h"
#include "AliRsnDaughter.h"
#include "AliRsnMother.h"
#include "AliRsnEvent.h"
//_________________________________________________________________________________________________
AliRsnCutValue::AliRsnCutValue() :
- AliRsnCut(),
- fValue(),
- fPairDef(0x0)
+ AliRsnCut(),
+ fValue(0x0)
{
//
// Default constructor.
//
-
- SetTargetType(fValue.GetTargetType());
}
//_________________________________________________________________________________________________
AliRsnCutValue::AliRsnCutValue
-(const char *name, AliRsnValue::EValueType type, Double_t min, Double_t max, AliRsnPairDef *pd) :
- AliRsnCut(name, AliRsnTarget::kTargetTypes, min, max),
- fValue(Form("val_%s", name), type),
- fPairDef(pd)
+(const char *name, Double_t min, Double_t max) :
+ AliRsnCut(name, AliRsnTarget::kTargetTypes, min, max),
+ fValue(0x0)
{
//
// Main constructor.
-// Recalls the setter for the value type of the AliRsnValue data member,
-// which determines also the type of target to be expected
+// Sets the AliRsnValue data member accordingly to arguments passed here.
+// NOTE: if the value needs a support object, it must be passed separately
+// using the GetValueObje() of this class
//
-
- SetTargetType(fValue.GetTargetType());
}
//_________________________________________________________________________________________________
AliRsnCutValue::AliRsnCutValue(const AliRsnCutValue& copy) :
- AliRsnCut(copy),
- fValue(copy.fValue),
- fPairDef(copy.fPairDef)
+ AliRsnCut(copy),
+ fValue(copy.fValue)
{
//
// Copy constructor.
// Does not duplicate memory allocation.
//
-
- SetTargetType(fValue.GetTargetType());
}
//_________________________________________________________________________________________________
// Does not duplicate memory allocation.
//
- AliRsnCut::operator=(copy);
-
- fValue = copy.fValue;
- fPairDef = copy.fPairDef;
- SetTargetType(fValue.GetTargetType());
-
- return (*this);
+ AliRsnCut::operator=(copy);
+ fValue = copy.fValue;
+
+ return (*this);
}
//_________________________________________________________________________________________________
// Calls the AliRsnValue::Eval() method and then checks its output.
//
- // make sure that target of this object matches that
- // of the inserted value object
- SetTargetType(fValue.GetTargetType());
-
- // try to compute values
- Bool_t success = fValue.Eval(object);
-
- // check success
- if (!success)
- {
- AliWarning(Form("[%s] Failed to compute value", GetName()));
- return kFALSE;
- }
-
- // check in range
- fCutValueD = fValue.GetComputedValue();
- return OkRangeD();
+ // skip cut if value is not initialized
+ if (!fValue) return kTRUE;
+
+ // match target types
+ SetTargetType(fValue->GetTargetType());
+
+ // try to compute values
+ Bool_t success = fValue->Eval(object);
+
+ // check success
+ if (!success) {
+ AliWarning(Form("[%s] Failed to compute value", GetName()));
+ return kFALSE;
+ }
+
+ // check in range
+ fCutValueD = fValue->GetComputedValue();
+ return OkRangeD();
}
//_________________________________________________________________________________________________
// Print information on this cut
//
- AliInfo(Form("Cut name : %s", GetName()));
- AliInfo(Form("Cut value : %s", fValue.GetValueTypeName()));
- AliInfo(Form("Cut range : %f - %f", fMinD, fMaxD));
+ AliInfo(Form("Cut name : %s", GetName()));
+ AliInfo(Form("Cut value : %s", fValue->GetName()));
+ AliInfo(Form("Cut range : %f - %f", fMinD, fMaxD));
}