14 <output>overlayPlots.root</output>
15 <contact>marko.staric@ijs.si</contact>
16 <description>Runs BG overlay and makes validation histograms</description>
21 from simulation
import add_simulation
24 from ROOT
import Belle2
25 from ROOT
import TH1F, TFile, TNamed
27 b2.set_random_seed(123452)
33 Make validation histograms for BG overlay.
37 ''' Initialize the Module: book histograms and set descriptions and checks'''
41 self.
histhist.append(TH1F(
'PXDDigits',
'PXDDigits (no data reduction)',
43 self.
histhist.append(TH1F(
'SVDShaperDigits',
'SVDShaperDigits', 100, 0, 4000))
44 self.
histhist.append(TH1F(
'CDCHits',
'CDCHits', 100, 0, 6000))
45 self.
histhist.append(TH1F(
'TOPDigits',
'TOPDigits', 100, 0, 2000))
46 self.
histhist.append(TH1F(
'ARICHDigits',
'ARICHDigits', 100, 0, 300))
47 self.
histhist.append(TH1F(
'ECLDigits',
'ECLDigits, m_Amp > 500 (roughly 25 MeV)',
49 self.
histhist.append(TH1F(
'KLMDigits',
'KLMDigits', 150, 0, 150))
51 for h
in self.
histhist:
52 h.SetXTitle(
'number of digits in event')
53 h.SetYTitle(
'entries per bin')
54 descr = TNamed(
'Description',
'Number of background ' + h.GetName() +
55 ' per event (with BG overlay only and no event generator)')
56 h.GetListOfFunctions().Add(descr)
57 check = TNamed(
'Check',
'Distribution must agree with its reference')
58 h.GetListOfFunctions().Add(check)
59 contact = TNamed(
'Contact',
'marko.staric@ijs.si')
60 h.GetListOfFunctions().Add(contact)
61 options = TNamed(
'MetaOptions',
'shifter')
62 h.GetListOfFunctions().Add(options)
65 ''' Event processor: fill histograms '''
67 for h
in self.
histhist:
69 if h.GetName() ==
'ECLDigits':
72 if digit.getAmp() > 500:
76 h.Fill(digits.getEntries())
79 """ Write histograms to file."""
81 tfile = TFile(
'overlayPlots.root',
'recreate')
82 for h
in self.
histhist:
88 if 'BELLE2_BACKGROUND_DIR' in os.environ:
89 bg = glob.glob(os.environ[
'BELLE2_BACKGROUND_DIR'] +
'/*.root')
91 b2.B2FATAL(
'No beam background samples found in folder ' +
92 os.environ[
'BELLE2_BACKGROUND_DIR'])
93 b2.B2INFO(
'Using background samples from ' + os.environ[
'BELLE2_BACKGROUND_DIR'])
95 b2.B2FATAL(
'variable BELLE2_BACKGROUND_DIR is not set')
98 main = b2.create_path()
101 eventinfosetter = b2.register_module(
'EventInfoSetter')
102 eventinfosetter.param({
'evtNumList': [1000],
'runList': [1]})
103 main.add_module(eventinfosetter)
106 add_simulation(main, bkgfiles=bg, bkgOverlay=
True, usePXDDataReduction=
False, forceSetPXDDataReduction=
True,
107 simulateT0jitter=
False)
113 progress = b2.register_module(
'Progress')
114 main.add_module(progress)
a (simplified) python wrapper for StoreArray.