Belle II Software  release-08-01-10
SVDDefaultOldDefaultErrorScaleFactorsImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 SVD Default OldDefault 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 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 = SVDPosErrScaleFactors()
43  clsParam.scaleError_clSize1 = clsScaleErrSize1
44  clsParam.scaleError_clSize2 = clsScaleErrSize2
45  clsParam.scaleError_clSize3 = clsScaleErrSize3
46 
48  clsParam,
49  "OldDefaultErrorScaleFactors_default_" +
50  str(
51  now.isoformat()) +
52  "_INFO:_scaleFactors=fromSimulation")
53 # "_INFO:_scaleFactors=1")
54 
56 
57  for layer in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
58  layerNumber = layer.getLayerNumber()
59  for ladder in geoCache.getLadders(layer):
60  ladderNumber = ladder.getLadderNumber()
61  for sensor in geoCache.getSensors(ladder):
62  sensorNumber = sensor.getSensorNumber()
63  for side in (0, 1):
64  print("setting OldDefault Error Scale Factors for " +
65  str(layerNumber) + "." + str(ladderNumber) + "." + str(sensorNumber) + "." + str(side))
66 
67  if side == 0: # V
68  if layerNumber == 3: # L3 V
69  clsParam.scaleError_clSize1 = 1.664
70  clsParam.scaleError_clSize2 = 0.977
71  clsParam.scaleError_clSize3 = 0.446
72  else:
73  if sensorNumber == 1: # FW V
74  clsParam.scaleError_clSize1 = 1.859
75  clsParam.scaleError_clSize2 = 1.185
76  clsParam.scaleError_clSize3 = 0.459
77  else: # BARREL V
78  clsParam.scaleError_clSize1 = 2.082
79  clsParam.scaleError_clSize2 = 1.218
80  clsParam.scaleError_clSize3 = 0.510
81  if side == 1: # U
82  if layerNumber == 3: # L3 U
83  clsParam.scaleError_clSize1 = 1.301
84  clsParam.scaleError_clSize2 = 0.711
85  clsParam.scaleError_clSize3 = 0.619
86  else:
87  if sensorNumber == 1: # FW U
88  clsParam.scaleError_clSize1 = 2.196
89  clsParam.scaleError_clSize2 = 0.889
90  clsParam.scaleError_clSize3 = 0.700
91  else: # BARREL U
92  clsParam.scaleError_clSize1 = 0.813
93  clsParam.scaleError_clSize2 = 0.693
94  clsParam.scaleError_clSize3 = 0.630
95 
96  print(" size 1 = " + str(clsParam.scaleError_clSize1) + ", size 2 = " +
97  str(clsParam.scaleError_clSize2) + ", size >2 = " + str(clsParam.scaleError_clSize3))
98 
99  cls_payload.set(layerNumber, ladderNumber, sensorNumber, bool(side), 1, clsParam)
100 
101  Belle2.Database.Instance().storeData(Belle2.SVDOldDefaultErrorScaleFactors.name, cls_payload, iov)
102 
103 
104 b2conditions.prepend_globaltag('svd_onlySVDinGeoConfiguration')
105 
106 main = b2.create_path()
107 
108 # Event info setter - execute single event
109 eventinfosetter = b2.register_module('EventInfoSetter')
110 eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
111 main.add_module(eventinfosetter)
112 
113 main.add_module("Gearbox")
114 main.add_module("Geometry")
115 
117 
118 # Show progress of processing
119 progress = b2.register_module('Progress')
120 main.add_module(progress)
121 
122 # Process events
123 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