#ifndef __HIST_RECO_TRKS__ #define __HIST_RECO_TRKS__ #include #include #include #include #include "Det.hh" #include "Trk.hh" #include "Head.hh" inline double get_delta_EbyE( double reco_E, double true_E ){ return ( reco_E - true_E ) / true_E; }; struct Reso { double E_res; double ang_res; Reso(Trk trk, Trk mc_trk, bool verbose = false){ E_res = get_delta_EbyE( trk.E, mc_trk.E ); ang_res = (180/pi)*angle_between( trk.dir, mc_trk.dir ); if ( verbose ){ cout << "ang_res: " << ang_res << endl; cout << "Reco E: " << trk.E << ", MC E: " << mc_trk.E << ", E_res: " << E_res << endl; } } }; inline double get_double_from_timestring( string timestring ){ string::size_type pos = timestring.find( "time:" ); return stod( timestring.substr(pos + 5) ); }; inline std::vector< Double_t > get_log_vector( Double_t xmin = 1e-3, Double_t xmax = 2e2, const Int_t nbins = 1000 ){ std::vector< Double_t > xbins(nbins+1); Double_t logxmin = std::log10(xmin); Double_t logxmax = std::log10(xmax); Double_t binwidth = (logxmax-logxmin)/nbins; xbins[0] = xmin; for( Int_t i=1; i<=nbins; i++ ){ xbins[i] = TMath::Power(10, logxmin+i*binwidth); } return xbins; }; inline std::vector< Double_t > get_lin_vector( Double_t xmin = 0, Double_t xmax = 1e3, const Int_t nbins = 1000 ){ std::vector< Double_t > xbins(nbins+1); Double_t binwidth = (xmax-xmin)/nbins; xbins[0] = xmin; for (Int_t i=1;i<=nbins;i++) { xbins[i] = xmin + i*binwidth; } return xbins; }; #endif