Cleanup code

This commit is contained in:
2012-11-16 15:54:03 +00:00
parent 8ca8351b3c
commit f8d9526e26

View File

@ -42,6 +42,20 @@ void plotRge(TString &names)
Double_t normStop[1000]; Double_t normStop[1000];
Double_t normStopmax[1000]; Double_t normStopmax[1000];
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]; TGraph *rge[1000];
TMultiGraph *mg = new TMultiGraph(); TMultiGraph *mg = new TMultiGraph();
@ -88,30 +102,23 @@ void plotRge(TString &names)
} }
// rescale depth to nm // rescale depth to nm
depth[j] = depth[j]/10.; depth[j] = depth[j]/10.;
// Find max and min of stopping profiles
if (normStop[j] > max)
max = normStop[j];
if (normStop[j] < min)
min = normStop[j];
// Find max and min of stopping depth
if (depth[j] > xmax) {
xmax = depth[j];
imax = i;
depthmax=depth;
nStepmax=nStep;
nStopmax=nStop;
// normStopmax=normStop;
}
if (depth[j] < xmin) {
xmin = depth[j];
}
} }
rge[i] = new TGraph(nStep, depth, normStop); rge[i] = new TGraph(nStep, depth, normStop);
mg->Add(rge[i]); 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;
}
rge[i]->SetMarkerStyle(20);
mg->Add(rge[i]);
ostr = dynamic_cast<TObjString*>(tokens->At(i)); ostr = dynamic_cast<TObjString*>(tokens->At(i));
str = ostr->GetString() + ", "; str = ostr->GetString() + ", ";
sprintf(cstr, "%.1lf", ostr->GetString().Atof() /1000.0); sprintf(cstr, "%.1lf", ostr->GetString().Atof() /1000.0);
@ -124,36 +131,6 @@ void plotRge(TString &names)
} }
cout << endl; cout << endl;
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;
Int_t last = tokens->GetEntries()-1;
Int_t col;
for (i=0; i<=last; i++) {
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;
}
rge[i]->SetMarkerStyle(20);
}
mg->Draw("APC"); mg->Draw("APC");
TLegend *legend = new TLegend(0.7, 0.7, 0.95, 0.95); TLegend *legend = new TLegend(0.7, 0.7, 0.95, 0.95);