#include "TCanvas.h" #include "TAxis.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include #include string DoubleToString(double a) { ostringstream temp; temp<GetMaximum(); maximumh1D2 *= 1.65; h1D2->SetMaximum(maximumh1D2); double maximum = 0.0; maximum = h1D4->GetMaximum(); maximum *= 1.65; h1D4->SetMaximum(maximum); TCanvas *cc = new TCanvas("cc", RunNum, 960, 680); cc->Divide(3,2); cc->cd(1); h2D0->Draw("COLZ1"); TPavesText *paves = new TPavesText(1.5, 15.0, 3.0, 18.0); paves->AddText(RunNum); paves->SetFillColor(11); paves->Draw(); cc->cd(2); h1D0->SetMinimum(0.0); h1D0->GetYaxis()->SetTitleOffset(1.2); h1D0->Draw(); cc->cd(3); h1D1->SetMinimum(0.0); h1D1->GetYaxis()->SetTitleOffset(1.2); h1D1->Draw(); cc->cd(4); h1D2->SetMinimum(0.0); h1D2->GetYaxis()->SetTitleOffset(1.2); h1D2->Draw(); cc->cd(5); h1D3->SetMinimum(0.0); h1D3->GetYaxis()->SetTitleOffset(1.2); h1D3->Draw(); cc->cd(6); h1D4->SetMinimum(0.0); h1D4->GetYaxis()->SetTitleOffset(1.2); h1D4->Draw(); cc->Print(figName); } void drawEachRun_1(TH2D* h2D0, TH1D* h1D0, TH1D* h1D1, TH1D* h1D2, TH1D* h1D3, TH1D* h1D4, TString figName, TString RunNum) { //double maximumh1D2 = 0.0; //maximumh1D2 = h1D2->GetMaximum(); //maximumh1D2 *= 1.65; //h1D2->SetMaximum(maximumh1D2); int rebin = 5; h1D3->Rebin(rebin); h1D4->Rebin(rebin); double maximum = 0.0; maximum = h1D3->GetMaximum(); maximum *= 2.45; h1D3->SetMaximum(maximum); double maximum14 = 0.0; maximum14 = h1D4->GetMaximum(); maximum14 *= 2.45; h1D4->SetMaximum(maximum14); TCanvas *cc = new TCanvas("cc", "cc", 960, 680); cc->Divide(3,2); cc->cd(1); h2D0->Draw("COLZ1"); TPavesText *paves = new TPavesText(-2.0, 1.7, 1.0, 2.1); paves->AddText(RunNum); paves->SetFillColor(11); paves->Draw(); // h2D0->SetStats(0); cc->cd(2); gPad->SetLogy(); h1D0->SetMinimum(0.1); h1D0->GetYaxis()->SetTitleOffset(1.2); h1D0->Draw(); cc->cd(3); h1D1->SetMinimum(0.0); h1D1->GetYaxis()->SetTitleOffset(1.2); h1D1->Draw(); cc->cd(4); h1D2->SetMinimum(0.0); h1D2->GetYaxis()->SetTitleOffset(1.2); h1D2->Draw(); cc->cd(5); //h1D3->SetStats(0); gStyle->SetOptFit(1111); TF1* fitphippi0 = new TF1("psiFitpi0","[0]*(1.0 + [1]*cos(2*(x + [2])))"); fitphippi0->SetLineColor(kBlack); h1D3->SetMinimum(0.0); h1D3->Fit(fitphippi0, ""); h1D3->SetMarkerStyle(20); h1D3->SetMarkerColor(kBlack); h1D3->Draw("e"); cc->cd(6); //h1D4->SetStats(0); TF1* fitphip = new TF1("psiFit","[0]*(1.0 + [1]*cos(2*(x + [2])))"); fitphip->SetLineColor(kBlack); h1D4->SetMinimum(0.0); h1D4->Fit(fitphip, ""); h1D4->SetMarkerStyle(20); h1D4->SetMarkerColor(kBlack); h1D4->Draw("e"); cc->Print(figName); } void drawEachRun() { gStyle->SetOptFit(1111); const int maxpolNum = 4; TString headfileName = "./histroot/"; // add any TH1D histogram name TString mid1fileName[maxpolNum] = {"PARA", "PERP", "AMO", "unknown"}; // add any TH1D histogram name TString mid2fileName = "/ana_p2gamma_"; // add any TH1D histogram name TString tailfileName = ".acc.root"; // add any TH1D histogram name //const int maxparaNum = 0; const int maxparaNum = 23; //TString paraRunNum[maxparaNum] = {}; // add any TH1D histogram name //TString paraRunNum[maxparaNum] = {"011431", "011436", "011446", "011448", "011450", "011453", "011457", "011474", "011475", "011476", "011482", "011484", "011497", "011510", "011514", "011519", "011521", "011532", "011553"}; // add any TH1D histogram name TString paraRunNum[maxparaNum] = {"011366", "011404", "011405", "011431", "011432", "011436", "011446", "011448", "011450", "011453", "011457", "011474", "011475", "011476", "011482", "011484", "011497", "011510", "011514", "011519", "011521", "011532", "011553"}; // add any TH1D histogram name //const int maxperpNum = 0; const int maxperpNum = 25; //TString perpRunNum[maxperpNum] = {}; // add any TH1D histogram name TString perpRunNum[maxperpNum] = {"011367", "011384", "011406", "011407", "011429", "011430", "011435", "011437", "011445", "011447", "011449", "011452", "011454", "011455", "011458", "011473", "011477", "011481", "011483", "011508", "011513", "011520", "011529", "011554", "011555"}; // add any TH1D histogram name const int maxamorphNum = 4; TString amorphRunNum[maxamorphNum] = {"011433", "011434", "011511", "011512"}; // add any TH1D histogram name //const int maxamorphNum = 5; //TString amorphRunNum[maxamorphNum] = {"010491", "010779", "010895", "011064", "011065", "011067"}; // add any TH1D histogram name const int maxunknownNum = 0; TString unknownRunNum[maxunknownNum] = {}; // add any TH1D histogram name //const int maxunknownNum = 2; //TString unknownRunNum[maxunknownNum] = {"010777", "011107"}; // add any TH1D histogram name const int maxNum[maxpolNum] = {maxparaNum, maxperpNum, maxamorphNum, maxunknownNum}; const int maxhist1DNum = 5; const int maxhist2DNum = 1; TString histTH1D[maxhist1DNum] = {"Delta_phi_7", "MMsq_7", "ME_7", "DeltaTBeamRF_pi0_cut6", "DeltaTBeamRF_pi0_cutBE"}; TString histTH2D[maxhist2DNum] = {"dEdx_vs_p_Proton_7"}; const int maxhist1DNum_1 = 5; const int maxhist2DNum_1 = 1; TString histTH1D_1[maxhist1DNum_1] = {"IM_2gamma_10", "t_pi0", "t_eta", "Phi_Proton_pi0", "Phi_Proton_eta"}; TString histTH2D_1[maxhist2DNum_1] = {"theta_Proton_vs_phi_Proton_0"}; cout<<"Lets begin to loop!"<