8 #include <TApplication.h>
17 #define _DBG_ cout<<__FILE__<<":"<<__LINE__<<" "
29 new TApplication(
"myapp", &argc, NULL);
33 file =
new TFile(
"hd_res_charged.root");
36 cout<<
"Couldn't open resolution file \"hd_res_charged.root\"!"<<endl;
37 cout<<
"Make sure it exists in the current directory and is readable,"<<endl;
41 cout<<
"Opened \""<<file->GetName()<<
"\""<<endl;
44 file->GetObject(
"dpt_over_pt_vs_p_vs_theta_2", pt_res_hist);
47 cout<<
"Couldn't find resolution histogram \"dpt_over_pt_vs_p_vs_theta_2\""<<endl;
48 cout<<
"in ROOT file!"<<endl;
54 file->GetObject(
"dtheta_vs_p_vs_theta_2", theta_res_hist);
57 cout<<
"Couldn't find resolution histogram \"dtheta_vs_p_vs_theta_2\""<<endl;
58 cout<<
"in ROOT file!"<<endl;
64 phi_res_hist = (TH2D*)gROOT->FindObject(
"dphi_vs_p_vs_theta_2");
67 cout<<
"Couldn't find resolution histogram \"dphi_vs_p_vs_theta_2\""<<endl;
68 cout<<
"in ROOT file!"<<endl;
74 efficiency_hist = (TH2D*)gROOT->FindObject(
"eff_vs_p_vs_theta");
77 cout<<
"Couldn't find efficiency histogram \"eff_vs_p_vs_theta\""<<endl;
78 cout<<
"in ROOT file!"<<endl;
104 double p = mom.Mag();
105 double theta = mom.Theta()*57.3;
106 int pbin = pt_res_hist->GetYaxis()->FindBin(p);
107 int thetabin = pt_res_hist->GetXaxis()->FindBin(theta);
110 if(pbin<1 || pbin>pt_res_hist->GetNbinsY()){pt_res=theta_res=phi_res=0.0;
return;}
111 if(thetabin<1 || thetabin>pt_res_hist->GetNbinsX()){pt_res=theta_res=phi_res=0.0;
return;}
116 pt_res = pt_res_hist->GetBinContent(thetabin, pbin)/100.0;
117 theta_res = theta_res_hist->GetBinContent(thetabin, pbin);
118 phi_res = phi_res_hist->GetBinContent(thetabin, pbin);
130 double p = mom.Mag();
131 double theta = mom.Theta()*57.3;
132 int pbin = efficiency_hist->GetYaxis()->FindBin(p);
133 int thetabin = efficiency_hist->GetXaxis()->FindBin(theta);
135 if(pbin<1 || pbin>efficiency_hist->GetNbinsY())
return 0.0;
136 if(thetabin<1 || thetabin>efficiency_hist->GetNbinsX())
return 0.0;
141 return efficiency_hist->GetBinContent(thetabin, pbin);
virtual ~DTrackingResolutionGEANT()
DTrackingResolutionGEANT()
double GetEfficiency(int geanttype, const TVector3 &mom)
void GetResolution(int geanttype, const TVector3 &mom, double &pt_res, double &theta_res, double &phi_res)