KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVVGObjectSum.h
1#ifndef __KVVGOBJECTSUM_H
2#define __KVVGOBJECTSUM_H
3
4#include "KVVarGlob.h"
5
22template
23<class SumObject>
24class KVVGObjectSum : public KVVarGlob {
25 Int_t fMult;// number of objects summed
26 SumObject fResult;// result of summing objects
27
28protected:
29 void Add(const SumObject& obj)
30 {
31 fResult += obj;
32 ++fMult;
33 }
34public:
36 : KVVarGlob()
37 {}
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.
Int_t GetMult() const
SumObject fResult
void Add(const SumObject &obj)
KVVGObjectSum(const Char_t *nom)
const SumObject & GetSumObject() const
void Copy(TObject &obj) const
Base class for all global variable implementations.
Definition KVVarGlob.h:233
void Copy(TObject &obj) const
Definition KVVarGlob.h:346