11import reconstruction
as reco
12import modularAnalysis
as ana
15from collections
import namedtuple
17MillepedeCollection = namedtuple(
'MillepedeCollection', [
'name',
'files',
'path',
'params'])
20def make_collection(name, files=None, path=None, **argk):
22 Handy function to make a collection configuration
23 to be passed in 'collections' argument of the create(...) function
30 List of input data files
34 Dictionary of collector parameters specific for collection
38 namedtuple('MillepedeCollection', ['name', 'files', 'path', 'params'])
46 return MillepedeCollection(name=name, path=path, files=files, params=argk)
49def physicsTracks(name="physicsTracks", files=None, add_unpackers=True, klm=False, prescale=1.):
51 Standard collection of all RecoTracks with standard reconstruction
58 List of input data files
60 Whether to add unpacking (set to False for MC)
62 Whether to add muid hits to the track fit
64 Process only 'prescale' fraction of events
66 path = basf2.create_path()
68 path.add_module(
'Progress')
69 path.add_module(
'RootInput')
71 path.add_module(
'Prescale', prescale=prescale).if_false(basf2.Path(), basf2.AfterConditionPath.END)
72 path.add_module(
'Gearbox')
73 path.add_module(
'Geometry')
76 raw.add_unpackers(path)
78 reco.add_reconstruction(path, pruneTracks=
False, add_muid_hits=klm)
81 tmp = basf2.create_path()
82 for m
in path.modules():
83 if m.name() ==
"PXDPostErrorChecker":
84 m.param(
'CriticalErrorMask', 0)
85 if m.name() ==
"SVDSpacePointCreator":
86 m.param(
"MinClusterTime", -999)
89 path.add_module(
'DAFRecoFitter')
91 return make_collection(name, files=files, path=path, tracks=[
'RecoTracks'])
94def cosmicTracks(name="cosmicTracks",
97 skim_hlt_cosmic=False,
98 cut='[z0 <= 57. or abs(d0) >= 26.5]
and abs(dz) > 0.4
and nTracks == 1
',
102 Standard collection of all RecoTracks with cosmic reconstruction
109 List of input data files
111 Whether to add unpacking (set to False for MC)
112 skim_hlt_cosmic : bool
113 Whether to add TriggerSkim module and process only events with cosmic TRG
115 Cut string to select GOOD events. By default set to avoid region of poorly described magnetic
116 field around QCS magnets + remove the 'background' from physics around IP
118 Whether to add muid hits to the track fit
120 Process only 'prescale' fraction of events
122 path = basf2.create_path()
124 path.add_module(
'Progress')
125 path.add_module(
'RootInput')
127 path.add_module(
'Prescale', prescale=prescale).if_false(basf2.Path(), basf2.AfterConditionPath.END)
132 triggerLines=[
"software_trigger_cut&filter&cosmic"]).if_value(
135 basf2.AfterConditionPath.END)
137 path.add_module(
'Gearbox')
138 path.add_module(
'Geometry')
141 raw.add_unpackers(path)
143 path.add_module(
'SetupGenfitExtrapolation')
144 reco.add_cosmics_reconstruction(
147 skipGeometryAdding=
True,
153 tmp = basf2.create_path()
154 for m
in path.modules():
155 if m.name() ==
"PXDPostErrorChecker":
156 m.param(
'CriticalErrorMask', 0)
157 if m.name() ==
"SVDSpacePointCreator":
158 m.param(
"MinClusterTime", -999)
162 path.add_module(
'SetRecoTrackMomentum', automatic=
True)
163 path.add_module(
'DAFRecoFitter', resortHits=
False, pdgCodesToUseForFitting=[13])
166 ana.fillParticleList(
'mu+:good_cosmics', cut, path=path)
168 path.add_module(
'SkimFilter', particleLists=[
'mu+:good_cosmics']).if_false(basf2.create_path())
170 return make_collection(name, files=files, path=path, tracks=[
'RecoTracks'])
177 skim_mumu_2trk=False,
178 muon_cut='p > 1.0 and abs(dz) < 2.0
and dr < 0.5
',
183 Di-muons with vertex+beam constraint collection
190 List of input data files
192 Whether to add unpacking (set to False for MC)
193 skim_hlt_cosmic : bool
194 Whether to add TriggerSkim module and process only events with accept_mumu_2trk TRG
196 Cut string to select daughter muons
198 Cut string to apply for reconstructed di-muon decay
200 Whether to add muid hits to the track fit
202 Process only 'prescale' fraction of events
204 path = basf2.create_path()
205 path.add_module(
'Progress')
206 path.add_module(
'RootInput')
208 path.add_module(
'Prescale', prescale=prescale).if_false(basf2.Path(), basf2.AfterConditionPath.END)
210 path.add_module(
'Gearbox')
211 path.add_module(
'Geometry')
216 triggerLines=[
"software_trigger_cut&skim&accept_mumu_2trk"]).if_value(
219 basf2.AfterConditionPath.END)
222 raw.add_unpackers(path)
224 reco.add_reconstruction(path, pruneTracks=
False, add_muid_hits=klm)
227 tmp = basf2.create_path()
228 for m
in path.modules():
229 if m.name() ==
"PXDPostErrorChecker":
230 m.param(
'CriticalErrorMask', 0)
231 if m.name() ==
"SVDSpacePointCreator":
232 m.param(
"MinClusterTime", -999)
236 path.add_module(
'DAFRecoFitter', pdgCodesToUseForFitting=[13])
238 ana.fillParticleList(f
"mu+:{name}", muon_cut, path=path)
239 ana.reconstructDecay(f
"Upsilon(4S):{name} -> mu+:{name} mu-:{name}", dimuon_cut, path=path)
241 vtx.raveFit(f
"Upsilon(4S):{name}", 0.001, daughtersUpdate=
True, silence_warning=
True, path=path)
243 return make_collection(name, files=files, path=path, primaryVertices=[f
"Upsilon(4S):{name}"])