Understanding T->SetBranchAddress in Emacs Macro

  • Thread starter Thread starter lavster
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the use of the T->SetBranchAddress function in a macro written for Emacs, specifically in the context of ROOT, a data analysis framework. Participants explore the meaning of this function, its relation to TTree and TBranch objects, and the declaration of variables in C/C++.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Exploratory

Main Points Raised

  • One participant asks for clarification on the meaning of T->SetBranchAddress ("B_PX", &B_PX) in the context of an Emacs macro.
  • Another participant explains that T->SetBranchAddress is related to a TTree object from ROOT, indicating that it allows reading a TBranch called "B_PX" from a file into a local variable B_PX.
  • A participant seeks further clarification on what a TBranch or branch is, expressing interest in understanding its function.
  • One participant describes a tree as a storage container for various data pieces, explaining how branches can represent different attributes of data entries.
  • A question arises about how to declare variables, specifically inquiring about the use of float_t and int_t, and the difference between them.
  • Another participant clarifies that Int_t is analogous to int (integer) and Float_t is similar to float, suggesting that understanding these types would benefit from studying an introductory C/C++ book.

Areas of Agreement / Disagreement

Participants generally agree on the basic functions of T->SetBranchAddress and the definitions of TTree and TBranch, but there are ongoing questions about variable declaration and types, indicating some uncertainty and a lack of consensus on those aspects.

Contextual Notes

Participants express varying levels of familiarity with C/C++ and ROOT, which may affect their understanding of the concepts discussed. There is also an implicit assumption that knowledge of programming is necessary to fully grasp the topics.

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
 
Technology 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.
 

Similar threads

  • · Replies 25 ·
Replies
25
Views
1K
Replies
27
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 18 ·
Replies
18
Views
6K
  • · Replies 8 ·
Replies
8
Views
2K