16 from ROOT
import gROOT, Belle2
17 gROOT.ProcessLine(
"gErrorIgnoreLevel = 4000;")
20 Compare the CDCTrigger2DFitterModule output with the old TRGCDCModule,
21 to confirm that the behaviour of the new code is correct.
32 particlegun_params = {
33 'pdgCodes': [-13, 13],
35 'momentumGeneration':
'inversePt',
36 'momentumParams': [0.3, 10.],
37 'thetaGeneration':
'uniform',
38 'thetaParams': [35, 123],
39 'phiGeneration':
'uniform',
40 'phiParams': [0, 360],
41 'vertexGeneration':
'fixed',
42 'xVertexParams': [0.],
43 'yVertexParams': [0.],
44 'zVertexParams': [0.]}
46 bkgdir =
'/sw/belle2/bkg/'
53 basf2.set_random_seed(seed)
55 basf2.set_log_level(basf2.LogLevel.ERROR)
57 main = basf2.create_path()
59 main.add_module(
'EventInfoSetter', evtNumList=evtnum)
60 main.add_module(
'Progress')
61 main.add_module(
'Gearbox')
62 main.add_module(
'Geometry', components=[
'CDC',
63 'MagneticFieldConstant4LimitedRCDC'])
64 particlegun = basf2.register_module(
'ParticleGun')
65 particlegun.param(particlegun_params)
66 main.add_module(particlegun)
67 main.add_module(
'FullSim')
69 bkgmixer = basf2.register_module(
'BeamBkgMixer')
70 bkgfiles = glob.glob(os.path.join(bkgdir,
'*[!(PXD)(ECL)]??.root'))
71 bkgmixer.param(
'backgroundFiles', bkgfiles)
72 bkgmixer.param(
'components', [
'CDC'])
73 main.add_module(bkgmixer)
74 cdcdigitizer = basf2.register_module(
'CDCDigitizer')
76 cdcdigitizer.param(
'TrigTimeJitter', 32.)
77 main.add_module(cdcdigitizer)
86 trgcdc = basf2.register_module(
'TRGCDC')
95 'FastSimulationMode': simMode,
99 'Fitter3Ds2DFitDrift': fitdrift,
100 'Fitter3DsXtSimple': xtsimple,
101 '2DfinderCollection':
'TRGCDC2DFinderTracks'}
102 trgcdc.param(trgcdc_params)
104 trgcdc.param(
'inputCollection',
'CDCHits4Trg')
105 main.add_module(trgcdc, logLevel=basf2.LogLevel.INFO)
108 main.add_module(
'CDCTriggerETF')
109 main.add_module(
'CDCTrigger2DFitter', logLevel=basf2.LogLevel.INFO,
110 minHits=2, useDriftTime=fitdrift, xtSimple=xtsimple,
111 outputCollectionName=
'FitterTracks')
112 main.add_module(
'CDCTrigger3DFitter', logLevel=basf2.LogLevel.INFO,
114 inputCollectionName=
'FitterTracks',
115 outputCollectionName=
'Fitter3DTracks')
124 test module to compare the output of TRGCDC and CDCTrigger2DFitter/CDCTrigger3DFitter
129 give info for both output lists and warnings in the case of mismatches
133 if oldTracks.getEntries() == newTracks.getEntries():
134 basf2.B2INFO(
"%d tracks" % oldTracks.getEntries())
136 basf2.B2WARNING(
"old version: %d, new version: %d" %
137 (oldTracks.getEntries(), newTracks.getEntries()))
138 for i
in range(max(oldTracks.getEntries(), newTracks.getEntries())):
139 if i < oldTracks.getEntries():
140 ptfactor = 0.3 * 1.5 / 100 * 222.376063
141 oldString =
"phi %.3f pt %.3f charge %d chi2 %.3f z %.3f cot %.3f chi2 %.3f" % \
142 (oldTracks[i].getPhi0() * 180. / np.pi,
143 oldTracks[i].getTransverseMomentum(1.5) / ptfactor,
144 oldTracks[i].getChargeSign(),
145 oldTracks[i].getChi2D(),
146 oldTracks[i].getZ0(),
147 oldTracks[i].getCotTheta(),
148 oldTracks[i].getChi3D())
150 oldString =
"no track"
151 if i < newTracks.getEntries():
152 newString =
"phi %.3f pt %.3f charge %d chi2 %.3f z %.3f cot %.3f chi2 %.3f" % \
153 (newTracks[i].getPhi0() * 180. / np.pi,
154 newTracks[i].getTransverseMomentum(1.5),
155 newTracks[i].getChargeSign(),
156 newTracks[i].getChi2D(),
157 newTracks[i].getZ0(),
158 newTracks[i].getCotTheta(),
159 newTracks[i].getChi3D())
161 newString =
"no track"
162 if oldString == newString:
163 basf2.B2INFO(oldString)
165 basf2.B2WARNING(
"old: " + oldString)
166 basf2.B2WARNING(
"new: " + newString)
169 main.add_module(
TestModule(), logLevel=basf2.LogLevel.INFO)
175 print(basf2.statistics)
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...
A (simplified) python wrapper for StoreArray.