Understanding T->SetBranchAddress in Emacs Macro

  • Thread starter Thread starter lavster
  • Start date Start date
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 8K views
lavster
Messages
213
Reaction score
0
what does T->SetBranchAddress ("B_PX", &B_PX); mean in the macro written in emacs

what does T->SetBranchAddress ("B_PX", &B_PX); mean in the macro written in emacs

thanks
 
Physics news on Phys.org


lavster said:
what does T->SetBranchAddress ("B_PX", &B_PX); mean in the macro written in emacs

thanks

That looks like its actually a TTree object from ROOT. It means that the TBranch called "B_PX" is being read from a file, and when you want to access its done through your local variable (that is declared) B_PX.

This will probably help you:
http://root.cern.ch/drupal/content/users-guide

Emacs is just an editor, like vi or wordpad, it has no relevance except reading the text file that the macro is written on. The program is written *in* C/C++.
 


excellent thanks! thanks for the link and your explanation! however, what's a tbranch, or just a branch in general?

cheers :)
 


Basically, a tree is a storage container that links assorted information/data-pieces together.

For example, say you take a group of people and record info on all of them (height, weight, age, sex, name, etc). You could assign each of those values to a branch in the tree. If you want all of the info on person #3, you'd just look at the 3rd entry in each branch of the tree.

Incidentally, branches can also be more complicated, they can be structures, objects, arrays, arrays of objects, etc.

In the ROOT software, they typically denote all of their objects by Txxxxxx, so TBranch is just their version of a branch in a TTree (their version of a tree).
 


great,that seems simple enough. how do you declare the variables?is that using the float_t and int_t commands? what's the difference betweem the two. I am assuming int means integer?

thanks againfor all your help!
 


No problem lavster.

Int_t is basically just like int, which is an integer. Float_t is just like a regular float (floats are basically the computers attempt to make real numbers). At this point you really should pick up an intro C/C++ book -- it will then all make more sense.