Extracting RMS scalar

I have what I want in the comments of my code. Also I have the root manual printed out and i’ve looked online in the resources and they are of no help to me. I think I’m at the point that I need some help. [code]{
//rms.C

//WHAT I WANT THIS PROGRAM TO DO
//I have 20 stored%i.root files.
//Each stored%i.root file is a tree with branches x_in,y_in,z_in,x_out,y_out,z_out
//When I plot tree.Draw("z_out-z_in") there is an RMS attached to it. 
//There is an RMS for each such stored%i.root file. 
//I want to extract the RMS and plot RMS vs 1-20(ie. that matches the stored%i.root)


//This Histogram was created to store the RMS from each stored%i.root file.
TH1D *h1 = new TH1D("h1","RMS",100000,-500,500);

for(int count = 1; count <= 20; count++)
{
	//Open the desired stored%i.root file
	TFile f(Form("stored%i.root",count));
	//This is where I'm stuck.
	//Things I tried and failed
	h1->tree->GetRMS()->Draw("z_out-z_in");
	
	h1->Draw();
}

}[/code]

Hi,

You need:tree->Draw("z_out-z_in >> hlocal"); double rms = hlocal->GetRMS(); h1->Fill(count,RMS); // or maybe you need a 2D histogram

Cheers,
Philippe.