14lightPropSpeed = 12.9925
17run_range = {
'201607': [787, 833],
18 '201608a': [885, 896],
19 '201608b': [917, 924],
21 '201702': [1601, 9999],
22 'gcr2017': [3058, 100000],
23 'phase2': [0, 100000],
24 'phase3': [0, 100000],
28triggerSize = {
'201607': [20.0, 6.0, 10.0],
29 '201608a': [100.0, 8.0, 10.0],
30 '201608b': [100.0, 8.0, 10.0],
31 '201609': [100.0, 8.0, 10.0],
32 '201702': [100.0, 8.0, 10.0],
33 'gcr2017': [100, 0, 8.0, 10.0],
34 'phase2': [100, 0, 8.0, 10.0],
35 'phase3': [100, 0, 8.0, 10.0],
36 'normal': [100.0, 8.0, 10.0]
39triggerPosition = {
'201607': [0.3744, 0.0, -1.284],
40 '201608a': [-1.87, -1.25, 18.7],
41 '201608b': [-1.87, -1.25, 11.0],
42 '201609': [0, 0, 11.0],
43 '201702': [0., -1.5, 21.0],
44 'gcr2017': [0.0, 0.0, 0.0],
45 'phase2': [0.0, 0.0, 0.0],
46 'phase3': [0.0, 0.0, 0.0],
47 'normal': [0.0, 0.0, 0.0]
51triggerPlaneDirection = {
'201607': [1, -1, 0],
63pmtPosition = {
'201607': [0, 0, 0],
64 '201608a': [-1.87, 0, -25.0],
65 '201608b': [-1.87, 0, -42.0],
66 '201609': [0, 0, -42.0],
67 '201702': [0., -1.5, -31.0],
68 'gcr2017': [0.0, 0.0, -50.0],
69 'phase2': [0.0, 0.0, -50.0],
70 'phase3': [0.0, 0.0, -50.0],
71 'normal': [0, 0, -50.0]
75globalPhiRotation = {
'201607': 1.875,
86lengthOfCounter = 100.0
89normTriggerPlaneDirection = []
95def set_cdc_cr_parameters(period):
97 global lengthOfCounter
100 global normTriggerPlaneDirection
103 global cosmics_period
105 lengthOfCounter = triggerSize[period][0]
106 widthOfCounter = triggerSize[period][1]
107 triggerPos = triggerPosition[period]
108 normTriggerPlaneDirection = triggerPlaneDirection[period]
109 readOutPos = pmtPosition[period]
110 globalPhi = globalPhiRotation[period]
111 cosmics_period = period
114def add_cdc_cr_simulation(path,
120 generate_2nd_cdc_hits=False,
123 Add CDC CR simulation.
130 bkginput = b2.register_module(
'BGOverlayInput')
131 bkginput.param(
'inputFileNames', bkgfiles)
132 path.add_module(bkginput)
134 bkgmixer = b2.register_module(
'BeamBkgMixer')
135 bkgmixer.param(
'backgroundFiles', bkgfiles)
137 bkgmixer.param(
'components', bkgcomponents)
140 bkgmixer.param(
'components', components)
141 bkgmixer.param(
'overallScaleFactor', bkgscale)
142 path.add_module(bkgmixer)
145 if 'Gearbox' not in path:
146 gearbox = b2.register_module(
'Gearbox')
147 path.add_module(gearbox)
150 if 'Geometry' not in path:
151 geometry = b2.register_module(
'Geometry', useDB=
True)
153 geometry.param(
'components', components)
154 path.add_module(geometry)
157 if 'FullSim' not in path:
158 g4sim = b2.register_module(
'FullSim',
159 ProductionCut=1000000.)
160 path.add_module(g4sim)
165 if components
is None or 'CDC' in components:
166 cdc_digitizer = b2.register_module(
'CDCDigitizer')
167 cdc_digitizer.param(
"Output2ndHit", generate_2nd_cdc_hits)
168 path.add_module(cdc_digitizer)
171 if components
is None or 'ECL' in components:
172 ecl_digitizer = b2.register_module(
'ECLDigitizer')
173 if bkgfiles
is not None:
174 ecl_digitizer.param(
'Background', 1)
175 path.add_module(ecl_digitizer)
178def add_cdc_cr_reconstruction(path, eventTimingExtraction=True,
182 Add CDC CR reconstruction
186 add_cdc_cr_track_finding(path, merge_tracks=
False)
189 path.add_module(
"SetupGenfitExtrapolation")
192 path.add_module(
"PlaneTriggerTrackTimeEstimator",
193 pdgCodeToUseForEstimation=13,
194 triggerPlanePosition=triggerPos,
195 triggerPlaneDirection=normTriggerPlaneDirection,
196 useFittedInformation=
False)
199 path.add_module(
"DAFRecoFitter",
201 pdgCodesToUseForFitting=13,
205 path.add_module(
"PlaneTriggerTrackTimeEstimator",
206 pdgCodeToUseForEstimation=13,
207 triggerPlanePosition=triggerPos,
208 triggerPlaneDirection=normTriggerPlaneDirection,
209 useFittedInformation=
True,
210 useReadoutPosition=topInCounter,
211 readoutPosition=readOutPos,
212 readoutPositionPropagationSpeed=lightPropSpeed
216 path.add_module(
"DAFRecoFitter",
217 probCut=pval2ndTrial,
218 pdgCodesToUseForFitting=13
221 if eventTimingExtraction
is True:
223 path.add_module(
"FullGridChi2TrackTimeExtractor",
224 RecoTracksStoreArrayName=
"RecoTracks",
225 GridMaximalT0Value=40,
226 GridMinimalT0Value=-40,
231 path.add_module(
"DAFRecoFitter",
232 probCut=pval2ndTrial,
233 pdgCodesToUseForFitting=13
237 path.add_module(
'TrackCreator',
239 useClosestHitToIP=
True,
244def add_cdc_reconstruction(path, eventTimingExtraction=True,
247 Add CDC CR reconstruction
251 add_cdc_track_finding(path)
254 path.add_module(
'SetupGenfitExtrapolation',
255 energyLossBrems=
False, noiseBrems=
False)
258 path.add_module(
"IPTrackTimeEstimator",
260 useFittedInformation=
False)
262 path.add_module(
"DAFRecoFitter",
266 path.add_module(
"IPTrackTimeEstimator",
268 useFittedInformation=
True)
271 path.add_module(
"DAFRecoFitter",
272 probCut=pval2ndTrial,
275 if eventTimingExtraction
is True:
277 path.add_module(
"FullGridChi2TrackTimeExtractor",
278 RecoTracksStoreArrayName=
"RecoTracks",
279 GridMaximalT0Value=40,
280 GridMinimalT0Value=-40,
285 path.add_module(
"DAFRecoFitter",
286 probCut=pval2ndTrial,
290 path.add_module(
'TrackCreator',
291 pdgCodes=[211, 321, 2212])
294def getExpRunNumber(fname):
296 Get expperimental number and run number
from file name.
298 f = ROOT.TFile(fname)
302 exp = e.getExperiment()
308def getRunNumber(fname):
310 Get run number from file name.
312 f = ROOT.TFile(fname)
321def getDataPeriod(exp=0, run=0):
323 Get data period from run number
324 It should be replaced the argument
from run to (exp, run)!
343 for key
in run_range:
344 if run_range[key][0] <= run <= run_range[key][1]:
346 print(
"Data period : " + key)
350 b2.B2WARNING(
"No valid data period is specified.")
351 b2.B2WARNING(
"Default configuration is loaded.")
361def getMapperAngle(exp=1, run=3118):
363 Get B field mapper angle from exp
and run number.
374def getTriggerType(exp=1, run=3118):
376 Get trigger type from exp
and run number.
379 if run >= 3100
and run <= 3600:
381 elif run >= 3642
and run <= 4018:
389def add_GCR_Trigger_simulation(path, backToBack=False, skipEcl=True):
391 function to simulate trigger for GCR cosmics 2017. use CDC+ECL trigger
392 :param path: path want to add trigger simulation
393 :param backToBack:
if true back to back TSF2;
if false single TSF2
394 :param skipEcl: ignore ECL
in trigger, just use CDC TSF2
396 empty_path = b2.create_path()
397 path.add_module('CDCTriggerTSF',
401 path.add_module(
'TRGECLFAM',
407 path.add_module(
'TRGECL',
414 TSF = path.add_module(
'TRGGDLCosmicRun',
415 BackToBack=backToBack,
417 TSF.if_false(empty_path)
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...