318
318
tracker+'_p_residual_p', "p Residuals in p", \
319
319
PZ_BIN, PZ_MIN, PZ_MAX, 500, -50.0, 50.0 )
321
tracker_dict['dpp_residual_p'] = ROOT.TH2F( \
322
tracker+'_dpp_residual_p', "dp/p Residuals in p", \
323
PZ_BIN, PZ_MIN, PZ_MAX, 500, -1.0, 1.0 )
322
327
tracker_dict['x_residual_pt'] = ROOT.TH2F( \
323
328
tracker+'_x_residual_pt', "X Residuals in p_{t}", \
1016
1021
tracker_plots['pt_residual_p'].Fill( P_mc, Pt_res )
1017
1022
tracker_plots['pz_residual_p'].Fill( P_mc, res_mom[2] )
1018
1023
tracker_plots['p_residual_p'].Fill( P_mc, P_res )
1024
tracker_plots['dpp_residual_p'].Fill( P_mc, P_res/P_mc )
1021
1027
tracker_plots['x_residual_pz'].Fill( Pz_mc, res_pos[0] )
1230
1236
plot_dict[tracker][component+plot_axis+'_bias'] = bias_graph
1239
for tracker in [ "upstream", "downstream" ] :
1240
for a_plot in [ "dpp_residual_p" ] :
1241
plot = plot_dict[tracker][a_plot]
1243
rms_error = array.array( 'd' )
1244
bin_size = array.array( 'd' )
1245
bins = array.array( 'd' )
1246
rms = array.array( 'd' )
1247
mean = array.array( 'd' )
1248
mean_error = array.array( 'd' )
1250
width = plot.GetXaxis().GetBinWidth(1)
1251
for i in range( 0, plot.GetXaxis().GetNbins() ) :
1252
projection = plot.ProjectionY( a_plot+'_pro_'+str(i), i, (i+1) )
1254
plot_mean = plot.GetXaxis().GetBinCenter( i ) + width
1255
pro_mean, pro_mean_err, pro_std, pro_std_err = \
1256
analysis.tools.fit_gaussian(projection)
1258
bin_size.append( width*0.5 )
1259
bins.append( plot_mean )
1260
rms.append( pro_std )
1261
rms_error.append( pro_std_err )
1262
mean.append( pro_mean )
1263
mean_error.append( pro_mean_err )
1266
resolution_graph = ROOT.TGraphErrors( len(bins), \
1267
bins, rms, bin_size, rms_error )
1268
bias_graph = ROOT.TGraphErrors( len(bins), \
1269
bins, mean, bin_size, mean_error )
1271
resolution_graph = None
1274
plot_dict[tracker][a_plot+'_resolution'] = resolution_graph
1275
plot_dict[tracker][a_plot+'_bias'] = bias_graph
1234
1279
for tracker in [ "upstream", "downstream" ] :
1235
1280
# for component in [ "pt_", "pz_", ] :