KaliVeda
Toolkit for HIC analysis
KVVGObjectSum.h
1 #ifndef __KVVGOBJECTSUM_H
2 #define __KVVGOBJECTSUM_H
3 
4 #include "KVVarGlob.h"
5 
22 template
23 <class SumObject>
24 class KVVGObjectSum : public KVVarGlob {
25  Int_t fMult;// number of objects summed
26  SumObject fResult;// result of summing objects
27 
28 protected:
29  void Add(const SumObject& obj)
30  {
31  fResult += obj;
32  ++fMult;
33  }
34 public:
36  : KVVarGlob()
37  {}
38  KVVGObjectSum(const Char_t* nom)
39  : KVVarGlob(nom)
40  {}
41  ROOT_COPY_CTOR(KVVGObjectSum, KVVarGlob)
42  ROOT_COPY_ASSIGN_OP(KVVGObjectSum)
43  virtual ~KVVGObjectSum() {}
44  void Copy(TObject& obj) const
45  {
46  KVVarGlob::Copy(obj);
47  dynamic_cast<KVVGObjectSum<SumObject>&>(obj).fResult = fResult;
48  }
49 
50  void Reset()
51  {
53  fResult = SumObject();
54  fMult = 0;
55  }
56 
57  const SumObject& GetSumObject() const
58  {
60  return fResult;
61  }
62 
63  Int_t GetMult() const
64  {
66  return fMult;
67  }
68 
69  ClassDef(KVVGObjectSum, 1) //Global variable calculating sum of objects
70 };
71 
72 #endif
int Int_t
char Char_t
#define ClassDef(name, id)
Global variable calculating sum of objects.
Definition: KVVGObjectSum.h:24
Int_t GetMult() const
Definition: KVVGObjectSum.h:63
SumObject fResult
Definition: KVVGObjectSum.h:26
void Add(const SumObject &obj)
Definition: KVVGObjectSum.h:29
KVVGObjectSum(const Char_t *nom)
Definition: KVVGObjectSum.h:38
const SumObject & GetSumObject() const
Definition: KVVGObjectSum.h:57
void Copy(TObject &obj) const
Definition: KVVGObjectSum.h:44
Base class for all global variable implementations.
Definition: KVVarGlob.h:233
void Copy(TObject &obj) const
Definition: KVVarGlob.h:346