[ROOT] Scans and Draws

From: Sidoti Antonio tel. +39+0461 88 1525 (sidoti@science.unitn.it)
Date: Tue Oct 16 2001 - 21:05:33 MEST


Hi rooters,
I am having a problem. I want to check if the entries two branches of a
rootuple are the same (see the attached help.root file).

TFile *help = TFile::Open("help.root")
TTree *tree = (TTree*)help->Get("cmp");

if I do a scan all the entries are the same:
    tree->Scan("ptsg3x.c:ptsint.c")

if I do a scan requiring a selection --> less entry but again the first
                                         two columns are the same.
    tree->Scan("ptsg3x.c:ptsint.c","abs(ptsg3x.c-ptsint.c)>1")

If I plot:
tree->Draw("ptsg3x.c-ptsint.c") -->I see two peaks at -1000 and +1000 (and
                                   also a peak at 0)

If I plot with constraints --> I see effectively only one peak in 0
tree->Draw("ptsg3x.c-ptsint.c",abs(ptsg3x.c-ptsint.c)<1")

Some questions:
1) if the entries are NOT the same why the TTree:Scan shows me same
columns
2) are the two branches different?
3) I see a peak at 200 when tree->Draw("ptsg3x.obsp") I am expecting only
one or 0 entry per channel.
...
Any ideas?
Thanks in advance
Antonio Sidoti

P.S I'm using  3.01/06

P.S2
I am filling the root file in the following way...

  /*TFile hfile("help.root","RECREATE","compare simple int and g3x");
  TTree *tree = new TTree("cmp","Tree with different branches");

tree->Branch("ptsint",&compn,"ev/I:obsp/I:c/F:d0/F:phi0/F:z0/F:ctg/F");*/

  TFile hfile("help.root","UPDATE","compare simple int and g3x");
  TTree *tree = (TTree*)hfile->Get("cmp");
  tree->Branch("ptsg3x",&comp,,"ev/I:obsp/I:c/F:d0/F:phi0/F:z0/F:ctg/F");

   for (Int_t jentry=0; jentry<nentries;jentry++) {
    Int_t ientry = LoadTree(jentry); //in case of a TChain, ientry is the
entry number in the current file
    nb = fChain->GetEntry(jentry);   nbytes += nb;
    compn.ev = EV_evnum;
    compn.obsp = MC_obsp;
    compn.c = PTS_c;
    compn.d0 = PTS_d0;
    compn.phi0 = PTS_phi0;
    compn.z0 = PTS_z0;
    compn.ctg = PTS_ctg;
    tree->Fill();
  }
  hfile->Write();
  hfile.Close();
}



_______________________________________________________________________________
	     a n t o n i o   	      s i d o t i

	     e-mail	              sidoti@science.unitn.it
	                              sidoti@fnal.gov
	     www   		      http://higgs.tn.infn.it/~sidoti/
_______________________________________________________________________________
		"Il meglio e` nemico del buono"









This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:03 MET