RE: [ROOT] TChains and Adding friends

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Dec 02 2002 - 21:56:12 MET


Hi Caius,

Using your file and little script (I put test.root in a data sub-directory).
I get the exact same histogram for both:
	chf_data->Draw("t_filter.fail","t_filter.fail==0")
and
	ch_data->Draw("t_filter.fail","t_filter.fail==0")

I tried with both 3.03.09 and the latest code in CVS.  Could you confirm I
you are getting the problem with test.root and you little script?  If you
do, how does it specifically fails (you could send picture of the canvases).

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Caius Howcroft
Sent: Tuesday, November 19, 2002 8:01 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] TChains and Adding friends



Hi,

Maybe I'm doing something really silly here, sorry if I am.

I have some file(s) each containing 3 trees, (filter, reco and trace).

I create a  chain for each tree, add the correct files and make the
filter and trace tree a friend of the reco tree. (see code at bottom).

I then want to do something like:
 if I then do something like

ch_mc->Draw("t_filter.fail","t_filter.fail==0") to count how many events
passed the filter I get a very different answer to
chf_mc->Draw("t_filter.fail","t_filter.fail==0").   This is really messing
up my results when I want to (for example) use the trace tree(e.g.
t_trace.tr_mindr) to plot
some stats about all events that passed (i.e. t_filter.fail==0) the
filter.


an example file is advailable at:

http://www.hep.phy.cam.ac.uk/~howcroft/test.root


Am I doing something really silly in the code below?

Cheers
  Caius

void loadchian(){
  ch_data = new TChain("t_trace");
  ch_bg = new TChain("t_trace");
  ch_mc = new TChain("t_trace");
  chf_data = new TChain("t_filter");
  chf_bg = new TChain("t_filter");
  chf_mc = new TChain("t_filter");
  chr_data = new TChain("reco");
  chr_bg = new TChain("reco");
  chr_mc = new TChain("reco");

  ch_data->Add("./data/*.root");
  ch_mc->Add("./mc/*.root");
  ch_bg->Add("./bg/*.root");
  chf_data->Add("./data/*.root");
  chf_mc->Add("./mc/*.root");
  chf_bg->Add("./bg/*.root");
  chr_data->Add("./data/*.root");
  chr_mc->Add("./mc/*.root");
  chr_bg->Add("./bg/*.root");

 ch_data->AddFriend(chf_data, "t_filter");
  ch_mc->AddFriend(chf_data, "t_filter");
  ch_bg->AddFriend(chf_data, "t_filter");
  ch_data->AddFriend(chr_data, "reco");
  ch_mc->AddFriend(chr_mc, "reco");
  ch_bg->AddFriend(chr_bg,"reco");
}

____________________________
CAIUS HOWCROFT
+44 (0)1223 764 128      UK(office)
AOL IM:                  sumsmug
Yahoo IM:                sumsmug



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:22 MET