Hello,
I’m having some problems with arrays of Char_t*. I’m trying to build a TTree with the following structure:
struct Results_summary_t {
.
.
Char_t side[4][3];
.
.
};
Then I create a branch for the field side
:
Results_summary_t results_summary;
TFile *f = new TFile("results_summary.root", "RECREATE");
TTree *tree = new TTree("T_RS","results summary data from ascii file");
tree -> Branch("Side", results_summary.side, "side[4]/C");
And finally I put the data into the field:
strcpy(results_summary.side[0], "HV\0");
strcpy(results_summary.side[2], "HV\0");
strcpy(results_summary.side[1], "RO\0");
strcpy(results_summary.side[3], "RO\0");
When I open a root session I get the following:
root [2] T_RS -> Show(0)
======> EVENT:0
site = ALU
serialNumber = 1
YPitch = 26.012,
26.013, 26.021, 26.021
ml = 1,
1, 2, 2
side = HV
The other values for side
don’t appear.
How could I get this as I expect? I’ve also tried with enumerated types instead of Char_t*. It works, but when you call the method Draw(), for instance, I think only numerical values are allowed:
enum Side {HV, RO};
struct Results_summary_t {
.
.
Side side[4];
.
.
};
root[3] T_RS -> Draw("YPitch", "ml == 1 && side == HV")
*ERROR 30 :
Bad numerical expression : "HV"
(Long64_t)(-1)
Thanks in advance