Understanding T->SetBranchAddress in Emacs Macro

  • Thread starter lavster
  • Start date
In summary, T->SetBranchAddress ("B_PX", &B_PX); means that a TBranch called "B_PX" is being read from a file and can be accessed through the local variable B_PX. This is part of a program written in C/C++ using the ROOT software, which utilizes trees and branches to store and link data. The T in TSetBranchAddress stands for TTree.
  • #1
lavster
217
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
  • #2


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++.
 
  • #3


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

cheers :)
 
  • #4


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).
 
  • #5


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!
 
  • #6


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.
 

What is T->SetBranchAddress in Emacs Macro?

T->SetBranchAddress is a function in Emacs Macro that allows you to define a pointer to a specific location in memory. This is useful for accessing data structures and variables in your code.

How do I use T->SetBranchAddress in my Emacs Macro?

To use T->SetBranchAddress, you must first define a pointer variable using the "defvar" function. Then, you can use the T->SetBranchAddress function to assign the pointer to a specific location in memory.

Can T->SetBranchAddress be used with any data type?

Yes, T->SetBranchAddress can be used with any data type, including integers, strings, and arrays. It is important to make sure that the data type of the pointer variable matches the data type of the value you are trying to access.

Can T->SetBranchAddress cause any errors in my code?

Like any function, T->SetBranchAddress can cause errors if not used correctly. It is important to make sure that your pointer variable is properly defined and that you are accessing a valid location in memory. Also, be aware of any potential memory leaks that may occur if the pointer is not properly managed.

Are there any alternatives to using T->SetBranchAddress in Emacs Macro?

Yes, there are other methods for accessing data structures and variables in Emacs Macro, such as using the "car" and "cdr" functions. However, T->SetBranchAddress can be a useful tool for managing and manipulating data in your code.

Similar threads

Replies
27
Views
2K
  • Programming and Computer Science
Replies
8
Views
1K
  • Nuclear Engineering
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
976
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
6
Views
1K
Replies
2
Views
91
Replies
3
Views
1K
  • Computing and Technology
Replies
8
Views
1K
  • Programming and Computer Science
Replies
6
Views
3K
Back
Top