Re: [ROOT] Change of cut not noticed

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Aug 10 2000 - 16:14:23 MEST


Hi Daniel,
The Probleme in your piece of code is with gROOT->Delete("mycut").
This statement will no nothing if your cut is not drawn on the screen.
When a TCutG object is created , it is automatically added to the list
of special ROOT objects, that you can retrieve with a statement like:
  TCutG *mycut = (TCutG*)gROOT->GetListOfSpecials()->FindObject("mycut")

In order to delete your cut, you should first get a pointer to it via the
avove statement, then do
  delete mycut;

You can also delete a cut via the mouse using the contextmenu item "Delete"
when your cut is drawn on the screen.

see http://root.cern.ch/root/html/TCutG.html

Rene Brun


Daniel Barna wrote:
> 
> Hi Rene,
> I am using v2.25 on a linux pc.
> These are the steps I made:
> 
> TFile file("file.root");
> TTree *t = (TTree *)file.Get("tree");
> t->Draw("x:z");
> 
> //Now I create a TCutG with the graphics editor, and rename it to "mycut".
> 
> t->Draw("x:z","mycut");
> // it works fine, only points in the selected area appear on the screen
> 
> gROOT->Delete("mycut");
> t->Draw("x:z");
> 
> // now I create another TCutG with the graphics editor, and rename
> // it again to "mycut"
> 
> t->Draw("x:z","mycut");
> 
> // at this step TTree::Draw seems to use the previous cut, the produced
> // plot is the same as before
> 
>    Daniel
> 
> > Hi Daniel,
> > I do not understand this problem. Which version are you using ?
> > What do you mean by "deleting the cut from the current directory" ? Could
> > you provide a snapshot of your code with the calls to create the cut,
> > delete it ?  Note that I am currently on holidays with sporadic access to
> > the internet.
> >
> > Rene Brun
> >
> > On Thu, 27 Jul 2000, Daniel Barna wrote:
> >
> > > Hi Rooters,
> > > I created a TCutG object by setting it's points in a
> > > fuction. It worked  fine when I used it in a selection of TTree::Draw.
> > > Later I deleted this TCutG object from the root directory, and created a
> > > new TCutG object with the same name, but TTree::Draw
> > > didn't recognize the change: it used still the old cut.
> > > What is the right way to avoid such a case?
> > > Thanks
> > > Daniel
> >
> >
> >



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET