RE: [ROOT] Reading a TTree

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Jul 28 2003 - 19:22:08 MEST


Hi Marco,

This is a common error.  TTree::Draw does not have access the C++ variables.
You have to create a custom string to pass it to TTree::Draw.  For example:

  h1->Draw(Form("Ivfas_data1[%d]",i),"","goff",200,0);

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Marco Ajello
Sent: Monday, July 28, 2003 4:08 AM
To: Rene Brun
Cc: roottalk@pcroot.cern.ch
Subject: [ROOT] Reading a TTree


Hi all.
I am reading a TTree of 200 events.
I have a TBranc called Ivfas_data[2304] of 2304 entries for each
of 200 events.
I want to do something like:

 for (i=0;i<2304;i++){
      h1->Draw("Ivfas_data1[i]","","goff",200,0);
      pedx[i]     = htemp->GetMean();
      rms_pedx[i] = htemp->GetRMS();
      htemp->Reset();

      h1->Draw("Ivfas_data2[i]","","goff",200,0);
      pedy[i]     = htemp->GetMean();
      rms_pedy[i] = htemp->GetRMS();
      htemp->Reset();
But what i get is :: UNKNOWN NAME ""i".
Could you help me?
Best Regards,
Marco


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET