rivet is hosted by Hepforge, IPPP Durham
Rivet  2.7.0
SingleValueProjection.hh
1 // -*- C++ -*-
2 #ifndef RIVET_SINGLEVALUEPROJECTION_HH
3 #define RIVET_SINGLEVALUEPROJECTION_HH
4 
5 #include "Rivet/Projection.hh"
6 
7 namespace Rivet {
8 
19 
20 public:
21 
23  SingleValueProjection() : _value(-1.0), _isSet(false) {
24  setName("SingleValueProjection");
25  }
26 
28  bool isSet() const {
29  return _isSet;
30  }
31 
33  double operator()() const {
34  return _value;
35  }
36 
37 protected:
38 
40  void set(double v) {
41  _value = v;
42  _isSet = true;
43  }
44 
45 
47  void clear() {
48  _value = -1.0;
49  _isSet = false;
50  }
51 
52 private:
53 
54  double _value;
55 
56  bool _isSet;
57 
58 };
59 
60 }
61 
62 #endif
63 
void setName(const std::string &name)
Used by derived classes to set their name.
Definition: Projection.hh:133
Definition: ALICE_2010_I880049.cc:13
Base class for projections returning a single floating point value.
Definition: SingleValueProjection.hh:18
bool isSet() const
Returns true if the value has been set.
Definition: SingleValueProjection.hh:28
SingleValueProjection()
The default constructor.
Definition: SingleValueProjection.hh:23
double operator()() const
Return the single value.
Definition: SingleValueProjection.hh:33
Base class for all Rivet projections.
Definition: Projection.hh:29
void clear()
Unset the value.
Definition: SingleValueProjection.hh:47