CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
79  theSeedCollectionLabel = parameterSet.getParameter<edm::InputTag>("InputObjects");
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<reco::TrackCollection>();
115  produces<reco::TrackCollection>("UpdatedAtVtx");
116  produces<TrackingRecHitCollection>();
117  produces<reco::TrackExtraCollection>();
118  produces<reco::TrackToTrackMap>();
119 
120  produces<std::vector<Trajectory>>();
121  produces<TrajTrackAssociationCollection>();
122 
123  produces<edm::AssociationMap<edm::OneToMany<std::vector<L2MuonTrajectorySeed>, std::vector<L2MuonTrajectorySeed>>>>();
124 }
125 
128  LogTrace("Muon|RecoMuon|L2eMuonProducer") << "L2MuonProducer destructor called" << endl;
129 }
130 
133  const std::string metname = "Muon|RecoMuon|L2MuonProducer";
134 
135  LogTrace(metname) << endl << endl << endl;
136  LogTrace(metname) << "L2 Muon Reconstruction Started" << endl;
137 
138  // Take the seeds container
139  LogTrace(metname) << "Taking the seeds: " << theSeedCollectionLabel.label() << endl;
141  event.getByToken(seedsToken, seeds);
142 
143  // Update the services
144  theService->update(eventSetup);
145 
146  // Reconstruct
147  LogTrace(metname) << "Track Reconstruction" << endl;
148  theTrackFinder->reconstruct(seeds, event, eventSetup);
149 
150  LogTrace(metname) << "edm::Event loaded"
151  << "================================" << endl
152  << endl;
153 }
154 
157  {
159  psd0.addUntracked<std::vector<std::string>>("Propagators",
160  {
161  "hltESPFastSteppingHelixPropagatorAny"
162  "hltESPFastSteppingHelixPropagatorOpposite",
163  });
164  psd0.add<bool>("RPCLayers", true);
165  psd0.addUntracked<bool>("UseMuonNavigation", true);
166  desc.add<edm::ParameterSetDescription>("ServiceParameters", psd0);
167  }
168 
169  desc.add<edm::InputTag>("InputObjects", edm::InputTag("hltL2MuonSeeds"));
170  {
172  psd0.add<std::string>("Fitter", "hltESPKFFittingSmootherForL2Muon");
173  psd0.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
174  psd0.add<unsigned int>("NMinRecHits", 2);
175  psd0.add<bool>("UseSubRecHits", false);
176  psd0.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
177  psd0.add<double>("RescaleError", 100.0);
178  desc.add<edm::ParameterSetDescription>("SeedTransformerParameters", psd0);
179  }
180 
181  {
183  psd0.add<bool>("DoRefit", false);
184  psd0.add<std::string>("SeedPropagator", "hltESPFastSteppingHelixPropagatorAny");
185  {
187  psd1.add<double>("NumberOfSigma", 3.0);
188  psd1.add<std::string>("FitDirection", "insideOut");
189  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
190  psd1.add<double>("MaxChi2", 1000.0);
191  {
193  psd2.add<double>("MaxChi2", 25.0);
194  psd2.add<double>("RescaleErrorFactor", 100.0);
195  psd2.add<int>("Granularity", 0);
196  psd2.add<bool>("ExcludeRPCFromFit", false);
197  psd2.add<bool>("UseInvalidHits", true);
198  psd2.add<bool>("RescaleError", false);
199  psd1.add<edm::ParameterSetDescription>("MuonTrajectoryUpdatorParameters", psd2);
200  }
201  psd1.add<bool>("EnableRPCMeasurement", true);
202  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
203  psd1.add<bool>("EnableDTMeasurement", true);
204  psd1.add<edm::InputTag>("RPCRecSegmentLabel", edm::InputTag("hltRpcRecHits"));
205  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
206  psd1.add<bool>("EnableGEMMeasurement", false);
207  psd1.add<edm::InputTag>("GEMRecSegmentLabel", edm::InputTag("gemRecHits"));
208  psd1.add<bool>("EnableME0Measurement", false);
209  psd1.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
210  psd1.add<bool>("EnableCSCMeasurement", true);
211  psd0.add<edm::ParameterSetDescription>("FilterParameters", psd1);
212  }
213  psd0.add<std::string>("NavigationType", "Standard");
214  {
216  psd1.add<std::string>("Fitter", "hltESPKFFittingSmootherForL2Muon");
217  psd1.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
218  psd1.add<unsigned int>("NMinRecHits", 2);
219  psd1.add<bool>("UseSubRecHits", false);
220  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
221  psd1.add<double>("RescaleError", 100.0);
222  psd0.add<edm::ParameterSetDescription>("SeedTransformerParameters", psd1);
223  }
224  psd0.add<bool>("DoBackwardFilter", true);
225  psd0.add<std::string>("SeedPosition", "in");
226  {
228  psd1.add<double>("NumberOfSigma", 3.0);
229  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
230  psd1.add<std::string>("FitDirection", "outsideIn");
231  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
232  psd1.add<double>("MaxChi2", 100.0);
233  {
235  psd2.add<double>("MaxChi2", 25.0);
236  psd2.add<double>("RescaleErrorFactor", 100.0);
237  psd2.add<int>("Granularity", 0);
238  psd2.add<bool>("ExcludeRPCFromFit", false);
239  psd2.add<bool>("UseInvalidHits", true);
240  psd2.add<bool>("RescaleError", false);
241  psd1.add<edm::ParameterSetDescription>("MuonTrajectoryUpdatorParameters", psd2);
242  }
243  psd1.add<bool>("EnableRPCMeasurement", true);
244  psd1.add<std::string>("BWSeedType", "fromGenerator");
245  psd1.add<bool>("EnableDTMeasurement", true);
246  psd1.add<edm::InputTag>("RPCRecSegmentLabel", edm::InputTag("hltRpcRecHits"));
247  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
248  psd1.add<bool>("EnableGEMMeasurement", false);
249  psd1.add<edm::InputTag>("GEMRecSegmentLabel", edm::InputTag("gemRecHits"));
250  psd1.add<bool>("EnableME0Measurement", false);
251  psd1.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
252  psd1.add<bool>("EnableCSCMeasurement", true);
253  psd0.add<edm::ParameterSetDescription>("BWFilterParameters", psd1);
254  }
255  psd0.add<bool>("DoSeedRefit", false);
256  desc.add<edm::ParameterSetDescription>("L2TrajBuilderParameters", psd0);
257  }
258  desc.add<bool>("DoSeedRefit", false);
259  {
261  psd0.add<std::string>("Smoother", "hltESPKFTrajectorySmootherForMuonTrackLoader");
262  psd0.add<bool>("DoSmoothing", false);
263  psd0.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
264  {
266  psd1.add<double>("MaxChi2", 1000000.0);
267  psd1.add<std::vector<double>>("BeamSpotPosition",
268  {
269  0.0,
270  0.0,
271  0.0,
272  });
273  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorOpposite");
274  psd1.add<std::vector<double>>("BeamSpotPositionErrors",
275  {
276  0.1,
277  0.1,
278  5.3,
279  });
280  psd0.add<edm::ParameterSetDescription>("MuonUpdatorAtVertexParameters", psd1);
281  }
282  psd0.add<bool>("VertexConstraint", true);
283  psd0.add<std::string>("TTRHBuilder", "hltESPTTRHBWithTrackAngle");
284  desc.add<edm::ParameterSetDescription>("TrackLoaderParameters", psd0);
285  }
286  desc.add<std::string>("MuonTrajectoryBuilder", "Exhaustive");
287  descriptions.add("L2MuonProducer", desc);
288 }
289 
290 // declare as a framework plugin
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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
#define LogTrace(id)
edm::EDGetTokenT< edm::View< TrajectorySeed > > seedsToken
void produce(edm::Event &, const edm::EventSetup &) override
reconstruct muons
edm::InputTag theSeedCollectionLabel
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
def move
Definition: eostools.py:511
ParameterDescriptionBase * add(U const &iLabel, T const &value)
L2MuonProducer(const edm::ParameterSet &)
constructor with config
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::string const & label() const
Definition: InputTag.h:36
Log< level::Warning, false > LogWarning
~L2MuonProducer() override
destructor
std::unique_ptr< MuonTrackFinder > theTrackFinder
the track finder