CMS 3D CMS Logo

L2MuonProducer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
16 //
17 //--------------------------------------------------
18 
19 #include <memory>
20 #include <string>
21 
44 
46 public:
49 
51  ~L2MuonProducer() override;
52 
54  void produce(edm::Event&, const edm::EventSetup&) override;
55  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
56 
57 private:
58  // MuonSeed Collection Label
60 
62  std::unique_ptr<MuonTrackFinder> theTrackFinder; //It isn't the same as in ORCA
63 
65  std::unique_ptr<MuonServiceProxy> theService;
66 
68 };
69 
72  LogTrace("Muon|RecoMuon|L2MuonProducer") << "constructor called" << endl;
73 
74  // Parameter set for the Builder
75  edm::ParameterSet trajectoryBuilderParameters =
76  parameterSet.getParameter<edm::ParameterSet>("L2TrajBuilderParameters");
77 
78  // MuonSeed Collection Label
80  seedsToken = consumes<edm::View<TrajectorySeed>>(theSeedCollectionLabel);
81  // service parameters
82  edm::ParameterSet serviceParameters = parameterSet.getParameter<edm::ParameterSet>("ServiceParameters");
83 
84  // TrackLoader parameters
85  edm::ParameterSet trackLoaderParameters = parameterSet.getParameter<edm::ParameterSet>("TrackLoaderParameters");
86 
87  // the services
88  theService = std::make_unique<MuonServiceProxy>(serviceParameters, consumesCollector());
89 
90  std::unique_ptr<MuonTrajectoryBuilder> trajectoryBuilder = nullptr;
91  // instantiate the concrete trajectory builder in the Track Finder
92 
93  edm::ConsumesCollector iC = consumesCollector();
94  string typeOfBuilder = parameterSet.getParameter<string>("MuonTrajectoryBuilder");
95  if (typeOfBuilder == "StandAloneMuonTrajectoryBuilder" || typeOfBuilder.empty())
96  trajectoryBuilder =
97  std::make_unique<StandAloneMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
98  else if (typeOfBuilder == "Exhaustive")
99  trajectoryBuilder =
100  std::make_unique<ExhaustiveMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
101  else {
102  edm::LogWarning("Muon|RecoMuon|StandAloneMuonProducer")
103  << "No Trajectory builder associated with " << typeOfBuilder
104  << ". Falling down to the default (StandAloneMuonTrajectoryBuilder)";
105  trajectoryBuilder =
106  std::make_unique<StandAloneMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
107  }
109  std::make_unique<MuonTrackFinder>(std::move(trajectoryBuilder),
110  std::make_unique<MuonTrackLoader>(trackLoaderParameters, iC, theService.get()),
111  std::make_unique<MuonTrajectoryCleaner>(true),
112  iC);
113 
114  produces<TrackingRecHitCollection>();
115  produces<reco::TrackExtraCollection>();
116  // TrackCollection refers to TrackingRechit and TrackExtra
117  // collections, need to declare its production after them to work
118  // around a rare race condition in framework scheduling
119  produces<reco::TrackCollection>();
120  produces<reco::TrackCollection>("UpdatedAtVtx");
121  produces<reco::TrackToTrackMap>();
122 
123  produces<std::vector<Trajectory>>();
124  produces<TrajTrackAssociationCollection>();
125 
126  produces<edm::AssociationMap<edm::OneToMany<std::vector<L2MuonTrajectorySeed>, std::vector<L2MuonTrajectorySeed>>>>();
127 }
128 
131  LogTrace("Muon|RecoMuon|L2eMuonProducer") << "L2MuonProducer destructor called" << endl;
132 }
133 
136  const std::string metname = "Muon|RecoMuon|L2MuonProducer";
137 
138  LogTrace(metname) << endl << endl << endl;
139  LogTrace(metname) << "L2 Muon Reconstruction Started" << endl;
140 
141  // Take the seeds container
142  LogTrace(metname) << "Taking the seeds: " << theSeedCollectionLabel.label() << endl;
144  event.getByToken(seedsToken, seeds);
145 
146  // Update the services
147  theService->update(eventSetup);
148 
149  // Reconstruct
150  LogTrace(metname) << "Track Reconstruction" << endl;
151  theTrackFinder->reconstruct(seeds, event, eventSetup);
152 
153  LogTrace(metname) << "edm::Event loaded"
154  << "================================" << endl
155  << endl;
156 }
157 
160  {
162  psd0.addUntracked<std::vector<std::string>>("Propagators",
163  {
164  "hltESPFastSteppingHelixPropagatorAny"
165  "hltESPFastSteppingHelixPropagatorOpposite",
166  });
167  psd0.add<bool>("RPCLayers", true);
168  psd0.addUntracked<bool>("UseMuonNavigation", true);
169  desc.add<edm::ParameterSetDescription>("ServiceParameters", psd0);
170  }
171 
172  desc.add<edm::InputTag>("InputObjects", edm::InputTag("hltL2MuonSeeds"));
173  {
175  psd0.add<std::string>("Fitter", "hltESPKFFittingSmootherForL2Muon");
176  psd0.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
177  psd0.add<unsigned int>("NMinRecHits", 2);
178  psd0.add<bool>("UseSubRecHits", false);
179  psd0.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
180  psd0.add<double>("RescaleError", 100.0);
181  desc.add<edm::ParameterSetDescription>("SeedTransformerParameters", psd0);
182  }
183 
184  {
186  psd0.add<bool>("DoRefit", false);
187  psd0.add<std::string>("SeedPropagator", "hltESPFastSteppingHelixPropagatorAny");
188  {
190  psd1.add<double>("NumberOfSigma", 3.0);
191  psd1.add<std::string>("FitDirection", "insideOut");
192  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
193  psd1.add<double>("MaxChi2", 1000.0);
194  {
196  psd2.add<double>("MaxChi2", 25.0);
197  psd2.add<double>("RescaleErrorFactor", 100.0);
198  psd2.add<int>("Granularity", 0);
199  psd2.add<bool>("ExcludeRPCFromFit", false);
200  psd2.add<bool>("UseInvalidHits", true);
201  psd2.add<bool>("RescaleError", false);
202  psd1.add<edm::ParameterSetDescription>("MuonTrajectoryUpdatorParameters", psd2);
203  }
204  psd1.add<bool>("EnableRPCMeasurement", true);
205  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
206  psd1.add<bool>("EnableDTMeasurement", true);
207  psd1.add<edm::InputTag>("RPCRecSegmentLabel", edm::InputTag("hltRpcRecHits"));
208  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
209  psd1.add<bool>("EnableGEMMeasurement", false);
210  psd1.add<edm::InputTag>("GEMRecSegmentLabel", edm::InputTag("gemRecHits"));
211  psd1.add<bool>("EnableME0Measurement", false);
212  psd1.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
213  psd1.add<bool>("EnableCSCMeasurement", true);
214  psd0.add<edm::ParameterSetDescription>("FilterParameters", psd1);
215  }
216  psd0.add<std::string>("NavigationType", "Standard");
217  {
219  psd1.add<std::string>("Fitter", "hltESPKFFittingSmootherForL2Muon");
220  psd1.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
221  psd1.add<unsigned int>("NMinRecHits", 2);
222  psd1.add<bool>("UseSubRecHits", false);
223  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
224  psd1.add<double>("RescaleError", 100.0);
225  psd0.add<edm::ParameterSetDescription>("SeedTransformerParameters", psd1);
226  }
227  psd0.add<bool>("DoBackwardFilter", true);
228  psd0.add<std::string>("SeedPosition", "in");
229  {
231  psd1.add<double>("NumberOfSigma", 3.0);
232  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
233  psd1.add<std::string>("FitDirection", "outsideIn");
234  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
235  psd1.add<double>("MaxChi2", 100.0);
236  {
238  psd2.add<double>("MaxChi2", 25.0);
239  psd2.add<double>("RescaleErrorFactor", 100.0);
240  psd2.add<int>("Granularity", 0);
241  psd2.add<bool>("ExcludeRPCFromFit", false);
242  psd2.add<bool>("UseInvalidHits", true);
243  psd2.add<bool>("RescaleError", false);
244  psd1.add<edm::ParameterSetDescription>("MuonTrajectoryUpdatorParameters", psd2);
245  }
246  psd1.add<bool>("EnableRPCMeasurement", true);
247  psd1.add<std::string>("BWSeedType", "fromGenerator");
248  psd1.add<bool>("EnableDTMeasurement", true);
249  psd1.add<edm::InputTag>("RPCRecSegmentLabel", edm::InputTag("hltRpcRecHits"));
250  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
251  psd1.add<bool>("EnableGEMMeasurement", false);
252  psd1.add<edm::InputTag>("GEMRecSegmentLabel", edm::InputTag("gemRecHits"));
253  psd1.add<bool>("EnableME0Measurement", false);
254  psd1.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
255  psd1.add<bool>("EnableCSCMeasurement", true);
256  psd0.add<edm::ParameterSetDescription>("BWFilterParameters", psd1);
257  }
258  psd0.add<bool>("DoSeedRefit", false);
259  desc.add<edm::ParameterSetDescription>("L2TrajBuilderParameters", psd0);
260  }
261  desc.add<bool>("DoSeedRefit", false);
262  {
264  psd0.add<std::string>("Smoother", "hltESPKFTrajectorySmootherForMuonTrackLoader");
265  psd0.add<bool>("DoSmoothing", false);
266  psd0.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
267  {
269  psd1.add<double>("MaxChi2", 1000000.0);
270  psd1.add<std::vector<double>>("BeamSpotPosition",
271  {
272  0.0,
273  0.0,
274  0.0,
275  });
276  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorOpposite");
277  psd1.add<std::vector<double>>("BeamSpotPositionErrors",
278  {
279  0.1,
280  0.1,
281  5.3,
282  });
283  psd0.add<edm::ParameterSetDescription>("MuonUpdatorAtVertexParameters", psd1);
284  }
285  psd0.add<bool>("VertexConstraint", true);
286  psd0.add<std::string>("TTRHBuilder", "hltESPTTRHBWithTrackAngle");
287  desc.add<edm::ParameterSetDescription>("TrackLoaderParameters", psd0);
288  }
289  desc.add<std::string>("MuonTrajectoryBuilder", "Exhaustive");
290  descriptions.add("L2MuonProducer", desc);
291 }
292 
293 // declare as a framework plugin
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::unique_ptr< MuonServiceProxy > theService
the event setup proxy, it takes care the services update
const std::string metname
std::string const & label() const
Definition: InputTag.h:36
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
#define LogTrace(id)
edm::EDGetTokenT< edm::View< TrajectorySeed > > seedsToken
void produce(edm::Event &, const edm::EventSetup &) override
reconstruct muons
edm::InputTag theSeedCollectionLabel
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
L2MuonProducer(const edm::ParameterSet &)
constructor with config
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Warning, false > LogWarning
~L2MuonProducer() override
destructor
std::unique_ptr< MuonTrackFinder > theTrackFinder
the track finder
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1