diff --git a/trimsp/TrimSPGUI/plotRge.C b/trimsp/TrimSPGUI/plotRge.C index 2f2707b..1adf8c3 100644 --- a/trimsp/TrimSPGUI/plotRge.C +++ b/trimsp/TrimSPGUI/plotRge.C @@ -42,6 +42,20 @@ void plotRge(TString &names) Double_t normStop[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]; TMultiGraph *mg = new TMultiGraph(); @@ -88,30 +102,23 @@ void plotRge(TString &names) } // rescale depth to nm 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); - 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(tokens->At(i)); str = ostr->GetString() + ", "; sprintf(cstr, "%.1lf", ostr->GetString().Atof() /1000.0); @@ -124,36 +131,6 @@ void plotRge(TString &names) } 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"); TLegend *legend = new TLegend(0.7, 0.7, 0.95, 0.95);