6 <contact>software-tracking@belle2.org</contact>
7 <input>VxdCdcValidationHarvested.root</input>
8 <description>This module creates efficiency plots for the V0 validation.</description>
18 """Create efficiency plots for the V0 validation"""
20 def __init__(self, input_file='../VxdCdcValidationHarvested.root', output_file='VxdCdcMergerValidation.root'):
35 """Fill the histograms in each event"""
36 input_root_file = ROOT.TFile.Open(self.
input_file,
"READ")
38 for event
in input_root_file.VxdCdcMergerHarvester_tree:
43 input_root_file.Close()
47 def histogram_plot(hist, title, x_variable, x_unit=None, description='', check='', contact='', meta_options=''):
48 """Label and annotate the histograms"""
49 hist.SetName(
"".join(title.split()))
50 xlabel =
'{} / ({})'.format(x_variable, x_unit)
if x_unit
is not None else '{}'.format(x_variable)
51 ylabel =
'Entries / ({} {})'.format((hist.GetXaxis().GetXmax() -
52 hist.GetXaxis().GetXmin()) /
53 hist.GetNbinsX(), x_unit)
if x_unit
is not None \
54 else 'Entries / ({})'.format((hist.GetXaxis().GetXmax() - hist.GetXaxis().GetXmin()) / hist.GetNbinsX())
55 hist.SetTitle(
"{};{};{}".format(title, xlabel, ylabel))
56 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Description', description))
57 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Check', check))
58 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Contact', contact))
59 hist.GetListOfFunctions().Add(ROOT.TNamed(
'MetaOptions', meta_options))
63 """Draw all of the histograms to the output ROOT file"""
64 output_root_file = ROOT.TFile.Open(self.
output_file,
"RECREATE")
66 VxdCdcMergerValidationPlots.histogram_plot(self.
hist_merged_hits,
"Number of hits of merged tracks",
"Number of Hits",
None,
67 description=
'Number of hits of merged tracks',
70 meta_options=
'').Write()
72 VxdCdcMergerValidationPlots.histogram_plot(self.
hist_good_over_pt,
"Good Merge over Pt",
"MC Track Pt (GeV)",
None,
73 description=
'Good Merge over Pt',
76 meta_options=
'').Write()
78 VxdCdcMergerValidationPlots.histogram_plot(self.
hist_good_over_theta,
"Good Merge over Theta",
"MC Track Theta (1)",
None,
79 description=
'Good Merge over Theta',
82 meta_options=
'').Write()
84 output_root_file.Write()
85 output_root_file.Close()
89 if __name__ ==
'__main__':