[ROOT] TChains and Adding friends

From: Caius Howcroft (howcroft@hep.phy.cam.ac.uk)
Date: Tue Nov 19 2002 - 15:01:11 MET


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:20 MET