~maus-release/maus/release

« back to all changes in this revision

Viewing changes to bin/scifi/tracker_resolution_plots.py

  • Committer: Paolo Franchini
  • Date: 2018-06-24 14:27:26 UTC
  • mfrom: (659.2.80 release-candidate)
  • Revision ID: p.franchini@warwick.ac.uk-20180624142726-nbxxyjyer146dr1t
Tags: MAUS-v3.2.0
MAUS-v3.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
318
318
              tracker+'_p_residual_p', "p Residuals in p", \
319
319
                                     PZ_BIN, PZ_MIN, PZ_MAX, 500, -50.0, 50.0 )
320
320
 
 
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 )
 
324
 
 
325
 
321
326
 
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 )
1019
1025
 
1020
1026
 
1021
1027
    tracker_plots['x_residual_pz'].Fill( Pz_mc, res_pos[0] )
1230
1236
        plot_dict[tracker][component+plot_axis+'_bias'] = bias_graph
1231
1237
 
1232
1238
 
 
1239
  for tracker in [ "upstream", "downstream" ] :
 
1240
    for a_plot in [ "dpp_residual_p" ] :
 
1241
      plot = plot_dict[tracker][a_plot]
 
1242
 
 
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' )
 
1249
 
 
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) )
 
1253
 
 
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)
 
1257
 
 
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 )
 
1264
 
 
1265
      if len(bins) != 0 :
 
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 )
 
1270
      else :
 
1271
        resolution_graph = None
 
1272
        bias_graph = None
 
1273
 
 
1274
      plot_dict[tracker][a_plot+'_resolution'] = resolution_graph
 
1275
      plot_dict[tracker][a_plot+'_bias'] = bias_graph
 
1276
 
 
1277
 
1233
1278
 
1234
1279
  for tracker in [ "upstream", "downstream" ] :
1235
1280
#    for component in [ "pt_", "pz_", ] :