Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:21:37

0001 #ifndef MYTCLONESARRAY_H__
0002 #define MYTCLONESARRAY_H__
0003 // This is how to store a class inside a TClonesArray, useful for
0004 // e.g. tracks or in general anything where you have many objects per event.
0005 // This class doesn't play the virtual base class inheritance game we do
0006 // for our dst's, so old files won't be readable if you change this class
0007 // root might still be able to read parts of old files but I really 
0008 // wouldn't rely on this
0009 
0010 #include <phool/PHObject.h>
0011 
0012 #include <cmath> // for NAN
0013 
0014 class TClonesArray;
0015 class MySimpleTree;
0016 
0017 class MyTClonesArray : public PHObject
0018 {
0019  public:
0020   MyTClonesArray();
0021   ~MyTClonesArray() override;
0022 
0023   void Reset() override;
0024   MySimpleTree *GetNewItem();
0025   MySimpleTree *GetItem(const unsigned int i) const;
0026   int Entries();
0027   void MyEventInt(const int i) {myeventint = i;}
0028   int MyEventInt() const {return myeventint;}
0029   void MyEventFloat(const float f) {myeventfloat = f;}
0030   float MyEventFloat() const {return myeventfloat;}
0031 
0032  private:
0033   int myeventint = 0;
0034   float myeventfloat = NAN;
0035   TClonesArray *MyTCArray = nullptr;
0036 
0037   ClassDefOverride(MyTClonesArray,1)
0038 };
0039 
0040 #endif /*MYTCLONESARRAY_H__*/