[ROOT] trouble using TSelector class

From: Mark Hodgkinson (markhod@hep.man.ac.uk)
Date: Fri Mar 22 2002 - 16:37:20 MET


I am using  the skeleton produced by TTree::MakeSelector to analyse some
 MC from the kk generator. When I look at a certain branch from a tree
using both this (with no cuts added) and also by looking at it directly
using TBrowser (also with no cuts) I get totally different histograms. The Selector
method shows one sharp spike, whereas the TBRowser shows the correct broad
distribution (I have seen many examples of the plot being a broad
distribution rather than one spike). Here is the code I used in the
skeleton:
 #define mark2_cxx
 #include "mark2.h"
 #include "TH2.h"
 #include "TStyle.h"
 #include "TCanvas.h"
 void mark2::Begin(TTree *tree)
 {

 Init(tree);
 TString option = GetOption();

 gDirectory->Delete("qsquared");
 qsquared = new TH1F("qsquared", "q squared, tau", 120, 0, 6);
 }

 Bool_t mark2::ProcessCut(Int_t entry)
 {
 return kTRUE;
 }

 void mark2::ProcessFill(Int_t entry)
 {
 b_had_mass->GetEntry(23);
 qsquared->Fill(had_mass);
 }

 void mark2::Terminate()
 {
 gStyle->SetOptStat(11111);
 TCanvas *c1 = new TCanvas("c1", "kk2 comparison with koralb", 10, 10,
800, 600);
 c1->SetBottomMargin(0.15);
 qsquared->GetXaxis()->SetTitle("Invariant Mass of tau");
 qsquared->GetXaxis()->SetTitleOffset(1.4);
 qsquared->Draw();
 }

 The above code is called mark2.C. In root I then do:
 .x chain.C

where chain.C contains:

  {

      TChain chain("h5");
      chain.Add("kk.root");

    }

 Finally I run the mark2.C with chain.Process("mark2.C") and get the
histogram drawn.

 I also thought I should be able to do:
 TFile kk("kk.root")
 h5.Process("mark2.C")

 where h5 is a TNuple, but this crashes. Is there a way to do this since
 a chain seems unnecessary if you only have one root file you want to use.

 I hope someone can spot my mistake.

 Thanks,

 Mark.


-- 
--------------------------------------------------------------------------------------------
Mark Hodgkinson				phone (+44)(0)161 2754150
Office 7-11				email markhod@hep.man.ac.uk
HEP Group
Schuster Laboratory
University of Manchester
Oxford Road
Manchester
England

http://www.hep.man.ac.uk/~markhod



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