Belle II Software  release-08-01-10
SVDDefaultHitTimeSelectionImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 SVD Default Hit Time Selection importer.
14 """
15 import basf2 as b2
16 from ROOT import Belle2
17 from ROOT.Belle2 import SVDHitTimeSelectionFunction
18 from basf2 import conditions as b2conditions
19 import datetime
20 
21 # import sys
22 
23 # default values
24 # cls hit time
25 clsTimeMin = -999
26 clsTimeFunctionID = 0 # default, t > clsTimeMin
27 clsTimeDeltaT = 30 # NOT USED
28 clsTimeNSigma = 10 # NOT USED
29 
30 # time difference U-V
31 clsTimeDiff = 999 # default for DATA and exp 1003, 1002
32 # clsTimeDiff = 10 # default for exp 0
33 
34 now = datetime.datetime.now()
35 
36 
38  """
39  Defining the python module to do the import.
40  """
41 
42  def beginRun(self):
43  """
44  call the functions to import the cluster parameters
45  """
47 
48  # SpacePoint time
49  hitTimeSelection = SVDHitTimeSelectionFunction()
50  # set default version = 0
51  hitTimeSelection.setFunctionID(clsTimeFunctionID)
52  # version 0: t > tMin
53  hitTimeSelection.setMinTime(clsTimeMin)
54  # version 1: |t-t0|<deltaT - NOT USED
55  hitTimeSelection.setDeltaTime(clsTimeDeltaT)
56  # version 2: |t-t0|<nSgma*tErrTOT - NOT USED
57  hitTimeSelection.setNsigma(clsTimeNSigma)
58  # cluster time difference
59  hitTimeSelection.setMaxUVTimeDifference(clsTimeDiff)
61  hitTimeSelection, "HitTimeSelection_noCuts_" + str(now.isoformat()) +
62  "_INFO:_tmin=" + str(clsTimeMin) + "_tDiff=" + str(clsTimeDiff))
63 
65 
66  for layer in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
67  layerNumber = layer.getLayerNumber()
68  for ladder in geoCache.getLadders(layer):
69  ladderNumber = ladder.getLadderNumber()
70  for sensor in geoCache.getSensors(ladder):
71  sensorNumber = sensor.getSensorNumber()
72  for side in (0, 1):
73  print("setting SVD Hit Time Selections for " +
74  str(layerNumber) + "." + str(ladderNumber) + "." + str(sensorNumber) + "." + str(side))
75 
76  Belle2.Database.Instance().storeData(Belle2.SVDHitTimeSelection.name, payload, iov)
77 
78 
79 b2conditions.prepend_globaltag('svd_onlySVDinGeoConfiguration')
80 
81 main = b2.create_path()
82 
83 # Event info setter - execute single event
84 eventinfosetter = b2.register_module('EventInfoSetter')
85 eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
86 main.add_module(eventinfosetter)
87 
88 main.add_module("Gearbox")
89 main.add_module("Geometry")
90 
91 main.add_module(defaultSVDHitTimeSelectionImporter())
92 
93 # Show progress of processing
94 progress = b2.register_module('Progress')
95 main.add_module(progress)
96 
97 # Process events
98 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