#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; // The file tdiff_res.cc is created by the tdiff_check_tgraph.C macro #include "tdiff_res.cc" #include "tdiff.cc" #include "E_calibrate.cc" #include "Angle.h" #include "Geom.h" #include "StandardLabels.C" //------------------------------------ // Copied from JEventProcessor_bcal_timing.cc typedef struct{ int event; int layer; int sector; int fADC_up; int fADC_dn; float Etot; float geometric_mean; float tup; float tdn; float tup_corrected; float tdn_corrected; float theta_thrown; float E_thrown; }HIT_t; //------------------------------------ //----------------- // Edep_vs_layer //----------------- void Edep_vs_layer(void) { gStyle->SetStatY(0.90); gStyle->SetOptStat(2200); TColor::CreateColorWheel(); TFile *f = new TFile("hd_root.root"); f->cd(); TTree *tree = (TTree*)gROOT->FindObject("tree"); HIT_t hit; HIT_t *hitptr = &hit; TBranch *branch = tree->GetBranch("T"); branch->SetAddress(hitptr); TH2D *h = new TH2D("h", "", MaxSummedLayers(), 0.5, (double)MaxSummedLayers()+0.5, 1000, 0.0, 0.35); TH2D *h_no_thresh = (TH2D*)h->Clone("h_no_thresh"); // Loop over all events and fill histogram. We do this // rather than TTree::Project since we need to call the // BCAL_tdiff_res for each entry int Nentries = branch->GetEntries(); double t_tot = 0.0; double A_tot = 0.0; double E_tot = 0.0; int last_event=1; for(int i=1; i<=Nentries; i++){ tree->GetEntry(i); if(hit.layer<1 || hit.layer>MaxSummedLayers())continue; // double E_tot = BCAL_fADC2E(hit.geometric_mean); // convert to GeV //cout<<"goemean = "<SetTicks(); c1->SetGrid(); h->Draw(); //char str[256]; //sprintf(str, "#sigma_{#Deltat/2} = #frac{(%4.1f#pm%4.1f) ps}{#sqrt{E}} #oplus (%4.1f#pm%4.1f) ps" // , fun->GetParameter(1), fun->GetParError(1) // , fun->GetParameter(0), fun->GetParError(0)); //TLatex *lab = new TLatex(0.4, 250, str); //lab->SetTextSize(0.05); //lab->Draw(); StandardLabels(h, Scheme(), "", AngleStr("#theta_{proton}=")); c1->SaveAs("Edep_vs_layer.png"); c1->SaveAs("Edep_vs_layer.pdf"); }