Belle II Software  release-08-01-10
SVDDefaultClusteringImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 SVD Default Clustering Parameters importer.
14 """
15 import basf2 as b2
16 from ROOT import Belle2
17 from ROOT.Belle2 import SVDClusterCuts
18 from basf2 import conditions as b2conditions
19 import datetime
20 
21 # import sys
22 
23 # default values
24 # cls cuts
25 clsSeedSNR = 5
26 clsAdjSNR = 3
27 clsMinSNR = 0
28 clsUnfoldingCoeffU = 0
29 clsUnfoldingCoeffV = 0
30 now = datetime.datetime.now()
31 
32 
34  """
35  Defining the python module to do the import.
36  """
37 
38  def beginRun(self):
39  """
40  call the functions to import the cluster parameters
41  """
43 
44  # cluster reconstruction & position error
45  clsParam = SVDClusterCuts()
46  clsParam.minSeedSNR = clsSeedSNR
47  clsParam.minAdjSNR = clsAdjSNR
48  clsParam.minClusterSNR = clsMinSNR
49  clsParam.UnfoldingCoeff = clsUnfoldingCoeffV
50 
52  clsParam,
53  "Clustering_default_" +
54  str(
55  now.isoformat()) +
56  "_INFO:_seed=" +
57  str(clsSeedSNR) +
58  "_adj=" +
59  str(clsAdjSNR) +
60  "_cls=" +
61  str(clsMinSNR) +
62  "_unfU=" +
63  str(clsUnfoldingCoeffU) +
64  "_unfV=" +
65  str(clsUnfoldingCoeffV))
66 
68 
69  for layer in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
70  layerNumber = layer.getLayerNumber()
71  for ladder in geoCache.getLadders(layer):
72  ladderNumber = ladder.getLadderNumber()
73  for sensor in geoCache.getSensors(ladder):
74  sensorNumber = sensor.getSensorNumber()
75  for side in (0, 1):
76  print("setting SVD Clustering parameters for " +
77  str(layerNumber) + "." + str(ladderNumber) + "." + str(sensorNumber) + "." + str(side))
78  if side == 1:
79  clsParam.UnfoldingCoeff = clsUnfoldingCoeffU
80  else:
81  clsParam.UnfoldingCoeff = clsUnfoldingCoeffV
82  print(clsParam.UnfoldingCoeff)
83  payload.set(layerNumber, ladderNumber, sensorNumber, bool(side), 1, clsParam)
84 
85  Belle2.Database.Instance().storeData(Belle2.SVDClustering.name, payload, iov)
86 
87 
88 b2conditions.prepend_globaltag('svd_onlySVDinGeoConfiguration')
89 
90 main = b2.create_path()
91 
92 # Event info setter - execute single event
93 eventinfosetter = b2.register_module('EventInfoSetter')
94 eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
95 main.add_module(eventinfosetter)
96 
97 main.add_module("Gearbox")
98 main.add_module("Geometry")
99 
100 main.add_module(defaultSVDClusteringImporter())
101 
102 # Show progress of processing
103 progress = b2.register_module('Progress')
104 main.add_module(progress)
105 
106 # Process events
107 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