How do I process this tree?

In the archived file, I have a data.root file that I am trying to analyze with my MyAnalysis.C code (Note that I haven’t written these codes, I simply want to run them).
I want to process the the tree events within the data.root file and I try to use the command in my root session:

events->Process("MyAnalysis.C")

Yet, when I try to run this, events is not recognized. Please forgive me as I am still a beginner when it comes to working with trees, but how would I run the events tree to have my .C code work?

ROOT Version: 6.22
Platform: Ubuntu 20.04


If you do

events->Process("MyAnalysis.C");

right after “opening” the tree in TBrowser as you did in your image, it should work (at least should not complain that “events” is unknown), since the “events” tree is available at that point --which you can check with

root[]  .ls

Independenty of that, you can get the tree like this:

root[] TFile *f = new TFile("data.root");  // or "/path/to/data.root" if it's not on the same directory

root[] TTree *T = (TTree*)f->Get("events"); // you can name the pointer "events" too, but you don't have to

and then do T->Process(...

1 Like

Hi there,

I proceeded to create the TTree and run it like so:

root [4] T->Process("MyAnalysis.C");
IncrementalExecutor::executeFunction: symbol '_ZN5MyJetD1Ev' unresolved while linking symbol '__ctor_2'!
You are probably missing the definition of MyJet::~MyJet()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZTV8MyPhoton' unresolved while linking symbol '__ctor_2'!
You are probably missing the definition of vtable for MyPhoton
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZTV5MyJet' unresolved while linking symbol '__ctor_2'!
You are probably missing the definition of vtable for MyJet
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZTV10MyElectron' unresolved while linking symbol '__ctor_2'!
You are probably missing the definition of vtable for MyElectron
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZTV6MyMuon' unresolved while linking symbol '__ctor_2'!
You are probably missing the definition of vtable for MyMuon
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN6MyMuonD1Ev' unresolved while linking symbol '__ctor_2'!
You are probably missing the definition of MyMuon::~MyMuon()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN10MyElectronD1Ev' unresolved while linking symbol '__ctor_2'!
You are probably missing the definition of MyElectron::~MyElectron()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN8MyPhotonD1Ev' unresolved while linking symbol '__ctor_2'!
You are probably missing the definition of MyPhoton::~MyPhoton()
Maybe you need to load the corresponding shared library?
Error in <TClingCallFunc::make_ctor_wrapper>: Failed to compile
  ==== SOURCE BEGIN ====
__attribute__((used)) extern "C" void __ctor_2(void** ret, void* arena, unsigned long nary)
{
   if (!arena) {
      if (!nary) {
         *ret = new MyAnalysis;
      }
      else {
         *ret = new MyAnalysis[nary];
      }
   }
   else {
      if (!nary) {
         *ret = new (arena) MyAnalysis;
      }
      else {
         *ret = new (arena) MyAnalysis[nary];
      }
   }
}

  ==== SOURCE END ====
Error in <TClingCallFunc::ExecDefaultConstructor>: Called with no wrapper, not implemented!
Error in <TClingClassInfo::New()>: Call of default constructor failed to return an object for class: MyAnalysis
Error in <TClass::New>: cannot create object of class MyAnalysis

Hi @Cepheides,
can you provide a short recipe (including the input file) to reproduce the problem e.g. on lxplus? I can’t tell what the issue might be (@pcanal might be able to guess).

Cheers,
Enrico

Is the library that implement MyJet and MyPhoton loaded (and/or has a rootmap file on the LD_LIBRARY_PATH that might enable auto-loading of the library?)

Hello all,
Dropbox link to archived file

To reproduce the problem,

  1. Download and extract the archive
  2. In the directory that contains the MyAnalysis.C code, type
TFile *f = new TFile("files/data.root");
TTree *T = (TTree*)f->Get("events");
T->Process("MyAnalysis.C");

To process the tree