5 Test backwards compatibility for RAW Objects and Unpackers.
7 The ability to unpack all recorded Belle II events also with future release is
8 vital to be able to reconstruct the full Belle II dataset during the lifetime of the experiment
10 This is the basis of unit tests which execute the unpackers and checks for the properties of the
11 unpacked sub-detector StoreArrays.
17 from ROOT
import Belle2
18 from basf2
import create_path, process, LogLevel, set_log_level, set_random_seed, conditions
19 from b2test_utils
import require_file
22 from rawdata
import add_unpackers
27 unpacked_dataobjects = [
28 DataStorePrinter(
"PXDRawHit", [
"getRow",
"getColumn",
"getCharge"]),
29 DataStorePrinter(
"SVDShaperDigit", [
"getCellID",
"getFADCTime",
"toString"]),
30 DataStorePrinter(
"CDCHit", [
"getID",
"getStatus",
"getTDCCount",
"getADCCount"]),
31 DataStorePrinter(
"ECLDigit", [
"getCellId",
"getAmp",
"getTimeFit"]),
32 DataStorePrinter(
"TOPDigit", [
"getModuleID",
"getPixelID",
"getPixelRow",
"getPixelCol",
"getRawTime",
33 "getPulseHeight",
"getPulseWidth"]),
34 DataStorePrinter(
"ARICHDigit", [
"getModuleID",
"getChannelID",
"getBitmap"]),
35 DataStorePrinter(
"BKLMDigit", [
"getUniqueChannelID",
"getTime",
"getEnergyDeposit",
"getCharge",
"getTime"]),
36 DataStorePrinter(
"EKLMDigit", [
"getUniqueChannelID",
"getCTime",
"getCharge",
"getPlane",
"getStrip"]),
37 DataStorePrinter(
"CDCTriggerSegmentHit", [
"getID"]),
38 DataStorePrinter(
"CDCTrigger2DFinderTrack", [
"getTime",
"getPt"]),
39 DataStorePrinter(
"CDCTriggerNeuroTrack", [
"getTime",
"getPt"]),
43 def unpack_and_print_files(filenames):
45 process a given files and print its unpacked raw contents
46 Needs to all happen in one process call, otherwise the Geomtery would
47 be loaded multiple times, which results in an error
50 if len(filenames) == 0:
51 print(
"TEST SKIPPED: No input files for test",
57 main.add_module(
"RootInput", inputFileNames=raw_files, logLevel=LogLevel.WARNING)
59 main.add_module(
"EventInfoPrinter")
61 main.add_module(
"Gearbox")
62 main.add_module(
"Geometry", useDB=
True)
64 main.add_module(PrintObjectsModule(unpacked_dataobjects))
70 def test_raw(phase_name, postfix, global_tag):
72 Runs the whole Raw unpacking testing scheme for one global tag for phase 2 or phase 3 events
75 set_log_level(LogLevel.ERROR)
79 conditions.override_globaltags([global_tag])
82 conditions.disable_globaltag_replay()
84 rawdata_path = require_file(os.path.join(
'rawdata', phase_name),
"validation")
85 unpack_and_print_files(glob.glob(os.path.join(rawdata_path, f
"{postfix}*.root")))