![]() |
|
|||
File indexing completed on 2025-08-05 08:21:37
0001 #ifndef MYSIMPLETREE_h 0002 #define MYSIMPLETREE_h 0003 0004 // This class just stores an int and a float. While not needed it is 0005 // better in the long run to get used to use methods to get to the 0006 // data. It doesn't matter for the root TTree which is saved but if 0007 // you save this class inside a TClonesArray (the other example) it 0008 // makes it easier. It also allows greater flexibility, e.g. if you ever 0009 // want to ("dammit I forgot to multiply myfloat with Pi") modify the 0010 // values on the fly: 0011 // exchange 0012 // float MyFloat() const {return myfloat;} 0013 // by 0014 // float MyFloat() const {return myfloat*M_PI;} 0015 // and you don't have to change your analysis code one bit 0016 0017 0018 #include <phool/PHObject.h> 0019 0020 #include <cmath> // for NAN 0021 0022 class MySimpleTree: public PHObject 0023 { 0024 0025 public: 0026 0027 MySimpleTree(); 0028 ~MySimpleTree() override {} 0029 0030 void Reset() override; 0031 0032 void MyFloat(const float f) {myfloat = f;} 0033 float MyFloat() const {return myfloat;} 0034 void MyInt(const int i) {myint = i;} 0035 int MyInt() const {return myint;} 0036 0037 private: 0038 int myint = -9999; 0039 float myfloat = NAN; 0040 0041 ClassDefOverride(MySimpleTree,1) 0042 0043 }; 0044 0045 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |