Belle II Software  release-08-01-10
SVDDefaultFADCMaskedStripsImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 SVD Default FADC Masked Strips 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 
25  '''default importer for FADC masked strips'''
26 
27  def beginRun(self):
28  '''begin run'''
29 
31 
33  0, "FADCMaskedStrips_default_" + str(now.isoformat()) + "_INFO:_noFADCMaskedstrips")
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 masked strips default value (0, not masked) for " +
46  str(layerNumber) + "." + str(ladderNumber) + "." + str(sensorNumber))
47  if side == 0 and not layerNumber == 3: # non-L3 V side
48  Nstrips = 512
49 
50  for strip in range(0, Nstrips):
51  payload.set(layerNumber, ladderNumber, sensorNumber, bool(side), strip, 0)
52 
53  # mask something, uncomment the following 2 lines:
54  # if(layerNumber == 3 and ladderNumber == 2 and sensorNumber == 2 and side == 0):
55  # payload.set(layerNumber, ladderNumber, sensorNumber, bool(side), strip, 1)
56 
57  Belle2.Database.Instance().storeData(Belle2.SVDFADCMaskedStrips.name, payload, iov)
58 
59 
60 b2conditions.prepend_globaltag("svd_onlySVDinGeoConfiguration")
61 
62 main = b2.create_path()
63 
64 # Event info setter - execute single event
65 eventinfosetter = b2.register_module('EventInfoSetter')
66 eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
67 main.add_module(eventinfosetter)
68 
69 main.add_module("Gearbox")
70 main.add_module("Geometry")
71 
72 main.add_module(defaultFADCMaskedStripsImporter())
73 
74 # Show progress of processing
75 progress = b2.register_module('Progress')
76 main.add_module(progress)
77 
78 # Process events
79 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