On Tue, 25 Feb 2003, Rene Brun wrote:
> If you have created your Tree with one single top level branch (eg event), you
> should set the address of this top level branch and not the address of one of
> the sub-branches. I need to see your code to come with a better
> diagnostic.
The tree is definitely not created from a single top level object - it is
created from multiple branches each containing a TClonesArray or a single
object. I can copy the TClonesArray branches successfully - they work
fine. It is only the single object branches that I have trouble with.
The code used to create the branches is:
if (_Fruits->InheritsFrom("TClonesArray")) {
tree->Branch(_BranchName.Data(), &_Fruits, buffersize);
} else {
tree->Branch(_BranchName.Data(),_Fruits->ClassName(),&_Fruits,buffersize);
}
However I have no control over this code (it's part of the D0 thumbnail
package). In the case in question _Fruits is a TObject * which points to
an instance of TMBGlob.
The code I have written to access the branch is:
// Turn on the branch for readout
tree()->SetBranchStatus(_bname.c_str(),1);
// Set the branch address to the data object
tree()->SetBranchAddress(_bname.c_str(),&_ptr);
and this works fine for the original TTree. _ptr points to a valid
instance of TMBGlob which gets filled with the data. I can also email a
tarball of the entire readout code if you need to see it all. I have also
tried turning on branches "Glob.*" but then I get the error that ROOT
con't find them. One thing that is worth mentioning is that I only provide
addresses for the branches which are turned on. I know this has
implications for the I/O speed but not for the CopyTree method.
> You are mentionning problems with rootcint with the more recent versions of
> ROOT. Did you report these problems to somebody?
I haven't reported these problems yet because I haven't had a chance to
look at them in detail. I had assumed that there were significant changes
to rootcint and that I would need to alter my code to make it work.
However if code that compiles with ROOT 3.03/09 should compile with ROOT
3.04/02 without changes then I'd be happy to send you the error messages I
get along with my code. If there are definite changes that I need to make
then I'd be very happy if you could give me a pointer to them - I didn't
see anything in the release notes that gave me cause for concern.
Roger
> Roger Moore wrote:
> >
> > I have been using the CopyTree method, along with a TEventList, to select
> > a subset of events and branches in a TChain to write out to a TTree. This
> > works absolutely fine for TClonesArray branches. However for the single
> > object branch in the TChain it fails miserably. The entire branch somehow
> > gets converted into a single 'TObject' branch. Shown below is the result
> > of a 'Print' of the original TChain branch:
> >
> > root [5] TMBTree->GetBranch("Glob")->Print("")
> > *Branch :Glob *
> > *Entries : 13865 : BranchElement (see below) *
> > *............................................................................*
> > *Br 1 :fUniqueID : *
> > *Entries : 13865 : Total Size= 68940 bytes File Size = 1414 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 39.59 *
> > *............................................................................*
> > *Br 2 :fBits : *
> > *Entries : 13865 : Total Size= 68860 bytes File Size = 1400 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 39.99 *
> > *............................................................................*
> > *Br 3 :_evtno : *
> > *Entries : 13865 : Total Size= 68880 bytes File Size = 49526 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 1.13 *
> > *............................................................................*
> > *Br 4 :_runno : *
> > *Entries : 13865 : Total Size= 68880 bytes File Size = 2602 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 21.50 *
> > *............................................................................*
> > *Br 5 :_store : *
> > *Entries : 13865 : Total Size= 68880 bytes File Size = 2279 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 24.55 *
> > *............................................................................*
> > *Br 6 :_solpol : *
> > *Entries : 13865 : Total Size= 68900 bytes File Size = 1418 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 39.46 *
> > *............................................................................*
> > *Br 7 :_torpol : *
> > *Entries : 13865 : Total Size= 68900 bytes File Size = 1418 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 39.46 *
> > *............................................................................*
> > *Br 8 :_ticknum : *
> > *Entries : 13865 : Total Size= 68920 bytes File Size = 17272 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 3.24 *
> > *............................................................................*
> > *Br 9 :_lumblk : *
> > *Entries : 13865 : Total Size= 68900 bytes File Size = 6973 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 8.02 *
> > *............................................................................*
> > *Br 10 :_solcur : *
> > *Entries : 13865 : Total Size= 68900 bytes File Size = 1980 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 28.26 *
> > *............................................................................*
> > *Br 11 :_torcur : *
> > *Entries : 13865 : Total Size= 68900 bytes File Size = 2299 *
> > *Baskets : 14 : Basket Size= 4000 bytes Compression= 24.34 *
> > *............................................................................*
> >
> > and after CopyTree has done its work the branch in the output file is now:
> >
> > *Branch :Glob *
> > *Entries : 326 : BranchElement (see below) *
> > *............................................................................*
> > *Br 0 :TObject : *
> > *Entries : 326 : Total Size= 16976 bytes File Size = 526 *
> > *Baskets : 1 : Basket Size= 4000 bytes Compression= 5.95 *
> > *............................................................................*
> >
> > The original class, TMBGlob, is loaded and ROOT clearly recognises it
> > since with the original branch I can decode and look at all the entries
> > with the class loaded. When I set the branch address I use the command:
> >
> > SetBranchAddress("Glob",&_ptr);
> >
> > where _ptr is of type "TMBGlob *" and points to a TMBGlob class instance.
> >
> > The version of ROOT I am running is v3.03/09. I have tried compiling the
> > code under both v03.04/02 and v03.05/00. However there are lots of
> > problems with both version from rootcint and, after an initial attempt to
> > fix them, I have come to the conclusiosn that this is several days effort
> > which is time I don't currently have!
> >
> > So is there a fix or workaround which I can use with v03.03/09?
> >
> > Thanks,
> >
> > Roger
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET