CMS 3D CMS Logo

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