Belle II Software development
SVDDefaultNoiseImporter.py
1#!/usr/bin/env python
2
3
10
11"""
12SVD Default Noise Calibration importer (MC).
13Script to Import Calibrations into a local DB
14"""
15import basf2 as b2
16from ROOT import Belle2
17import datetime
18from basf2 import conditions as b2conditions
19
20now = datetime.datetime.now()
21
22'''
23# Phase 3 - scaled with 375
24noise_L3_U = 2.48
25noise_L3_V = 1.81
26noise_bkw_U = 2.08
27noise_bkw_V = 1.81
28noise_origami_U = 2.40
29noise_origami_V = 1.33
30noise_fwd_U = 2.00
31noise_fwd_V = 1.81
32'''
33# Phase 3 - scaled with rescaled gain
34noise_L3_U = 3.29
35noise_L3_V = 2.46
36noise_bkw_U = 3.12
37noise_bkw_V = 2.75
38noise_origami_U = 3.32
39noise_origami_V = 2.28
40noise_fwd_U = 3.03
41noise_fwd_V = 2.76
42'''
43# TestBeam
44noise_L3_U = 2.51
45noise_L3_V = 1.73
46noise_bkw_U = -1
47noise_bkw_V = -1
48noise_origami_U = 2.88
49noise_origami_V = 1.73
50noise_fwd_U = -1
51noise_fwd_V = -1
52'''
53
54
55class defaultNoiseImporter(b2.Module):
56 ''' default strip noise importer'''
57
58 def beginRun(self):
59 '''begin run'''
60
62
63 payload = Belle2.SVDNoiseCalibrations.t_payload(-1, "NoiseCalibrations_default_" +
64 str(now.isoformat()) + "_INFO:_fromPhase3calibrations")
65
67
68 for layer in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
69 layerNumber = layer.getLayerNumber()
70 for ladder in geoCache.getLadders(layer):
71 ladderNumber = ladder.getLadderNumber()
72 for sensor in geoCache.getSensors(ladder):
73 sensorNumber = sensor.getSensorNumber()
74 for side in (0, 1):
75 Nstrips = 768
76 print("setting Noise for " +
77 str(layerNumber) + "." + str(ladderNumber) + "." + str(sensorNumber) + "." + str(side))
78 if side == 0: # V
79 if layerNumber == 3: # L3 V
80 noise = noise_L3_V
81 else:
82 Nstrips = 512
83 if sensorNumber == 1: # FW V
84 noise = noise_fwd_V
85 else: # BKW V
86 if sensorNumber == layerNumber - 1: # FW V
87 noise = noise_bkw_V
88 else: # BARREL V
89 noise = noise_origami_V
90 if side == 1: # U
91 if layerNumber == 3: # L3 U
92 noise = noise_L3_U
93 else:
94 if sensorNumber == 1: # FW U
95 noise = noise_fwd_U
96 else: # BKW U
97 if sensorNumber == layerNumber - 1: # FW U
98 noise = noise_bkw_U
99 else: # BARREL U
100 noise = noise_origami_U
101
102 print(str(Nstrips))
103 for strip in range(0, Nstrips):
104 payload.set(layerNumber, ladderNumber, sensorNumber, bool(side), strip, noise)
105
106 Belle2.Database.Instance().storeData(Belle2.SVDNoiseCalibrations.name, payload, iov)
107
108
109b2conditions.prepend_globaltag("svd_onlySVDinGeoConfiguration")
110
111main = b2.create_path()
112
113# Event info setter - execute single event
114eventinfosetter = b2.register_module('EventInfoSetter')
115eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
116main.add_module(eventinfosetter)
117
118main.add_module("Gearbox")
119main.add_module("Geometry")
120
121main.add_module(defaultNoiseImporter())
122
123# Show progress of processing
124progress = b2.register_module('Progress')
125main.add_module(progress)
126
127# Process events
128b2.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