#include "TH2F.h" #include "TH3F.h" #include "TStyle.h" void histPresent ( const char *filename = "analysis_07_8.root", // const char *filename = "analysis_07_8_smooth.root", // const char *filename = "analysis_08_2.root", // const char *filename = "analysis_08_2_smooth.root", const char *foldername = "nustar_present", // const char *ext = ".eps", const char *ext = ".pdf", const Bool_t can1 = 0, const Bool_t can2 = 0, const Bool_t can3 = 1, const Bool_t can4 = 0) //const Bool_t can5 = 0/*, const Bool_t can6 = 0*/) { using std::cout; using std::endl; gSystem->Load("../libData.so"); TFile *f = new TFile(Form("../data/dataDSR4/%s", filename)); TTree *t = (TTree*)f->Get("atree"); if(can1){ TCanvas *c1 = new TCanvas("c1", "canvas 1"); c1->Divide(2,2); c1->cd(1); //TH1F *h1 = new TH1F("h1", "CFD", 50, -15, 15); TH1F *h1 = new TH1F("h1", "CFD", 50, 0, 20); t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h1","Ach0.fTimeCFD>100. && Ach0.fTimeCFD<160 && Ach1.fTimeCFD>100. && Ach1.fTimeCFD<160",""); //x h1->GetXaxis()->SetTitle("Time difference [ns]"); h1->GetXaxis()->CenterTitle(); //h1->Fit("gaus", "","",-3,2); h1->Fit("gaus", "","",8,13); gStyle->SetOptFit(); c1->Update(); c1->cd(2); //TH1F *h2 = new TH1F("h2", "LED",50, -10, 10); TH1F *h2 = new TH1F("h2", "LED",50, 0, 20); t->Draw("Ach0.fTimeLED - Ach1.fTimeLED >> h2","Ach0.fTimeLED>100. && Ach0.fTimeLED < 150 && Ach1.fTimeLED>100 && Ach1.fTimeLED < 150","col"); //x h2->GetXaxis()->SetTitle("Time difference [ns]"); h2->GetXaxis()->CenterTitle(); //h2->Fit("gaus", "","",-3,1); h2->Fit("gaus", "","",7,12); gStyle->SetOptFit(); c1->Update(); /* c1->cd(3); //TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20); TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100,0, 20); t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h3","Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150","col"); //x h3->GetXaxis()->SetTitle("Time difference [ns]"); h3->GetXaxis()->CenterTitle(); //h3->Fit("gaus", "","",-3,2); h3->Fit("gaus", "","",9,12); gStyle->SetOptFit();*/ c1->cd(3); //TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20); TH1F *h3 = new TH1F("h3", "Middle point of front level", 100,1, 20); t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h3","","col"); //x h3->GetXaxis()->SetTitle("Time difference [ns]"); h3->GetXaxis()->CenterTitle(); //h3->Fit("gaus", "","",-3,2); h3->Fit("gaus", "","",9,12); gStyle->SetOptFit(); c1->Update(); c1->cd(4); //TH1F *h4 = new TH1F("h4", "the middle point of front edge", 50, -10, 10); TH1F *h4 = new TH1F("h4", "the 10 percent point of front edge", 80, 1, 20); t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h4","",""); h4->GetXaxis()->SetTitle("Time difference [ns]"); h4->GetXaxis()->CenterTitle(); //h4->Fit("gaus","","",-3,1); h4->Fit("gaus","","",9,13); gStyle->SetOptFit(); c1->Print(Form("../macros/picsDRS4/%s/Smoothed_deltas%s", foldername, ext)); } if(can2){ TCanvas *c2 = new TCanvas("c2", "canvas 2"); c2->Divide(2,2); c2->cd(1); //TH1F *h1 = new TH1F("h1", "CFD", 50, -15, 15); TH1F *h5 = new TH1F("h5", "ToT", 50, 0, 12); t->Draw("Ach0.fToT >> h5","Ach0.fToT > 0",""); //x h5->GetXaxis()->SetTitle("Time over threshold [ns]"); h5->GetXaxis()->CenterTitle(); //h1->Fit("gaus", "","",-3,2); //h1->Fit("gaus", "","",8,13); //gStyle->SetOptFit(); c2->Update(); c2->cd(2); //TH1F *h2 = new TH1F("h2", "LED",50, -10, 10); TH1F *h6 = new TH1F("h6", "ToT",50, 0, 12); t->Draw("Ach1.fToT >> h6","Ach1.fToT > 0","col"); //x h6->GetXaxis()->SetTitle("Time over threshold [ns]"); h6->GetXaxis()->CenterTitle(); //h2->Fit("gaus", "","",-3,1); //h2->Fit("gaus", "","",7,12); //gStyle->SetOptFit(); c2->Update(); c2->cd(3); //TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20); TH1F *h7 = new TH1F("h7", "Middle point of front level", 80,1, 20); t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h7","Ach0.fToT > 2. && Ach0.fToT < 6. && Ach1.fToT > 2. && Ach1.fToT < 6. ","col"); //x h7->GetXaxis()->SetTitle("Time difference [ns]"); h7->GetXaxis()->CenterTitle(); //h3->Fit("gaus", "","",-3,2); h7->Fit("gaus", "","",9,12); gStyle->SetOptFit(); c2->Update(); c2->cd(4); //TH1F *h4 = new TH1F("h4", "the middle point of front edge", 50, -10, 10); TH1F *h8 = new TH1F("h8", "the 10 percent point of front edge", 80, 1, 20); t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h8"," Ach0.fToT > 2. && Ach0.fToT < 6. && Ach1.fToT > 2. && Ach1.fToT < 6.",""); h8->GetXaxis()->SetTitle("Time difference [ns]"); h8->GetXaxis()->CenterTitle(); //h4->Fit("gaus","","",-3,1); h8->Fit("gaus","","",9,13); gStyle->SetOptFit(); c2->Print(Form("../macros/picsDRS4/%s/Smoothed_deltas_tot_corr%s", foldername, ext)); } if(can3){ TCanvas *c3 = new TCanvas("c3", "canvas 3"); c3->Divide(2,2); c3->cd(1); TH1F *h9 = new TH1F("h9", "Charge CFD", 200, 0 ,0.5e-9); t->Draw("Ach0.fChargeCFD >> h9","",""); c3->Update(); c3->cd(2); TH1F *h10 = new TH1F("h10", "Charge LED",200, 0 ,0.5e-9); t->Draw("Ach0.fChargeLED >> h10","",""); c3->Update(); c3->cd(3); TH1F *h11 = new TH1F("h11", "Sum of charges CFD for 4 channels",200, 0 ,10e-9); t->Draw("Ach0.fChargeCFD + Ach1.fChargeCFD + Ach2.fChargeCFD + Ach3.fChargeCFD >> h11","",""); c3->Update(); c3->cd(4); TH1F *h12 = new TH1F("h12", "Sum of charges LED for 4 channels",200, 0 ,10e-9); t->Draw("Ach0.fChargeLED + Ach1.fChargeLED + Ach2.fChargeLED + Ach3.fChargeLED >> h12","",""); c3->Update(); } }