Dear Rene,
thank you very much for your quick answer; please find in
/afs/cern.ch/user/g/govoni/public/TClonesArraySaving.tar.gz
the class code.
pietro
On 30 May, 2006, at 15:36, Rene Brun wrote:
> What you do should work. However, you forgot to attach your class  
> (at least the class header),
> so it is difficult to come with better diagnostics.
>
> Rene Brun
>
> Pietro Govoni wrote:
>> dear Rooters,
>>
>> I am trying to save a TClonesArray in a TTree in the following way:
>>
>> CalibTree::CalibTree (const std::string & fileName,
>>                       const std::string & treeName):
>>   m_file (0), m_tree (0), m_data (0), m_dataSize (0)
>> {
>>   TDirectory *dir = gDirectory;
>>   m_file = new TFile (fileName.c_str (),"RECREATE") ;
>>   m_file->cd () ;
>>   m_tree = new TTree (treeName.c_str(),"Analysis tree") ;
>>   m_tree->SetAutoSave (10000000) ;
>>   dir->cd();
>>
>> //  m_tree->cd () ;
>>   m_data = new TClonesArray (TRootCalibObj::Class(), 1) ;
>>   m_data->ExpandCreateFast (1) ;
>>
>>   m_tree->Branch ("EGCO", &m_data, 64000, 2) ;
>>   m_tree->Print () ;
>> }
>>
>>
>> The content of the TClonesArray, that is a TRootCalibObj, inherits  
>> from a TObject.
>> As far as I understood, I would expect the TTree to be filled by a  
>> set of branches, each of them corresponding to a variable of the  
>> TRootCalibObj.
>> Nevertheless, the Print () of the Tree only gives as output:
>>
>> Warning in <TTree::Bronch>: Using split mode on a class: TObject  
>> with a custom Streamer
>> ********************************************************************* 
>> *********
>> *Tree    :Analysis  : Analysis  
>> tree                                          *
>> *Entries :        0 : Total =            2591 bytes  File  Size  
>> =          0 *
>> *        :          : Tree compression factor =    
>> 1.00                       *
>> ********************************************************************* 
>> *********
>> *Br    0 :EGCO      :  
>> EGCO_                                                  *
>> *Entries :        0 : Total  Size=       2726 bytes  One basket in  
>> memory    *
>> *Baskets :        0 : Basket Size=      64000 bytes   
>> Compression=   1.00     *
>> *.................................................................... 
>> ........*
>> *Br    1 :EGCO.fUniqueID : fUniqueID 
>> [EGCO_]                                  *
>> *Entries :        0 : Total  Size=        766 bytes  One basket in  
>> memory    *
>> *Baskets :        0 : Basket Size=      64000 bytes   
>> Compression=   1.00     *
>> *.................................................................... 
>> ........*
>> *Br    2 :EGCO.fBits : fBits 
>> [EGCO_]                                          *
>> *Entries :        0 : Total  Size=        742 bytes  One basket in  
>> memory    *
>> *Baskets :        0 : Basket Size=      64000 bytes   
>> Compression=   1.00     *
>> *.................................................................... 
>> ........*
>>
>>
>> What I am missing?
>>
>>
>> Thank you very much,
>>
>> pietro
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET