Difference in opening TClonesArray with 2.22.10 and 2.23.10

From: Stephan Hurling (hurling@mail.desy.de)
Date: Mon Jan 10 2000 - 15:28:39 MET


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


+-------------------------------------------------------------------------+
|                                                                         |
|                                                                         |
|    Stephan Hurling                                                      |
|                                                                         |
|    DESY                                  Telephone: **49 40 8998 3228   |
|    Group FH1, Build. 1c/162              FAX      : **49 40 8998 4385   |
|    Notkestrasse 85                                                      |
|                                                                         |
|    D-22607 Hamburg (Germany)             e-mail: hurling@mail.desy.de   |
|                                                                         |
|                                                                         |
+-------------------------------------------------------------------------+
 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:16 MET