//
-// Class AliRsnCut
+// *** Class AliRsnCut ***
//
-// General implementation of a single cut strategy, which can be:
-// - a value contained in a given interval [--> IsBetween()]
-// - a value equal to a given reference [--> IsEqual() ]
-// In all cases, the reference value(s) is (are) given as data members
-// and each kind of cut requires a given value type (Int, UInt, Double),
-// but the cut check procedure is then automatized and chosen thanks to
-// an enumeration of the implemented cut types.
-// At the end, the user (or any other point which uses this object) has
-// to use the method IsSelected() to check if this cut has been passed.
+// Cut base class: all other cuts inherit from it.
+// The 'core' of the class is the method "IsSelected()" which
+// must be overloaded by any specific cut implementation.
//
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// This class provides some default instruments to check values
+// against a reference or an allowed range, in order to permit
+// a unique way to execute such kind of checks.
+// Moreover, if one checks values and ranges using default methods
+// a debug message can be printed on request.
+//
+// authors: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// Martin Vala (martin.vala@cern.ch)
//
#ifndef ALIRSNCUT_H
#define ALIRSNCUT_H
-#include "TNamed.h"
-
-class AliRsnDaughter;
-class AliRsnPairParticle;
-class AliRsnPairDef;
-class AliRsnEvent;
-
-class AliRsnCut : public TNamed
-{
- public:
-
- // available cut types
- // some ones work both for pairs and single tracks
- enum EType {
- kMomentum = 0,
- kTransMomentum,
- kEta,
- kRadialImpactParam,
- kMomentumMC,
- kTransMomentumMC,
- kEtaMC,
- kNSigma,
- kNSigmaCalculate,
- kStatus,
- kIsLabelEqual,
- kIsTruePair,
- kIsPrimary,
- kChargePos,
- kChargeNeg,
- kPIDType,
- kPIDProb,
- kMultiplicity,
- kMultiplicityDifference,
- kMultiplicityRatio,
- kPhiMeanDifference,
- kVzDifference,
- kLastCutType
- };
-
- // types of cut variables
- enum EVarType {
- kDouble_t = 0,
- kInt_t,
- kUInt_t
- };
+#include "AliRsnTarget.h"
- // possible targets for a cut
- enum ETarget {
- kParticle = 0,
- kPair,
- kEvent,
- kMixEvent,
- kLastCutTarget
- };
+class AliRsnCut : public AliRsnTarget {
+public:
- AliRsnCut();
- AliRsnCut(const char *name, const char *title, EType type);
- AliRsnCut(const char *name, const char *title, EType type, Double_t min, Double_t max = 1e-100);
- AliRsnCut(const char *name, const char *title, EType type, Int_t min, Int_t max = 32767);
- AliRsnCut(const char *name, const char *title, EType type, UInt_t min, UInt_t max = 65534);
- AliRsnCut(const char *name, const char *title, EType type, ULong_t min, ULong_t max = 65534);
+ AliRsnCut(const char *name = "dummy", RSNTARGET target = AliRsnTarget::kTargetTypes);
+ AliRsnCut(const char *name, RSNTARGET target, Int_t imin, Int_t imax = 0 , Double_t dmin = 0., Double_t dmax = 0.);
+ AliRsnCut(const char *name, RSNTARGET target, Double_t dmin, Double_t dmax = 0., Int_t imin = 0 , Int_t imax = 0);
+ AliRsnCut(const AliRsnCut& copy);
+ AliRsnCut& operator=(const AliRsnCut& copy);
+ virtual ~AliRsnCut() { };
- ~AliRsnCut();
+ Int_t GetMinI() const {return fMinI;}
+ Int_t GetMaxI() const {return fMaxI;}
+ Double_t GetMinD() const {return fMinD;}
+ Double_t GetMaxD() const {return fMaxD;}
+ Int_t GetCutValueI() const {return fCutValueI;}
+ Double_t GetCutValueD() const {return fCutValueD;}
+ Bool_t GetCutResult() const {return fCutResult;}
- void SetCutValues(EType type, const Double_t& theValue, const Double_t& theValue2);
- void SetCutValues(EType type, const Int_t& theValue, const Int_t& theValue2);
- void SetCutValues(EType type, const UInt_t& theValue, const UInt_t& theValue2);
- void SetCutValues(EType type, const ULong_t& theValue, const ULong_t& theValue2);
+ void SetRangeI(Int_t min, Int_t max) {fMinI = min; fMaxI = max;}
+ void SetRangeD(Double_t min, Double_t max) {fMinD = min; fMaxD = max;}
- Bool_t IsSelected(ETarget tgt, AliRsnDaughter *daughter);
- Bool_t IsSelected(ETarget tgt, AliRsnPairParticle *pair);
- Bool_t IsSelected(ETarget tgt, AliRsnEvent *event);
- Bool_t IsSelected(ETarget tgt, AliRsnEvent *ev1, AliRsnEvent *ev2);
+ void SetValueI(Int_t value) {fMinI = value;}
+ void SetValueD(Double_t value) {fMinD = value;}
- void PrintAllValues();
+ Bool_t OkValueI();
+ Bool_t OkRangeI();
+ Bool_t OkValueD();
+ Bool_t OkRangeD();
- Bool_t IsBetween(const Double_t &theValue);
- Bool_t IsBetween(const Int_t &theValue);
- Bool_t MatchesValue(const Int_t &theValue);
- Bool_t MatchesValue(const UInt_t &theValue);
- Bool_t MatchesValue(const ULong_t &theValue);
- Bool_t MatchesValue(const Double_t &theValue);
+ virtual Bool_t IsSelected(TObject *object);
+ virtual void Print(Option_t *opt = "") const;
- private:
+protected:
- Double_t fDMin; // min. double value
- Double_t fDMax; // max. double value
- Int_t fIMin; // min. int value
- Int_t fIMax; // max. int value
- UInt_t fUIMin; // min. uint value
- UInt_t fUIMax; // max. uint value
- ULong_t fULMin; // min. ulong value
- ULong_t fULMax; // max. ulong value
+ Int_t fMinI; // lower edge of INT range or ref. value for INT CUT
+ Int_t fMaxI; // upper edge of INT range (not used for value cuts)
+ Double_t fMinD; // lower edge of DOUBLE range or ref. value for DOUBLE CUT
+ Double_t fMaxD; // upper edge of DOUBLE range (not used for value cuts)
- EType fType; // cut type
- EVarType fVarType; // variable type
+ Int_t fCutValueI; // cut value INT
+ Double_t fCutValueD; // cut value DOUBLE
- static const Double_t fgkDSmallNumber; // small double value
- static const Double_t fgkDBigNumber; // big double value
- static const Int_t fgkIBigNumber; // big int value
+ Bool_t fCutResult; // tells if the cut is passed or not
- ClassDef(AliRsnCut, 1)
+ ClassDef(AliRsnCut, 1)
};
#endif