Skip to content

Instantly share code, notes, and snippets.

@carbolymer
Created Jun 13, 2012
Embed
What would you like to do?
int pythia2()
{
int i = 0, index = 0;
TCanvas *canv = 0;
TFile *files[7];
TH1F *multiplicity[4];
TH1F *multiplicity14[4];
TH1F *chMultiplicity[4];
TH1F *chMultiplicity14[4];
TH1F *rapidity[4];
TH1F *rapidity14[4];
TH1F *pseudorapidity[4];
TH1F *pseudorapidity14[4];
TH1F *pT[4];
TH1F *pT14[4];
TH1F *apT[4];
TH1F *apT14[4];
TH1F **pointer;
TLegend * legend = 0;
char *labels[7] =
{
"14Tev/MPI on/ISR on/FSR on",
"7TeV",
"1.96TeV",
"200GeV",
"14Tev/MPI off/ISR on/FSR on",
"14Tev/MPI on/ISR off/FSR on",
"14Tev/MPI on/ISR on/FSR off"
};
char *fileNames[12] =
{
"multiplicity",
"multiplicity14",
"chMultiplicity",
"chMultiplicity14",
"rapidity",
"rapidity14",
"pseudorapidity",
"pseudorapidity14",
"pT",
"pT14",
"apT",
"apT14"
};
files[0] = new TFile("pp14TeVMPIonISRonFSRon.root");
files[1] = new TFile("pp7TeVMPIonISRonFSRon.root");
files[2] = new TFile("pp1.96TeVMPIonISRonFSRon.root");
files[3] = new TFile("pp200GeVMPIonISRonFSRon.root");
files[4] = new TFile("pp14TeVMPIoffISRonFSRon.root");
files[5] = new TFile("pp14TeVMPIonISRoffFSRon.root");
files[6] = new TFile("pp14TeVMPIonISRonFSRoff.root");
for(i = 0 ; i < 7 ; ++i)
if(files[i]->IsZombie())
{
cout << "Error loading " << i << "file" << endl;
return 1;
}
// <--begin-->
for(i = 0; i < 4; ++i)
multiplicity[i] = (TH1F*) files[i]->Get("hFinal");
multiplicity14[0] = (TH1F*) files[0]->Get("hFinal");
for(i = 1; i < 4; ++i)
multiplicity14[i] = (TH1F*) files[i+3]->Get("hFinal");
// <--begin-->
for(i = 0; i < 4; ++i)
chMultiplicity[i] = (TH1F*) files[i]->Get("hCharged");
chMultiplicity14[0] = (TH1F*) files[0]->Get("hCharged");
for(i = 1; i < 4; ++i)
chMultiplicity14[i] = (TH1F*) files[i+3]->Get("hCharged");
// <--begin-->
for(i = 0; i < 4; ++i)
rapidity[i] = (TH1F*) files[i]->Get("hy");
rapidity14[0] = (TH1F*) files[0]->Get("hy");
for(i = 1; i < 4; ++i)
rapidity14[i] = (TH1F*) files[i+3]->Get("hy");
// <--begin-->
for(i = 0; i < 4; ++i)
pseudorapidity[i] = (TH1F*) files[i]->Get("heta");
pseudorapidity14[0] = (TH1F*) files[0]->Get("heta");
for(i = 1; i < 4; ++i)
pseudorapidity14[i] = (TH1F*) files[i+3]->Get("heta");
// <--begin-->
for(i = 0; i < 4; ++i)
pT[i] = (TH1F*) files[i]->Get("hpT");
pT14[0] = (TH1F*) files[0]->Get("hpT");
for(i = 1; i < 4; ++i)
pT14[i] = (TH1F*) files[i+3]->Get("hpT");
// <--begin-->
for(i = 0; i < 4; ++i)
apT[i] = (TH1F*) files[i]->Get("hepTch");
apT14[0] = (TH1F*) files[0]->Get("hepTch");
for(i = 1; i < 4; ++i)
apT14[i] = (TH1F*) files[i+3]->Get("hepTch");
// <--begin-->
delete canv;
delete legend;
pointer = multiplicity;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[3]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
legend->AddEntry(pointer[i],labels[i]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = multiplicity14;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[6]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
if(i == 0)
legend->AddEntry(pointer[i],labels[i]);
else
legend->AddEntry(pointer[i],labels[i+3]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = chMultiplicity;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[3]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
legend->AddEntry(pointer[i],labels[i]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = chMultiplicity14;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[6]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
if(i == 0)
legend->AddEntry(pointer[i],labels[i]);
else
legend->AddEntry(pointer[i],labels[i+3]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = rapidity;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[3]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
legend->AddEntry(pointer[i],labels[i]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = rapidity14;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[6]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
if(i == 0)
legend->AddEntry(pointer[i],labels[i]);
else
legend->AddEntry(pointer[i],labels[i+3]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = pseudorapidity;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[3]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
legend->AddEntry(pointer[i],labels[i]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = pseudorapidity14;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[6]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
if(i == 0)
legend->AddEntry(pointer[i],labels[i]);
else
legend->AddEntry(pointer[i],labels[i+3]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = pT;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[3]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
legend->AddEntry(pointer[i],labels[i]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = pT14;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[6]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
if(i == 0)
legend->AddEntry(pointer[i],labels[i]);
else
legend->AddEntry(pointer[i],labels[i+3]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = apT;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[3]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
legend->AddEntry(pointer[i],labels[i]);
}
legend->Draw();
canv->SaveAs(".png");
// <--begin-->
delete canv;
delete legend;
pointer = apT14;
legend = new TLegend(0.78, 0.55, 0.98, 0.77);
canv = new TCanvas(fileNames[index++], "zadanie3", 1200,800);
canv->SetLogy(); // nie dziala z TCanvas::Divide()
pointer[3]->Draw();
pointer[3]->SetLineColor(4);
legend->AddEntry(pointer[3],labels[6]);
for(i = 0; i < 3; ++i)
{
pointer[i]->SetLineColor(i+1);
pointer[i]->Draw("SAME");
if(i == 0)
legend->AddEntry(pointer[i],labels[i]);
else
legend->AddEntry(pointer[i],labels[i+3]);
}
legend->Draw();
canv->SaveAs(".png");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment