CMS 3D CMS Logo

L3MuonProducer.cc
Go to the documentation of this file.
1 
11 // Framework
18 
20 
21 // TrackFinder and specific GLB Trajectory Builder
27 
28 using namespace edm;
29 using namespace std;
30 
31 //
32 // constructor with config
33 //
35  LogTrace("L3MuonProducer") << "constructor called" << endl;
36 
37  // Parameter set for the Builder
38  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("L3TrajBuilderParameters");
39 
40  // L2 Muon Collection Label
41  theL2CollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");
42  l2MuonToken_ = consumes<reco::TrackCollection>(theL2CollectionLabel);
43  l2MuonTrajToken_ = consumes<std::vector<Trajectory>>(theL2CollectionLabel.label());
44  l2AssoMapToken_ = consumes<TrajTrackAssociationCollection>(theL2CollectionLabel.label());
45  updatedL2AssoMapToken_ = consumes<reco::TrackToTrackMap>(theL2CollectionLabel.label());
46 
47  // service parameters
48  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
49 
50  // TrackLoader parameters
51  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
52 
53  // the services
54  theService = std::make_unique<MuonServiceProxy>(serviceParameters, consumesCollector());
55  ConsumesCollector iC = consumesCollector();
56 
57  // instantiate the concrete trajectory builder in the Track Finder
58  auto mtl = std::make_unique<MuonTrackLoader>(trackLoaderParameters, iC, theService.get());
59  auto l3mtb = std::make_unique<L3MuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
60  theTrackFinder = std::make_unique<MuonTrackFinder>(std::move(l3mtb), std::move(mtl), iC);
61 
62  theL2SeededTkLabel =
63  trackLoaderParameters.getUntrackedParameter<std::string>("MuonSeededTracksInstance", std::string());
64 
65  produces<TrackingRecHitCollection>(theL2SeededTkLabel);
66  produces<reco::TrackExtraCollection>(theL2SeededTkLabel);
67  // TrackCollection refers to TrackingRechit and TrackExtra
68  // collections, need to declare its production after them to work
69  // around a rare race condition in framework scheduling
70  produces<reco::TrackCollection>(theL2SeededTkLabel);
71  produces<vector<Trajectory>>(theL2SeededTkLabel);
72  produces<TrajTrackAssociationCollection>(theL2SeededTkLabel);
73 
74  produces<TrackingRecHitCollection>();
75  produces<reco::TrackExtraCollection>();
76  // TrackCollection refers to TrackingRechit and TrackExtra
77  // collections, need to declare its production after them to work
78  // around a rare race condition in framework scheduling
79  produces<reco::TrackCollection>();
80  produces<vector<Trajectory>>();
81  produces<TrajTrackAssociationCollection>();
82 
83  produces<reco::MuonTrackLinksCollection>();
84 }
85 
86 //
87 // destructor
88 //
89 L3MuonProducer::~L3MuonProducer() { LogTrace("L3MuonProducer") << "destructor called" << endl; }
90 
91 //
92 // reconstruct muons
93 //
95  const string metname = "Muon|RecoMuon|L3MuonProducer";
96  LogTrace(metname) << endl << endl << endl;
97  LogTrace(metname) << "L3 Muon Reconstruction started" << endl;
98 
99  typedef vector<Trajectory> TrajColl;
100 
101  // Update the services
102  theService->update(eventSetup);
103 
104  // Take the L2 muon container(s)
105  LogTrace(metname) << "Taking the L2 Muons " << theL2CollectionLabel << endl;
106 
108  event.getByToken(l2MuonToken_, L2Muons);
109 
110  Handle<vector<Trajectory>> L2MuonsTraj;
111  vector<MuonTrajectoryBuilder::TrackCand> L2TrackCands;
112 
113  event.getByToken(l2MuonTrajToken_, L2MuonsTraj);
114 
116  event.getByToken(l2AssoMapToken_, L2AssoMap);
117 
118  edm::Handle<reco::TrackToTrackMap> updatedL2AssoMap;
119  event.getByToken(updatedL2AssoMapToken_, updatedL2AssoMap);
120 
121  for (TrajTrackAssociationCollection::const_iterator it = L2AssoMap->begin(); it != L2AssoMap->end(); ++it) {
122  const Ref<vector<Trajectory>> traj = it->key;
123  const reco::TrackRef tkRegular = it->val;
124  reco::TrackRef tkUpdated;
127  if (theL2CollectionLabel.instance() == "UpdatedAtVtx") {
128  iEnd = updatedL2AssoMap->end();
129  iii = updatedL2AssoMap->find(it->val);
130  if (iii != iEnd)
131  tkUpdated = (*updatedL2AssoMap)[it->val];
132  }
133 
134  const reco::TrackRef tk = (tkUpdated.isNonnull()) ? tkUpdated : tkRegular;
135 
137  if (traj->isValid())
138  L2Cand.first = &*traj;
139  L2TrackCands.push_back(L2Cand);
140  }
141 
142  theTrackFinder->reconstruct(L2TrackCands, event, eventSetup);
143 
144  LogTrace(metname) << "Event loaded"
145  << "================================" << endl
146  << endl;
147 }
148 
151  {
153  psd0.addUntracked<std::vector<std::string>>("Propagators",
154  {
155  "hltESPSmartPropagatorAny",
156  "SteppingHelixPropagatorAny",
157  "hltESPSmartPropagator",
158  "hltESPSteppingHelixPropagatorOpposite",
159  });
160  psd0.add<bool>("RPCLayers", true);
161  psd0.addUntracked<bool>("UseMuonNavigation", true);
162  desc.add<edm::ParameterSetDescription>("ServiceParameters", psd0);
163  }
164  desc.add<edm::InputTag>("MuonCollectionLabel", edm::InputTag("hltL2Muons", "UpdatedAtVtx"));
165  {
167  psd0.addUntracked<bool>("PutTkTrackIntoEvent", false);
168  psd0.add<std::string>("TTRHBuilder", "hltESPTTRHBWithTrackAngle");
169  psd0.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
170  psd0.addUntracked<bool>("SmoothTkTrack", false);
171  psd0.addUntracked<std::string>("MuonSeededTracksInstance", "L2Seeded");
172  psd0.add<std::string>("Smoother", "hltESPKFTrajectorySmootherForMuonTrackLoader");
173  {
175  psd1.add<double>("MaxChi2", 1000000.0);
176  psd1.add<std::string>("Propagator", "hltESPSteppingHelixPropagatorOpposite");
177  psd1.add<std::vector<double>>("BeamSpotPositionErrors",
178  {
179  0.1,
180  0.1,
181  5.3,
182  });
183  psd0.add<edm::ParameterSetDescription>("MuonUpdatorAtVertexParameters", psd1);
184  }
185  psd0.add<bool>("VertexConstraint", false);
186  psd0.add<bool>("DoSmoothing", false);
187  desc.add<edm::ParameterSetDescription>("TrackLoaderParameters", psd0);
188  }
189  {
191  psd0.add<double>("ScaleTECyFactor", -1.0);
192  psd0.add<edm::InputTag>("tkTrajVertex", edm::InputTag("hltPixelVertices"));
193  psd0.add<bool>("tkTrajUseVertex", false);
194  {
196  psd1.add<int>("TrackerSkipSection", -1);
197  psd1.add<bool>("DoPredictionsOnly", false);
198  psd1.add<bool>("PropDirForCosmics", false);
199  psd1.add<int>("HitThreshold", 1);
200  psd1.add<int>("MuonHitsOption", 1);
201  psd1.add<bool>("RefitFlag", true);
202  psd1.add<std::string>("Fitter", "hltESPL3MuKFTrajectoryFitter");
203  psd1.add<int>("SkipStation", -1);
204  psd1.add<std::string>("TrackerRecHitBuilder", "hltESPTTRHBWithTrackAngle");
205  psd1.add<double>("Chi2CutRPC", 1.0);
206  psd1.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
207  psd1.add<std::string>("RefitDirection", "insideOut");
208  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
209  psd1.add<edm::InputTag>("GEMRecHitLabel", edm::InputTag("gemRecHits"));
210  psd1.add<edm::InputTag>("ME0RecHitLabel", edm::InputTag("me0Segments"));
211  psd1.add<std::vector<int>>("DYTthrs",
212  {
213  30,
214  15,
215  });
216  psd1.add<int>("DYTselector", 1);
217  psd1.add<bool>("DYTupdator", false);
218  psd1.add<bool>("DYTuseAPE", false);
219  psd1.add<bool>("DYTuseThrsParametrization", true);
220  {
222  psd2.add<std::vector<double>>("eta0p8", {1, -0.919853, 0.990742});
223  psd2.add<std::vector<double>>("eta1p2", {1, -0.897354, 0.987738});
224  psd2.add<std::vector<double>>("eta2p0", {1, -0.986855, 0.998516});
225  psd2.add<std::vector<double>>("eta2p2", {1, -0.940342, 0.992955});
226  psd2.add<std::vector<double>>("eta2p4", {1, -0.947633, 0.993762});
227  psd1.add<edm::ParameterSetDescription>("DYTthrsParameters", psd2);
228  }
229  psd1.add<double>("Chi2CutCSC", 150.0);
230  psd1.add<double>("Chi2CutDT", 10.0);
231  psd1.add<double>("Chi2CutGEM", 1.0);
232  psd1.add<double>("Chi2CutME0", 1.0);
233  psd1.add<bool>("RefitRPCHits", true);
234  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
235  psd1.add<std::string>("Propagator", "hltESPSmartPropagatorAny");
236  psd1.add<int>("TrackerSkipSystem", -1);
237  psd0.add<edm::ParameterSetDescription>("GlbRefitterParameters", psd1);
238  }
239  psd0.add<double>("tkTrajMaxChi2", 9999.0);
240  psd0.add<double>("ScaleTECxFactor", -1.0);
241  psd0.add<std::string>("TrackerRecHitBuilder", "hltESPTTRHBWithTrackAngle");
242  psd0.add<edm::InputTag>("tkTrajBeamSpot", edm::InputTag("hltOnlineBeamSpot"));
243  psd0.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
244  psd0.add<double>("tkTrajMaxDXYBeamSpot", 9999.0);
245  psd0.add<std::string>("TrackerPropagator", "SteppingHelixPropagatorAny");
246  {
248  psd1.add<bool>("precise", true);
249  psd1.add<bool>("Eta_fixed", true);
250  psd1.add<double>("Eta_min", 0.1);
251  psd1.add<bool>("Z_fixed", false);
252  psd1.add<edm::InputTag>("MeasurementTrackerName", edm::InputTag("hltESPMeasurementTracker"));
253  psd1.add<int>("maxRegions", 2);
254  psd1.add<double>("Pt_min", 3.0);
255  psd1.add<double>("Rescale_Dz", 4.0);
256  psd1.add<double>("PhiR_UpperLimit_Par1", 0.6);
257  psd1.add<double>("PhiR_UpperLimit_Par2", 0.2);
258  psd1.add<edm::InputTag>("vertexCollection", edm::InputTag("pixelVertices"));
259  psd1.add<bool>("Phi_fixed", true);
260  psd1.add<edm::InputTag>("input", edm::InputTag("hltL2Muons", "UpdatedAtVtx"));
261  psd1.add<double>("DeltaR", 0.025);
262  psd1.add<int>("OnDemand", -1);
263  psd1.add<double>("DeltaZ", 24.2);
264  psd1.add<double>("Rescale_phi", 3.0);
265  psd1.add<double>("Rescale_eta", 3.0);
266  psd1.add<double>("DeltaEta", 0.04);
267  psd1.add<double>("DeltaPhi", 0.15);
268  psd1.add<double>("Phi_min", 0.1);
269  psd1.add<bool>("UseVertex", false);
270  psd1.add<double>("EtaR_UpperLimit_Par1", 0.25);
271  psd1.add<double>("EtaR_UpperLimit_Par2", 0.15);
272  psd1.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
273  psd1.add<bool>("Pt_fixed", false);
274  psd0.add<edm::ParameterSetDescription>("MuonTrackingRegionBuilder", psd1);
275  }
276  psd0.add<bool>("RefitRPCHits", true);
277  psd0.add<double>("PCut", 2.5);
278  {
281  false, // do predictions only
282  "hltESPL3MuKFTrajectoryFitter", // fitter
283  "hltESPKFTrajectorySmootherForMuonTrackLoader", // smoother
284  "hltESPSmartPropagatorAny", // propagator
285  "insideOut", // refit direction
286  true, // refit rpc hits
287  "hltESPTTRHBWithTrackAngle", // tracker rechit builder
288  "hltESPMuonTransientTrackingRecHitBuilder" // muon rechit builder
289  );
290  psd0.add<edm::ParameterSetDescription>("TrackTransformer", psd1);
291  }
292  {
294  psd1.add<double>("Quality_3", 7.0);
295  psd1.add<double>("DeltaRCut_1", 0.1);
296  psd1.add<double>("MinP", 2.5);
297  psd1.add<double>("MinPt", 1.0);
298  psd1.add<double>("Quality_2", 15.0);
299  psd1.add<double>("Pt_threshold2", 999999999.0);
300  psd1.add<double>("LocChi2Cut", 0.001);
301  psd1.add<double>("Eta_threshold", 1.2);
302  psd1.add<double>("Pt_threshold1", 0.0);
303  psd1.add<double>("Chi2Cut_1", 50.0);
304  psd1.add<double>("Quality_1", 20.0);
305  psd1.add<double>("Chi2Cut_3", 200.0);
306  psd1.add<double>("DeltaRCut_3", 1.0);
307  psd1.add<double>("DeltaRCut_2", 0.2);
308  psd1.add<double>("DeltaDCut_1", 40.0);
309  psd1.add<double>("DeltaDCut_2", 10.0);
310  psd1.add<double>("DeltaDCut_3", 15.0);
311  psd1.add<double>("Chi2Cut_2", 50.0);
312  psd1.add<std::string>("Propagator", "hltESPSmartPropagator");
313  psd0.add<edm::ParameterSetDescription>("GlobalMuonTrackMatcher", psd1);
314  }
315  psd0.add<double>("PtCut", 1.0);
316  psd0.add<bool>("matchToSeeds", true);
317  psd0.add<edm::InputTag>("tkTrajLabel", edm::InputTag("hltBRSMuonSeededTracksOutIn"));
318  desc.add<edm::ParameterSetDescription>("L3TrajBuilderParameters", psd0);
319  }
320  descriptions.add("L3MuonProducer", desc);
321 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::pair< const Trajectory *, reco::TrackRef > TrackCand
const std::string metname
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:232
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
const_iterator find(const key_type &k) const
find element with specified reference key
#define LogTrace(id)
const_iterator end() const
last iterator over the map (read only)
void produce(edm::Event &, const edm::EventSetup &) override
reconstruct muons
ParameterDescriptionBase * add(U const &iLabel, T const &value)
L3MuonProducer(const edm::ParameterSet &)
constructor with config
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillPSetDescription(edm::ParameterSetDescription &descriptions, bool doPredictionsOnly=false, const std::string &fitter="KFFitterForRefitInsideOut", const std::string &smoother="KFSmootherForRefitInsideOut", const std::string &propagator="SmartPropagatorAnyRK", const std::string &refitDirection="alongMomentum", bool refitRPCHits=true, const std::string &trackerRecHitBuilder="WithTrackAngle", const std::string &muonRecHitBuilder="MuonRecHitBuilder", const std::string &mtdRecHitBuilder="MTDRecHitBuilder")
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const_iterator begin() const
first iterator over the map (read only)
HLT enums.
~L3MuonProducer() override
destructor
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1