KaliVeda  1.13/01
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  Int_t fMult;// number of objects summed
25  SumObject fResult;// result of summing objects
26 
27 protected:
28  void Add(const SumObject& obj)
29  {
30  fResult += obj;
31  ++fMult;
32  }
33 public:
35  : KVVarGlob()
36  {}
37  KVVGObjectSum(const Char_t* nom)
38  : KVVarGlob(nom)
39  {}
40  ROOT_COPY_CTOR(KVVGObjectSum, KVVarGlob)
41  ROOT_COPY_ASSIGN_OP(KVVGObjectSum)
42  virtual ~KVVGObjectSum() {}
43  void Copy(TObject& obj) const
44  {
45  KVVarGlob::Copy(obj);
46  dynamic_cast<KVVGObjectSum<SumObject>&>(obj).fResult = fResult;
47  }
48 
49  void Reset()
50  {
52  fResult = SumObject();
53  fMult = 0;
54  }
55 
56  const SumObject& GetSumObject() const
57  {
59  return fResult;
60  }
61 
62  Int_t GetMult() const
63  {
65  return fMult;
66  }
67 
68  ClassDef(KVVGObjectSum, 1) //Global variable calculating sum of objects
69 };
70 
71 #endif
int Int_t
char Char_t
#define ClassDef(name, id)
Global variable calculating sum of objects.
Definition: KVVGObjectSum.h:23
Int_t GetMult() const
Definition: KVVGObjectSum.h:62
SumObject fResult
Definition: KVVGObjectSum.h:25
void Add(const SumObject &obj)
Definition: KVVGObjectSum.h:28
KVVGObjectSum(const Char_t *nom)
Definition: KVVGObjectSum.h:37
const SumObject & GetSumObject() const
Definition: KVVGObjectSum.h:56
void Copy(TObject &obj) const
Make a copy of this object.
Definition: KVVGObjectSum.h:43
Base class for all global variable implementations.
Definition: KVVarGlob.h:231
void Copy(TObject &obj) const
Make a copy of this object.
Definition: KVVarGlob.h:344