#include #include "stdio.h" #include "stdlib.h" #include "TROOT.h" #include "TStopwatch.h" #include "TString.h" #include "TTree.h" #include "TFile.h" #include "TH1.h" #include "TCanvas.h" #include "TPostScript.h" using namespace std; TCanvas *c1; TH1F **hDiff,*hSumWinDay,*hSumWinNight,*hSumWinDay1to50,*hSumWinNight1to50; TH1F *hSumWinDay51to100,*hSumWinNight51to100,*hSumWinDay101to150; TH1F *hSumWinNight101to150,*hSumWinDay151to175,*hSumWinNight151to175; int test() { // need to write the code! get the ttrees, loop over OR tubes, make diff // plots based on day and night data, then superimpose them gStyle->SetOptFit(1111); gStyle->SetOptStat(kFALSE); TString *psfile,*output; TStopwatch *timer; timer = new TStopwatch(); timer->Start(); hSumWinDay = new TH1F("SumWinDay","Day Difference: May, December", 175,0.5,175.5); hSumWinNight = new TH1F("SumWinNight","Night Difference: May, December", 175,0.5,175.5); hSumWinDay1to50 = new TH1F("SumWinDay1to50", "OR 1-50 Day Difference: May, December", 50,0.5,50.5); hSumWinNight1to50 = new TH1F("SumWinNight1to50", "OR 1-50 Night Difference: May, December", 50,0.5,50.5); hSumWinDay51to100 = new TH1F("SumWinDay51to100", "OR 51-100 Day Difference: May, December", 50,50.5,100.5); hSumWinNight51to100 = new TH1F("SumWinNight51to100", "OR 51-100 Night Difference: May, December", 50,50.5,100.5); hSumWinDay101to150 = new TH1F("SumWinDay101to150", "OR 101-150 Day Difference: May, December", 50,100.5,150.5); hSumWinNight101to150 = new TH1F("SumWinNight101to150", "OR 101-150 Night Difference: May, December", 50,100.5,150.5); hSumWinDay151to175 = new TH1F("SumWinDay151to175", "OR 151-175 Day Difference: May, December", 25,150.5,175.5); hSumWinNight151to175 = new TH1F("SumWinNight151to175", "OR 151-175 Night Difference: May, December", 25,150.5,175.5); hSumWinDay->SetXTitle("OR PMT"); hSumWinDay->SetYTitle("#Delta(mean)"); hSumWinNight->SetXTitle("OR PMT"); hSumWinNight->SetYTitle("#Delta(mean)"); hSumWinDay1to50->SetXTitle("OR PMT"); hSumWinDay1to50->SetYTitle("#Delta(mean)"); hSumWinNight1to50->SetXTitle("OR PMT"); hSumWinNight1to50->SetYTitle("#Delta(mean)"); hSumWinDay51to100->SetXTitle("OR PMT"); hSumWinDay51to100->SetYTitle("#Delta(mean)"); hSumWinNight51to100->SetXTitle("OR PMT"); hSumWinNight51to100->SetYTitle("#Delta(mean)"); hSumWinDay101to150->SetXTitle("OR PMT"); hSumWinDay101to150->SetYTitle("#Delta(mean)"); hSumWinNight101to150->SetXTitle("OR PMT"); hSumWinNight101to150->SetYTitle("#Delta(mean)"); hSumWinDay151to175->SetXTitle("OR PMT"); hSumWinDay151to175->SetYTitle("#Delta(mean)"); hSumWinNight151to175->SetXTitle("OR PMT"); hSumWinNight151to175->SetYTitle("#Delta(mean)"); hDiff = new TH1F[175]; for (int i=1; i<=175; i++) { TString hname("TChiDiff_"); TString htitle("Gaussian Mean Differences for Outrigger "); char hnum[3]; sprintf(hnum,"%d",i); hname.Append(hnum); htitle.Append(hnum); hDiff[i-1] = new TH1F(hname,htitle,14,0.5,14.5); hDiff[i-1]->GetXaxis()->SetBinLabel(1,"1/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(2,"2/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(3,"3/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(4,"4/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(5,"5/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(6,"6/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(7,"7/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(8,"8/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(9,"9/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(10,"10/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(11,"11/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(12,"12/04"); hDiff[i-1]->GetXaxis()->SetBinLabel(13,"1/05"); hDiff[i-1]->GetXaxis()->SetBinLabel(14,"2/05"); } psfile = new TString("test.ps"); c1 = new TCanvas("c1","OR Tchi Peak Differences",600,800); TPostScript *ps = new TPostScript(psfile->Data(),111); c1->Divide(2,3); ps->NewPage(); c1->cd(1); gPad->SetGridy(); hSumWinNight->SetLineColor(kBlue); hSumWinNight->Draw(); c1->cd(2); gPad->SetGridy(); hSumWinDay->SetLineColor(kRed); hSumWinDay->Draw(); c1->cd(3); gPad->SetGridy(); hSumWinNight1to50->SetLineColor(kBlue); hSumWinNight1to50->Draw(); c1->cd(4); gPad->SetGridy(); hSumWinDay1to50->SetLineColor(kRed); hSumWinDay1to50->Draw(); c1->cd(5); gPad->SetGridy(); hSumWinNight51to100->SetLineColor(kBlue); hSumWinNight51to100->Draw(); c1->cd(6); gPad->SetGridy(); hSumWinDay51to100->SetLineColor(kRed); hSumWinDay51to100->Draw(); c1->Update(); ps->NewPage(); c1->cd(1); hSumWinNight101to150->SetLineColor(kBlue); hSumWinNight101to150->Draw(); c1->cd(2); hSumWinDay101to150->SetLineColor(kRed); hSumWinDay101to150->Draw(); c1->cd(3); hSumWinNight151to175->SetLineColor(kBlue); hSumWinNight151to175->Draw(); c1->cd(4); hSumWinDay151to175->SetLineColor(kRed); hSumWinDay151to175->Draw(); c1->Update(); ps->NewPage(); for (int i=1; i<=175; i++) { if (!(i%6)) c1->cd(6); else c1->cd(i%6); hDiff[i-1]->Draw(); if (!(i%6) && i>0) { c1->Update(); ps->NewPage(); } } c1->Update(); ps->Close(); timer->Stop(); timer->Print(); return 0; }