12 Test backwards compatibility for RAW Objects and Unpackers.
14 The ability to unpack all recorded Belle II events also with future release is
15 vital to be able to reconstruct the full Belle II dataset during the lifetime of the experiment
17 This is the basis of unit tests which execute the unpackers and checks for the properties of the
18 unpacked sub-detector StoreArrays.
24 from ROOT
import Belle2
25 from basf2
import create_path, process, LogLevel, set_log_level, set_random_seed, conditions
26 from b2test_utils
import require_file
29 from rawdata
import add_unpackers
34 unpacked_dataobjects = [
35 DataStorePrinter(
"PXDRawHit", [
"getRow",
"getColumn",
"getCharge"]),
36 DataStorePrinter(
"SVDShaperDigit", [
"getCellID",
"getFADCTime",
"toString"]),
37 DataStorePrinter(
"CDCHit", [
"getID",
"getStatus",
"getTDCCount",
"getADCCount"]),
38 DataStorePrinter(
"ECLDigit", [
"getCellId",
"getAmp",
"getTimeFit"]),
39 DataStorePrinter(
"TOPDigit", [
"getModuleID",
"getPixelID",
"getPixelRow",
"getPixelCol",
"getRawTime",
40 "getPulseHeight",
"getPulseWidth"]),
41 DataStorePrinter(
"ARICHDigit", [
"getModuleID",
"getChannelID",
"getBitmap"]),
42 DataStorePrinter(
"BKLMDigit", [
"getUniqueChannelID",
"getTime",
"getEnergyDeposit",
"getCharge",
"getTime"]),
43 DataStorePrinter(
"EKLMDigit", [
"getUniqueChannelID",
"getCTime",
"getCharge",
"getPlane",
"getStrip"]),
44 DataStorePrinter(
"CDCTriggerSegmentHit", [
"getID"]),
45 DataStorePrinter(
"CDCTrigger2DFinderTrack", [
"getTime",
"getPt"]),
46 DataStorePrinter(
"CDCTriggerNeuroTrack", [
"getTime",
"getPt"]),
50 def unpack_and_print_files(filenames):
52 process a given files and print its unpacked raw contents
53 Needs to all happen in one process call, otherwise the Geomtery would
54 be loaded multiple times, which results in an error
57 if len(filenames) == 0:
58 print(
"TEST SKIPPED: No input files for test",
64 main.add_module(
"RootInput", inputFileNames=raw_files, logLevel=LogLevel.WARNING)
66 main.add_module(
"EventInfoPrinter")
68 main.add_module(
"Gearbox")
69 main.add_module(
"Geometry", useDB=
True)
71 main.add_module(PrintObjectsModule(unpacked_dataobjects))
77 def test_raw(phase_name, postfix, global_tag):
79 Runs the whole Raw unpacking testing scheme for one global tag for phase 2 or phase 3 events
82 set_log_level(LogLevel.ERROR)
86 conditions.override_globaltags([global_tag])
89 conditions.disable_globaltag_replay()
91 rawdata_path = require_file(os.path.join(
'rawdata', phase_name),
"validation")
92 unpack_and_print_files(glob.glob(os.path.join(rawdata_path, f
"{postfix}*.root")))
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...