Belle II Software  release-08-01-10
SVDDefaultCoGOnlyErrorScaleFactorsImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 SVD Default CoGOnly Error Scaling Factors importer.
14 """
15 import basf2 as b2
16 from ROOT import Belle2
17 from ROOT.Belle2 import SVDPosErrScaleFactors
18 from basf2 import conditions as b2conditions
19 import datetime
20 
21 # import sys
22 
23 # default values
24 clsScaleErrSize1 = 1
25 clsScaleErrSize2 = 1
26 clsScaleErrSize3 = 1
27 clsScaleErrSize4 = 1
28 clsScaleErrSize5 = 1
29 now = datetime.datetime.now()
30 
31 
33  """
34  Defining the python module to do the import.
35  """
36 
37  def beginRun(self):
38  """
39  call the functions to import the cluster parameters
40  """
42 
43  # cluster position error
44  clsParam = SVDPosErrScaleFactors()
45  clsParam.scaleError_clSize1 = clsScaleErrSize1
46  clsParam.scaleError_clSize2 = clsScaleErrSize2
47  clsParam.scaleError_clSize3 = clsScaleErrSize3
48  clsParam.scaleError_clSize4 = clsScaleErrSize4
49  clsParam.scaleError_clSize5 = clsScaleErrSize5
50 
52  clsParam,
53  "CoGOnlyErrorScaleFactors_default_" +
54  str(
55  now.isoformat()) +
56  "_INFO:_scaleFactors=1")
57 
59 
60  for layer in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
61  layerNumber = layer.getLayerNumber()
62  for ladder in geoCache.getLadders(layer):
63  ladderNumber = ladder.getLadderNumber()
64  for sensor in geoCache.getSensors(ladder):
65  sensorNumber = sensor.getSensorNumber()
66  for side in (0, 1):
67  print("setting CoGOnly Error Scale Factors for " +
68  str(layerNumber) + "." + str(ladderNumber) + "." + str(sensorNumber) + "." + str(side))
69  cls_payload.set(layerNumber, ladderNumber, sensorNumber, bool(side), 1, clsParam)
70 
71  Belle2.Database.Instance().storeData(Belle2.SVDCoGOnlyErrorScaleFactors.name, cls_payload, iov)
72 
73 
74 b2conditions.prepend_globaltag('svd_onlySVDinGeoConfiguration')
75 
76 main = b2.create_path()
77 
78 # Event info setter - execute single event
79 eventinfosetter = b2.register_module('EventInfoSetter')
80 eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
81 main.add_module(eventinfosetter)
82 
83 main.add_module("Gearbox")
84 main.add_module("Geometry")
85 
87 
88 # Show progress of processing
89 progress = b2.register_module('Progress')
90 main.add_module(progress)
91 
92 # Process events
93 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