Hi Stephan,
After ROOT 2.23.06 we have begun having a similar problem reading
our standard data files. These files have trees of TClonesArrays.
Here are some observations about it:
1) It affects Linux RH5.2 and Sunos5.6 which we have checked.
2) The problem affects Float_t arrays which are data members of
objects held in TClonesArrays. The first element of the
Float_t array is OK; all subsequent elements are zero.
3) The problem only affects those TClonesArrays containing a
single object. Objects in TClonesArrays containing more
than one object are read in normally.
4) Although our files were written by much earlier versions of
ROOT, the problem does not go away when we rewrite them with
ROOT 2.23.10.
George Irwin
> Dear Rooters,
>
> I've got the following problem: A colleague of mine created a file
for
> calorimeter calibration with ROOT version 2.22.10. He introduced a
> TClonesArray containing a class "RootVlqCaloCluster" containing
itself a
> normal standart C-array "Float_t ChannelEnergies[168];" . So far so
good.
> Now we try to open his file and we get different results with
different
> versions of ROOT.
>
> See the output from an interactive session with ROOT 2.22.10:
>
>
> Initialising finished.
>
> root [0] gSystem.Load("libroot2.22.10.so");
> root [1] TFile *f1 = new
TFile("/h1wgs/naxos/x03/usr/nix/CalibrationSample1/CalibData1.root");
> root [2] TTree *mytree = (TTree*)f1->Get("T");
> root [3] mytree->SetBranchStatus("CaloCluster",1);
> root [4] TClonesArray* rootVlqCaloCluster = new
TClonesArray("RootVlqCaloCluster", 1);
> root [5] TBranchClones *calo = (TBranchClones*)
mytree->GetBranch("CaloCluster");
> root [6] calo ->SetAddress(&rootVlqCaloCluster);
> root [7] mytree->GetEvent(5);
> root [8] printf("rootVlqCaloCluster->GetLast()
%d\n",rootVlqCaloCluster->GetLast());
> rootVlqCaloCluster->GetLast() 0 <-------- AHA, ONE
RESULT IN ARRAY!
> root [9] RootVlqCaloCluster *caloclus =
(RootVlqCaloCluster*)rootVlqCaloCluster->At(0);
> root [10] printf("ChannelEnergies[59]
%f\n",caloclus->ChannelEnergies[59]);
> ChannelEnergies[59] -0.018854 <-------- RIGHT
RESULT, ONLY NOISE!
>
> Ok, that's what we want so see also with ROOT 2.23.10. New Session,
new
> lib:
>
>
> Initialising finished.
>
> root [0] gSystem.Load("libroot2.23.10.so");
> root [1] TFile *f1 = new
TFile("/h1wgs/naxos/x03/usr/nix/CalibrationSample1/CalibData1.root");
> root [2] TTree *mytree = (TTree*)f1->Get("T");
> root [3] mytree->SetBranchStatus("CaloCluster",1);
> Error in <TTree::SetBranchStatus>: unknown branch -> CaloCluster
<---- OOOPS, WHY NOT ?
> root [4] TClonesArray* rootVlqCaloCluster = new
TClonesArray("RootVlqCaloCluster", 1);
> root [5] TBranchClones *calo = (TBranchClones*)
mytree->GetBranch("CaloCluster");
> root [6] calo ->SetAddress(&rootVlqCaloCluster);
> root [7] mytree->GetEvent(5);
> root [8] printf("rootVlqCaloCluster->GetLast()
%d\n",rootVlqCaloCluster->GetLast());
> rootVlqCaloCluster->GetLast() 0 <---- AHA, ONE RESULT
AGAIN!
> root [9] RootVlqCaloCluster *caloclus =
(RootVlqCaloCluster*)rootVlqCaloCluster->At(0);
> root [10] printf("ChannelEnergies[59]
%f\n",caloclus->ChannelEnergies[59]);
> ChannelEnergies[59] 0.000000 <---- WRONG RESULT!
>
>
> I'm pretty shure we've done something wrong, but at the moment,
we're too
> blind to see it. For that reason our macros deliver wrong results.
Can
> anybody help? Has the file format changed?
>
> The used code for the example above resides in
>
> /afs/desy.de/user/h/hurling/RootTest/...
>
>
> Many thanks for your help!!
>
> All the best / Alles Gute
>
> Stephan
>
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:16 MET