Belle II Software development
VxdCdcMergerValidationPlots Class Reference

Public Member Functions

def __init__ (self, input_file='../VxdCdcValidationHarvested.root', output_file='VxdCdcMergerValidation.root')
 
def collect_histograms (self)
 
def plot (self)
 

Static Public Member Functions

def histogram_plot (hist, title, x_variable, x_unit=None, description='', check='', contact='', meta_options='')
 

Public Attributes

 input_file
 cached name of the input file
 
 output_file
 cached name of the output file
 
 hist_merged_hits
 1D histogram of merged hits
 
 hist_good_over_pt
 Profile histogram of good merged hits by transverse momentum.
 
 hist_good_over_theta
 Profile histogram of good merged hits by polar angle.
 

Detailed Description

Create efficiency plots for the V0 validation

Definition at line 26 of file vxdCdcMergerValidationCreatePlots.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  input_file = '../VxdCdcValidationHarvested.root',
  output_file = 'VxdCdcMergerValidation.root' 
)
Constructor

Definition at line 29 of file vxdCdcMergerValidationCreatePlots.py.

29 def __init__(self, input_file='../VxdCdcValidationHarvested.root', output_file='VxdCdcMergerValidation.root'):
30 """Constructor"""
31
32 self.input_file = input_file
33
34 self.output_file = output_file
35
36
37 self.hist_merged_hits = ROOT.TH1F("merged_hits", "Merged Hits", 70, 0, 140)
38
39 self.hist_good_over_pt = ROOT.TProfile("good_over_pt", "Good Merge over Pt", 50, 0, 4)
40
41 self.hist_good_over_theta = ROOT.TProfile("good_over_theta", "Good Merge over Theta", 50, 0, 4)
42

Member Function Documentation

◆ collect_histograms()

def collect_histograms (   self)
Fill the histograms in each event

Definition at line 43 of file vxdCdcMergerValidationCreatePlots.py.

43 def collect_histograms(self):
44 """Fill the histograms in each event"""
45 input_root_file = ROOT.TFile.Open(self.input_file, "READ")
46
47 for event in input_root_file.VxdCdcMergerHarvester_tree:
48 self.hist_merged_hits.Fill(event.PR_NHITS)
49 self.hist_good_over_pt.Fill(event.MC_PT, event.GOOD_MERGE)
50 self.hist_good_over_theta.Fill(event.MC_THETA, event.GOOD_MERGE)
51
52 input_root_file.Close()
53 return self
54

◆ histogram_plot()

def histogram_plot (   hist,
  title,
  x_variable,
  x_unit = None,
  description = '',
  check = '',
  contact = '',
  meta_options = '' 
)
static
Label and annotate the histograms

Definition at line 56 of file vxdCdcMergerValidationCreatePlots.py.

56 def histogram_plot(hist, title, x_variable, x_unit=None, description='', check='', contact='', meta_options=''):
57 """Label and annotate the histograms"""
58 hist.SetName("".join(title.split()))
59 xlabel = f'{x_variable} / ({x_unit})' if x_unit is not None else f'{x_variable}'
60 ylabel = f'Entries / ({(hist.GetXaxis().GetXmax() - hist.GetXaxis().GetXmin()) / hist.GetNbinsX()} {x_unit})' \
61 if x_unit is not None \
62 else f'Entries / ({(hist.GetXaxis().GetXmax() - hist.GetXaxis().GetXmin()) / hist.GetNbinsX()})'
63 hist.SetTitle(f"{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))
68 return hist
69

◆ plot()

def plot (   self)
Draw all of the histograms to the output ROOT file

Definition at line 70 of file vxdCdcMergerValidationCreatePlots.py.

70 def plot(self):
71 """Draw all of the histograms to the output ROOT file"""
72 output_root_file = ROOT.TFile.Open(self.output_file, "RECREATE")
73
74 VxdCdcMergerValidationPlots.histogram_plot(self.hist_merged_hits, "Number of hits of merged tracks", "Number of Hits", None,
75 description='Number of hits of merged tracks',
76 check='',
77 contact='software-tracking@belle2.org',
78 meta_options='').Write()
79
80 VxdCdcMergerValidationPlots.histogram_plot(self.hist_good_over_pt, "Good Merge over Pt", "MC Track Pt (GeV)", None,
81 description='Good Merge over Pt',
82 check='',
83 contact='software-tracking@belle2.org',
84 meta_options='').Write()
85
86 VxdCdcMergerValidationPlots.histogram_plot(self.hist_good_over_theta, "Good Merge over Theta", "MC Track Theta (1)", None,
87 description='Good Merge over Theta',
88 check='',
89 contact='software-tracking@belle2.org',
90 meta_options='').Write()
91
92 output_root_file.Write()
93 output_root_file.Close()
94 return self
95
96
Definition: plot.py:1

Member Data Documentation

◆ hist_good_over_pt

hist_good_over_pt

Profile histogram of good merged hits by transverse momentum.

Definition at line 39 of file vxdCdcMergerValidationCreatePlots.py.

◆ hist_good_over_theta

hist_good_over_theta

Profile histogram of good merged hits by polar angle.

Definition at line 41 of file vxdCdcMergerValidationCreatePlots.py.

◆ hist_merged_hits

hist_merged_hits

1D histogram of merged hits

Definition at line 37 of file vxdCdcMergerValidationCreatePlots.py.

◆ input_file

input_file

cached name of the input file

Definition at line 32 of file vxdCdcMergerValidationCreatePlots.py.

◆ output_file

output_file

cached name of the output file

Definition at line 34 of file vxdCdcMergerValidationCreatePlots.py.


The documentation for this class was generated from the following file: