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