72 lines
1.8 KiB
C++
72 lines
1.8 KiB
C++
|
void PID_paper(double gamma, int start= 1){
|
||
|
|
||
|
TFile * f1 = new TFile("pid_total.root");
|
||
|
TH2F * hPID = (TH2F*) f1->Get("hPID2");
|
||
|
|
||
|
gStyle->SetOptStat(""); /// no state
|
||
|
gStyle->SetOptTitle(0); /// no title
|
||
|
|
||
|
TCanvas * ccc = new TCanvas("ccc", "ccc", 1000, 1000);
|
||
|
///ccc->Divide(2,1);
|
||
|
|
||
|
///========= set Z-color
|
||
|
|
||
|
///---- custom color
|
||
|
///Int_t colors[] = {0, 1, 2, 3, 4, 5, 6};
|
||
|
///gStyle->SetPalette((sizeof(colors)/sizeof(Int_t)), colors);
|
||
|
|
||
|
|
||
|
///----- build-in color
|
||
|
int color = kBeach;
|
||
|
//int color = kGreenBrownTerrain;
|
||
|
//int color = kColorPrintableOnGrey;
|
||
|
//int color = kSunset;
|
||
|
|
||
|
///gStyle->SetPalette(kBlueRedYellow);
|
||
|
///gStyle->SetPalette(kRainBow);
|
||
|
gStyle->SetPalette(color);TColor::InvertPalette();
|
||
|
|
||
|
///======== set contours
|
||
|
|
||
|
TGraph * ggg = new TGraph(); /// this is for displaying the gamma correction
|
||
|
|
||
|
const int nCon = 200; /// number of contours
|
||
|
double contours[nCon];
|
||
|
|
||
|
double zMax = hPID->GetMaximum();
|
||
|
|
||
|
for( int i = 0; i < nCon; i++){
|
||
|
double xpos = i*1.0/nCon;
|
||
|
double ypos = TMath::Power(xpos, gamma) *0.95;
|
||
|
|
||
|
contours[i] = start + ypos*(zMax - start);
|
||
|
ggg->AddPoint(xpos, ypos);
|
||
|
}
|
||
|
|
||
|
ccc->cd();ccc->cd()->SetGrid(0,0);
|
||
|
hPID->GetYaxis()->SetRangeUser(1.5, 16);
|
||
|
hPID->SetContour(nCon, contours);
|
||
|
hPID->Draw("col");
|
||
|
|
||
|
TEllipse * si42 = new TEllipse(3.01, 14, 0.05, 0.55);
|
||
|
si42->SetFillStyle(0);
|
||
|
si42->SetLineColor(2);
|
||
|
si42->SetLineWidth(3);
|
||
|
|
||
|
si42->Draw("same");
|
||
|
|
||
|
TLatex text;
|
||
|
text.SetTextColor(2);
|
||
|
text.SetTextSize(0.05);
|
||
|
text.DrawLatex(3.05, 14.2, "^{42}Si");
|
||
|
|
||
|
///------ in case want to see the gamma correction
|
||
|
///ccc->cd(2);
|
||
|
///ggg->Draw("AP*");
|
||
|
|
||
|
///====== save as pdf
|
||
|
ccc->SaveAs(Form("haha_%3.1f_%d_%d.pdf", gamma, start, color));
|
||
|
|
||
|
|
||
|
}
|