12from ROOT
import Belle2
14import generators
as gen
15import simulation
as sim
17import reconstruction
as reco
18import modularAnalysis
as ana
26import millepede_calibration
as mpc
27from caf.framework
import CAF
28from caf
import backends
32 main = basf2.create_path()
34 main.add_module(
"EventInfoSetter", evtNumList=[200])
36 main.add_module(
'Gearbox')
37 main.add_module(
'Geometry')
39 gen.add_kkmc_generator(main,
'mu-mu+')
41 sim.add_simulation(main)
43 main.add_module(
"RootOutput", outputFileName=filename)
44 main.add_module(
"Progress")
47 print(basf2.statistics)
48 return os.path.abspath(filename)
51def diMuonCollection(name="diMuonCollection", add_unpackers=True):
52 path = basf2.create_path()
54 path.add_module(
'Progress')
56 path.add_module(
'RootInput')
57 path.add_module(
'Gearbox')
58 path.add_module(
'Geometry')
61 raw.add_unpackers(path)
63 reco.add_reconstruction(path, pruneTracks=
False)
65 tmp = basf2.create_path()
66 for m
in path.modules():
67 if m.name() ==
"PXDPostErrorChecker":
68 m.param(
'CriticalErrorMask', 0)
69 if m.name()
in [
"PXDUnpacker",
"CDCHitBasedT0Extraction",
"TFCDC_WireHitPreparer"]:
70 m.set_log_level(basf2.LogLevel.ERROR)
71 if m.name() ==
"SVDSpacePointCreator":
72 m.param(
"MinClusterTime", -999)
75 path.add_module(
'DAFRecoFitter')
77 ana.fillParticleList(
'mu+:mu_dimuon',
'abs(formula(z0)) < 0.5 and abs(d0) < 0.5 and nTracks == 2', writeOut=
True, path=path)
78 ana.reconstructDecay(
'Z0:mumu -> mu-:mu_dimuon mu+:mu_dimuon',
'', writeOut=
True, path=path)
79 vtx.raveFit(
'Z0:mumu', 0.001, daughtersUpdate=
True, silence_warning=
True, path=path)
81 return mpc.make_collection(name, path=path, primaryVertices=[
'Z0:mumu'])
84def get_calibration(files, tags):
88 dbobjects=[
'VXDAlignment',
'BeamSpot'],
90 diMuonCollection(name=
"dimuon_skim", add_unpackers=
False)
97 'method diagonalization 3 0.1',
106 timedep=[([], [(0, 0, 0)])],
107 params=dict(minPValue=0.001, externalIterations=0))
112if __name__ ==
'__main__':
115 if not len(input_files):
118 outfile =
'cafBeamSpotVXDHalfShells_TestData.root'
119 print(
"No input file provided. This will now generate test data into {} and run over it.".format(outfile))
120 print(
"It will take couple of minutes.")
121 print(
"You can set this file as input next time using -i option of basf2")
125 cal = get_calibration(
126 files={
'dimuon_skim': input_files},
127 tags=[tag
for tag
in basf2.conditions.default_globaltags])
129 cal.max_iterations = 0
132 cal_fw.add_calibration(cal)
133 cal_fw.backend = backends.Local(1)
static Environment & Instance()
Static method to get a reference to the Environment instance.
def vxd_sensors(layers=None, rigid=True, surface=True, surface2=True, surface3=True, surface4=True, parameters=None)
def vxd_ladders(layers=None, parameters=None)