AliPhysics  1909eaa (1909eaa)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliCutValueRange.h
Go to the documentation of this file.
1 #ifndef ALICUTVALUERANGE_H
2 #define ALICUTVALUERANGE_H
3 /* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice */
5 
6 #include <iosfwd>
7 #include <TObject.h>
8 
9 namespace EMCalTriggerPtAnalysis{
10 
11 template<typename t>
13 
14 template<typename t>
15 std::ostream &operator<<(std::ostream &stream, const AliCutValueRange<t> &val);
16 
30 template<typename t>
31 class AliCutValueRange : public TObject {
32 public:
43  AliCutValueRange(t min, t max);
50  AliCutValueRange(t limit, bool isUpper);
54  virtual ~AliCutValueRange() {}
55 
56  friend std::ostream &operator<< <>(std::ostream &stream, const AliCutValueRange<t> &val);
57 
58  void SetLimits(t min, t max){
59  fLimits[0] = min;
60  fLimits[1] = max;
61  fHasLimit[0] = fHasLimit[1] = true;
62  }
63  void UnsetLimits(){ fHasLimit[0] = fHasLimit[1] = false; }
69  void SetLimit(t value, bool isUpper){
70  int bin = isUpper ? 1 : 0;
71  fLimits[bin] = value;
72  fHasLimit[bin] = true;
73  }
78  void UnsetLimit(bool isUpper){
79  int bin = isUpper ? 1 : 0;
80  fHasLimit[bin] = false;
81  }
85  void Negate() { fNegate = true; }
89  void SetPositive() { fNegate = false; }
94  void SetUseLargerEqual(Bool_t doUse = true) { fUseLargerEqual = doUse; }
99  void SetUseSmallerEqual(Bool_t doUse = true) { fUseSmallerEqual = doUse; }
106  bool IsInRange(t value) const;
111  t GetMinimum() const { return fLimits[0]; }
116  t GetMaximum() const { return fLimits[1]; }
117 
122  void PrintStream(std::ostream &stream) const;
123 
124 private:
125  t fLimits[2];
126  bool fHasLimit[2];
127  bool fNegate;
130 
132  ClassDef(AliCutValueRange, 1); // Value range for cuts
134 };
135 
136 }
137 
138 #endif
void SetLimit(t value, bool isUpper)
bool fUseSmallerEqual
Use smaller equal for upper bound (true by default)
void PrintStream(std::ostream &stream) const
bool fUseLargerEqual
Use larger equal for lower bound (true by default)
t fLimits[2]
Specifies the limit in either of the direction (not used unless fHasLimit of that direction is true) ...
bool fNegate
Defines whether result should be inverted.
Class containing a range for a value to cut on.
void SetUseSmallerEqual(Bool_t doUse=true)
bool Bool_t
Definition: External.C:53
bool fHasLimit[2]
Specifies whether limit in any of the two directions is set.