{ TCanvas *cThetaT[nointervals]; for (Int_t i = 0; iSetTitle(canvasTitle.Data()); cThetaT[i]->Divide(2, 3); che->SetLineColor(kBlack); for (Int_t j = 0; j < 6; j++) { //different files if (!kChains[j]) continue; cThetaT[i]->cd(j+1); chs[j]->SetLineColor(kGray+1); chs[j]->SetFillColor(kGray+1); hsName.Form("hscoskT%d_%d", i, j); drawCommand.Form("fCosThetaTk>>%s(50,-1,1)", hsName.Data()); chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && sRatio[j], "", sEventsECuts[i][j]); hscoskT[i][j] = (TH1F*)gPad->FindObject(hsName.Data()); heName.Form("hecoskT%d_%d", i, j); drawCommand.Form("fCosThetaTk>>%s(50,-1,1)", heName.Data()); che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles, "E same", eEventsECuts[i][j]); hecoskT[i][j] = (TH1F*)gPad->FindObject(heName.Data()); hscoskT[i][j]->Draw(); // hscoskT[i][j]->GetYaxis()->SetRangeUser(0, coskTRange[i][j]); hecoskT[i][j]->Draw("E same"); if (kAutoRange) { Float_t leftMaxMC = kRangeProportion*hecoskT[i][j]->GetMaximum(); Float_t leftMaxE = kRangeProportion*hscoskT[i][j]->GetMaximum(); hscoskT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); leftMaxMC > leftMaxE ? hscoskT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hscoskT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); } else { hscoskT[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]); } cThetaT[i]->Update(); hiName.Form("hicoskT%d_%d", i, j); drawCommand.Form("sCosThetaTk>>%s(50,0,1)", hiName.Data()); ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same"); TH1F *hicoskT[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); Float_t rightmax = 1.1*hicoskT[i][j]->GetMaximum(); Float_t scale = cThetaT[i]->GetPad(j+1)->GetUymax()/rightmax; hicoskT[i][j]->SetLineColor(kRed); hicoskT[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(); cThetaT[i]->Update(); if (kVerbose) { Info("sfAngInt_cosThetaTk.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f", i, j, hecoskT[i][j]->Integral(0,hecoskT[i][j]->GetNbinsX()), hscoskT[i][j]->Integral(0,hscoskT[i][j]->GetNbinsX()), hecoskT[i][j]->Integral(0,hecoskT[i][j]->GetNbinsX())/hscoskT[i][j]->Integral(0,hscoskT[i][j]->GetNbinsX()) ); } }//for j if (savePictures) { canvasName.Form("%sfig%dcosThetakT:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data()); cThetaT[i]->SaveAs(canvasName.Data()); cThetaT[i]->cd(); cThetaT[i]->Close(); } }//if }//for i sw.Print(); sw.Continue(); }