Belle II Software development
ImportScintillatorDigitizationParameters.py
1#!/usr/bin/env python3
2
3
10
11# Import KLM scintillator digitization parameters payloads.
12
13import sys
14import basf2
15import math
16from ROOT import Belle2 # noqa: make the Belle2 namespace available
17from ROOT.Belle2 import KLMDatabaseImporter, KLMScintillatorDigitizationParameters
18
19basf2.set_log_level(basf2.LogLevel.INFO)
20
21mc = False
22if (len(sys.argv) >= 2):
23 if (sys.argv[1] == 'mc'):
24 mc = True
25
26dbImporter = KLMDatabaseImporter()
27
28digPar = KLMScintillatorDigitizationParameters()
29# ADC resolution (maximal output value + 1).
30digPar.setADCRange(4096)
31# ADC sampling time in TDC periods (frequency is global clock * 8).
32digPar.setADCSamplingTDCPeriods(1)
33# Number of digitizations.
34digPar.setNDigitizations(200)
35# ADC pedestal.
36digPar.setADCPedestal(3700)
37# Photoelectron amplitude.
38digPar.setADCPEAmplitude(20)
39# ADC threshold (the difference with pedestal is 3 photoelectron amplitudes).
40digPar.setADCThreshold(3640)
41# ADC output value corresponding to saturation.
42digPar.setADCSaturation(1000)
43# Number of photoelectrons per 1 MeV.
44digPar.setNPEperMeV(22)
45# Cosine of the maximal angle of total internal reflection in the fiber.
46digPar.setMinCosTheta(math.cos(26.7 / 180.0 * math.pi))
47# Mirror reflective index.
48digPar.setMirrorReflectiveIndex(0.95)
49# Scintillator deexcitation time in ns.
50digPar.setScintillatorDeExcitationTime(3.0)
51# Fiber deexcitation time in ns.
52digPar.setFiberDeExcitationTime(10.0)
53# Effective light speed in the fiber in cm/ns.
54digPar.setFiberLightSpeed(17.0)
55# Fiber attenuation length.
56digPar.setAttenuationLength(300.0)
57# Photoelectron signal attenuation frequency in ns^{-1}.
58# Value from T2K paper by F. Retiere: PoS (PD07) 017: 1.0 / 8.75.
59digPar.setPEAttenuationFrequency(0.11428571428571428571)
60# Mean SiPM noise (negative: turned off).
61digPar.setMeanSiPMNoise(-1)
62# Constant background.
63digPar.setEnableConstBkg(False)
64
65if (mc):
66 dbImporter.setIOV(1002, 0, 1002, -1)
67 dbImporter.importScintillatorDigitizationParameters(digPar)
68
69 dbImporter.setIOV(1003, 0, 1003, -1)
70 dbImporter.importScintillatorDigitizationParameters(digPar)
71
72 dbImporter.setIOV(0, 0, 0, -1)
73 dbImporter.importScintillatorDigitizationParameters(digPar)
74
75else:
76 dbImporter.setIOV(0, 0, -1, -1)
77 dbImporter.importScintillatorDigitizationParameters(digPar)