13 from ROOT
import Belle2, TFile, TTree, gROOT
21 inputFile = sys.argv[1]
22 outputFile = sys.argv[2]
24 svd_Clusters =
"SVDClusters"
25 svd_ClustersFromTracks =
"SVDClustersFromTracks"
26 svd_EventInfo =
"SVDEventInfo"
27 svd_EventMD =
"EventMetaData"
29 b2.set_random_seed(11)
36 Class used to check the goodness of the CoG time calibration
41 Initialize object (histograms, lists, ...) used by the class
46 self.
layerlayer = np.zeros(1, dtype=int)
48 self.
ladderladder = np.zeros(1, dtype=int)
50 self.
sensorsensor = np.zeros(1, dtype=int)
52 self.
sideside = np.zeros(1, dtype=int)
54 self.
TBTB = np.zeros(1, dtype=int)
56 self.
evtTimeevtTime = np.zeros(1, dtype=float)
60 self.
clsTimeclsTime = np.zeros(1, dtype=float)
62 self.
clsSizeclsSize = np.zeros(1, dtype=float)
66 self.
clsSNRclsSNR = np.zeros(1, dtype=float)
68 self.
runrun = np.zeros(1, dtype=int)
70 self.
expexp = np.zeros(1, dtype=int)
97 self.
treetree = TTree(
'cls',
'tree')
99 self.
treetree.Branch(
'layer', self.
layerlayer,
'layer/I')
101 self.
treetree.Branch(
'ladder', self.
ladderladder,
'ladder/I')
103 self.
treetree.Branch(
'sensor', self.
sensorsensor,
'sensor/I')
105 self.
treetree.Branch(
'side', self.
sideside,
'side/I')
107 self.
treetree.Branch(
'tb', self.
TBTB,
'tb/I')
109 self.
treetree.Branch(
'evtT0', self.
evtTimeevtTime,
'evtT0/D')
111 self.
treetree.Branch(
'evtT0Sync', self.
evtTimeSyncevtTimeSync,
'evtT0Sync/D')
113 self.
treetree.Branch(
'clsTime', self.
clsTimeclsTime,
'clsTime/D')
115 self.
treetree.Branch(
'clsSize', self.
clsSizeclsSize,
'clsSize/D')
117 self.
treetree.Branch(
'clsCharge', self.
clsChargeclsCharge,
'clsCharge/D')
119 self.
treetree.Branch(
'clsSNR', self.
clsSNRclsSNR,
'clsSNR/D')
121 self.
treetree.Branch(
'run', self.
runrun,
'run/I')
123 self.
treetree.Branch(
'exp', self.
expexp,
'exp/I')
136 self.
treeTrackstreeTracks.Branch(
'tb', self.
TBTB,
'tb/I')
150 self.
treeTrackstreeTracks.Branch(
'run', self.
runrun,
'run/I')
152 self.
treeTrackstreeTracks.Branch(
'exp', self.
expexp,
'exp/I')
156 Function that allows to cicle on the events
162 clsTB = svd_evtInfo.getModeByte().getTriggerBin()
163 self.
TBTB[0] = ord(clsTB)
165 self.
runrun[0] = svd_evtMD.getRun()
166 self.
expexp[0] = svd_evtMD.getExperiment()
168 for svdCluster
in svd_cls:
169 self.
clsTimeclsTime[0] = svdCluster.getClsTime()
170 self.
clsSizeclsSize[0] = svdCluster.getSize()
171 self.
clsChargeclsCharge[0] = svdCluster.getCharge()
172 self.
clsSNRclsSNR[0] = svdCluster.getSNR()
173 self.
layerlayer[0] = svdCluster.getSensorID().getLayerNumber()
174 self.
ladderladder[0] = svdCluster.getSensorID().getLadderNumber()
175 self.
sensorsensor[0] = svdCluster.getSensorID().getSensorNumber()
176 self.
sideside[0] = svdCluster.isUCluster()
178 self.
ftswShiftftswShift = svd_evtInfo.getSVD2FTSWTimeShift(svdCluster.getFirstFrame())
179 hasT0 = et0.hasEventT0()
181 self.
evtTimeevtTime[0] = et0.getEventT0()
188 for svdClusterTracks
in svd_clsFromTrks:
189 self.
clsTimeTracksclsTimeTracks[0] = svdClusterTracks.getClsTime()
190 self.
clsSizeTracksclsSizeTracks[0] = svdClusterTracks.getSize()
192 self.
clsSNRTracksclsSNRTracks[0] = svdClusterTracks.getSNR()
193 self.
layerTrackslayerTracks[0] = svdClusterTracks.getSensorID().getLayerNumber()
194 self.
ladderTracksladderTracks[0] = svdClusterTracks.getSensorID().getLadderNumber()
195 self.
sensorTrackssensorTracks[0] = svdClusterTracks.getSensorID().getSensorNumber()
196 self.
sideTrackssideTracks[0] = svdClusterTracks.isUCluster()
198 self.
ftswShiftTracksftswShiftTracks = svd_evtInfo.getSVD2FTSWTimeShift(svdCluster.getFirstFrame())
199 hasT0 = et0.hasEventT0()
210 Terminates te class and produces the output rootfile
215 self.
treetree.Write()
217 self.
tFiletFile.Close()
224 main = b2.create_path()
226 rootinput = b2.register_module(
'RootInput')
227 rootinput.param(
'inputFileName', inputFile)
228 main.add_module(rootinput)
236 progress = b2.register_module(
'Progress')
237 main.add_module(progress)
A (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.