#include #include #include #include #include #include #include #include #include #include using namespace std; int main() { TFile *f = new TFile("CCD_images_trees.root"); TTree *TreeB = (TTree*)f->Get("Biases"); TH2I *Bias_cam0; //THIS HISTOGRAM IS CURRENTLY EMPTY WITH NO AXIS RANGE OR NUMBER OF BINS TH2I *Bias_cam0_Avg= new TH2I("Bias0","Bias_cam0_Avg",385, 0, 3080, 385, 0, 3080); //See lab book to see how I got x and y axis range. TH2I *Bias_cam1; //THIS HISTOGRAM IS CURRENTLY EMPTY WITH NO AXIS RANGE OR NUMBER OF BINS TH2I *Bias_cam1_Avg= new TH2I("Bias1","Bias_cam1_Avg",385, 0, 3080, 385, 0, 3080); //See lab book to see how I got x and y axis range. TH2I *Bias_cam2; //THIS HISTOGRAM IS CURRENTLY EMPTY WITH NO AXIS RANGE OR NUMBER OF BINS TH2I *Bias_cam2_Avg= new TH2I("Bias2","Bias_cam2_Avg",385, 0, 3080, 385, 0, 3080); //See lab book to see how I got x and y axis range. TH2I *Bias_cam3; //THIS HISTOGRAM IS CURRENTLY EMPTY WITH NO AXIS RANGE OR NUMBER OF BINS TH2I *Bias_cam3_Avg= new TH2I("Bias3","Bias_cam3_Avg",385, 0, 3080, 385, 0, 3080); //See lab book to see how I got x and y axis range. TreeB -> SetBranchAddress("Bias_cam0", &Bias_cam0); TreeB -> SetBranchAddress("Bias_cam1", &Bias_cam1); TreeB -> SetBranchAddress("Bias_cam2", &Bias_cam2); TreeB -> SetBranchAddress("Bias_cam3", &Bias_cam3); TCanvas *c4 = new TCanvas("c4","c4"); c4->Divide(2,2); Int_t nentriesB = (Int_t)TreeB->GetEntries(); for (Int_t i=0;iGetEntry(i);//Gets each entry in current tree branch(es) Bias_cam0_Avg->Add(Bias_cam0); //add current entry Bias_cam1_Avg->Add(Bias_cam1); //add current entry Bias_cam2_Avg->Add(Bias_cam2); //add current entry Bias_cam3_Avg->Add(Bias_cam3); //add current entry } c4->cd(1); Bias_cam0_Avg->Scale(1.0/4); Bias_cam0_Avg->Draw("colz"); c4->cd(2); Bias_cam1_Avg->Scale(1.0/4); Bias_cam1_Avg->Draw("colz"); c4->cd(3); Bias_cam2_Avg->Scale(1.0/4); Bias_cam2_Avg->Draw("colz"); c4->cd(4); Bias_cam3_Avg->Scale(1.0/4); Bias_cam3_Avg->Draw("colz"); TTree *TreeE = (TTree*)f->Get("Events"); TH2I *Event_cam0; TH2I *Event_cam1; TH2I *Event_cam2; TH2I *Event_cam3; TreeE -> SetBranchAddress("Event_cam0", &Event_cam0); TreeE -> SetBranchAddress("Event_cam1", &Event_cam1); TreeE -> SetBranchAddress("Event_cam2", &Event_cam2); TreeE -> SetBranchAddress("Event_cam3", &Event_cam3); TCanvas *c0 = new TCanvas("c0","c0"); c0->Divide(2,2); Int_t nentriesE = (Double_t)TreeE->GetEntries(); for (Int_t i=0;iGetEntry(i); //Gets each entry in current tree branch(es) TH2I *CEvent_cam0 = (TH2I*) Event_cam0->Clone(); CEvent_cam0->Add(Bias_cam0_Avg,-1); TH2I *CEvent_cam1 = (TH2I*) Event_cam1->Clone(); CEvent_cam1->Add(Bias_cam1_Avg,-1); TH2I *CEvent_cam2 = (TH2I*) Event_cam2->Clone(); CEvent_cam2->Add(Bias_cam2_Avg,-1); TH2I *CEvent_cam3 = (TH2I*) Event_cam3->Clone(); CEvent_cam3->Add(Bias_cam3_Avg,-1); if (i==0) { TH1I *Pixel_Event_cam0= new TH1I("Pixel0","Pixel_Event0",600, -100, 500); TH1I *Pixel_Event_cam1= new TH1I("Pixel1","Pixel_Event1",600, -100, 500); TH1I *Pixel_Event_cam2= new TH1I("Pixel2","Pixel_Event2",600, -100, 500); TH1I *Pixel_Event_cam3= new TH1I("Pixel3","Pixel_Event3",600, -100, 500); for (Int_t j=0; jGetXaxis()->GetNbins(); j++) { for (Int_t z=0; zGetYaxis()->GetNbins(); z++) { Pixel_Event_cam0->Fill(CEvent_cam0->GetBinContent(j+1,z+1)); Pixel_Event_cam1->Fill(CEvent_cam1->GetBinContent(j+1,z+1)); Pixel_Event_cam2->Fill(CEvent_cam2->GetBinContent(j+1,z+1)); Pixel_Event_cam3->Fill(CEvent_cam3->GetBinContent(j+1,z+1)); } } c0->cd(1); gPad->SetLogy(); //set Y-axis of c1 canvas to Log Scale. Pixel_Event_cam0->GetXaxis()->SetTitle("THE PIXEL VALUES"); Pixel_Event_cam0->Draw(); c0->cd(2); gPad->SetLogy(); //set Y-axis of c1 canvas to Log Scale. Pixel_Event_cam1->GetXaxis()->SetTitle("THE PIXEL VALUES"); Pixel_Event_cam1->Draw(); c0->cd(3); gPad->SetLogy(); //set Y-axis of c1 canvas to Log Scale. Pixel_Event_cam2->GetXaxis()->SetTitle("THE PIXEL VALUES"); Pixel_Event_cam2->Draw(); c0->cd(4); gPad->SetLogy(); //set Y-axis of c1 canvas to Log Scale. Pixel_Event_cam3->GetXaxis()->SetTitle("THE PIXEL VALUES"); Pixel_Event_cam3->Draw(); } } return 0; }