3 import reconstruction
as reco
4 import modularAnalysis
as ana
7 from collections
import namedtuple
9 MillepedeCollection = namedtuple(
'MillepedeCollection', [
'name',
'files',
'path',
'params'])
12 def make_collection(name, files=None, path=None, **argk):
14 Handy function to make a collection configuration
15 to be passed in 'collections' argument of the create(...) function
22 List of input data files
26 Dictionary of collector parameters specific for collection
30 namedtuple('MillepedeCollection', ['name', 'files', 'path', 'params'])
38 return MillepedeCollection(name=name, path=path, files=files, params=argk)
41 def physicsTracks(name="physicsTracks", files=None, add_unpackers=True, klm=False, prescale=1.):
43 Standard collection of all RecoTracks with standard reconstruction
50 List of input data files
52 Whether to add unpacking (set to False for MC)
54 Whether to add muid hits to the track fit
56 Process only 'prescale' fraction of events
58 path = basf2.create_path()
60 path.add_module(
'Progress')
61 path.add_module(
'RootInput')
63 path.add_module(
'Prescale', prescale=prescale).if_false(basf2.Path(), basf2.AfterConditionPath.END)
64 path.add_module(
'Gearbox')
65 path.add_module(
'Geometry')
68 raw.add_unpackers(path)
70 reco.add_reconstruction(path, pruneTracks=
False, add_muid_hits=klm)
73 tmp = basf2.create_path()
74 for m
in path.modules():
75 if m.name() ==
"PXDPostErrorChecker":
76 m.param(
'CriticalErrorMask', 0)
77 if m.name() ==
"SVDSpacePointCreator":
78 m.param(
"MinClusterTime", -999)
81 path.add_module(
'DAFRecoFitter')
83 return make_collection(name, files=files, path=path, tracks=[
'RecoTracks'])
86 def cosmicTracks(name="cosmicTracks",
89 skim_hlt_cosmic=False,
90 cut='[z0 <= 57. or abs(d0) >= 26.5]
and abs(dz) > 0.4
and nTracks == 1
',
94 Standard collection of all RecoTracks with cosmic reconstruction
101 List of input data files
103 Whether to add unpacking (set to False for MC)
104 skim_hlt_cosmic : bool
105 Whether to add TriggerSkim module and process only events with cosmic TRG
107 Cut string to select GOOD events. By default set to avoid region of poorly described magnetic
108 field around QCS magnets + remove the 'background' from physics around IP
110 Whether to add muid hits to the track fit
112 Process only 'prescale' fraction of events
114 path = basf2.create_path()
116 path.add_module(
'Progress')
117 path.add_module(
'RootInput')
119 path.add_module(
'Prescale', prescale=prescale).if_false(basf2.Path(), basf2.AfterConditionPath.END)
124 triggerLines=[
"software_trigger_cut&filter&cosmic"]).if_value(
127 basf2.AfterConditionPath.END)
129 path.add_module(
'Gearbox')
130 path.add_module(
'Geometry')
133 raw.add_unpackers(path)
135 path.add_module(
'SetupGenfitExtrapolation')
136 reco.add_cosmics_reconstruction(
139 skipGeometryAdding=
True,
140 data_taking_period=
'early_phase3',
146 tmp = basf2.create_path()
147 for m
in path.modules():
148 if m.name() ==
"PXDPostErrorChecker":
149 m.param(
'CriticalErrorMask', 0)
150 if m.name() ==
"SVDSpacePointCreator":
151 m.param(
"MinClusterTime", -999)
155 path.add_module(
'SetRecoTrackMomentum', automatic=
True)
156 path.add_module(
'DAFRecoFitter', resortHits=
True, pdgCodesToUseForFitting=[13])
159 ana.fillParticleList(
'mu+:good_cosmics', cut, path=path)
161 path.add_module(
'SkimFilter', particleLists=[
'mu+:good_cosmics']).if_false(basf2.create_path())
163 return make_collection(name, files=files, path=path, tracks=[
'RecoTracks'])
170 skim_mumu_2trk=False,
171 muon_cut='p > 1.0 and abs(dz) < 2.0
and dr < 0.5
',
176 Di-muons with vertex+beam constraint collection
183 List of input data files
185 Whether to add unpacking (set to False for MC)
186 skim_hlt_cosmic : bool
187 Whether to add TriggerSkim module and process only events with accept_mumu_2trk TRG
189 Cut string to select daughter muons
191 Cut string to apply for reconstructed di-muon decay
193 Whether to add muid hits to the track fit
195 Process only 'prescale' fraction of events
197 path = basf2.create_path()
198 path.add_module(
'Progress')
199 path.add_module(
'RootInput')
201 path.add_module(
'Prescale', prescale=prescale).if_false(basf2.Path(), basf2.AfterConditionPath.END)
203 path.add_module(
'Gearbox')
204 path.add_module(
'Geometry')
209 triggerLines=[
"software_trigger_cut&skim&accept_mumu_2trk"]).if_value(
212 basf2.AfterConditionPath.END)
215 raw.add_unpackers(path)
217 reco.add_reconstruction(path, pruneTracks=
False, add_muid_hits=klm)
220 tmp = basf2.create_path()
221 for m
in path.modules():
222 if m.name() ==
"PXDPostErrorChecker":
223 m.param(
'CriticalErrorMask', 0)
224 if m.name() ==
"SVDSpacePointCreator":
225 m.param(
"MinClusterTime", -999)
229 path.add_module(
'DAFRecoFitter', pdgCodesToUseForFitting=[13])
231 ana.fillParticleList(f
"mu+:{name}", muon_cut, path=path)
232 ana.reconstructDecay(f
"Upsilon(4S):{name} -> mu+:{name} mu-:{name}", dimuon_cut, path=path)
234 vtx.raveFit(f
"Upsilon(4S):{name}", 0.001, daughtersUpdate=
True, silence_warning=
True, path=path)
236 return make_collection(name, files=files, path=path, primaryVertices=[f
"Upsilon(4S):{name}"])