Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MyTClonesArray.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MyTClonesArray.h
1 #ifndef MYTCLONESARRAY_H__
2 #define MYTCLONESARRAY_H__
3 // This is how to store a class inside a TClonesArray, useful for
4 // e.g. tracks or in general anything where you have many objects per event.
5 // This class doesn't play the virtual base class inheritance game we do
6 // for our dst's, so old files won't be readable if you change this class
7 // root might still be able to read parts of old files but I really
8 // wouldn't rely on this
9 
10 #include <phool/PHObject.h>
11 
12 #include <cmath> // for NAN
13 
14 class TClonesArray;
15 class MySimpleTree;
16 
17 class MyTClonesArray : public PHObject
18 {
19  public:
21  ~MyTClonesArray() override;
22 
23  void Reset() override;
25  MySimpleTree *GetItem(const unsigned int i) const;
26  int Entries();
27  void MyEventInt(const int i) {myeventint = i;}
28  int MyEventInt() const {return myeventint;}
29  void MyEventFloat(const float f) {myeventfloat = f;}
30  float MyEventFloat() const {return myeventfloat;}
31 
32  private:
33  int myeventint = 0;
34  float myeventfloat = NAN;
35  TClonesArray *MyTCArray = nullptr;
36 
37  ClassDefOverride(MyTClonesArray,1)
38 };
39 
40 #endif /*MYTCLONESARRAY_H__*/