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