Belle II Software development
SVDDefaultOldDefaultErrorScaleFactorsImporter.py
1#!/usr/bin/env python
2
3
10
11"""
12SVD Default OldDefault Error Scaling Factors importer.
13"""
14import basf2 as b2
15from ROOT import Belle2
16from ROOT.Belle2 import SVDPosErrScaleFactors
17from basf2 import conditions as b2conditions
18import datetime
19
20# import sys
21
22# default values
23clsScaleErrSize1 = 1
24clsScaleErrSize2 = 1
25clsScaleErrSize3 = 1
26now = datetime.datetime.now()
27
28
30 """
31 Defining the python module to do the import.
32 """
33
34 def beginRun(self):
35 """
36 call the functions to import the cluster parameters
37 """
39
40 # cluster position error
41 clsParam = SVDPosErrScaleFactors()
42 clsParam.scaleError_clSize1 = clsScaleErrSize1
43 clsParam.scaleError_clSize2 = clsScaleErrSize2
44 clsParam.scaleError_clSize3 = clsScaleErrSize3
45
47 clsParam,
48 "OldDefaultErrorScaleFactors_default_" +
49 str(
50 now.isoformat()) +
51 "_INFO:_scaleFactors=fromSimulation")
52# "_INFO:_scaleFactors=1")
53
55
56 for layer in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
57 layerNumber = layer.getLayerNumber()
58 for ladder in geoCache.getLadders(layer):
59 ladderNumber = ladder.getLadderNumber()
60 for sensor in geoCache.getSensors(ladder):
61 sensorNumber = sensor.getSensorNumber()
62 for side in (0, 1):
63 print("setting OldDefault Error Scale Factors for " +
64 str(layerNumber) + "." + str(ladderNumber) + "." + str(sensorNumber) + "." + str(side))
65
66 if side == 0: # V
67 if layerNumber == 3: # L3 V
68 clsParam.scaleError_clSize1 = 1.664
69 clsParam.scaleError_clSize2 = 0.977
70 clsParam.scaleError_clSize3 = 0.446
71 else:
72 if sensorNumber == 1: # FW V
73 clsParam.scaleError_clSize1 = 1.859
74 clsParam.scaleError_clSize2 = 1.185
75 clsParam.scaleError_clSize3 = 0.459
76 else: # BARREL V
77 clsParam.scaleError_clSize1 = 2.082
78 clsParam.scaleError_clSize2 = 1.218
79 clsParam.scaleError_clSize3 = 0.510
80 if side == 1: # U
81 if layerNumber == 3: # L3 U
82 clsParam.scaleError_clSize1 = 1.301
83 clsParam.scaleError_clSize2 = 0.711
84 clsParam.scaleError_clSize3 = 0.619
85 else:
86 if sensorNumber == 1: # FW U
87 clsParam.scaleError_clSize1 = 2.196
88 clsParam.scaleError_clSize2 = 0.889
89 clsParam.scaleError_clSize3 = 0.700
90 else: # BARREL U
91 clsParam.scaleError_clSize1 = 0.813
92 clsParam.scaleError_clSize2 = 0.693
93 clsParam.scaleError_clSize3 = 0.630
94
95 print(" size 1 = " + str(clsParam.scaleError_clSize1) + ", size 2 = " +
96 str(clsParam.scaleError_clSize2) + ", size >2 = " + str(clsParam.scaleError_clSize3))
97
98 cls_payload.set(layerNumber, ladderNumber, sensorNumber, bool(side), 1, clsParam)
99
100 Belle2.Database.Instance().storeData(Belle2.SVDOldDefaultErrorScaleFactors.name, cls_payload, iov)
101
102
103b2conditions.prepend_globaltag('svd_onlySVDinGeoConfiguration')
104
105main = b2.create_path()
106
107# Event info setter - execute single event
108eventinfosetter = b2.register_module('EventInfoSetter')
109eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
110main.add_module(eventinfosetter)
111
112main.add_module("Gearbox")
113main.add_module("Geometry")
114
116
117# Show progress of processing
118progress = b2.register_module('Progress')
119main.add_module(progress)
120
121# Process events
122b2.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