Re: [ROOT] TLorentzVector in a tree.

From: Fabrizio Pierella (Fabrizio.Pierella@cern.ch)
Date: Wed Sep 04 2002 - 17:47:32 MEST


  Hi Francesco,
  just an example

  gSystem.Load("libPhysics.so"); 
  TFile f("data.root","recreate"); 
  f.SetCompressionLevel(1); 
  TTree tdat("tdat","Tree for resolution"); 
  TLorentzVector *p4datrad=new TLorentzVector(0.,0.,0.,0.); 
  tdat.Branch("p4datrad","TLorentzVector",&p4datrad); 
  p4datrad->SetPxPyPzE(1.,1.,0.,5.); // same as "p4datrad->SetXYZT(1.,1.,0.,5.);" 
  tdat.Fill(); 
  tdat.Print(); 
  tdat.Write();     

hoping it helps you, regards
                                    Fabrizio

On Wed, 4 Sep 2002, Perfetto Francesco wrote:

> 
>  Hi Rene
> 
> I am trying to create a tree with a branch containing a TLorentzVector,
> but it doesn't fill the variable (its components Px(),Py(),Pz(),E() in
> the tree.
> 
>  What is correct for to use TTree::Branch ? (if possible a example).
> 
> {...
> TFile   *file = new TFile("data.root","RECREATE");
> TLorentzVector p4datrad;
> TTree   *tdat = new TTree("tdat","Tree for resolution");
> tdat->Branch("p4datrad","TLorentzVector",&p4datrad);
> ...
> tdat->fill()
> }
> p.s. All others variables ( Double_t,Float_t...) are regularry filled
> 
> 
>                                               Regards.
> 
> 



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