2 from ROOT
import Belle2
4 from tracking
import add_cdc_cr_track_finding
5 from tracking
import add_cdc_track_finding
8 lightPropSpeed = 12.9925
11 run_range = {
'201607': [787, 833],
12 '201608a': [885, 896],
13 '201608b': [917, 924],
15 '201702': [1601, 9999],
16 'gcr2017': [3058, 100000],
17 'phase2': [0, 100000],
18 'phase3': [0, 100000],
22 triggerSize = {
'201607': [20.0, 6.0, 10.0],
23 '201608a': [100.0, 8.0, 10.0],
24 '201608b': [100.0, 8.0, 10.0],
25 '201609': [100.0, 8.0, 10.0],
26 '201702': [100.0, 8.0, 10.0],
27 'gcr2017': [100, 0, 8.0, 10.0],
28 'phase2': [100, 0, 8.0, 10.0],
29 'phase3': [100, 0, 8.0, 10.0],
30 'normal': [100.0, 8.0, 10.0]
33 triggerPosition = {
'201607': [0.3744, 0.0, -1.284],
34 '201608a': [-1.87, -1.25, 18.7],
35 '201608b': [-1.87, -1.25, 11.0],
36 '201609': [0, 0, 11.0],
37 '201702': [0., -1.5, 21.0],
38 'gcr2017': [0.0, 0.0, 0.0],
39 'phase2': [0.0, 0.0, 0.0],
40 'phase3': [0.0, 0.0, 0.0],
41 'normal': [0.0, 0.0, 0.0]
45 triggerPlaneDirection = {
'201607': [1, -1, 0],
57 pmtPosition = {
'201607': [0, 0, 0],
58 '201608a': [-1.87, 0, -25.0],
59 '201608b': [-1.87, 0, -42.0],
60 '201609': [0, 0, -42.0],
61 '201702': [0., -1.5, -31.0],
62 'gcr2017': [0.0, 0.0, -50.0],
63 'phase2': [0.0, 0.0, -50.0],
64 'phase3': [0.0, 0.0, -50.0],
65 'normal': [0, 0, -50.0]
69 globalPhiRotation = {
'201607': 1.875,
80 lengthOfCounter = 100.0
83 normTriggerPlaneDirection = []
89 def set_cdc_cr_parameters(period):
91 global lengthOfCounter
94 global normTriggerPlaneDirection
99 lengthOfCounter = triggerSize[period][0]
100 widthOfCounter = triggerSize[period][1]
101 triggerPos = triggerPosition[period]
102 normTriggerPlaneDirection = triggerPlaneDirection[period]
103 readOutPos = pmtPosition[period]
104 globalPhi = globalPhiRotation[period]
105 cosmics_period = period
108 def add_cdc_cr_simulation(path,
114 generate_2nd_cdc_hits=False,
117 Add CDC CR simulation.
120 empty_path = create_path()
125 bkginput = register_module(
'BGOverlayInput')
126 bkginput.param(
'inputFileNames', bkgfiles)
127 path.add_module(bkginput)
129 bkgmixer = register_module(
'BeamBkgMixer')
130 bkgmixer.param(
'backgroundFiles', bkgfiles)
132 bkgmixer.param(
'components', bkgcomponents)
135 bkgmixer.param(
'components', components)
136 bkgmixer.param(
'overallScaleFactor', bkgscale)
137 path.add_module(bkgmixer)
140 if 'Gearbox' not in path:
141 gearbox = register_module(
'Gearbox')
142 path.add_module(gearbox)
145 if 'Geometry' not in path:
146 geometry = register_module(
'Geometry', useDB=
True)
148 geometry.param(
'components', components)
149 path.add_module(geometry)
152 if 'FullSim' not in path:
153 g4sim = register_module(
'FullSim',
154 ProductionCut=1000000.)
155 path.add_module(g4sim)
160 if components
is None or 'CDC' in components:
161 cdc_digitizer = register_module(
'CDCDigitizer')
162 cdc_digitizer.param(
"Output2ndHit", generate_2nd_cdc_hits)
163 path.add_module(cdc_digitizer)
166 if components
is None or 'ECL' in components:
167 ecl_digitizer = register_module(
'ECLDigitizer')
168 if bkgfiles
is not None:
169 ecl_digitizer.param(
'Background', 1)
170 path.add_module(ecl_digitizer)
173 def add_cdc_cr_reconstruction(path, eventTimingExtraction=True,
177 Add CDC CR reconstruction
181 add_cdc_cr_track_finding(path, merge_tracks=
False)
184 path.add_module(
"SetupGenfitExtrapolation")
187 path.add_module(
"PlaneTriggerTrackTimeEstimator",
188 pdgCodeToUseForEstimation=13,
189 triggerPlanePosition=triggerPos,
190 triggerPlaneDirection=normTriggerPlaneDirection,
191 useFittedInformation=
False)
194 path.add_module(
"DAFRecoFitter",
196 pdgCodesToUseForFitting=13,
200 path.add_module(
"PlaneTriggerTrackTimeEstimator",
201 pdgCodeToUseForEstimation=13,
202 triggerPlanePosition=triggerPos,
203 triggerPlaneDirection=normTriggerPlaneDirection,
204 useFittedInformation=
True,
205 useReadoutPosition=topInCounter,
206 readoutPosition=readOutPos,
207 readoutPositionPropagationSpeed=lightPropSpeed
211 path.add_module(
"DAFRecoFitter",
212 probCut=pval2ndTrial,
213 pdgCodesToUseForFitting=13
216 if eventTimingExtraction
is True:
218 path.add_module(
"FullGridChi2TrackTimeExtractor",
219 RecoTracksStoreArrayName=
"RecoTracks",
220 GridMaximalT0Value=40,
221 GridMinimalT0Value=-40,
226 path.add_module(
"DAFRecoFitter",
227 probCut=pval2ndTrial,
228 pdgCodesToUseForFitting=13
232 path.add_module(
'TrackCreator',
234 useClosestHitToIP=
True,
239 def add_cdc_reconstruction(path, eventTimingExtraction=True,
242 Add CDC CR reconstruction
246 add_cdc_track_finding(path)
249 path.add_module(
'SetupGenfitExtrapolation',
250 energyLossBrems=
False, noiseBrems=
False)
253 path.add_module(
"IPTrackTimeEstimator",
255 useFittedInformation=
False)
257 path.add_module(
"DAFRecoFitter",
261 path.add_module(
"IPTrackTimeEstimator",
263 useFittedInformation=
True)
266 path.add_module(
"DAFRecoFitter",
267 probCut=pval2ndTrial,
270 if eventTimingExtraction
is True:
272 path.add_module(
"FullGridChi2TrackTimeExtractor",
273 RecoTracksStoreArrayName=
"RecoTracks",
274 GridMaximalT0Value=40,
275 GridMinimalT0Value=-40,
280 path.add_module(
"DAFRecoFitter",
281 probCut=pval2ndTrial,
285 path.add_module(
'TrackCreator',
286 pdgCodes=[211, 321, 2212])
289 def getExpRunNumber(fname):
291 Get expperimental number and run number from file name.
293 f = ROOT.TFile(fname)
297 exp = e.getExperiment()
303 def getRunNumber(fname):
305 Get run number from file name.
307 f = ROOT.TFile(fname)
316 def getDataPeriod(exp=0, run=0):
318 Get data period from run number
319 It should be replaced the argument from run to (exp, run)!
338 for key
in run_range:
339 if run_range[key][0] <= run <= run_range[key][1]:
341 print(
"Data period : " + key)
345 B2WARNING(
"No valid data period is specified.")
346 B2WARNING(
"Default configuration is loaded.")
351 def getPhiRotation():
356 def getMapperAngle(exp=1, run=3118):
358 Get B field mapper angle from exp and run number.
369 def getTriggerType(exp=1, run=3118):
371 Get trigger type from exp and run number.
374 if run >= 3100
and run <= 3600:
376 elif run >= 3642
and run <= 4018:
384 def add_GCR_Trigger_simulation(path, backToBack=False, skipEcl=True):
386 function to simulate trigger for GCR cosmics 2017. use CDC+ECL trigger
387 :param path: path want to add trigger simulation
388 :param backToBack: if true back to back TSF2; if false single TSF2
389 :param skipEcl: ignore ECL in trigger, just use CDC TSF2
391 empty_path = create_path()
392 path.add_module(
'CDCTriggerTSF',
396 path.add_module(
'TRGECLFAM',
402 path.add_module(
'TRGECL',
409 TSF = path.add_module(
'TRGGDLCosmicRun',
410 BackToBack=backToBack,
412 TSF.if_false(empty_path)