Belle II Software development
SVDRecoConfigurationImporter.py
1#!/usr/bin/env python
2
3
10
11"""
12Importer of the SVD Reconstruction Configuration
13"""
14import basf2
15from ROOT import Belle2
16import datetime
17
18now = datetime.datetime.now()
19
20# cluster reconstruction algorithms:
21algorithmFor_timeRecoWith6Samples = "CoG3"
22algorithmFor_timeRecoWith3Samples = "CoG3"
23algorithmFor_positionRecoWith6Samples = "CoGOnly"
24algorithmFor_positionRecoWith3Samples = "CoGOnly"
25algorithmFor_chargeRecoWith6Samples = "MaxSample"
26algorithmFor_chargeRecoWith3Samples = "MaxSample"
27# strip reconstruction algorithms:
28algorithmFor_stripTimeRecoWith6Samples = "dontdo"
29algorithmFor_stripTimeRecoWith3Samples = "dontdo"
30algorithmFor_stripChargeRecoWith6Samples = "MaxSample"
31algorithmFor_stripChargeRecoWith3Samples = "MaxSample"
32# grouping
33grouping_stateOfTimeGroupingInClusterizerIn6Samples = True # in 6 Samples DAQ Mode
34grouping_useOfSVDGroupInfoInSPCreatorIn6Samples = True
35grouping_stateOfTimeGroupingInClusterizerIn3Samples = False # in 3 Samples DAQ Mode
36grouping_useOfSVDGroupInfoInSPCreatorIn3Samples = False
37# cut on sample SNR
38snr_useOfSVDSpacePointSNRFractionIn6Samples = False
39snr_useOfSVDSpacePointSNRFractionIn3Samples = False
40
41
42class recoConfigurationImporter(basf2.Module):
43 ''' importer of the SVD Reconstruction Configuration'''
44
45 def beginRun(self):
46 '''begin run'''
47
49
50 uniqueID = "SVDRecoConfiguration_default_3=6_" + \
51 str(now.isoformat()) + "_INFO:" + \
52 "_" + str(algorithmFor_timeRecoWith6Samples) + "Time" + \
53 "_" + str(algorithmFor_chargeRecoWith6Samples) + "Charge" + \
54 "_" + str(algorithmFor_positionRecoWith6Samples) + "Position"
55
56 groupingSpecificString = ""
57 if grouping_stateOfTimeGroupingInClusterizerIn6Samples and grouping_stateOfTimeGroupingInClusterizerIn3Samples:
58 if grouping_useOfSVDGroupInfoInSPCreatorIn6Samples or grouping_useOfSVDGroupInfoInSPCreatorIn3Samples:
59 groupingSpecificString += "_groupSelectionON"
60 else:
61 groupingSpecificString += "_groupIdON"
62 elif grouping_stateOfTimeGroupingInClusterizerIn6Samples:
63 if grouping_useOfSVDGroupInfoInSPCreatorIn6Samples:
64 groupingSpecificString += "_6groupSelectionON"
65 else:
66 groupingSpecificString += "_6groupIdON"
67 elif grouping_stateOfTimeGroupingInClusterizerIn3Samples:
68 if grouping_useOfSVDGroupInfoInSPCreatorIn3Samples:
69 groupingSpecificString += "_3groupSelectionON"
70 else:
71 groupingSpecificString += "_3groupIdON"
72
73 uniqueID += groupingSpecificString
74
75 cutOnSampleSNRSpecificString = ""
76 if snr_useOfSVDSpacePointSNRFractionIn6Samples and snr_useOfSVDSpacePointSNRFractionIn3Samples:
77 cutOnSampleSNRSpecificString = "_cutOnSampleSNRFractionON"
78 elif snr_useOfSVDSpacePointSNRFractionIn6Samples:
79 cutOnSampleSNRSpecificString = "_cutOn6SampleSNRFractionON"
80 elif snr_useOfSVDSpacePointSNRFractionIn3Samples:
81 cutOnSampleSNRSpecificString = "_cutOn3SampleSNRFractionON"
82
83 uniqueID += cutOnSampleSNRSpecificString
84
85 payload = Belle2.SVDRecoConfiguration(uniqueID)
86
87 # cluster time
88 payload.setTimeRecoWith6Samples(algorithmFor_timeRecoWith6Samples)
89 payload.setTimeRecoWith3Samples(algorithmFor_timeRecoWith3Samples)
90 # cluster position
91 payload.setPositionRecoWith6Samples(algorithmFor_positionRecoWith6Samples)
92 payload.setPositionRecoWith3Samples(algorithmFor_positionRecoWith3Samples)
93 # cluster charge
94 payload.setChargeRecoWith6Samples(algorithmFor_chargeRecoWith6Samples)
95 payload.setChargeRecoWith3Samples(algorithmFor_chargeRecoWith3Samples)
96 # strip time
97 payload.setStripTimeRecoWith6Samples(algorithmFor_stripTimeRecoWith6Samples)
98 payload.setStripTimeRecoWith3Samples(algorithmFor_stripTimeRecoWith3Samples)
99 # strip charge
100 payload.setStripChargeRecoWith6Samples(algorithmFor_stripChargeRecoWith6Samples)
101 payload.setStripChargeRecoWith3Samples(algorithmFor_stripChargeRecoWith3Samples)
102 # SVDTimeGrouping
103 payload.setStateOfSVDTimeGrouping(6, grouping_stateOfTimeGroupingInClusterizerIn6Samples)
104 payload.setUseOfSVDGroupInfoInSPCreator(6, grouping_useOfSVDGroupInfoInSPCreatorIn6Samples)
105 payload.setStateOfSVDTimeGrouping(3, grouping_stateOfTimeGroupingInClusterizerIn3Samples)
106 payload.setUseOfSVDGroupInfoInSPCreator(3, grouping_useOfSVDGroupInfoInSPCreatorIn3Samples)
107 # Cut on sample SNR
108 payload.setUseOfSVDSpacePointSNRFraction(6, snr_useOfSVDSpacePointSNRFractionIn6Samples)
109 payload.setUseOfSVDSpacePointSNRFraction(3, snr_useOfSVDSpacePointSNRFractionIn3Samples)
110
111 Belle2.Database.Instance().storeData(Belle2.SVDRecoConfiguration.name, payload, iov)
112
113
114main = basf2.create_path()
115
116# Event info setter - execute single event
117eventinfosetter = basf2.register_module('EventInfoSetter')
118eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
119main.add_module(eventinfosetter)
120
121main.add_module(recoConfigurationImporter())
122
123# Process events
124basf2.process(main)
static IntervalOfValidity always()
Function that returns an interval of validity that is always valid, c.f.
This class store the reconstruction configuration of SVD.
static Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:42