Fwd: Re: [ROOT] looping over variables

From: Vincent ROBERFROID (roberfroid@fynu.ucl.ac.be)
Date: Thu Oct 30 2003 - 16:55:22 MET


Try something like that :

TNtuple *nt[4];
for(Int_t i=0; i<4; i++)
  nt[i]=(TNtuple*)file->Get(Form("net%d",i));
TString var[0]={"z","rho","phi"};
for(Int_t i=0;i<3; i++){
  nt[0]->Draw(Form("abs(t_net-t_phot):%s",var[i].Data()),"","prof");
  for(Int_t j=1; j<4; j++){
	nt[j]->Draw(Form("abs(t_net-t_phot):%s",var[i].Data()),"","prof same");
  }
  c1.Update();
  psfile.NewPage();
}

Vincent


On Thursday 30 October 2003 14:41, daan wrote:
> Hi,
>
> How can I loop over some variable list and ntuple list and make plots with
> the TNtuple::Draw method?
>
> I want to do something like:
>
> for vars in z rho phi
> 	for tuples in net1 net2 net3 net4
> 		tuples->Draw("abs(t_net-t_phot):[vars]");
> 	endfor
> endfor
>
>
> What I do now is:
> //  * z
> net1->Draw("abs(t_net-t_phot):z","","prof");
> net2->Draw("abs(t_net-t_phot):z","","prof same");
> net3->Draw("abs(t_net-t_phot):z","","prof same");
> net4->Draw("abs(t_net-t_phot):z","","prof same");
> c1.Update();
> psfile.NewPage();
> //  * rho
> net1->Draw("abs(t_net-t_phot):rho","","prof");
> net2->Draw("abs(t_net-t_phot):rho","","prof same");
> net3->Draw("abs(t_net-t_phot):rho","","prof same");
> net4->Draw("abs(t_net-t_phot):rho","","prof same");
> c1.Update();
> psfile.NewPage();
> //  * phi
> net1->Draw("abs(t_net-t_phot):phi","","prof");
> net2->Draw("abs(t_net-t_phot):phi","","prof same");
> net3->Draw("abs(t_net-t_phot):phi","","prof same");
> net4->Draw("abs(t_net-t_phot):phi","","prof same");
> c1.Update();
>
>
> thanks!
>
>
> daan

--
Roberfroid Vincent
Assistant UCL
UCL - Institut de Physique Nucléaire
2, Chemin du Cyclotron
B-1348 Louvain-la-Neuve
Tél: +32 10 47 38 75
Fax: +32 10 45 21 83
email: roberfroid@fynu.ucl.ac.be
http://www.fynu.ucl.ac.be/users/v.roberfroid/index.html

-------------------------------------------------------

-- 
Roberfroid Vincent
Assistant UCL
UCL - Institut de Physique Nucléaire
2, Chemin du Cyclotron
B-1348 Louvain-la-Neuve
Tél: +32 10 47 38 75
Fax: +32 10 45 21 83
email: roberfroid@fynu.ucl.ac.be
http://www.fynu.ucl.ac.be/users/v.roberfroid/index.html



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