Belle II Software development
ARICHImportParametersToDB.py
1#!/usr/bin/env python3
2
3
10
11# use to import parmeters from xml files to corresponding database classes
12# uncomment the desired function
13# optionaly IOV of created payload can be set as
14# basf2 arich/utility/scripts/ARICHImportPrametersToDB.py -- 3 0 3 -1
15# for example for all runs of experiment 3
16# arguments: 1 experimentLow, 2 runLow, 3 experimentHigh , 4 runHigh
17
18import basf2 as b2
19from ROOT import Belle2 # noqa: make Belle2 namespace available
20from ROOT.Belle2 import ARICHDatabaseImporter
21import sys
22
23argvs = sys.argv
24argc = len(argvs)
25
26# set local database folder
27b2.use_local_database("localdb/database.txt", "localdb")
28
29# EventInfoSetter is only needed to register EventMetaData in the Datastore to
30# get rid of an error message with gearbox
31eventinfo = b2.register_module('EventInfoSetter')
32eventinfo.initialize()
33
34# load gearbox for reading parameters from xml files (by default in "arich/data")
35paramloader = b2.register_module('Gearbox')
36paramloader.initialize()
37
38main = b2.create_path()
39main.add_module(eventinfo)
40b2.process(main)
41
42# and run the importer
43dbImporter = ARICHDatabaseImporter()
44
45# set IOV if desired (default IOV is 0,0,-1,-1)
46if argc == 5:
47 dbImporter.SetIOV(int(argvs[1]), int(argvs[2]), int(argvs[3]), int(argvs[4]))
48
49# uncomment/comment the desired function
50
51# import modules info
52# ARICHModulesInfo is a lightweight DB class, used by ARICH simulation/reconstruction software,
53# that holds information of installed and active HAPD modules and their 2D QE maps.
54# This function goes through arich/data/ARICH-InstalledModules.xml, finds QE maps of corresponding HAPDs in
55# the database (payload "dbstore_ARICHHapdQE_rev_*.root" must exist in the DB) and
56# creates ARICHModulesInfo which is then stored in DB
57
58# dbImporter.importModulesInfo()
59
60
61# import channel mask
62# ARICHChannelMask is a lightweight DB class, used by ARICH simulation/reconstruction software,
63# that holds list of dead channels of all installed HAPD modules.
64# This function goes through arich/data/ARICH-InstalledModules.xml, finds list of dead channels of
65# corresponding HAPDs in the database (payload "dbstore_ARICHModuleTest_rev_*.root" must exist in the DB) and
66# creates ARICHChannelMask which is then stored in DB
67
68# dbImporter.importChannelMask()
69
70
71# import simulation parameters
72# ARICHSimulationPar is DB class, used by ARICH simulation/reconstruction software,
73# that holds QE vs. wavelenght curve, and some other parameters of photon detection.
74# The parameters are read from arich/data/ARICH-SimulationPar.xml
75
76# dbImporter.importSimulationParams()
77
78# import reconstruction parameters
79# at this point it only initializes "default" values, defined in ARICHReconstructionPar class itself
80
81# dbImporter.importReconstructionParams()
82
83
84# import channel mapping
85# ARICHChannelMapping is a DB class, used by ARICH simulation/reconstruction software,
86# that holds mapping of HAPD channel asic numbers to channel (x,y) position numbers (0,11)
87# The mapping is read from arich/data/ARICH-ChannelMapping.xml
88
89# dbImporter.importChannelMapping()
90
91
92# import front-end mappings
93# ARICHMergerMapping and ARICHCopperMapping are DB classes that hold mapping of HAPD modules
94# to merger boards and mapping of mereger boards to copper boards
95# Mappings are read from the arich/data/ARICH-FrontEndMapping.xml
96
97# dbImporter.importFEMappings()
98
99# Import geometry parameters from xml files to the database
100# Parameters are read from arich/data/ARICH-(Aerogel,Detector,Hapd,Mirrors).xml
101
102# dbImporter.importGeometryConfig()
103
104# Import merger cooling bodies geometry
105# from arich/data/ARICH-Merger-cooling_v2.xml
106
107# dbImporter.importMergerCoolingGeo()
108
109# Import simple cosmic test geometry (i.e. one aerogel tile + scintilators).
110# Parameters are read from arich/data/ARICH-CosmicTest.xml
111
112# dbImporter.importCosmicTestGeometry()
113
114# Import global alignment parameters
115# Parameters are read from arich/data/ARICH-GlobalAlignment.xml
116
117# dbImporter.importGlobalAlignment()
118
119# Import mirror alignment parameters
120# Parameters are read from arich/data/ARICH-MirrorAlignment.xml
121
122# dbImporter.importMirrorAlignment()
123
124# Import aerogel tile alignment parameters
125# Parameters are read from arich/data/ARICH-AeroTilesAlignment.xml
126
127# dbImporter.importAeroTilesAlignment()