{ TCanvas *cThetaP1T[nointervals]; for (Int_t i = 0; iSetTitle(canvasTitle.Data()); cThetaP1T[i]->Divide(2, 3); che->SetLineColor(kBlack); for (Int_t j = 0; j < 6; j++) { //different files cThetaP1T[i]->cd(j+1); chs[j]->SetLineColor(kGray+1); chs[j]->SetFillColor(kGray+1); hsName.Form("hsthetaP1T%d_%d", i, j); drawCommand.Form("fP1ThetaCM>>%s(50,0,3.14)", hsName.Data()); chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && crEpsilonT && sRatio[j], "", sEvents[j]); hsthetaP1T[i][j] = (TH1F*)gPad->FindObject(hsName.Data()); heName.Form("hethetaP1T%d_%d", i, j); drawCommand.Form("fP1ThetaCM>>%s(50,0,3.14)", heName.Data()); che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles && cEpsilonT, "E same", eEvents[j]); hethetaP1T[i][j] = (TH1F*)gPad->FindObject(heName.Data()); hsthetaP1T[i][j]->Draw(); hsthetaP1T[i][j]->GetYaxis()->SetRangeUser(0, tP1Range[i][j]); hethetaP1T[i][j]->Draw("E same"); cThetaP1T[i]->Update(); hiName.Form("hithetaP1T%d_%d", i, j); drawCommand.Form("sP1CM.Theta()>>%s", hiName.Data()); ti[j]->Draw(drawCommand.Data(), ciEpsilon && ciBeE[i] && sRatio[j], "same"); TH1F *hithetaP1T[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); Float_t rightmax = 1.1*hithetaP1T[i][j]->GetMaximum(); Float_t scale = cThetaP1T[i]->GetPad(j+1)->GetUymax()/rightmax; hithetaP1T[i][j]->SetLineColor(kRed); hithetaP1T[i][j]->Scale(scale); //draw an axis on the right side TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(), gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L"); axis->SetLineColor(kRed); axis->SetLabelColor(kRed); axis->Draw(); cThetaP1T[i]->Update(); }//for j if (savePictures) { canvasName.Form("%sfig%dthetaP1T:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data()); cThetaP1T[i]->SaveAs(canvasName.Data()); cThetaP1T[i]->cd(); cThetaP1T[i]->Close(); } }//if }//for i sw.Print(); sw.Continue(); }