// Root macro // run this with: root $AADIR/aa.C residuals.C // // see residuals.py for same example in python. #include "../util/foreach.hh" void fill_residuals( vector& hits, Trk& nu, TH1D& hist, double offset = 0 ) { for (int i=0; i 300) break; if (evt.mc_hits.size() < 1000 ) continue; double offset = evt.mc_t - evt.t.AsDouble()*1e9; // shift tracks to match detector for(int i = 0; i < evt.mc_trks.size() ;++i) { evt.mc_trks[i].pos += f.header.coord_origin(); } Trk& nu = evt.mc_trks[0]; cout << evt.hits.size() << endl; fill_residuals( evt.mc_hits, nu, hres1 ); fill_residuals( evt.hits, nu, hres2 , offset); } hres1.Scale( 1.0 / hres1.Integral() ); hres2.Scale( 1.0 / hres2.Integral() ); hres1.SetLineColor(2); hres2.SetLineColor(4); hres1.Draw(); hres2.Draw("same"); }