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