Clean legent in scan plotting.
This commit is contained in:
@ -42,6 +42,13 @@ void plotRge(TString &names)
|
|||||||
Double_t normStop[1000];
|
Double_t normStop[1000];
|
||||||
Double_t normStopmax[1000];
|
Double_t normStopmax[1000];
|
||||||
|
|
||||||
|
TString pathname;
|
||||||
|
int sep;
|
||||||
|
TString path;
|
||||||
|
TString name,legtit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Int_t col;
|
Int_t col;
|
||||||
Int_t color[1000];
|
Int_t color[1000];
|
||||||
for (i=0; i<1000; i++)
|
for (i=0; i<1000; i++)
|
||||||
@ -55,11 +62,14 @@ void plotRge(TString &names)
|
|||||||
color[6] = TColor::kAzure+7;
|
color[6] = TColor::kAzure+7;
|
||||||
color[7] = TColor::kOrange+4;
|
color[7] = TColor::kOrange+4;
|
||||||
color[8] = TColor::kBlue-7;
|
color[8] = TColor::kBlue-7;
|
||||||
|
|
||||||
TGraph *rge[1000];
|
TGraph *rge[1000];
|
||||||
|
|
||||||
TMultiGraph *mg = new TMultiGraph();
|
TMultiGraph *mg = new TMultiGraph();
|
||||||
|
|
||||||
|
TLegend *legend = new TLegend(0.7, 0.7, 0.95, 0.95);
|
||||||
|
legend->SetFillColor(TColor::GetColor(255,255,255)); // white
|
||||||
|
|
||||||
tokens = names.Tokenize(" \t,;");
|
tokens = names.Tokenize(" \t,;");
|
||||||
|
|
||||||
Double_t min = 0, max = 0, xmax = 0, xmin = 0;
|
Double_t min = 0, max = 0, xmax = 0, xmin = 0;
|
||||||
@ -123,21 +133,37 @@ void plotRge(TString &names)
|
|||||||
str = ostr->GetString() + ", ";
|
str = ostr->GetString() + ", ";
|
||||||
sprintf(cstr, "%.1lf", ostr->GetString().Atof() /1000.0);
|
sprintf(cstr, "%.1lf", ostr->GetString().Atof() /1000.0);
|
||||||
str += cstr;
|
str += cstr;
|
||||||
str += " (keV)";
|
|
||||||
|
// remove path
|
||||||
|
sep = str.Last('/');
|
||||||
|
path = str(0,sep);
|
||||||
|
name = str(sep+1,str.Length()-sep-1);
|
||||||
|
// remove comma etc.
|
||||||
|
sep = name.Last(',');
|
||||||
|
name = name(0,sep);
|
||||||
|
// remove extension etc.
|
||||||
|
sep = name.Last('.');
|
||||||
|
name = name(0,sep);
|
||||||
|
// remove ????_ etc.
|
||||||
|
sep = name.Last('_');
|
||||||
|
path = name(sep+1);
|
||||||
|
name = name(sep+2,name.Length()-sep-1);
|
||||||
|
legtit = "";
|
||||||
|
legtit += path;
|
||||||
|
legtit += "=";
|
||||||
|
legtit += name;
|
||||||
|
legtit += " (keV)";
|
||||||
|
|
||||||
|
cout << endl << legtit << endl ;
|
||||||
rge[i]->SetTitle(str.Data());
|
rge[i]->SetTitle(str.Data());
|
||||||
rge[i]->SetFillColor(TColor::kWhite);
|
rge[i]->SetFillColor(TColor::kWhite);
|
||||||
|
legend->AddEntry(rge[i], legtit);
|
||||||
|
|
||||||
delete fileGraph;
|
delete fileGraph;
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
mg->Draw("APC");
|
mg->Draw("APC");
|
||||||
|
|
||||||
TLegend *legend = new TLegend(0.7, 0.7, 0.95, 0.95);
|
|
||||||
legend->SetFillColor(TColor::GetColor(255,255,255)); // white
|
|
||||||
for (i=0; i<tokens->GetEntries(); i++) {
|
|
||||||
legend->AddEntry(rge[i]);
|
|
||||||
}
|
|
||||||
legend->Draw();
|
legend->Draw();
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user