Belle II Software  release-08-01-10
SVDDefaultCoGOnlyPositionErrorImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 SVD Default CoGOnly Position Error Formulas importer.
14 """
15 import basf2 as b2
16 from ROOT import Belle2
17 from ROOT.Belle2 import SVDPositionErrorFunction
18 from basf2 import conditions as b2conditions
19 import datetime
20 
21 # import sys
22 
23 # default values
24 # read the svd/dbobjects/SVDPositionErrorFunction class
25 # now replicates the same formulas as in release-05
26 
27 now = datetime.datetime.now()
28 
29 
31  """
32  Defining the python module to do the import.
33  """
34 
35  def beginRun(self):
36  """
37  call the functions to import the cluster parameters
38  """
40 
41  # cluster position error
42  clsParam = SVDPositionErrorFunction()
43 
45  clsParam,
46  "CoGOnlyPositionError_default_" +
47  str(
48  now.isoformat()) +
49  "_INFO:_formulas=rel05")
50 
52 
53  for layer in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
54  layerNumber = layer.getLayerNumber()
55  for ladder in geoCache.getLadders(layer):
56  ladderNumber = ladder.getLadderNumber()
57  for sensor in geoCache.getSensors(ladder):
58  sensorNumber = sensor.getSensorNumber()
59  for side in (0, 1):
60  print("setting CoGOnly Position Error for " +
61  str(layerNumber) + "." + str(ladderNumber) + "." + str(sensorNumber) + "." + str(side))
62  cls_payload.set(layerNumber, ladderNumber, sensorNumber, bool(side), 1, clsParam)
63 
64  Belle2.Database.Instance().storeData(Belle2.SVDCoGOnlyPositionError.name, cls_payload, iov)
65 
66 
67 b2conditions.prepend_globaltag('svd_onlySVDinGeoConfiguration')
68 
69 main = b2.create_path()
70 
71 # Event info setter - execute single event
72 eventinfosetter = b2.register_module('EventInfoSetter')
73 eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
74 main.add_module(eventinfosetter)
75 
76 main.add_module("Gearbox")
77 main.add_module("Geometry")
78 
80 
81 # Show progress of processing
82 progress = b2.register_module('Progress')
83 main.add_module(progress)
84 
85 # Process events
86 b2.process(main)
static IntervalOfValidity always()
Function that returns an interval of validity that is always valid, c.f.
base class for calibrations classes
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
static Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:42