Belle II Software development
MakePlots Class Reference
Inheritance diagram for MakePlots:

Public Member Functions

def set_descr (self, h, D)
 
def initialize (self)
 
def event (self)
 
def terminate (self)
 

Public Attributes

 tfile
 root file pointer
 
 recBunchNo
 validation histogram
 
 offset
 validation histogram
 
 numTracks
 validation histogram
 
 usedTracks
 validation histogram
 
 effi_numTracks
 validation histogram
 
 effi_usedTracks
 validation histogram
 
 effi
 validation histogram
 
 nev
 number of events with valid TOPRecBunch object pointer
 

Detailed Description

Makes validation histograms for bunch finder

Definition at line 26 of file 3_bunchFinderPlots.py.

Member Function Documentation

◆ event()

def event (   self)
 Event processor: fill histograms 

Definition at line 100 of file 3_bunchFinderPlots.py.

100 def event(self):
101
102 ''' Event processor: fill histograms '''
103
104 recBunch = Belle2.PyStoreObj('TOPRecBunch')
105 if not recBunch.isValid():
106 return
107 self.nev += 1
108 if recBunch.isReconstructed():
109 self.recBunchNo.Fill(recBunch.getBunchNo())
110 self.offset.Fill(recBunch.getCurrentOffset())
111 self.numTracks.Fill(recBunch.getNumTracks())
112 self.usedTracks.Fill(recBunch.getUsedTracks())
113 if recBunch.getBunchNo() == recBunch.getMCBunchNo():
114 self.effi_numTracks.Fill(recBunch.getNumTracks())
115 self.effi_usedTracks.Fill(recBunch.getUsedTracks())
116
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67

◆ initialize()

def initialize (   self)
 Initializes the Module: book histograms and set descriptions and checks

Definition at line 44 of file 3_bunchFinderPlots.py.

44 def initialize(self):
45 ''' Initializes the Module: book histograms and set descriptions and checks'''
46
47
48 self.tfile = TFile.Open("bunchFinder.root", "recreate")
49
50
51 self.recBunchNo = TH1F("recBunchNo",
52 "Reconstructed relative bunch number; relative bunch number; events per bunch",
53 100, -50.0 - 0.5, 50.0 - 0.5)
54 self.set_descr(self.recBunchNo, 'Reconstructed bunch number relative to L1 trigger.')
55
56
57 self.offset = TH1F("offset",
58 "Offset to reconstructed bunch; offset [ns]; events per bin",
59 100, -1.0, 1.0)
60 self.set_descr(self.offset, 'Offset to reconstructed bunch.')
61
62
63 self.numTracks = TH1F("numTracks",
64 "Number of tracks in TOP acceptance; number of tracks; entries per bin",
65 10, 0.5, 10.5)
66 self.set_descr(self.numTracks, 'Number of tracks per event in the acceptance of TOP.')
67
68
69 self.usedTracks = TH1F("usedTracks",
70 "Number of tracks used for bunch finding; number of used track; entries per bins",
71 10, 0.5, 10.5)
72 self.set_descr(self.usedTracks, 'Number of tracks in the event actually used for finding the bunch crossing.')
73
74
75 self.effi_numTracks = TH1F("effi_numTracks",
76 "Efficiency vs. number of tracks; number of tracks; efficiency",
77 10, 0.5, 10.5)
78 self.set_descr(self.effi_numTracks, 'Efficieny of finding the correct bunch crossing versus '
79 'the number of tracks per event in the acceptance of TOP.')
80
81
82 self.effi_usedTracks = TH1F("effi_usedTracks",
83 "Efficiency vs. number of used tracks; number of used tracks; efficiency",
84 10, 0.5, 10.5)
85 self.set_descr(self.effi_usedTracks, 'Efficieny of finding the correct bunch crossing versus '
86 'the number of tracks per event actually used.')
87
88
89 self.effi = TH1F("effi", "Acceptance and efficiency", 2, 0.5, 2.5)
90 self.effi.GetXaxis().SetBinLabel(1, "acceptance")
91 self.effi.GetXaxis().SetBinLabel(2, "efficiency")
92 self.effi.GetXaxis().SetLabelSize(0.08)
93 self.effi.GetXaxis().SetAlphanumeric()
94 self.set_descr(self.effi, 'Acceptance is defined as fraction of events with at least one track crossing TOP. '
95 'Efficiency is defined as fraction of correctly reconstructed bunch crossings in accepted events.')
96
97
98 self.nev = 0
99

◆ set_descr()

def set_descr (   self,
  h,
  D 
)
Sets description, check and contact to validation histogram.
:param h validation histogram
:param D description text

Definition at line 31 of file 3_bunchFinderPlots.py.

31 def set_descr(self, h, D):
32 '''
33 Sets description, check and contact to validation histogram.
34 :param h validation histogram
35 :param D description text
36 '''
37 descr = TNamed('Description', D)
38 h.GetListOfFunctions().Add(descr)
39 check = TNamed('Check', 'Must agree with reference')
40 h.GetListOfFunctions().Add(check)
41 contact = TNamed('Contact', 'marko.staric@ijs.si')
42 h.GetListOfFunctions().Add(contact)
43

◆ terminate()

def terminate (   self)
 Processes and writes histograms to file

Definition at line 117 of file 3_bunchFinderPlots.py.

117 def terminate(self):
118 ''' Processes and writes histograms to file'''
119
120 eff = self.numTracks.GetEntries() / self.nev
121 err = math.sqrt(eff * (1 - eff) / self.nev)
122 self.effi.SetBinContent(1, eff)
123 self.effi.SetBinError(1, err)
124
125 eff = self.effi_numTracks.GetEntries() / self.numTracks.GetEntries()
126 err = math.sqrt(eff * (1 - eff) / self.numTracks.GetEntries())
127 self.effi.SetBinContent(2, eff)
128 self.effi.SetBinError(2, err)
129
130 self.numTracks.Sumw2()
131 self.effi_numTracks.Sumw2()
132 self.effi_numTracks.Divide(self.effi_numTracks, self.numTracks, 1, 1, "B")
133
134 self.usedTracks.Sumw2()
135 self.effi_usedTracks.Sumw2()
136 self.effi_usedTracks.Divide(self.effi_usedTracks, self.usedTracks, 1, 1, "B")
137
138 self.tfile.Write()
139 self.tfile.Close()
140
141
142# Create path

Member Data Documentation

◆ effi

effi

validation histogram

Definition at line 89 of file 3_bunchFinderPlots.py.

◆ effi_numTracks

effi_numTracks

validation histogram

Definition at line 75 of file 3_bunchFinderPlots.py.

◆ effi_usedTracks

effi_usedTracks

validation histogram

Definition at line 82 of file 3_bunchFinderPlots.py.

◆ nev

nev

number of events with valid TOPRecBunch object pointer

Definition at line 98 of file 3_bunchFinderPlots.py.

◆ numTracks

numTracks

validation histogram

Definition at line 63 of file 3_bunchFinderPlots.py.

◆ offset

offset

validation histogram

Definition at line 57 of file 3_bunchFinderPlots.py.

◆ recBunchNo

recBunchNo

validation histogram

Definition at line 51 of file 3_bunchFinderPlots.py.

◆ tfile

tfile

root file pointer

Definition at line 48 of file 3_bunchFinderPlots.py.

◆ usedTracks

usedTracks

validation histogram

Definition at line 69 of file 3_bunchFinderPlots.py.


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