Re: [ROOT] how to use TLorentzVector in a call to a function

From: Stanislav NESTEROV (Stanislav.Nesterov@cern.ch)
Date: Wed Sep 25 2002 - 13:01:25 MEST


   Hi Perfetto,

   Sorry, I've not noticed that you don't load "libPhysics.so" before 
executing script library.

   So you must not load it in local procedure, 'cause you delta_egamma is 
not only in this scope. Just do like this:

[root] gSystem->Load("libPhysics.so");

or you can compile it with ACliC (aftre loading library) and use your 
precompiled script.

		best regards,
					Stanislav.

On Wed, 25 Sep 2002, Perfetto Francesco wrote:

> Hi Stanislav,
> I thanks you for your help, I have do that you tell me, but not even this
> work.This time root tell me:
> 
> Compiled for solaris.
> 
> CINT/ROOT C/C++ Interpreter version 5.15.21, Dec 8 2001
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] .L ana_dali_mc.C
> root [1] ana_dali_mc mio
> root [2] mio.Loop()
> Error: Illegal Assignment to an undeclared symbol TLorentzVector&x
> FILE:ana_dali_mc.C LINE:304
> *** Interpreter error recovered ***
> root [3]
> 
> On Wed, 25 Sep 2002, Stanislav NESTEROV wrote:
> 
> >
> >  Hi Perfetto,
> >  You should replace your line
> >
> > > Double_t delta_egamma(TLorentzVector x,TLorentzVector y)
> >
> >  with
> >
> > > Double_t delta_egamma(TLorentzVector& x,TLorentzVector& y)
> >
> >
> >    and all will be fine.
> >
> > 			Best regards,
> > 				Stanislav.
> >
> > On Wed, 25 Sep 2002, Perfetto Francesco wrote:
> >
> > > Hi ROOTers,
> > > I am sorry if this question is very too trivial, but I don't know where
> > > mistake.
> > > The problem is that, when call the  my function "delta_egamma" in my
> > > program ,root tell me :
> > >
> > > root [0] .L ana_dali_mc.C
> > > root [1] ana_dali_mc mio
> > > root [2] mio.Loop()
> > > Error: Illegal Assignment to an undeclared symbol TLorentzVectorx
> > > FILE:ana_dali_mc.C LINE:304
> > > *** Interpreter error recovered ***
> > >
> > > My program is:
> > >
> > > #define ana_dali_mc_cxx
> > > #include "ana_dali_mc.h"
> > >
> > > void ana_dali_mc::Loop()
> > > {
> > >
> > >   if (!TClassTable::GetDict("Physics")) {
> > >     gSystem.Load("$ROOTSYS/lib/libPhysics.so");
> > >   }
> > >  ...
> > >  Double_t pluto;
> > >  TLorentzVector p4datetasys_pim,p4datetasys_pip,p4datetasys_piz;
> > >  TTree *tmc = new TTree("tmc","Tree for montecarlo");
> > >
> > >  for (Int_t jentry=0; jentry<nentries;jentry++)
> > >    { ...
> > >      pluto = delta_egamma(p4datetasys_pip,p4datetasys_pim);
> > >      tmc ->Fill();
> > >    }
> > > }
> > >
> > > Double_t delta_egamma(TLorentzVector x,TLorentzVector y)
> > > {
> > >   Double_t delta;
> > >   TLorentzVector pippo;
> > >
> > >   pippo = x;
> > >   mimmie= y;
> > >   ...
> > >   delta = pippo.Mag2();
> > >
> > >   return delta;
> > > }
> > >
> > > Someone can tell me how can I do that ?(where is my mistake ? )
> > >
> > > 						Regards
> > > 						Francesco.
> > >
> > >
> >
> >
> >
> 
> 



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