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