13 <contact>software-tracking@belle2.org</contact>
14 <input>VxdCdcValidationHarvested.root</input>
15 <description>This module creates efficiency plots for the V0 validation.</description>
26 """Create efficiency plots for the V0 validation"""
28 def __init__(self, input_file='../VxdCdcValidationHarvested.root', output_file='VxdCdcMergerValidation.root'):
36 self.
hist_merged_hitshist_merged_hits = ROOT.TH1F(
"merged_hits",
"Merged Hits", 70, 0, 140)
38 self.
hist_good_over_pthist_good_over_pt = ROOT.TProfile(
"good_over_pt",
"Good Merge over Pt", 50, 0, 4)
40 self.
hist_good_over_thetahist_good_over_theta = ROOT.TProfile(
"good_over_theta",
"Good Merge over Theta", 50, 0, 4)
43 """Fill the histograms in each event"""
44 input_root_file = ROOT.TFile.Open(self.
input_fileinput_file,
"READ")
46 for event
in input_root_file.VxdCdcMergerHarvester_tree:
51 input_root_file.Close()
55 def histogram_plot(hist, title, x_variable, x_unit=None, description='', check='', contact='', meta_options=''):
56 """Label and annotate the histograms"""
57 hist.SetName(
"".join(title.split()))
58 xlabel =
'{} / ({})'.format(x_variable, x_unit)
if x_unit
is not None else '{}'.format(x_variable)
59 ylabel =
'Entries / ({} {})'.format((hist.GetXaxis().GetXmax() -
60 hist.GetXaxis().GetXmin()) /
61 hist.GetNbinsX(), x_unit)
if x_unit
is not None \
62 else 'Entries / ({})'.format((hist.GetXaxis().GetXmax() - hist.GetXaxis().GetXmin()) / hist.GetNbinsX())
63 hist.SetTitle(
"{};{};{}".format(title, xlabel, ylabel))
64 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Description', description))
65 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Check', check))
66 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Contact', contact))
67 hist.GetListOfFunctions().Add(ROOT.TNamed(
'MetaOptions', meta_options))
71 """Draw all of the histograms to the output ROOT file"""
72 output_root_file = ROOT.TFile.Open(self.
output_fileoutput_file,
"RECREATE")
74 VxdCdcMergerValidationPlots.histogram_plot(self.
hist_merged_hitshist_merged_hits,
"Number of hits of merged tracks",
"Number of Hits",
None,
75 description=
'Number of hits of merged tracks',
78 meta_options=
'').Write()
80 VxdCdcMergerValidationPlots.histogram_plot(self.
hist_good_over_pthist_good_over_pt,
"Good Merge over Pt",
"MC Track Pt (GeV)",
None,
81 description=
'Good Merge over Pt',
84 meta_options=
'').Write()
86 VxdCdcMergerValidationPlots.histogram_plot(self.
hist_good_over_thetahist_good_over_theta,
"Good Merge over Theta",
"MC Track Theta (1)",
None,
87 description=
'Good Merge over Theta',
90 meta_options=
'').Write()
92 output_root_file.Write()
93 output_root_file.Close()
97 if __name__ ==
'__main__':
101 print(
"This validation deactivated and thus basf2 is not executed.\n"
102 "If you want to run this validation, please set the 'ACTIVE' flag above to 'True'.\n"
def histogram_plot(hist, title, x_variable, x_unit=None, description='', check='', contact='', meta_options='')
input_file
cached name of the input file
def __init__(self, input_file='../VxdCdcValidationHarvested.root', output_file='VxdCdcMergerValidation.root')
output_file
cached name of the output file
hist_good_over_pt
Profile histogram of good merged hits by transverse momentum.
def collect_histograms(self)
hist_merged_hits
1D histogram of merged hits
hist_good_over_theta
Profile histogram of good merged hits by polar angle.