EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MySimpleTree.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MySimpleTree.h
1 #ifndef MYSIMPLETREE_h
2 #define MYSIMPLETREE_h
3 
4 // This class just stores an int and a float. While not needed it is
5 // better in the long run to get used to use methods to get to the
6 // data. It doesn't matter for the root TTree which is saved but if
7 // you save this class inside a TClonesArray (the other example) it
8 // makes it easier. It also allows greater flexibility, e.g. if you ever
9 // want to ("dammit I forgot to multiply myfloat with Pi") modify the
10 // values on the fly:
11 // exchange
12 // float MyFloat() const {return myfloat;}
13 // by
14 // float MyFloat() const {return myfloat*M_PI;}
15 // and you don't have to change your analysis code one bit
16 
17 
18 #include <phool/PHObject.h>
19 
20 class MySimpleTree: public PHObject
21 {
22 
23  public:
24 
25  MySimpleTree();
26  virtual ~MySimpleTree() {}
27 
28  void Reset();
29 
30  void MyFloat(const float f) {myfloat = f;}
31  float MyFloat() const {return myfloat;}
32  void MyInt(const int i) {myint = i;}
33  int MyInt() const {return myint;}
34 
35  protected:
36  int myint;
37  float myfloat;
38 
39  ClassDef(MySimpleTree,1)
40 
41 };
42 
43 #endif