Compacting and cleaning up code.
This commit is contained in:
parent
38d55a3ebe
commit
48d276dbc3
@ -21,11 +21,11 @@ void plotFrc(char *FileName)
|
|||||||
TObjString *strtoken;
|
TObjString *strtoken;
|
||||||
Int_t nPars = 0;
|
Int_t nPars = 0;
|
||||||
Int_t ntokens = 0;
|
Int_t ntokens = 0;
|
||||||
Int_t i = 0;
|
Int_t i = 0, iloop;
|
||||||
Int_t nline=0;
|
Int_t nline=0;
|
||||||
Int_t intNorm=0;
|
Int_t intNorm=0;
|
||||||
Ssiz_t pos;
|
Ssiz_t pos;
|
||||||
Double_t x[100],yl1[100],yl2[100],yl3[100],yl4[100],yl5[100],yl6[100],yl7[100],bck[100];
|
Double_t x[100],yl1[100],yl2[100],yl3[100],yl4[100],yl5[100],yl6[100],yl7[100],bck[100],yl[100][100];
|
||||||
Int_t Flag[7]=0;
|
Int_t Flag[7]=0;
|
||||||
|
|
||||||
FILE *fp = fopen(FileName,"r");
|
FILE *fp = fopen(FileName,"r");
|
||||||
@ -66,71 +66,15 @@ void plotFrc(char *FileName)
|
|||||||
intNorm = intNorm++;
|
intNorm = intNorm++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is Layer1
|
for (iloop=0; iloop<=6; iloop++) {
|
||||||
strtoken = (TObjString*) token->At(10);
|
strtoken = (TObjString*) token->At(iloop+10);
|
||||||
label = strtoken->GetName();
|
label = strtoken->GetName();
|
||||||
yl1[i] = label.Atof();
|
yl[iloop][i] = label.Atof();
|
||||||
if (yl1[i]>0) {
|
if (yl[iloop][i]>0) {
|
||||||
Flag[0]=1;
|
Flag[iloop]=1;
|
||||||
intNorm = intNorm++;
|
intNorm = intNorm++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is Layer2
|
|
||||||
strtoken = (TObjString*) token->At(11);
|
|
||||||
label = strtoken->GetName();
|
|
||||||
yl2[i] = label.Atof();
|
|
||||||
if (yl2[i]>0) {
|
|
||||||
Flag[1]=1;
|
|
||||||
intNorm = intNorm++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is Layer3
|
|
||||||
strtoken = (TObjString*) token->At(12);
|
|
||||||
label = strtoken->GetName();
|
|
||||||
yl3[i] = label.Atof();
|
|
||||||
if (yl3[i]>0) {
|
|
||||||
Flag[2]=1;
|
|
||||||
intNorm = intNorm++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is Layer4
|
|
||||||
strtoken = (TObjString*) token->At(13);
|
|
||||||
label = strtoken->GetName();
|
|
||||||
yl4[i] = label.Atof();
|
|
||||||
if (yl4[i]>0) {
|
|
||||||
Flag[3]=1;
|
|
||||||
intNorm = intNorm++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is Layer5
|
|
||||||
strtoken = (TObjString*) token->At(14);
|
|
||||||
label = strtoken->GetName();
|
|
||||||
yl5[i] = label.Atof();
|
|
||||||
if (yl5[i]>0) {
|
|
||||||
Flag[4]=1;
|
|
||||||
intNorm = intNorm++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is Layer6
|
|
||||||
strtoken = (TObjString*) token->At(15);
|
|
||||||
label = strtoken->GetName();
|
|
||||||
yl6[i] = label.Atof();
|
|
||||||
if (yl6[i]>0) {
|
|
||||||
Flag[5]=1;
|
|
||||||
intNorm = intNorm++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is Layer7
|
|
||||||
strtoken = (TObjString*) token->At(16);
|
|
||||||
label = strtoken->GetName();
|
|
||||||
yl7[i] = label.Atof();
|
|
||||||
if (yl7[i]>0) {
|
|
||||||
Flag[6]=1;
|
|
||||||
intNorm = intNorm++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
nline++;
|
nline++;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -140,109 +84,34 @@ void plotFrc(char *FileName)
|
|||||||
TCanvas *c = new TCanvas("c",str);
|
TCanvas *c = new TCanvas("c",str);
|
||||||
c->Show();
|
c->Show();
|
||||||
TLegend *legend = new TLegend(0.8, 0.8, 0.95, 0.95);
|
TLegend *legend = new TLegend(0.8, 0.8, 0.95, 0.95);
|
||||||
legend->SetFillColor(TColor::GetColor(255,255,255)); // white
|
|
||||||
|
|
||||||
TMultiGraph *mg = new TMultiGraph();
|
TMultiGraph *mg = new TMultiGraph();
|
||||||
|
TGraph *gr[100];
|
||||||
|
|
||||||
if (Flag[0]==1){
|
for ( Int_t iloop=0; iloop<=6; iloop++) {
|
||||||
TGraph *gr1 = new TGraph(i,x,yl1);
|
if (Flag[iloop]==1){
|
||||||
// gr1->Draw("APC");
|
gr[iloop] = new TGraph(i,x,yl[iloop]);
|
||||||
gr1->SetMarkerStyle(20);
|
// gr1->Draw("APC");
|
||||||
gr1->SetMarkerColor(TColor::kRed);
|
gr[iloop]->SetMarkerStyle(20+iloop);
|
||||||
gr1->SetLineColor(TColor::kRed);
|
gr[iloop]->SetMarkerColor(TColor::GetColorBright(iloop+1));
|
||||||
// Preferably get the chemical formula from header
|
gr[iloop]->SetLineColor(TColor::GetColorBright(iloop+1));
|
||||||
ostr = dynamic_cast<TObjString*>(labels->At(10));
|
gr[iloop]->SetFillColor(TColor::GetColor(255,255,255)); // white
|
||||||
xlab = ostr->GetString();
|
// Preferably get the chemical formula from header
|
||||||
legend->AddEntry(gr1,xlab);
|
ostr = dynamic_cast<TObjString*>(labels->At(iloop+10));
|
||||||
mg->Add(gr1);
|
xlab = ostr->GetString();
|
||||||
|
legend->AddEntry(gr[iloop],xlab);
|
||||||
|
legend->SetFillColor(TColor::GetColor(255,255,255)); // white
|
||||||
|
mg->Add(gr[iloop]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag[1]==1){
|
|
||||||
TGraph *gr2 = new TGraph(i,x,yl2);
|
|
||||||
gr2->SetMarkerStyle(20);
|
|
||||||
gr2->SetMarkerColor(TColor::kGreen);
|
|
||||||
gr2->SetLineColor(TColor::kGreen);
|
|
||||||
// gr2->Draw("PC");
|
|
||||||
// Preferably get the chemical formula from header
|
|
||||||
ostr = dynamic_cast<TObjString*>(labels->At(11));
|
|
||||||
xlab = ostr->GetString();
|
|
||||||
legend->AddEntry(gr2,xlab);
|
|
||||||
mg->Add(gr2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Flag[2]==1){
|
|
||||||
TGraph *gr3 = new TGraph(i,x,yl3);
|
|
||||||
gr3->SetMarkerStyle(20);
|
|
||||||
gr3->SetMarkerColor(TColor::kBlue);
|
|
||||||
gr3->SetLineColor(TColor::kBlue);
|
|
||||||
// gr3->Draw("PC");
|
|
||||||
// Preferably get the chemical formula from header
|
|
||||||
ostr = dynamic_cast<TObjString*>(labels->At(12));
|
|
||||||
xlab = ostr->GetString();
|
|
||||||
legend->AddEntry(gr3,xlab);
|
|
||||||
mg->Add(gr3);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Flag[3]==1){
|
|
||||||
TGraph *gr4 = new TGraph(i,x,yl4);
|
|
||||||
gr4->SetMarkerStyle(20);
|
|
||||||
gr4->SetMarkerColor(TColor::kMagenta);
|
|
||||||
gr4->SetLineColor(TColor::kMagenta);
|
|
||||||
// gr4->Draw("PC");
|
|
||||||
// Preferably get the chemical formula from header
|
|
||||||
ostr = dynamic_cast<TObjString*>(labels->At(13));
|
|
||||||
xlab = ostr->GetString();
|
|
||||||
legend->AddEntry(gr4,xlab);
|
|
||||||
mg->Add(gr4);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Flag[4]==1){
|
|
||||||
TGraph *gr5 = new TGraph(i,x,yl5);
|
|
||||||
gr5->SetMarkerStyle(20);
|
|
||||||
gr5->SetMarkerColor(TColor::kOrange);
|
|
||||||
gr5->SetLineColor(TColor::kOrange);
|
|
||||||
// gr5->Draw("PC");
|
|
||||||
// Preferably get the chemical formula from header
|
|
||||||
ostr = dynamic_cast<TObjString*>(labels->At(14));
|
|
||||||
xlab = ostr->GetString();
|
|
||||||
legend->AddEntry(gr5,xlab);
|
|
||||||
mg->Add(gr5);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Flag[5]==1){
|
|
||||||
TGraph *gr6 = new TGraph(i,x,yl6);
|
|
||||||
gr6->SetMarkerStyle(20);
|
|
||||||
gr6->SetMarkerColor(TColor::kViolet);
|
|
||||||
gr6->SetLineColor(TColor::kViolet);
|
|
||||||
// gr6->Draw("PC");
|
|
||||||
// Preferably get the chemical formula from header
|
|
||||||
ostr = dynamic_cast<TObjString*>(labels->At(15));
|
|
||||||
xlab = ostr->GetString();
|
|
||||||
legend->AddEntry(gr6,xlab);
|
|
||||||
mg->Add(gr6);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Flag[6]==1){
|
|
||||||
TGraph *gr7 = new TGraph(i,x,yl7);
|
|
||||||
gr7->SetMarkerStyle(20);
|
|
||||||
gr7->SetMarkerColor(TColor::kAzure+7);
|
|
||||||
gr7->SetLineColor(TColor::kAzure+7);
|
|
||||||
// gr7->Draw("PC");
|
|
||||||
// Preferably get the chemical formula from header
|
|
||||||
ostr = dynamic_cast<TObjString*>(labels->At(16));
|
|
||||||
xlab = ostr->GetString();
|
|
||||||
legend->AddEntry(gr7,xlab);
|
|
||||||
mg->Add(gr7);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Flag[7]==1){
|
if (Flag[7]==1){
|
||||||
TGraph *gr8 = new TGraph(i,x,bck);
|
TGraph *gr[7] = new TGraph(i,x,bck);
|
||||||
gr8->SetMarkerStyle(20);
|
gr[7]->SetMarkerStyle(20);
|
||||||
gr8->SetMarkerColor(TColor::kAzure+7);
|
gr[7]->SetMarkerColor(TColor::kAzure+7);
|
||||||
gr8->SetLineColor(TColor::kAzure+7);
|
gr[7]->SetLineColor(TColor::kAzure+7);
|
||||||
// gr8->Draw("PC");
|
gr[7]->SetFillColor(TColor::GetColor(255,255,255)); // white
|
||||||
legend->AddEntry(gr8,"Back Scat.");
|
legend->AddEntry(gr[7],"Back Scat.");
|
||||||
mg->Add(gr8);
|
mg->Add(gr[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
mg->Draw("APC");
|
mg->Draw("APC");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user