Perform natural sorting on file names before plotting profiles

This commit is contained in:
salman 2011-09-22 15:42:45 +00:00
parent 45f076bef8
commit 079fd24c12
3 changed files with 25 additions and 6 deletions

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'TrimSPGUI.ui' # Form implementation generated from reading ui file 'TrimSPGUI.ui'
# #
# Created: Thu Aug 11 16:45:18 2011 # Created: Thu Sep 22 17:41:56 2011
# by: The PerlQt User Interface Compiler (puic) # by: The PerlQt User Interface Compiler (puic)
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -2692,7 +2692,11 @@ sub PlotProfiles
this, this,
"Select RGE files dialog", "Select RGE files dialog",
"Choose RGE file to plot"); "Choose RGE file to plot");
my @files = @$files_ref; my @files_tmp = @$files_ref;
# Do "natural" sorting on the file name list
# This will produce (hopefully) a plot with largest needed depth scale
my @files = grep {s/(^|\D)0+(\d)/$1$2/g,1} sort grep {s/(\d+)/sprintf"%06.6d",$1/ge,1} @files_tmp;
my $filenames=join(",",@files); my $filenames=join(",",@files);
if ($filenames ne "" ) { if ($filenames ne "" ) {

View File

@ -672,7 +672,11 @@ void TrimSPGUI::PlotProfiles()
this, this,
"Select RGE files dialog", "Select RGE files dialog",
"Choose RGE file to plot"); "Choose RGE file to plot");
my @files = @$files_ref; my @files_tmp = @$files_ref;
# Do "natural" sorting on the file name list
# This will produce (hopefully) a plot with largest needed depth scale
my @files = grep {s/(^|\D)0+(\d)/$1$2/g,1} sort grep {s/(\d+)/sprintf"%06.6d",$1/ge,1} @files_tmp;
my $filenames=join(",",@files); my $filenames=join(",",@files);
if ($filenames ne "" ) { if ($filenames ne "" ) {

View File

@ -32,11 +32,15 @@ void plotRge(TString &names)
Int_t i, j; Int_t i, j;
Int_t nStep = 0; Int_t nStep = 0;
Int_t nStepmax = 0;
Double_t *depth; Double_t *depth;
Double_t *nStop; Double_t *nStop;
Double_t *depthmax;
Double_t *nStopmax;
Double_t norm; Double_t norm;
Double_t intNorm; Double_t intNorm;
Double_t normStop[1000]; Double_t normStop[1000];
Double_t normStopmax[1000];
TGraph *rge[1000]; TGraph *rge[1000];
@ -93,6 +97,10 @@ void plotRge(TString &names)
if (depth[j] > xmax) { if (depth[j] > xmax) {
xmax = depth[j]; xmax = depth[j];
imax = i; imax = i;
depthmax=depth;
nStepmax=nStep;
nStopmax=nStop;
// normStopmax=normStop;
} }
if (depth[j] < xmin) { if (depth[j] < xmin) {
xmin = depth[j]; xmin = depth[j];
@ -112,8 +120,6 @@ void plotRge(TString &names)
delete fileGraph; delete fileGraph;
} }
cout << endl; cout << endl;
// plot again deepest to get the right x scale !!
// rge[imax] = new TGraph(nStep, depth, normStop);
Int_t color[1000]; Int_t color[1000];
for (i=0; i<1000; i++) for (i=0; i<1000; i++)
@ -128,6 +134,9 @@ void plotRge(TString &names)
color[7] = TColor::kOrange+4; color[7] = TColor::kOrange+4;
color[8] = TColor::kBlue-7; color[8] = TColor::kBlue-7;
// plot again deepest to get the right x scale !!
// rge[999] = new TGraph(nStepmax, depthmax, normStopmax);
Int_t last = tokens->GetEntries()-1; Int_t last = tokens->GetEntries()-1;
// Int_t last = imax; // Int_t last = imax;
rge[last]->SetMarkerStyle(20); rge[last]->SetMarkerStyle(20);
@ -139,8 +148,9 @@ void plotRge(TString &names)
rge[last]->Draw("apc"); rge[last]->Draw("apc");
rge[last]->GetYaxis()->SetRangeUser(min, 1.05*max); rge[last]->GetYaxis()->SetRangeUser(min, 1.05*max);
// This does not work
rge[last]->GetXaxis()->SetRangeUser(xmin, xmax); rge[last]->GetXaxis()->SetRangeUser(xmin, xmax);
// cout << "xmin " << xmin << " xmax" << xmax << endl; cout << "xmin =" << xmin << ", xmax = " << xmax << ", imax = " << imax << endl;
Int_t col; Int_t col;
@ -166,6 +176,7 @@ void plotRge(TString &names)
} }
legend->Draw(); legend->Draw();
delete tokens; delete tokens;
// I am not sure what this does, but it waits until canvas is closed // I am not sure what this does, but it waits until canvas is closed