6 <output>overlayPlots.root</output>
7 <contact>marko.staric@ijs.si</contact>
8 <description>Runs BG overlay and makes validation histograms</description>
13 from simulation
import add_simulation
18 from ROOT
import Belle2
19 from ROOT
import TH1F, TFile, TNamed
21 set_random_seed(123452)
27 Make validation histograms for BG overlay.
31 ''' Initialize the Module: book histograms and set descriptions and checks'''
35 self.
hist.append(TH1F(
'PXDDigits',
'PXDDigits (no data reduction)',
37 self.
hist.append(TH1F(
'SVDShaperDigits',
'SVDShaperDigits', 100, 0, 4000))
38 self.
hist.append(TH1F(
'CDCHits',
'CDCHits', 100, 0, 4000))
39 self.
hist.append(TH1F(
'TOPDigits',
'TOPDigits', 100, 0, 2000))
40 self.
hist.append(TH1F(
'ARICHDigits',
'ARICHDigits', 100, 0, 300))
41 self.
hist.append(TH1F(
'ECLDigits',
'ECLDigits, m_Amp > 500 (roughly 25 MeV)',
43 self.
hist.append(TH1F(
'KLMDigits',
'KLMDigits', 150, 0, 150))
46 h.SetXTitle(
'number of digits in event')
47 h.SetYTitle(
'entries per bin')
48 descr = TNamed(
'Description',
'Number of background ' + h.GetName() +
49 ' per event (with BG overlay only and no event generator)')
50 h.GetListOfFunctions().Add(descr)
51 check = TNamed(
'Check',
'Distribution must agree with its reference')
52 h.GetListOfFunctions().Add(check)
53 contact = TNamed(
'Contact',
'marko.staric@ijs.si')
54 h.GetListOfFunctions().Add(contact)
55 options = TNamed(
'MetaOptions',
'shifter')
56 h.GetListOfFunctions().Add(options)
59 ''' Event processor: fill histograms '''
63 if h.GetName() ==
'ECLDigits':
66 if digit.getAmp() > 500:
70 h.Fill(digits.getEntries())
73 """ Write histograms to file."""
75 tfile = TFile(
'overlayPlots.root',
'recreate')
82 if 'BELLE2_BACKGROUND_DIR' in os.environ:
83 bg = glob.glob(os.environ[
'BELLE2_BACKGROUND_DIR'] +
'/*.root')
85 B2FATAL(
'No beam background samples found in folder ' +
86 os.environ[
'BELLE2_BACKGROUND_DIR'])
87 B2INFO(
'Using background samples from ' + os.environ[
'BELLE2_BACKGROUND_DIR'])
89 B2FATAL(
'variable BELLE2_BACKGROUND_DIR is not set')
95 eventinfosetter = register_module(
'EventInfoSetter')
96 eventinfosetter.param({
'evtNumList': [1000],
'runList': [1]})
97 main.add_module(eventinfosetter)
100 add_simulation(main, bkgfiles=bg, bkgOverlay=
True, usePXDDataReduction=
False, forceSetPXDDataReduction=
True)
106 progress = register_module(
'Progress')
107 main.add_module(progress)