RE: Use new methods in Draw()

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Fri, 19 Jan 2007 12:45:48 -0600


Hi,

To reproduce the problem, I still need access to (a short version of) your data/root file.

Thanks,
Philippe

-----Original Message-----
From: Hengtong Ding [mailto:dinght_at_iopp.ccnu.edu.cn] Sent: Friday, January 19, 2007 7:52 AM
To: Philippe Canal
Cc: 'Rene Brun'; 'Nico De Simone'; roottalk_at_pcroot.cern.ch Subject: RE: [ROOT] Use new methods in Draw()

Hi Philippe,
Very sorry for missing the macro.
My get.C is

{

    TFile *f1 = new TFile("test.root","read");     TTree *tree = f1 -> Get("tree") ;
    Double_t store_pp[8];
    tree->SetBranchAddress("bpp",store_pp) ;     tree->Draw("sum.C");
// when I use the line below instead, it works

   // tree->Draw("store_pp[0]");
}

where sum.C is

double sum() {   

  return store_pp[0];

}

 Another question about the method of the Draw(),  one can use , for example, tree-> Draw("pp[1]","weightpp*(pp[2]>30.))

 to draw pp[1] weighted as weighpp and within cut "pp[2] > 30."

 in which pp[1] pp[2] and weightpp are stored in the tree.  

 But I want to draw other variables within a  cut, for example "pp[1]+pp[2] >30" (also with the weight), how could I do that ?

Best regards,

Hengtong

On Fri, 19 Jan 2007, Philippe Canal wrote:

> Hi,
>
> You could give me access to your ROOT file and get.C, so that
> I can attempt to reproduce this problem?
>
> Thanks,
> Philippe
>
> -----Original Message-----
> From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch]
> On Behalf Of Hengtong Ding
> Sent: Friday, January 19, 2007 12:25 AM
> To: Rene Brun
> Cc: Nico De Simone; roottalk_at_pcroot.cern.ch
> Subject: Re: [ROOT] Use new methods in Draw()
>
> Hi Rene,
> I tried the method you told to Nico, but it failed.
>
> I use Root v5-11-06
> Processing get.C...
>
> Warning in <TTreePlayer::DrawScript>: TTreeProxy does not work in
> interpreted mode yet. The script will to compiled.
> Info in <TTreePlayer::DrawScript>: Will process tree/chain using
> generatedSel.h+
> Info in <TUnixSystem::ACLiC>: creating shared library
>

/direct/data01/ALICE/dinght/HVQMuon/QuenchCodes/results/0-5/beauty/run001/./
> generatedSel_h.so
>

/direct/data01/ALICE/dinght/HVQMuon/QuenchCodes/results/0-5/beauty/run001/fi
> leldrYq8.cxx:
> In
> member function `ROOT::TBranchProxy&
> ROOT::TBranchProxy::operator=(const
> ROOT::TBranchProxy&)':
>

/direct/data01/ALICE/dinght/HVQMuon/QuenchCodes/results/0-5/beauty/run001/fi
> leldrYq8.cxx:458:
> non-static
> const member `const TString ROOT::TBranchProxy::fBranchName', can't use

> default assignment operator
>

/direct/data01/ALICE/dinght/HVQMuon/QuenchCodes/results/0-5/beauty/run001/fi
> leldrYq8.cxx:458:
> non-static
> const member `const TString ROOT::TBranchProxy::fDataMember', can't use

> default assignment operator
>

/direct/data01/ALICE/dinght/HVQMuon/QuenchCodes/results/0-5/beauty/run001/fi
> leldrYq8.cxx:458:
> non-static
> const member `const Bool_t ROOT::TBranchProxy::fIsMember', can't use
> default
> assignment operator
> g++:
>

/direct/data01/ALICE/dinght/HVQMuon/QuenchCodes/results/0-5/beauty/run001/./
> fileldrYq8.o:
> No such file or directory
> Error in <ACLiC>: Compilation failed!
> Error in <TSelector::GetSelector>: file generatedSel.h+ does not have a
> valid class deriving from TSelector
>
>
> Another question about the method of the Draw(),
> one can use , for example,
>
> tree-> Draw("pp[1]","weightpp*(pp[2]>30.))
>
> to draw pp[1] weighted as weighpp and within cut "pp[2] > 30."
>
> in which pp[1] pp[2] and weightpp are stored in the tree.
>
> But I want to draw other variables within a
> cut, for example "pp[1]+pp[2] >30" (also with the weight), like Nico's
> case,
> how could I do that ?
>
> Best regards,
> Hengtong
>
> On Thu, 18 Jan 2007, Rene Brun wrote:
>
> > Hi Nico,
> >
> > Create a small script, say sum.C with
> > double sum() {return a+b;}
> >
> > and do:
> > tree.Draw("sum.C")
> >
> > Rene Brun
> >
> >
> >
> > Nico De Simone wrote:
> > > Dear Rooters,
> > > Using TTree::Draw() I can access member variables and methods defined
> > > in the class used to build the tree.
> > >
> > > How can I create new methods or new variables, in a new class, and use
> > > it in the same Draw()? Eg: the original class gives me the ints a and
> > > b and I want to create c=a+b and do tree-> Draw("c"). With MakeClass
I
> > > only get member variables of the original class but not the methods
> > > and add them is not trivial. Is there a better way?
> > >
> > > Thanks for any help.
> > > Nico
> > >
> >
>
>

-- 
************************************************
 *             Hengtong Ding                    *                    
 *                                              *
 *  Address:  Institute of Particle Physics,    *
 *            Central China Normal University   * 
 *            Wuhan, 430079,  P. R. China       *
 *  Tel:      0086 27 6786 7946 (lab)           *
 *            0086 27 8715 0351 (dormitory)     *
 *  Fax:      0086 27 6786 3213                 *
 *  Email:    dinght_at_iopp.ccnu.edu.cn           *
 *	      dinghengtong_at_hotmail.com          *
 ************************************************
Received on Fri Jan 19 2007 - 19:47:12 CET

This archive was generated by hypermail 2.2.0 : Sat Jan 20 2007 - 23:50:00 CET