]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/RESONANCES/AliRsnCutValue.cxx
Fixed all fixable coding conventions violations
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutValue.cxx
index 94d8a0c3b23b313b396ecd15fb15389017d0cfc6..5fe68c16d1a4ac5a4ab67ad2536775894c9e301a 100644 (file)
@@ -1,7 +1,7 @@
 //
 // *** 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
@@ -15,6 +15,7 @@
 // author: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
 //
 
+#include "AliRsnValue.h"
 #include "AliRsnDaughter.h"
 #include "AliRsnMother.h"
 #include "AliRsnEvent.h"
@@ -26,45 +27,37 @@ ClassImp(AliRsnCutValue)
 
 //_________________________________________________________________________________________________
 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());
 }
 
 //_________________________________________________________________________________________________
@@ -75,13 +68,10 @@ AliRsnCutValue& AliRsnCutValue::operator=(const AliRsnCutValue& copy)
 // 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);
 }
 
 //_________________________________________________________________________________________________
@@ -92,23 +82,24 @@ Bool_t AliRsnCutValue::IsSelected(TObject *object)
 // 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();
 }
 
 //_________________________________________________________________________________________________
@@ -118,7 +109,7 @@ void AliRsnCutValue::Print(const Option_t *) const
 // 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));
 }