Added checking for chemical formula and better coloring scheme for plots.

This commit is contained in:
salman 2015-10-12 16:36:59 +02:00
parent c4b73dba4e
commit d438ba41dd
2 changed files with 9 additions and 26 deletions

View File

@ -360,13 +360,16 @@ sub CreateInpFile
$All{$LComp} = $Comp;
my %LElComp=Chem::parse_formula($Comp);
foreach my $key (keys %LElComp) {
if ($key eq "") {
# Check if composition is understood
if ($key eq "" || Chem::Zof($key) eq "") {
$Check++;
}
}
if ($Comp eq "") {$Check++;}
# Write composition to results file header
# Densities of layers
my $Lrho="L".$i."rho";
my $rho = this->{ui}->layerTable->item($i-1,1)->text();
@ -381,7 +384,7 @@ sub CreateInpFile
# Sanity check, is the layer supposed to have value? are they all there?
if ($Check!=0) {
my $ErrMsg="Error: Layer $i is empty or bad chemical formula.\nPleach check!\n";
my $ErrMsg="Error: Bad chemical formula in Layer $i.\nPleach check!\n";
print STDERR $ErrMsg;
my $HelpWindow = Qt::MessageBox::information( this, "Error!",$ErrMsg);
return("ERROR");

View File

@ -50,23 +50,9 @@ void plotRge(TString &names)
Int_t col;
Int_t color[1000];
for (i=0; i<1000; i++)
color[i] = -1;
color[0] = TColor::kRed;
color[1] = TColor::kGreen;
color[2] = TColor::kBlue;
color[3] = TColor::kMagenta;
color[4] = TColor::kOrange;
color[5] = TColor::kViolet;
color[6] = TColor::kAzure+7;
color[7] = TColor::kOrange+4;
color[8] = TColor::kBlue-7;
TGraph *rge[1000];
TMultiGraph *mg = new TMultiGraph();
TLegend *legend = new TLegend(0.7, 0.7, 0.95, 0.95);
legend->SetFillColor(TColor::GetColor(255,255,255)); // white
@ -115,16 +101,10 @@ void plotRge(TString &names)
}
rge[i] = new TGraph(nStep, depth, normStop);
if (color[i] >= 0) {
rge[i]->SetMarkerColor(color[i]);
rge[i]->SetLineColor(color[i]);
} else {
TRandom *rand = new TRandom(i);
col = TColor::GetColor((Int_t)rand->Integer(255),(Int_t)rand->Integer(255),(Int_t)rand->Integer(255));
rge[i]->SetMarkerColor(col);
rge[i]->SetLineColor(col);
delete rand;
}
col = TColor::GetColorBright(i+1);
rge[i]->SetMarkerColor(col);
rge[i]->SetLineColor(col);
rge[i]->SetMarkerStyle(20);
mg->Add(rge[i]);