# How do I process this tree?

**URL:** <https://root-forum.cern.ch/t/how-do-i-process-this-tree/42132>\
**Category:** Newbie\
**Created:** [November 5, 2020, 4:28am UTC](https://root-forum.cern.ch/t/how-do-i-process-this-tree/42132 "2020-11-05T04:28:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cepheides](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/bcef8e/32.png) [@Cepheides](https://root-forum.cern.ch/u/Cepheides)\
**Post date:** [November 5, 2020, 4:28am UTC](https://root-forum.cern.ch/t/how-do-i-process-this-tree/42132/1 "2020-11-05T04:28:52Z")

</div>

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

* * *

 ![tree](https://root-forum.cern.ch/uploads/default/original/3X/b/3/b3ead6e515329a8ff6e5801c08f600163d198975.png)

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [November 5, 2020, 7:03am UTC](https://root-forum.cern.ch/t/how-do-i-process-this-tree/42132/2 "2020-11-05T07:03:14Z")

</div>

If you do

```auto
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

```auto
root[] .ls

```

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

```auto
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(...`

---

<div class="post-metadata">

**Author:** ![Cepheides](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/bcef8e/32.png) [@Cepheides](https://root-forum.cern.ch/u/Cepheides)\
**Post date:** [November 5, 2020, 6:37pm UTC](https://root-forum.cern.ch/t/how-do-i-process-this-tree/42132/3 "2020-11-05T18:37:13Z")

</div>

Hi there,

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

```auto
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

```

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [November 9, 2020, 9:43am UTC](https://root-forum.cern.ch/t/how-do-i-process-this-tree/42132/4 "2020-11-09T09:43:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [November 9, 2020, 5:39pm UTC](https://root-forum.cern.ch/t/how-do-i-process-this-tree/42132/5 "2020-11-09T17:39:47Z")

</div>

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?)

---

<div class="post-metadata">

**Author:** ![Cepheides](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/bcef8e/32.png) [@Cepheides](https://root-forum.cern.ch/u/Cepheides)\
**Post date:** [November 9, 2020, 8:29pm UTC](https://root-forum.cern.ch/t/how-do-i-process-this-tree/42132/6 "2020-11-09T20:29:58Z")

</div>

Hello all,  
[Dropbox link to archived file](https://www.dropbox.com/s/1ompqf2yfxycqkp/HEPTutorial.tar.xz?dl=0)

To reproduce the problem,

1. Download and extract the archive
2. In the directory that contains the `MyAnalysis.C` code, type

```auto
TFile *f = new TFile("files/data.root");
TTree *T = (TTree*)f->Get("events");
T->Process("MyAnalysis.C");

```

To process the tree
