Belle II Software  release-08-01-10
SVDDefaultHotStripsImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 SVD Default HotStrips Calibration importer.
14 Script to Import Calibrations into a local DB
15 """
16 import basf2 as b2
17 from ROOT import Belle2
18 import datetime
19 from basf2 import conditions as b2conditions
20 
21 now = datetime.datetime.now()
22 
23 
24 class defaultHotStripsImporter(b2.Module):
25  '''default importer for hot strips'''
26 
27  def beginRun(self):
28  '''begin run'''
29 
31  # iov = IntervalOfValidity(0,0,-1,-1)
32 
33  payload = Belle2.SVDHotStripsCalibrations.t_payload(0, "HotStrips_default_" + str(now.isoformat()) + "_INFO:_noHotstrips")
34 
36 
37  for layer in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
38  layerNumber = layer.getLayerNumber()
39  for ladder in geoCache.getLadders(layer):
40  ladderNumber = ladder.getLadderNumber()
41  for sensor in geoCache.getSensors(ladder):
42  sensorNumber = sensor.getSensorNumber()
43  for side in (0, 1):
44  Nstrips = 768
45  print("setting hot strips default value (0, good strip) for " +
46  str(layerNumber) + "." + str(ladderNumber) + "." + str(sensorNumber))
47 
48  if side == 0 and not layerNumber == 3: # non-L3 V side
49  Nstrips = 512
50 
51  for strip in range(0, Nstrips):
52  payload.set(layerNumber, ladderNumber, sensorNumber, bool(side), 1, 0)
53 
54  Belle2.Database.Instance().storeData(Belle2.SVDHotStripsCalibrations.name, payload, iov)
55 
56 
57 b2conditions.prepend_globaltag("svd_onlySVDinGeoConfiguration")
58 
59 main = b2.create_path()
60 
61 # Event info setter - execute single event
62 eventinfosetter = b2.register_module('EventInfoSetter')
63 eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
64 main.add_module(eventinfosetter)
65 
66 main.add_module("Gearbox")
67 main.add_module("Geometry")
68 
69 main.add_module(defaultHotStripsImporter())
70 
71 # Show progress of processing
72 progress = b2.register_module('Progress')
73 main.add_module(progress)
74 
75 # Process events
76 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