TTree and custom classes

Hi,
I’m working on a project where I store data in a custom class and store the object in a TTree for later access and processing. My custom class extends off TObject, includes the ClassDef and ClassImp functions, along with functions to modify and/or retrieve stored data (which includes Int_t, Double_t, string, and vector).
The problem I’m running into is that after associating the object with a branch, saving data to the object, calling Fill() and Write(), no data is saved.
Without posting the full code (I can post full code if needed), this is what I roughly have:

TFile *Events = new TFile("CoreasEvents.root", "RECREATE");
  if(Events->IsOpen())
{
      CoreasEvent *testEvent = new CoreasEvent;
      TTree *eventTree = new TTree("Event List", "Collection of CoreasEvent Objects" );
      eventTree->Branch("CoreasEvent", "CoreasEvent", &testEvent, 64000, 99);
      //code for grabbing and storing into testEvent object
      eventTree->Fill();
      eventTree->Write("eventTree");
}

I’ve been compiling the code using CINT if it matters at all.
I’ve looked through various tutorials on how to use TTree with custom objects but I can’t find out what’s wrong with my code. Any help would be appreciated.

Maybe you could try:
root [0] TFile *f = TFile::Open(“CoreasEvents.root”);
root [1] f->ls();
root [2] eventTree->Print();

Hi,
That method was one of the methods I used to verify no data was saved. One curious thing though is that the structure of the object is saved, but not the data it contains.
Just in case though, this is how I’ve been trying to access the class after it’s saved:

CoreasEvent *buf = new CoreasEvent;
TBranch *branch = eventTree->GetBranch("CoreasEvent");
branch->SetAddress(&buf);
buf->print(); //print() is is simply a function that calls cout and prints some basic values stored in the class, used to verify whether or not any data was saved

One thing I wanted to ask is that, when looking through the documentation, I see both GetEntry and GetEvent. What is the difference between these two functions?
Another thing to note is that in some examples I noticed split level 0 was used, but whenever I attempt to use split level 0, the program crashes with a segfault. I was wondering why that might be.
Thank you.

Could you, please, execute the commands that I gave you and post the output here (note: you may need to load some shared library which provides the dictionary for your “CoreasEvent” class before you do this).

BTW. It seems that you try to “buf->print();” without prior calling “branch->GetEntry(SomeEntryNumber);” or “eventTree->GetEntry(SomeEntryNumber);” (where “0 <= SomeEntryNumber < eventTree->GetEntries()”) .

P.S. See TTree::GetEvent and/or TBranch::GetEvent methods descriptions if you want to learn what it does (and compare them to TTree::GetEntry and/or TBranch::GetEntry methods descriptions, if you like).

Sure thing!

root [4] TFile *f = TFile::Open("CoreasEvents.root")
root [5] f->ls()
TFile**         CoreasEvents.root
 TFile*         CoreasEvents.root
  KEY: TTree    eventTree;1     Collection of CoreasEvent Objects
root [6] eventTree->Print()
******************************************************************************
*Tree    :Event List: Collection of CoreasEvent Objects                      *
*Entries :        1 : Total =           15145 bytes  File  Size =       1899 *
*        :          : Tree compression factor =   1.00                       *
******************************************************************************
*Branch  :CoreasEvent                                                        *
*Entries :        1 : BranchElement (see below)                              *
*............................................................................*
*Br    0 :fUniqueID : UInt_t                                                 *
*Entries :        1 : Total  Size=        580 bytes  File Size  =         86 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    1 :fBits     : UInt_t                                                 *
*Entries :        1 : Total  Size=        572 bytes  File Size  =         94 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    2 :energy    : Double_t                                               *
*Entries :        1 : Total  Size=        561 bytes  File Size  =         79 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    3 :seed      : string                                                 *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    4 :x1        : Double_t                                               *
*Entries :        1 : Total  Size=        541 bytes  File Size  =         75 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    5 :xMax      : Double_t                                               *
*Entries :        1 : Total  Size=        551 bytes  File Size  =         77 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    6 :nMax      : Double_t                                               *
*Entries :        1 : Total  Size=        551 bytes  File Size  =         77 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    7 :showerLength : Double_t                                            *
*Entries :        1 : Total  Size=        591 bytes  File Size  =         85 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    8 :zenAngle  : Double_t                                               *
*Entries :        1 : Total  Size=        571 bytes  File Size  =         81 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    9 :aziAngle  : Double_t                                               *
*Entries :        1 : Total  Size=        571 bytes  File Size  =         81 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   10 :magField  : vector<Double_t>                                       *
*Entries :        1 : Total  Size=        583 bytes  File Size  =         93 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   11 :xFreq     : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        568 bytes  File Size  =         90 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   12 :xFEX      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   13 :xFEY      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   14 :xFEZ      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   15 :xFEH      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   16 :xTime     : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        568 bytes  File Size  =         90 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   17 :xTEX      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   18 :xTEY      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   19 :xTEZ      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   20 :xTEH      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   21 :fgIsA     : TClass*                                                *
*Entries :        1 : Total  Size=        568 bytes  File Size  =         90 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*

As far as my code goes, I had GetEntry in my source code but forgot to include it in my post.

There’s one branch that looks suspicious to me: “Br 21 :fgIsA : TClass*”.
Is it possible that you run your code which creates the tree (and the root file) as interpreted?
In particular, is it possible that you did not create a compiled dictionary for your “CoreasEvent” class?
Could you try (and post the output here):
root […] .class CoreasEvent

Here is the output I get when I run .class CoreasEvent

root [7] .class CoreasEvent
===========================================================================
class CoreasEvent
 size=0x160 FILE:CoreasEvent.h LINE:7
 (tagnum=2835,voffset=344,isabstract=0,parent=-1,gcomp=0:0,funcs(dn21=~xcpd)=f1)
List of base class--------------------------------------------------------
0x0        public: TObject //Basic ROOT object
List of member variable---------------------------------------------------
Defined in CoreasEvent
CoreasEvent.h     9 0xf        private: Double_t energy //primary particle energy in GeV
CoreasEvent.h    10 0x17       private: string seed , size=8 //CORSIKA run number
(compiled)            0xbde1150  static const size_t npos
CoreasEvent.h    11 0x1f       private: Double_t x1 //Depth of first interaction in g/cm^2
CoreasEvent.h    12 0x27       private: Double_t xMax //Depth where shower hits its peak in g/cm^2
CoreasEvent.h    13 0x2f       private: Double_t nMax //Maxmimum number of charged particles in shower
CoreasEvent.h    14 0x37       private: Double_t showerLength //Length of shower in km
CoreasEvent.h    15 0x3f       private: Double_t zenAngle //Zenith angle of shower in degrees
CoreasEvent.h    16 0x47       private: Double_t aziAngle //Azimuthal angle of shower in degrees
CoreasEvent.h    17 0x4f       private: vector<Double_t> magField , size=24 //Magnetic field in Horizontal, and Verticle components
CoreasEvent.h    18 0x67       private: vector<vector<Double_t> > xFreq , size=24 //2D vector of distance from shower core and frequency
CoreasEvent.h    19 0x7f       private: vector<vector<Double_t> > xFEX , size=24 //2D vector of distance from shower core and west component of electric field in frequency domain
CoreasEvent.h    20 0x97       private: vector<vector<Double_t> > xFEY , size=24 //2D vector of distance from shower core and north component of electric field in frequency domain
CoreasEvent.h    21 0xaf       private: vector<vector<Double_t> > xFEZ , size=24 //2D vector of distance from shower core and vertical component of electric field in frequency domain
CoreasEvent.h    22 0xc7       private: vector<vector<Double_t> > xFEH , size=24 //2D vector of distance from shower core and horizontal component of electric field in frequency domain
CoreasEvent.h    23 0xdf       private: vector<vector<Double_t> > xTime , size=24 //2D vector of distance from shower core and time
CoreasEvent.h    24 0xf7       private: vector<vector<Double_t> > xTEX , size=24 //2D vector of distance from shower core and west component of electric field in time domain
CoreasEvent.h    25 0x10f      private: vector<vector<Double_t> > xTEY , size=24 //2D vector of distance from shower core and north component of electric field in time domain
CoreasEvent.h    26 0x127      private: vector<vector<Double_t> > xTEZ , size=24 //2D vector of distance from shower core and vertical component of electric field in time domain
CoreasEvent.h    27 0x13f      private: vector<vector<Double_t> > xTEH , size=24 //2D vector of distance from shower core and horizontal component of electric field in time domain
CoreasEvent.h    64 0xbad5770  private: static TClass* fgIsA
CoreasEvent.h    64 0x157      private: long G__virtualinfo
List of member function---------------------------------------------------
filename       line:size busy function type and name  (in CoreasEvent)
CoreasEvent.cpp   6:11   0 public: void init_cevent(void);
CoreasEvent.cpp  17:4    0 public: CoreasEvent CoreasEvent(void);
CoreasEvent.cpp  21:11   0 public: CoreasEvent CoreasEvent(Double_t energy,string seed,Double_t x1,Double_t xMax,Int_t nMax,Double_t showerLength,Double_t zenAngle,Double_t aziAngle);
CoreasEvent.cpp 147:17   0 public: void print(void);
CoreasEvent.cpp  33:22   0 public: void reset(void);
CoreasEvent.h    36:4    0 public: Int_t getEnergy(void);
CoreasEvent.h    40:4    0 public: string getSeed(void);
CoreasEvent.h    44:4    0 public: Double_t getX1(void);
CoreasEvent.h    48:4    0 public: Double_t getXMax(void);
CoreasEvent.h    52:4    0 public: Double_t getNMax(void);
CoreasEvent.h    56:4    0 public: Double_t getShowerLength(void);
CoreasEvent.h    60:4    0 public: Double_t getZenAngle(void);
CoreasEvent.h    64:4    0 public: Double_t getAziAngle(void);
CoreasEvent.h    68:4    0 public: vector<Double_t> getMagField(void);
CoreasEvent.h    72:4    0 public: vector<vector<Double_t> > getXFreq(void);
CoreasEvent.h    76:4    0 public: vector<vector<Double_t> > getXFEX(void);
CoreasEvent.h    80:4    0 public: vector<vector<Double_t> > getXFEY(void);
CoreasEvent.h    84:4    0 public: vector<vector<Double_t> > getXFEZ(void);
CoreasEvent.h    88:4    0 public: vector<vector<Double_t> > getXFEH(void);
CoreasEvent.h    92:4    0 public: vector<vector<Double_t> > getXTime(void);
CoreasEvent.h    96:4    0 public: vector<vector<Double_t> > getXTEX(void);
CoreasEvent.h   100:4    0 public: vector<vector<Double_t> > getXTEY(void);
CoreasEvent.h   104:4    0 public: vector<vector<Double_t> > getXTEZ(void);
CoreasEvent.h   108:4    0 public: vector<vector<Double_t> > getXTEH(void);
CoreasEvent.cpp  55:12   0 public: void setEnergy(Double_t energy);
CoreasEvent.cpp  75:4    0 public: void setSeed(string seed);
CoreasEvent.cpp  79:4    0 public: void setX1(Double_t x1);
CoreasEvent.cpp  83:4    0 public: void setXMax(Double_t xMax);
CoreasEvent.cpp  87:4    0 public: void setNMax(Double_t nMax);
CoreasEvent.cpp  91:4    0 public: void setShowerLength(Double_t showerLength);
CoreasEvent.cpp  95:4    0 public: void setZenAngle(Double_t zenAngle);
CoreasEvent.cpp  99:4    0 public: void setAziAngle(Double_t aziAngle);
CoreasEvent.cpp 103:4    0 public: void setMagField(vector<Double_t> magField);
CoreasEvent.cpp 107:4    0 public: void setXFreq(vector<vector<Double_t> > xFreq);
CoreasEvent.cpp 111:4    0 public: void setXFEX(vector<vector<Double_t> > xFEX);
CoreasEvent.cpp 115:4    0 public: void setXFEY(vector<vector<Double_t> > xFEY);
CoreasEvent.cpp 119:4    0 public: void setXFEZ(vector<vector<Double_t> > xFEZ);
CoreasEvent.cpp 123:4    0 public: void setXFEH(vector<vector<Double_t> > xFEH);
CoreasEvent.cpp 127:4    0 public: void setXTime(vector<vector<Double_t> > xTime);
CoreasEvent.cpp 131:4    0 public: void setXTEX(vector<vector<Double_t> > xTEX);
CoreasEvent.cpp 135:4    0 public: void setXTEY(vector<vector<Double_t> > xTEY);
CoreasEvent.cpp 139:4    0 public: void setXTEZ(vector<vector<Double_t> > xTEZ);
CoreasEvent.cpp 143:4    0 public: void setXTEH(vector<vector<Double_t> > xTEH);
CoreasEvent.h    64:1    0 public: static TClass* Class(void);
CoreasEvent.h    64:1    0 public: static const char* Class_Name(void);
CoreasEvent.h    64:1    0 public: static Version_t Class_Version(void);
CoreasEvent.h    -1:0    0 public: static void Dictionary(void);
CoreasEvent.h    64:1    0 public: virtual TClass* IsA(void) const;
CoreasEvent.h    64:1    0 public: virtual void ShowMembers(TMemberInspector& insp,char* parent);
CoreasEvent.h    -1:0    0 public: virtual void Streamer(TBuffer& b);
CoreasEvent.h    64:1    0 public: void StreamerNVirtual(TBuffer& b);
CoreasEvent.h    64:1    0 public: static const char* DeclFileName(void);
CoreasEvent.h    -1:0    0 public: static const char* ImplFileName(void);
CoreasEvent.h    -1:0    0 public: static int ImplFileLine(void);
CoreasEvent.h    64:1    0 public: static int DeclFileLine(void);

How would I go about compiling a dictionary for my class? My experience with this is somewhat limited.

root [0] .L CoreasEvent.cpp++
… then load and execute the code which creates the tree (this code can be run as interpreted, I believe) …

I noticed that if I loaded CoreasEvent.cpp before running the code that creates the tree, I also had to load CoreasEvent.cpp before accessing the file otherwise it would complain about a lack of dictionary Warning in <TClass::TClass>: no dictionary for class CoreasEvent is available

Aside from that, this is the output I get when I load CoreasEvent.cpp before accessing the root file

root [0] .L CoreasEvent.cpp
root [1] TFile *f = TFile::Open("CoreasEvents.root")
root [2] f->ls()
TFile**         CoreasEvents.root
 TFile*         CoreasEvents.root
  KEY: TTree    eventTree;1     Collection of CoreasEvent Objects
root [3] eventTree->Print()
******************************************************************************
*Tree    :Event List: Collection of CoreasEvent Objects                      *
*Entries :        1 : Total =           15145 bytes  File  Size =       1899 *
*        :          : Tree compression factor =   1.00                       *
******************************************************************************
*Branch  :CoreasEvent                                                        *
*Entries :        1 : BranchElement (see below)                              *
*............................................................................*
*Br    0 :fUniqueID : UInt_t                                                 *
*Entries :        1 : Total  Size=        580 bytes  File Size  =         86 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    1 :fBits     : UInt_t                                                 *
*Entries :        1 : Total  Size=        572 bytes  File Size  =         94 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    2 :energy    : Double_t                                               *
*Entries :        1 : Total  Size=        561 bytes  File Size  =         79 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    3 :seed      : string                                                 *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    4 :x1        : Double_t                                               *
*Entries :        1 : Total  Size=        541 bytes  File Size  =         75 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    5 :xMax      : Double_t                                               *
*Entries :        1 : Total  Size=        551 bytes  File Size  =         77 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    6 :nMax      : Double_t                                               *
*Entries :        1 : Total  Size=        551 bytes  File Size  =         77 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    7 :showerLength : Double_t                                            *
*Entries :        1 : Total  Size=        591 bytes  File Size  =         85 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    8 :zenAngle  : Double_t                                               *
*Entries :        1 : Total  Size=        571 bytes  File Size  =         81 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br    9 :aziAngle  : Double_t                                               *
*Entries :        1 : Total  Size=        571 bytes  File Size  =         81 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   10 :magField  : vector<Double_t>                                       *
*Entries :        1 : Total  Size=        583 bytes  File Size  =         93 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   11 :xFreq     : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        568 bytes  File Size  =         90 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   12 :xFEX      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   13 :xFEY      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   14 :xFEZ      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   15 :xFEH      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   16 :xTime     : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        568 bytes  File Size  =         90 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   17 :xTEX      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   18 :xTEY      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   19 :xTEZ      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   20 :xTEH      : vector<vector<Double_t> >                              *
*Entries :        1 : Total  Size=        563 bytes  File Size  =         89 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
*Br   21 :fgIsA     : TClass*                                                *
*Entries :        1 : Total  Size=        568 bytes  File Size  =         90 *
*Baskets :        1 : Basket Size=      64000 bytes  Compression=   1.00     *
*............................................................................*
root [4] .class CoreasEvent
===========================================================================
class CoreasEvent
 size=0x160 FILE:CoreasEvent.h LINE:7
 (tagnum=2835,voffset=344,isabstract=0,parent=-1,gcomp=0:0,funcs(dn21=~xcpd)=f1)
List of base class--------------------------------------------------------
0x0        public: TObject //Basic ROOT object
List of member variable---------------------------------------------------
Defined in CoreasEvent
CoreasEvent.h     9 0xf        private: Double_t energy //primary particle energy in GeV
CoreasEvent.h    10 0x17       private: string seed , size=8 //CORSIKA run number
(compiled)            0x10e6e0a0 static const size_t npos
CoreasEvent.h    11 0x1f       private: Double_t x1 //Depth of first interaction in g/cm^2
CoreasEvent.h    12 0x27       private: Double_t xMax //Depth where shower hits its peak in g/cm^2
CoreasEvent.h    13 0x2f       private: Double_t nMax //Maxmimum number of charged particles in shower
CoreasEvent.h    14 0x37       private: Double_t showerLength //Length of shower in km
CoreasEvent.h    15 0x3f       private: Double_t zenAngle //Zenith angle of shower in degrees
CoreasEvent.h    16 0x47       private: Double_t aziAngle //Azimuthal angle of shower in degrees
CoreasEvent.h    17 0x4f       private: vector<Double_t> magField , size=24 //Magnetic field in Horizontal, and Verticle components
CoreasEvent.h    18 0x67       private: vector<vector<Double_t> > xFreq , size=24 //2D vector of distance from shower core and frequency
CoreasEvent.h    19 0x7f       private: vector<vector<Double_t> > xFEX , size=24 //2D vector of distance from shower core and west component of electric field in frequency domain
CoreasEvent.h    20 0x97       private: vector<vector<Double_t> > xFEY , size=24 //2D vector of distance from shower core and north component of electric field in frequency domain
CoreasEvent.h    21 0xaf       private: vector<vector<Double_t> > xFEZ , size=24 //2D vector of distance from shower core and vertical component of electric field in frequency domain
CoreasEvent.h    22 0xc7       private: vector<vector<Double_t> > xFEH , size=24 //2D vector of distance from shower core and horizontal component of electric field in frequency domain
CoreasEvent.h    23 0xdf       private: vector<vector<Double_t> > xTime , size=24 //2D vector of distance from shower core and time
CoreasEvent.h    24 0xf7       private: vector<vector<Double_t> > xTEX , size=24 //2D vector of distance from shower core and west component of electric field in time domain
CoreasEvent.h    25 0x10f      private: vector<vector<Double_t> > xTEY , size=24 //2D vector of distance from shower core and north component of electric field in time domain
CoreasEvent.h    26 0x127      private: vector<vector<Double_t> > xTEZ , size=24 //2D vector of distance from shower core and vertical component of electric field in time domain
CoreasEvent.h    27 0x13f      private: vector<vector<Double_t> > xTEH , size=24 //2D vector of distance from shower core and horizontal component of electric field in time domain
CoreasEvent.h    64 0x10b61e00 private: static TClass* fgIsA
CoreasEvent.h    64 0x157      private: long G__virtualinfo
List of member function---------------------------------------------------
filename       line:size busy function type and name  (in CoreasEvent)
CoreasEvent.cpp   6:11   0 public: void init_cevent(void);
CoreasEvent.cpp  17:4    0 public: CoreasEvent CoreasEvent(void);
CoreasEvent.cpp  21:11   0 public: CoreasEvent CoreasEvent(Double_t energy,string seed,Double_t x1,Double_t xMax,Int_t nMax,Double_t showerLength,Double_t zenAngle,Double_t aziAngle);
CoreasEvent.cpp 147:17   0 public: void print(void);
CoreasEvent.cpp  33:22   0 public: void reset(void);
CoreasEvent.h    36:4    0 public: Int_t getEnergy(void);
CoreasEvent.h    40:4    0 public: string getSeed(void);
CoreasEvent.h    44:4    0 public: Double_t getX1(void);
CoreasEvent.h    48:4    0 public: Double_t getXMax(void);
CoreasEvent.h    52:4    0 public: Double_t getNMax(void);
CoreasEvent.h    56:4    0 public: Double_t getShowerLength(void);
CoreasEvent.h    60:4    0 public: Double_t getZenAngle(void);
CoreasEvent.h    64:4    0 public: Double_t getAziAngle(void);
CoreasEvent.h    68:4    0 public: vector<Double_t> getMagField(void);
CoreasEvent.h    72:4    0 public: vector<vector<Double_t> > getXFreq(void);
CoreasEvent.h    76:4    0 public: vector<vector<Double_t> > getXFEX(void);
CoreasEvent.h    80:4    0 public: vector<vector<Double_t> > getXFEY(void);
CoreasEvent.h    84:4    0 public: vector<vector<Double_t> > getXFEZ(void);
CoreasEvent.h    88:4    0 public: vector<vector<Double_t> > getXFEH(void);
CoreasEvent.h    92:4    0 public: vector<vector<Double_t> > getXTime(void);
CoreasEvent.h    96:4    0 public: vector<vector<Double_t> > getXTEX(void);
CoreasEvent.h   100:4    0 public: vector<vector<Double_t> > getXTEY(void);
CoreasEvent.h   104:4    0 public: vector<vector<Double_t> > getXTEZ(void);
CoreasEvent.h   108:4    0 public: vector<vector<Double_t> > getXTEH(void);
CoreasEvent.cpp  55:12   0 public: void setEnergy(Double_t energy);
CoreasEvent.cpp  75:4    0 public: void setSeed(string seed);
CoreasEvent.cpp  79:4    0 public: void setX1(Double_t x1);
CoreasEvent.cpp  83:4    0 public: void setXMax(Double_t xMax);
CoreasEvent.cpp  87:4    0 public: void setNMax(Double_t nMax);
CoreasEvent.cpp  91:4    0 public: void setShowerLength(Double_t showerLength);
CoreasEvent.cpp  95:4    0 public: void setZenAngle(Double_t zenAngle);
CoreasEvent.cpp  99:4    0 public: void setAziAngle(Double_t aziAngle);
CoreasEvent.cpp 103:4    0 public: void setMagField(vector<Double_t> magField);
CoreasEvent.cpp 107:4    0 public: void setXFreq(vector<vector<Double_t> > xFreq);
CoreasEvent.cpp 111:4    0 public: void setXFEX(vector<vector<Double_t> > xFEX);
CoreasEvent.cpp 115:4    0 public: void setXFEY(vector<vector<Double_t> > xFEY);
CoreasEvent.cpp 119:4    0 public: void setXFEZ(vector<vector<Double_t> > xFEZ);
CoreasEvent.cpp 123:4    0 public: void setXFEH(vector<vector<Double_t> > xFEH);
CoreasEvent.cpp 127:4    0 public: void setXTime(vector<vector<Double_t> > xTime);
CoreasEvent.cpp 131:4    0 public: void setXTEX(vector<vector<Double_t> > xTEX);
CoreasEvent.cpp 135:4    0 public: void setXTEY(vector<vector<Double_t> > xTEY);
CoreasEvent.cpp 139:4    0 public: void setXTEZ(vector<vector<Double_t> > xTEZ);
CoreasEvent.cpp 143:4    0 public: void setXTEH(vector<vector<Double_t> > xTEH);
CoreasEvent.h    64:1    0 public: static TClass* Class(void);
CoreasEvent.h    64:1    0 public: static const char* Class_Name(void);
CoreasEvent.h    64:1    0 public: static Version_t Class_Version(void);
CoreasEvent.h    -1:0    0 public: static void Dictionary(void);
CoreasEvent.h    64:1    0 public: virtual TClass* IsA(void) const;
CoreasEvent.h    64:1    0 public: virtual void ShowMembers(TMemberInspector& insp,char* parent);
CoreasEvent.h    -1:0    0 public: virtual void Streamer(TBuffer& b);
CoreasEvent.h    64:1    0 public: void StreamerNVirtual(TBuffer& b);
CoreasEvent.h    64:1    0 public: static const char* DeclFileName(void);
CoreasEvent.h    -1:0    0 public: static const char* ImplFileName(void);
CoreasEvent.h    -1:0    0 public: static int ImplFileLine(void);
CoreasEvent.h    64:1    0 public: static int DeclFileLine(void);

You need “++” -> see my previous post (it MUST be pre-compiled by ACLiC).
Note: your tree is broken -> you need to recreate it after you load a compiled dictionary for your “CoreasEvent” class.

Just to clarify, in order to pre-compile with ACLiC, would I just run “.L CoreasEvent.cpp+”? Or would I run it for the script that creates the tree with include links to CoreasEvent.cpp?
I’m following this guide: root.cern.ch/download/doc/ROOTUs … 07s09.html

I prefer “++”, but you may use just “+”, if you like.
You should “.L CoreasEvent.cpp++” first.
Then you can “.L” any code (either as interpreted or as compiled) that uses this class -> note however, this code must NOT #include “CoreasEvent.cpp”, it should #include “CoreasEvent.h” only.

Attempting to run “.L CoreasEvent.cpp++” returns the error

root [0] .L CoreasEvent.cpp++
Info in <TUnixSystem::ACLiC>: creating shared library /u/home/joelam/projects/CoreasEvent/./CoreasEvent_cpp.so
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:18: error: âxFreqâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:18: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:19: error: âxFEXâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:19: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:20: error: âxFEYâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:20: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:21: error: âxFEZâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:21: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:22: error: âxFEHâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:22: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:23: error: âxTimeâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:23: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:24: error: âxTEXâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:24: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:25: error: âxTEYâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:25: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:26: error: âxTEZâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:26: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:27: error: âxTEHâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:27: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:72: error: a function call cannot appear in a constant-expression
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:72: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:76: error: a function call cannot appear in a constant-expression
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:76: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:80: error: a function call cannot appear in a constant-expression
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:80: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:84: error: a function call cannot appear in a constant-expression
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:84: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:88: error: a function call cannot appear in a constant-expression
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:88: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:92: error: a function call cannot appear in a constant-expression
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:92: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:96: error: a function call cannot appear in a constant-expression
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:96: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:100: error: a function call cannot appear in a constant-expression
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:100: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:104: error: a function call cannot appear in a constant-expression
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:104: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:108: error: a function call cannot appear in a constant-expression
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:108: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:122: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:123: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:124: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:125: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:126: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:127: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:128: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:129: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:130: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:131: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h: In member function âInt_t CoreasEvent::getEnergy()â:
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.h:38: warning: converting to âInt_tâ from âDouble_tâ
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp: At global scope:
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:107: error: ânewXFreqâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:107: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:111: error: ânewXFEXâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:111: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:115: error: ânewXFEYâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:115: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:119: error: ânewXFEZâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:119: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:123: error: ânewXFEHâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:123: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:127: error: ânewXTimeâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:127: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:131: error: ânewXTEXâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:131: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:135: error: ânewXTEYâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:135: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:139: error: ânewXTEZâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:139: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:143: error: ânewXTEHâ was not declared in this scope
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:143: error: â>>â should be â> >â within a nested template argument list
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp: In member function âvoid CoreasEvent::print()â:
/u/home/joelam/projects/CoreasEvent/./CoreasEvent.cpp:158: warning: comparison between signed and unsigned integer expressions
g++: /u/home/joelam/projects/CoreasEvent/CoreasEvent_cpp_ACLiC_dict.o: No such file or directory
Error in <ACLiC>: Compilation failed!

All the errors seem to point to lines where 2D vectors were used. Is there any way to fix this?

These are c++ source code errors. You need to fix them.
Try (fix all reported errors and warnings):
root-config --cxx --cflags -O2 -W -Wall -c CoreasEvent.cpp

Okay, I will try that.
I see a lot of errors that look like this: CoreasEvent.h:9: error: âDouble_tâ does not name a type
What does it mean when it says does not name a type? For reference, that specific error points to this line: Double_t energy; in the class declaration. It also gives similar errors to the other lines in the class declaration.
Would this method require me to add include lines for classes from the root library?

You said you were inheriting from a “TObject”, so you should have #include “TObject.h” which should also be sufficient for a “Double_t” and so.

Adding #include “Tobject.h” resolved issues with 2D vectors and strings (#include being present). This is the output I’m currently getting when i run root-config --cxx --cflags -O2 -W -Wall -c CoreasEvent.cpp

CoreasEvent.h:10: error: âstringâ does not name a type
CoreasEvent.h:17: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:17: error: expected â;â before â<â token
CoreasEvent.h:18: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:18: error: expected â;â before â<â token
CoreasEvent.h:19: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:19: error: expected â;â before â<â token
CoreasEvent.h:20: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:20: error: expected â;â before â<â token
CoreasEvent.h:21: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:21: error: expected â;â before â<â token
CoreasEvent.h:22: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:22: error: expected â;â before â<â token
CoreasEvent.h:23: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:23: error: expected â;â before â<â token
CoreasEvent.h:24: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:24: error: expected â;â before â<â token
CoreasEvent.h:25: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:25: error: expected â;â before â<â token
CoreasEvent.h:26: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:26: error: expected â;â before â<â token
CoreasEvent.h:27: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:27: error: expected â;â before â<â token
CoreasEvent.h:33: error: âstringâ has not been declared
CoreasEvent.h:40: error: âstringâ does not name a type
CoreasEvent.h:68: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:68: error: expected â;â before â<â token
CoreasEvent.h:72: error: expected `;' before âvectorâ
CoreasEvent.h:72: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:72: error: expected â;â before â<â token
CoreasEvent.h:76: error: expected `;' before âvectorâ
CoreasEvent.h:76: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:76: error: expected â;â before â<â token
CoreasEvent.h:80: error: expected `;' before âvectorâ
CoreasEvent.h:80: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:80: error: expected â;â before â<â token
CoreasEvent.h:84: error: expected `;' before âvectorâ
CoreasEvent.h:84: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:84: error: expected â;â before â<â token
CoreasEvent.h:88: error: expected `;' before âvectorâ
CoreasEvent.h:88: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:88: error: expected â;â before â<â token
CoreasEvent.h:92: error: expected `;' before âvectorâ
CoreasEvent.h:92: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:92: error: expected â;â before â<â token
CoreasEvent.h:96: error: expected `;' before âvectorâ
CoreasEvent.h:96: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:96: error: expected â;â before â<â token
CoreasEvent.h:100: error: expected `;' before âvectorâ
CoreasEvent.h:100: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:100: error: expected â;â before â<â token
CoreasEvent.h:104: error: expected `;' before âvectorâ
CoreasEvent.h:104: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:104: error: expected â;â before â<â token
CoreasEvent.h:108: error: expected `;' before âvectorâ
CoreasEvent.h:108: error: ISO C++ forbids declaration of âvectorâ with no type
CoreasEvent.h:108: error: expected â;â before â<â token
CoreasEvent.h:113: error: expected `;' before âvoidâ
CoreasEvent.h:114: error: âstringâ has not been declared
CoreasEvent.h:121: error: âvectorâ has not been declared
CoreasEvent.h:121: error: expected â,â or â...â before â<â token
CoreasEvent.h:122: error: âvectorâ has not been declared
CoreasEvent.h:122: error: expected â,â or â...â before â<â token
CoreasEvent.h:123: error: âvectorâ has not been declared
CoreasEvent.h:123: error: expected â,â or â...â before â<â token
CoreasEvent.h:124: error: âvectorâ has not been declared
CoreasEvent.h:124: error: expected â,â or â...â before â<â token
CoreasEvent.h:125: error: âvectorâ has not been declared
CoreasEvent.h:125: error: expected â,â or â...â before â<â token
CoreasEvent.h:126: error: âvectorâ has not been declared
CoreasEvent.h:126: error: expected â,â or â...â before â<â token
CoreasEvent.h:127: error: âvectorâ has not been declared
CoreasEvent.h:127: error: expected â,â or â...â before â<â token
CoreasEvent.h:128: error: âvectorâ has not been declared
CoreasEvent.h:128: error: expected â,â or â...â before â<â token
CoreasEvent.h:129: error: âvectorâ has not been declared
CoreasEvent.h:129: error: expected â,â or â...â before â<â token
CoreasEvent.h:130: error: âvectorâ has not been declared
CoreasEvent.h:130: error: expected â,â or â...â before â<â token
CoreasEvent.h:131: error: âvectorâ has not been declared
CoreasEvent.h:131: error: expected â,â or â...â before â<â token
CoreasEvent.h: In member function âInt_t CoreasEvent::getEnergy()â:
CoreasEvent.h:38: warning: converting to âInt_tâ from âDouble_tâ
CoreasEvent.cpp: In constructor âCoreasEvent::CoreasEvent()â:
CoreasEvent.cpp:9: error: âseedâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:17: error: prototype for âCoreasEvent::CoreasEvent(Double_t, std::string, Double_t, Double_t, Int_t, Double_t, Double_t, Double_t)â does not match any in class âCoreasEventâ
CoreasEvent.h:7: error: candidates are: CoreasEvent::CoreasEvent(const CoreasEvent&)
CoreasEvent.h:33: error:                 CoreasEvent::CoreasEvent(Double_t, int, Double_t, Double_t, Int_t, Double_t, Double_t, Double_t)
CoreasEvent.cpp:6: error:                 CoreasEvent::CoreasEvent()
CoreasEvent.cpp: In constructor âCoreasEvent::CoreasEvent(Double_t, std::string, Double_t, Double_t, Int_t, Double_t, Double_t, Double_t)â:
CoreasEvent.cpp:20: error: âseedâ was not declared in this scope
CoreasEvent.cpp: In member function âvoid CoreasEvent::reset()â:
CoreasEvent.cpp:32: error: âseedâ was not declared in this scope
CoreasEvent.cpp:39: error: âmagFieldâ was not declared in this scope
CoreasEvent.cpp:40: error: âxFreqâ was not declared in this scope
CoreasEvent.cpp:41: error: âxFEXâ was not declared in this scope
CoreasEvent.cpp:42: error: âxFEYâ was not declared in this scope
CoreasEvent.cpp:43: error: âxFEZâ was not declared in this scope
CoreasEvent.cpp:44: error: âxFEHâ was not declared in this scope
CoreasEvent.cpp:45: error: âxTimeâ was not declared in this scope
CoreasEvent.cpp:46: error: âxTEXâ was not declared in this scope
CoreasEvent.cpp:47: error: âxTEYâ was not declared in this scope
CoreasEvent.cpp:48: error: âxTEZâ was not declared in this scope
CoreasEvent.cpp:49: error: âxTEHâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:71: error: prototype for âvoid CoreasEvent::setSeed(std::string)â does not match any in class âCoreasEventâ
CoreasEvent.h:114: error: candidate is: void CoreasEvent::setSeed(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setSeed(std::string)â:
CoreasEvent.cpp:73: error: âseedâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:99: error: prototype for âvoid CoreasEvent::setMagField(std::vector<double, std::allocator<double> >)â does not match any in class âCoreasEventâ
CoreasEvent.h:121: error: candidate is: void CoreasEvent::setMagField(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setMagField(std::vector<double, std::allocator<double> >)â:
CoreasEvent.cpp:101: error: âmagFieldâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:103: error: ânewXFreqâ was not declared in this scope
CoreasEvent.cpp:103: error: â>>â should be â> >â within a nested template argument list
CoreasEvent.cpp:103: error: prototype for âvoid CoreasEvent::setXFreq(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â does not match any in class âCoreasEventâ
CoreasEvent.h:122: error: candidate is: void CoreasEvent::setXFreq(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setXFreq(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â:
CoreasEvent.cpp:105: error: âxFreqâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:107: error: ânewXFEXâ was not declared in this scope
CoreasEvent.cpp:107: error: â>>â should be â> >â within a nested template argument list
CoreasEvent.cpp:107: error: prototype for âvoid CoreasEvent::setXFEX(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â does not match any in class âCoreasEventâ
CoreasEvent.h:123: error: candidate is: void CoreasEvent::setXFEX(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setXFEX(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â:
CoreasEvent.cpp:109: error: âxFEXâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:111: error: ânewXFEYâ was not declared in this scope
CoreasEvent.cpp:111: error: â>>â should be â> >â within a nested template argument list
CoreasEvent.cpp:111: error: prototype for âvoid CoreasEvent::setXFEY(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â does not match any in class âCoreasEventâ
CoreasEvent.h:124: error: candidate is: void CoreasEvent::setXFEY(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setXFEY(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â:
CoreasEvent.cpp:113: error: âxFEYâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:115: error: ânewXFEZâ was not declared in this scope
CoreasEvent.cpp:115: error: â>>â should be â> >â within a nested template argument list
CoreasEvent.cpp:115: error: prototype for âvoid CoreasEvent::setXFEZ(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â does not match any in class âCoreasEventâ
CoreasEvent.h:125: error: candidate is: void CoreasEvent::setXFEZ(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setXFEZ(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â:
CoreasEvent.cpp:117: error: âxFEZâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:119: error: ânewXFEHâ was not declared in this scope
CoreasEvent.cpp:119: error: â>>â should be â> >â within a nested template argument list
CoreasEvent.cpp:119: error: prototype for âvoid CoreasEvent::setXFEH(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â does not match any in class âCoreasEventâ
CoreasEvent.h:126: error: candidate is: void CoreasEvent::setXFEH(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setXFEH(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â:
CoreasEvent.cpp:121: error: âxFEHâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:123: error: ânewXTimeâ was not declared in this scope
CoreasEvent.cpp:123: error: â>>â should be â> >â within a nested template argument list
CoreasEvent.cpp:123: error: prototype for âvoid CoreasEvent::setXTime(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â does not match any in class âCoreasEventâ
CoreasEvent.h:127: error: candidate is: void CoreasEvent::setXTime(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setXTime(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â:
CoreasEvent.cpp:125: error: âxTimeâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:127: error: ânewXTEXâ was not declared in this scope
CoreasEvent.cpp:127: error: â>>â should be â> >â within a nested template argument list
CoreasEvent.cpp:127: error: prototype for âvoid CoreasEvent::setXTEX(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â does not match any in class âCoreasEventâ
CoreasEvent.h:128: error: candidate is: void CoreasEvent::setXTEX(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setXTEX(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â:
CoreasEvent.cpp:129: error: âxTEXâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:131: error: ânewXTEYâ was not declared in this scope
CoreasEvent.cpp:131: error: â>>â should be â> >â within a nested template argument list
CoreasEvent.cpp:131: error: prototype for âvoid CoreasEvent::setXTEY(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â does not match any in class âCoreasEventâ
CoreasEvent.h:129: error: candidate is: void CoreasEvent::setXTEY(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setXTEY(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â:
CoreasEvent.cpp:133: error: âxTEYâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:135: error: ânewXTEZâ was not declared in this scope
CoreasEvent.cpp:135: error: â>>â should be â> >â within a nested template argument list
CoreasEvent.cpp:135: error: prototype for âvoid CoreasEvent::setXTEZ(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â does not match any in class âCoreasEventâ
CoreasEvent.h:130: error: candidate is: void CoreasEvent::setXTEZ(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setXTEZ(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â:
CoreasEvent.cpp:137: error: âxTEZâ was not declared in this scope
CoreasEvent.cpp: At global scope:
CoreasEvent.cpp:139: error: ânewXTEHâ was not declared in this scope
CoreasEvent.cpp:139: error: â>>â should be â> >â within a nested template argument list
CoreasEvent.cpp:139: error: prototype for âvoid CoreasEvent::setXTEH(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â does not match any in class âCoreasEventâ
CoreasEvent.h:131: error: candidate is: void CoreasEvent::setXTEH(int)
CoreasEvent.cpp: In member function âvoid CoreasEvent::setXTEH(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >)â:
CoreasEvent.cpp:141: error: âxTEHâ was not declared in this scope
CoreasEvent.cpp: In member function âvoid CoreasEvent::print()â:
CoreasEvent.cpp:146: error: âgetSeedâ was not declared in this scope
CoreasEvent.cpp:154: error: âgetMagFieldâ was not declared in this scope

All the errors seem to point to string and vector.
For reference I am running the code on gcc 4.1.2

Either (recommended):
std::string<…> …;
std::vector<…> …;
or (acceptable):
using std::string;
using std::vector;
or (discouraged):
using namespace std;

I’m not quite sure how I managed to forget to add using namespace std but that happens occasionally I suppose.
I managed to fix all the errors and successfully save data to the root file. Thank you very much Wile!