// Author: Emil Frlez (July 9, 2009) // add histos written in the different files #include "TCanvas.h" #include "TH1.h" #include "TF1.h" #include "TMath.h" void add_histos(Int_t nrun1=87810, Int_t nrun2=90400) { gROOT->Reset(); gStyle->SetHistLineWidth(2); gStyle->SetLineWidth(2); gStyle->SetLabelSize(0.055,"XYZ"); gStyle->SetPadTickX(1); gStyle->SetPadTickY(1); gStyle->SetPadTopMargin(0.06); gStyle->SetPadBottomMargin(0.12); gStyle->SetPadLeftMargin(0.15); gStyle->SetPadRightMargin(0.04); gStyle->SetMarkerColor(1); gStyle->SetMarkerSize(0.1); gStyle->SetMarkerStyle(20); gStyle->SetTitleSize(0.08,"XYZ"); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetPalette(1,0); gROOT->ForceStyle(); TLatex l; l.SetTextFont(72); l.SetTextSize(0.06); l.SetTextAlign(12); TCanvas* c1 = new TCanvas("c1","PEN",0,0,750,950); c1->ToggleEventStatus(); c1->SetHighLightColor(0); c1->SetFillColor(0); //TH1::AddDirectory(kTRUE); //<============ TFile *out_file = new TFile("examine_histos.root","RECREATE"); Int_t nr1=87810; Int_t nr2=90400; TH1F *h1a_n0_w0 = new TH1F("h1a_n0_w0","wire0 no hit precentage vs run",nr2-nr1,nr1,nr2); TH1F *h1a_n0_w1 = new TH1F("h1a_n0_w1","wire1 no hit precentage vs run",nr2-nr1,nr1,nr2); TH1F *h1a_n0_w2 = new TH1F("h1a_n0_w2","wire2 no hit precentage vs run",nr2-nr1,nr1,nr2); TH1F *h1a_n0_w3 = new TH1F("h1a_n0_w3","wire3 no hit precentage vs run",nr2-nr1,nr1,nr2); TH1F *h1a_n1_w0 = new TH1F("h1a_n1_w0","wire0 single hit precentage vs run",nr2-nr1,nr1,nr2); TH1F *h1a_n1_w1 = new TH1F("h1a_n1_w1","wire1 single hit precentage vs run",nr2-nr1,nr1,nr2); TH1F *h1a_n1_w2 = new TH1F("h1a_n1_w2","wire2 single hit precentage vs run",nr2-nr1,nr1,nr2); TH1F *h1a_n1_w3 = new TH1F("h1a_n1_w3","wire3 single hit precentage vs run",nr2-nr1,nr1,nr2); TH1F *h1a_a_w0 = new TH1F("h1a_a_w0","wire0 most probable ampliture",nr2-nr1,nr1,nr2); TH1F *h1a_a_w1 = new TH1F("h1a_a_w1","wire1 most probable ampliture",nr2-nr1,nr1,nr2); TH1F *h1a_a_w2 = new TH1F("h1a_a_w2","wire2 most probable ampliture",nr2-nr1,nr1,nr2); TH1F *h1a_a_w3 = new TH1F("h1a_a_w3","wire3 most probable ampliture",nr2-nr1,nr1,nr2); for (Int_t i=nrun1;iFindObject("h1_n0_w0"); gROOT->FindObject("h1_n0_w1"); gROOT->FindObject("h1_n0_w2"); gROOT->FindObject("h1_n0_w3"); gROOT->FindObject("h1_n1_w0"); gROOT->FindObject("h1_n1_w1"); gROOT->FindObject("h1_n1_w2"); gROOT->FindObject("h1_n1_w3"); gROOT->FindObject("h1_a_w0"); gROOT->FindObject("h1_a_w1"); gROOT->FindObject("h1_a_w2"); gROOT->FindObject("h1_a_w3"); h1a_n0_w0->Add(h1_n0_w0); h1a_n0_w1->Add(h1_n0_w1); h1a_n0_w2->Add(h1_n0_w2); h1a_n0_w3->Add(h1_n0_w3); h1a_n1_w0->Add(h1_n1_w0); h1a_n1_w1->Add(h1_n1_w1); h1a_n1_w2->Add(h1_n1_w2); h1a_n1_w3->Add(h1_n1_w3); h1a_a_w0->Add(h1_a_w0); h1a_a_w1->Add(h1_a_w1); h1a_a_w2->Add(h1_a_w2); h1a_a_w3->Add(h1_a_w3); //in_file->Close(); //delete in_file; //gDirectory -> Delete(Form("e%d.root",i)); printf(" %d\n",i); } } char *input; c1->Divide(1,4); c1->cd(1); h1a_a_w0->SetMaximum(70); h1a_a_w0->SetMinimum(0); h1a_a_w0->SetFillColor(38); h1a_a_w0->SetAxisRange(0,119,"Y"); h1a_a_w0->SetTitleSize(0.06,"Y"); h1a_a_w0->SetTitleSize(0.06,"X"); h1a_a_w0->GetYaxis()->SetTitle("Run Number"); h1a_a_w0->GetYaxis()->SetTitle("Average Wire0 Amplitude"); h1a_a_w0->SetTitleOffset(0.6,"X"); h1a_a_w0->SetTitleOffset(1.2,"Y"); h1a_a_w0->Draw("l"); Float_t x[2] = {90260,90260}; Float_t y[2] = {0,100}; TPolyLine* l1 = new TPolyLine(2,x,y); l1->SetLineColor(kRed); l1->Draw(); l.DrawLatex(87800,-15,"Oct. 17"); l.DrawLatex(90300,-15,"Nov. 18"); l.DrawLatex(90000,105,"HV Increased"); c1->cd(2); h1a_a_w1->SetFillColor(38); h1a_a_w1->SetAxisRange(0,119,"Y"); h1a_a_w1->SetTitleSize(0.06,"Y"); h1a_a_w1->SetTitleSize(0.06,"X"); h1a_a_w1->GetYaxis()->SetTitle("Run Number"); h1a_a_w1->GetYaxis()->SetTitle("Average Wire1 Amplitude"); h1a_a_w1->SetTitleOffset(0.6,"X"); h1a_a_w1->SetTitleOffset(1.2,"Y"); h1a_a_w1->Draw("l"); l1->Draw(); //l.DrawLatex(-100,125," "); c1->cd(3); h1a_a_w2->SetFillColor(38); h1a_a_w2->SetAxisRange(0,119,"Y"); h1a_a_w2->SetTitleSize(0.06,"Y"); h1a_a_w2->SetTitleSize(0.06,"X"); h1a_a_w2->GetYaxis()->SetTitle("Run Number"); h1a_a_w2->GetYaxis()->SetTitle("Average Wire2 Amplitude"); h1a_a_w2->SetTitleOffset(0.6,"X"); h1a_a_w2->SetTitleOffset(1.2,"Y"); h1a_a_w2->Draw("l"); l1->Draw(); //l.DrawLatex(-100,125," "); c1->cd(4); h1a_a_w3->SetFillColor(38); h1a_a_w3->SetAxisRange(0,119,"Y"); h1a_a_w3->SetTitleSize(0.06,"Y"); h1a_a_w3->SetTitleSize(0.06,"X"); h1a_a_w3->GetYaxis()->SetTitle("Run Number"); h1a_a_w3->GetYaxis()->SetTitle("Average Wire3 Amplitude"); h1a_a_w3->SetTitleOffset(0.6,"X"); h1a_a_w3->SetTitleOffset(1.2,"Y"); h1a_a_w3->Draw("l"); l1->Draw(); //l.DrawLatex(-100,125," "); c1->Update(); c1->Print("f1.eps"); input = Getline("Type to continue: "); out_file->Write(); }