Re: [ROOT] sub-branch SetAddress/GetEvent behavior question

From: Kate Scholberg (schol@mit.edu)
Date: Wed Jul 04 2001 - 20:09:43 MEST


>
> Yes, you can set individual branch addresses and read only one or a few
> branches. The problem in your case is that you seem to have a branch
> with an int*. You cannot read this branch alone. You also need the
> accompanying branch holding the length of the array.
> Currently, I assume that both the counter and the array are in the same class.
>

Hmm, the sub-branch I'm trying to read isn't an int*, it's just a
plain int.  (However the class for the super-branch does have a couple
of arrays).

Here's the full class for the split branch:

class EventNtuple: public TObject {
public:
  int Eventno;
  int Run;
  int RunType;
  int Time[2];
  int RawWords;
  float RadS;
  float ThetaS;
  float PhiS;
  float Yaw;
  float Pitch;
  float Roll;
  float VelocityS;
  float VelTheta;
  float VelPhi;
  float ThetaM;
  float PhiM;
  int Particles;
  int Tracks;
  int Betas;
  int Charges;
  int TrRecHits;
  int TrClusters;
  int TrRawClusters;
  int TrMCClusters;
  int TOFClusters;
  int TOFMCClusters;
  int CTCClusters;
  int CTCMCClusters;
  int AntiMCClusters;
  int AntiClusters;
  int EventStatus;
};


I'm trying to set the branch address using

int* evptr = 0;
amstree->SetBranchAddress("Eventno",&evptr)

The 2nd argument of SetBranchAddress should be the address of a
pointer, right?  I tried all sorts of other things, too... I tried
putting in the address of an int instead , I tried first instantiating the
int that evptr is pointing to, etc.)

But GetEvent reads in nothing for the sub-branch, although it works fine for
setting the top branch level address.

Kate.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:51 MET