#include "StandardLabels.C" void dE_MIP_fcal(void) { TFile *f = new TFile("../single_pion_fcal/single_pion_fcal.root"); TTree *t_pion = (TTree*)gROOT->FindObject("DFCALCluster"); TFile *f = new TFile("../single_pion_fcal/single_proton_fcal.root"); TTree *t_proton = (TTree*)gROOT->FindObject("DFCALCluster"); TH1D *dE_pion = new TH1D("dE_pion", "", 600, 0.0, 2.5); TH1D *dE_proton = (TH1D*)dE_pion->Clone("dE_proton"); t_pion->Project("dE_pion", "E"); t_proton->Project("dE_proton", "E"); TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGridy(); double max = dE_proton->GetMaximum()*1.05; TH2D *axes = new TH2D("axes", "Hadron Energy deposition in FCAL block", 100, 0.0, 1.5, 100, 0.0, max); axes->SetStats(0); axes->SetXTitle("dE (GeV)"); dE_proton->SetLineColor(kRed); dE_pion->SetLineColor(kBlue); dE_proton->SetLineWidth(2); dE_pion->SetLineWidth(2); axes->Draw(); dE_proton->Draw("same"); dE_pion->Draw("same"); int ibin_proton = dE_proton->GetMaximumBin(); double mip_proton = dE_proton->GetBinCenter(ibin_proton); int ibin_pion = dE_pion->GetMaximumBin(); double mip_pion = dE_pion->GetBinCenter(ibin_pion); cout<<"mip_proton="<AddEntry(dE_proton, str); sprintf(str, "pion : MIP=%3.0fMeV", mip_pion*1000.0); leg->AddEntry(dE_pion, str); leg->Draw(); StandardLabels(axes, "p=3.0GeV/c", "particle direction parallel to axis of block", "dZ=45cm"); c1->SaveAs("dE_MIP_fcal.pdf"); c1->SaveAs("dE_MIP_fcal.png"); }