Cannot read my TTree- botched SetBranchAddress()?

I am trying to read a TTree from a TFile using ROOT 3.10.01. I do this using tree->MakeSelector(). After adding “fChain->GetEntry(entry);” to the “Process()” method (why is it not there by default?!? Previous versions of ROOT at least had this cricial piece of code in a comment), I see that only some of my variables are being filled from the tree, the rest of them a garbage. This seems to be caused by incorrect value pointers:

Here is the tree “structure” generated by MakeSelector():

class T_align : public TSelector {
   public :
   TTree          *fChain;   //!pointer to the analyzed TTree or TChain
//Declaration of leaves types
   Int_t           EVID_nrun;
   Int_t           EVID_nevt;
   Int_t           ALIGN_nplanes;
   Int_t           ALIGN_iplane[45];   //[nplanes]
   Float_t         ALIGN_posu[45];   //[nplanes]
   Float_t         ALIGN_posv[45];   //[nplanes]
   Float_t         ALIGN_resuv[45];   //[nplanes]
   Float_t         ALIGN_resz[45];   //[nplanes]
   Float_t         ALIGN_fitp;
   Float_t         ALIGN_fitc;
   Float_t         ALIGN_fitcl;

//List of branches
   TBranch        *b_EVID;   //!
   TBranch        *b_ALIGN;   //!

Here are the value addresses printed by printf("%s %p %p",“nplanes”,b_ALIGN->FindLeaf(“nplanes”)->GetValuePointer(),&ALIGN_nplanes):

pointers    nplanes: 0x8b0f720 0x8b0f720, diff 0
pointers     iplane: 0x8b0f724 0x8b0f724, diff 0
pointers       posu: 0x8b0f724 0x8b0f7d8, diff -180
pointers       posv: 0x8b0f724 0x8b0f88c, diff -360
pointers      resuv: 0x8b0f724 0x8b0f940, diff -540
pointers       resz: 0x8b0f724 0x8b0f9f4, diff -720
pointers       fitp: 0x8b0f724 0x8b0faa8, diff -900
pointers       fitc: 0x8b0f728 0x8b0faac, diff -900
pointers      fitcl: 0x8b0f72c 0x8b0fab0, diff -900

Observe how the value pointers for “iplane[nplanes]”, etc fail to increment. What is going on here?

K.O.

Hi Konstantin,

See the comments in the generated code in function Process:
// Processing function. This function is called
// to process an event. It is the user’s responsability to read
// the corresponding entry in memory (may be just a partial read).
// Once the entry is in memory one can apply a selection and if the
// event is selected histograms can be filled.

You can read the full entry if you like with
fChain->GetEntry(entry);

However, in general, you want to read only
a few branches. See example in the
tutorial h1analysis.C

I do not understand why you are getting a problem when calling fChain->GetEntry(entry).

In your print statement, what is b_ALIGN?
Why do you go via FindLeaf, when you have directly the variables as class members of the selector?

Rene