Hello root talkers,
I am relatively new to the ROOT platform and I am encountering a problem when trying to use TH1F class to display histograms from different root files.
I am unsure if what I am trying to do is possible however I am trying to plot 4 histograms on one canvas with each canvas pertaining to a different root file.
All root files contain the same tree and leaves. Each of the 4 TChains differ solely by a measurement length that was changed in the sim to prdocue the root files.
I am not producing any errors from root however only one histogram is plotted.
(Basically, I am trying to plot the flux of a particle through a number of planes. Each of the 4 jobs contain the same root file with the same variable/planes however the (x,y,z) coordinates are changed for each job. I am curious on how the flux of particles through each plane changes as the distance increases. I thought a 2x2 canvas would display the fluxes for each job.)
I am running version 5.14 on Scientific Linux 4.7. My file is listed below.
Thank you for the help
// Read in job101
TChain files101 ("h50");
for (Int_t ifile101 = 1; ifile101 <= 99; ifile101++)
{
files101.Add(Form("/amd/lnxdata304/nfs/data34/boone/fordd/GNUMI_MUONS/
batch/job1000/batch_testplanes_%i.root", ifile101));
}
// Read in job201
TChain files201 ("h50");
for (Int_t ifile201 = 102; ifile201 <= 200; ifile201++)
{
files201.Add(Form("/amd/lnxdata304/nfs/data34/boone/fordd/GNUMI_MUONS/
batch/job1000/batch_testplanes_%i.root", ifile201));
}
// Read in job301
TChain files301 ("h50");
for (Int_t ifile301 = 202; ifile301 <= 299; ifile301++)
{
files301.Add(Form("/amd/lnxdata304/nfs/data34/boone/fordd/GNUMI_MUONS/
batch/job1000/batch_testplanes_%i.root", ifile301));
}
// Read in job501
TChain files501 ("h50");
for (Int_t ifile501 = 400; ifile501 <= 499; ifile501++)
{
files501.Add(Form("/amd/lnxdata304/nfs/data34/boone/fordd/GNUMI_MUONS/
batch/job1000/batch_testplanes_%i.root", ifile501));
}
// Histograms for particles going through planes for each job
TH1F *muon_plane_job101 = new TH1F("muon_plane_job101","",100,0,10.);
TH1F *muon_plane_job201 = new TH1F("muon_plane_job201","",100,0,10.);
TH1F *muon_plane_job301 = new TH1F("muon_plane_job301","",100,0,10.);
TH1F *muon_plane_job501 = new TH1F("muon_plane_job501","",100,0,10.);
// Plotting histograms for each job
files101.Draw("plane >> muon_plane_job101", "(type == 5) || (type == 6)");
files201.Draw("plane >> muon_plane_job201", "(type == 5) || (type == 6)");
files301.Draw("plane >> muon_plane_job301", "(type == 5) || (type == 6)");
files501.Draw("plane >> muon_plane_job501", "(type == 5) || (type == 6)");
// Create new canvas and divide into 4 pads
TCanvas *c1 = new TCanvas("c1", "Distribution of Muons Through Each Plane",
1100,700);
c1->Divide(2,2);
// 1st Pad
c1->cd(1);
muon_plane_job101->Draw();
// 2nd Pad
c1->cd(1);
muon_plane_job501->Draw();
// 3rd Pad
c1->cd(1);
muon_plane_job301->Draw();
// 4th Pad
c1->cd(1);
muon_plane_job201->Draw(); Received on Tue Apr 27 2010 - 15:14:00 CEST
This archive was generated by hypermail 2.2.0 : Thu Apr 29 2010 - 11:50:01 CEST