void timewalk_check_profile(void) { TFile *f = new TFile("hd_root.root"); TTree *tree = (TTree*)gROOT->FindObject("tree"); TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGrid(); TH2D *axes = new TH2D("axes","", 100, 0.0, 400.0, 100, -15.0, 15.0); axes->SetStats(0); axes->SetXTitle("fADC"); axes->SetYTitle("t (ns)"); // Open PDF file for plots c1->Print("timewalk_check_profile.ps["); // Loop over layers int Nlayers=0; for(int ilayer=1; ilayer<=10 ; ilayer++, Nlayers++){ TProfile *hup = new TProfile("hup", "", 100, 0.0, 400.0); TProfile *hdn = new TProfile("hdn", "", 100, 0.0, 400.0); char cut_up[256]; char cut_dn[256]; sprintf(cut_up, "layer==%d && tup>0 && tup<100.0", ilayer); sprintf(cut_dn, "layer==%d && tdn>0 && tdn<100.0", ilayer); tree->Project("hup", "tup_corrected:fADC_up", cut_up); tree->Project("hdn", "tdn_corrected:fADC_dn", cut_dn); hup->SetLineColor(kCyan); hdn->SetLineColor(kMagenta); hup->SetLineWidth(2); hdn->SetLineWidth(2); char title[256]; sprintf(title, "Timewalk Check for layer %d", ilayer); axes->SetTitle(title); axes->Draw(); tree->Draw("tup_corrected:fADC_up", cut_up, "same"); tree->Draw("tdn_corrected:fADC_dn", cut_dn, "same"); hup->Draw("same"); hdn->Draw("same"); c1->Update(); c1.Print("timewalk_check_profile.ps"); } // Close PDF file c1->Print("timewalk_check_profile.ps]"); cout<<"Plots written to \"timewalk_check_profile.ps\". Convert to PDF with:"<