11 import reconstruction
as reco
12 import modularAnalysis
as ana
15 from collections
import namedtuple
17 MillepedeCollection = namedtuple(
'MillepedeCollection', [
'name',
'files',
'path',
'params'])
20 def 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)
49 def 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'])
94 def 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
', klm=False,
101 Standard collection of all RecoTracks with cosmic reconstruction
108 List of input data files
110 Whether to add unpacking (set to False for MC)
111 skim_hlt_cosmic : bool
112 Whether to add TriggerSkim module and process only events with cosmic TRG
114 Cut string to select GOOD events. By default set to avoid region of poorly described magnetic
115 field around QCS magnets + remove the 'background' from physics around IP
117 Whether to add muid hits to the track fit
119 Process only 'prescale' fraction of events
121 path = basf2.create_path()
123 path.add_module(
'Progress')
124 path.add_module(
'RootInput')
126 path.add_module(
'Prescale', prescale=prescale).if_false(basf2.Path(), basf2.AfterConditionPath.END)
131 triggerLines=[
"software_trigger_cut&filter&cosmic"]).if_value(
134 basf2.AfterConditionPath.END)
136 path.add_module(
'Gearbox')
137 path.add_module(
'Geometry')
140 raw.add_unpackers(path)
142 path.add_module(
'SetupGenfitExtrapolation')
143 reco.add_cosmics_reconstruction(
146 skipGeometryAdding=
True,
152 tmp = basf2.create_path()
153 for m
in path.modules():
154 if m.name() ==
"PXDPostErrorChecker":
155 m.param(
'CriticalErrorMask', 0)
156 if m.name() ==
"SVDSpacePointCreator":
157 m.param(
"MinClusterTime", -999)
161 path.add_module(
'SetRecoTrackMomentum', automatic=
True)
162 path.add_module(
'DAFRecoFitter', resortHits=
True, pdgCodesToUseForFitting=[13])
165 ana.fillParticleList(
'mu+:good_cosmics', cut, path=path)
167 path.add_module(
'SkimFilter', particleLists=[
'mu+:good_cosmics']).if_false(basf2.create_path())
169 return make_collection(name, files=files, path=path, tracks=[
'RecoTracks'])
176 skim_mumu_2trk=False,
177 muon_cut='p > 1.0 and abs(dz) < 2.0
and dr < 0.5
',
182 Di-muons with vertex+beam constraint collection
189 List of input data files
191 Whether to add unpacking (set to False for MC)
192 skim_hlt_cosmic : bool
193 Whether to add TriggerSkim module and process only events with accept_mumu_2trk TRG
195 Cut string to select daughter muons
197 Cut string to apply for reconstructed di-muon decay
199 Whether to add muid hits to the track fit
201 Process only 'prescale' fraction of events
203 path = basf2.create_path()
204 path.add_module(
'Progress')
205 path.add_module(
'RootInput')
207 path.add_module(
'Prescale', prescale=prescale).if_false(basf2.Path(), basf2.AfterConditionPath.END)
209 path.add_module(
'Gearbox')
210 path.add_module(
'Geometry')
215 triggerLines=[
"software_trigger_cut&skim&accept_mumu_2trk"]).if_value(
218 basf2.AfterConditionPath.END)
221 raw.add_unpackers(path)
223 reco.add_reconstruction(path, pruneTracks=
False, add_muid_hits=klm)
226 tmp = basf2.create_path()
227 for m
in path.modules():
228 if m.name() ==
"PXDPostErrorChecker":
229 m.param(
'CriticalErrorMask', 0)
230 if m.name() ==
"SVDSpacePointCreator":
231 m.param(
"MinClusterTime", -999)
235 path.add_module(
'DAFRecoFitter', pdgCodesToUseForFitting=[13])
237 ana.fillParticleList(f
"mu+:{name}", muon_cut, path=path)
238 ana.reconstructDecay(f
"Upsilon(4S):{name} -> mu+:{name} mu-:{name}", dimuon_cut, path=path)
240 vtx.raveFit(f
"Upsilon(4S):{name}", 0.001, daughtersUpdate=
True, silence_warning=
True, path=path)
242 return make_collection(name, files=files, path=path, primaryVertices=[f
"Upsilon(4S):{name}"])