Hi Tuan,
For your first problem, add a "." as the last character of your branch
names. See documentation of TTree::Branch
For your second problem, it is hard to come with a diagnostic without
looking at your classes. If your Jets or Electrons are in a correct
container (TClonesArray for example), it is perfectly normal to have 0
entries. Do not play yourself by filling branch per branch?.
See an example at $ROOTSYS/test/Event.h,cxx,etc
Rene Brun
On Fri, 31 May 2002, Vu Anh Tuan wrote:
> Hi,
>
> I've got several questions. They are quite independent:
>
> 1. I have two branches named EMS and JET in my tree. Actually they are
> two classes with several attributs, in particular they both have
> _EMF. My program is like this
>
> JET *myjet;
> EMS *myele;
>
> // Tree and branches declarations here
> TTree mytree ...
>
> // In the loop I fill myjet and myele attributes
> for
> {
> myjet->_EMF = something;
> ...
> myele->_EMF = something else;
> mytree->Fill();
> }
>
> The problem is that when I open my tree up, I find that in two blocks
> EMS and JET I have exactly the same plots for EMF values. When I change
> _EMS to _jEMF and _eEMF in JET and EMS class definitions respectively,
> it's OK back.
>
> So why it works like this?
>
> 2. In the second question I still have the same above structure, with a
> little difference: sometimes I do NOT want myele branch to be
> filled. The reason is simple: in hadronic colliders you have in data a
> lot of jets but not always electrons. I still want to collect data in
> the same root-tuple. But when myele attributes are not initialised,
> the method myTree->Fill() takes any value to put into EMS branch. I
> tried to get around this bug by two ways inside the loop
>
> - // If I want to fill only JET branch
> mytree->GetBranch("JET")->Fill();
>
> It doesn't work: no entries have been saved.
>
> - // If I want to fill only JET branch
> mytree->SetBranchStatus("EMS",0);
> mytree->Fill();
> mytree->SetBranchStatus("*",1);
> // If I want to fill all branches
> mytree->Fill();
>
> It fills everything up as usual.
>
> Can someone help me?
>
> Thanks,
>
> Tuan
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET