Character strings in C structures and TTree

Anton Fokin (dr_mamadu@mail.ru)
Tue, 27 Jul 1999 22:44:28 +0400


This is a multi-part message in MIME format.

------=_NextPart_000_000C_01BED881.95A2AE40
Content-Type: text/plain;
charset="koi8-r"
Content-Transfer-Encoding: quoted-printable

Hi rooters,

I wonder how to fill a tree with a C structure which contains cnaracter =
strings. If I have=20

typedef struct {
char ticker[10];
Int_t adc1;
Int_t adc2;
} TData;

and do=20

static TData Data;

TBranch *branch =3D =
tree->Branch("Data",&Data,"ticker/C:adc1/I:adc2/I");

it doesn't work (well, as expected although) and to get it working I =
have to put my string variable at the bottom of the structure, i.e.

typedef struct {
Int_t adc1;
Int_t adc2;
char ticker[10];

} TData;

Could you comment this? Also, could you tell me if it is possible to =
work with this character string in the TTree::Draw method? something =
like "ticker=3D=3DMUMMY" or ...

Best,
Anton

------=_NextPart_000_000C_01BED881.95A2AE40
Content-Type: text/html;
charset="koi8-r"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">

Hi = rooters,
 
I wonder how to = fill a tree=20 with a C structure which contains cnaracter strings. If  I have=20
 
typedef struct = {
  char=20 ticker[10];
  Int_t  adc1;
  Int_t  = adc2;
} = TData;
and do =
 
static TData = Data;
 
  TBranch = *branch =3D=20 tree->Branch("Data",&Data,"ticker/C:adc1/I:adc2/I&q= uot;);
 
it doesn't work = (well, as=20 expected although) and to get it working I have to put my string = variable at the=20 bottom of the structure, i.e.
 
typedef struct = {
  = Int_t =20 adc1;
  Int_t  adc2;
  = char=20 ticker[10];
}=20 TData;
 
 
Could you comment this? Also, = could you tell=20 me if it is possible to work with this character string in the = TTree::Draw=20 method? something like "ticker=3D=3DMUMMY" or ...
 
Best,
Anton
------=_NextPart_000_000C_01BED881.95A2AE40--