KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVVGObjectSum.h
Go to the documentation of this file.
1 #ifndef __KVVGOBJECTSUM_H
2 #define __KVVGOBJECTSUM_H
3 
4 #include "KVVarGlob.h"
5 
21 template
22 <class SumObject>
23 class KVVGObjectSum : public KVVarGlob {
24  SumObject fResult;// result of summing objects
25 
26 protected:
27  void Add(const SumObject& obj)
28  {
29  fResult += obj;
30  }
31 public:
33  : KVVarGlob()
34  {}
35  KVVGObjectSum(const Char_t* nom)
36  : KVVarGlob(nom)
37  {}
38  ROOT_COPY_CTOR(KVVGObjectSum, KVVarGlob)
39  ROOT_COPY_ASSIGN_OP(KVVGObjectSum)
40  virtual ~KVVGObjectSum() {}
41  void Copy(TObject& obj) const
42  {
43  KVVarGlob::Copy(obj);
44  dynamic_cast<KVVGObjectSum<SumObject>&>(obj).fResult = fResult;
45  }
46 
47  void Reset()
48  {
50  fResult = SumObject();
51  }
52 
53  const SumObject& GetSumObject() const
54  {
56  return fResult;
57  }
58 
59  ClassDef(KVVGObjectSum, 1) //Global variable calculating sum of objects
60 };
61 
62 #endif
char Char_t
#define ClassDef(name, id)
Global variable calculating sum of objects.
Definition: KVVGObjectSum.h:23
SumObject fResult
Definition: KVVGObjectSum.h:24
void Add(const SumObject &obj)
Definition: KVVGObjectSum.h:27
KVVGObjectSum(const Char_t *nom)
Definition: KVVGObjectSum.h:35
const SumObject & GetSumObject() const
Definition: KVVGObjectSum.h:53
void Copy(TObject &obj) const
Make a copy of this object.
Definition: KVVGObjectSum.h:41
Base class for all global variable implementations.
Definition: KVVarGlob.h:217
void Copy(TObject &obj) const
Make a copy of this object.
Definition: KVVarGlob.h:328