CMS 3D CMS Logo

L2MuonProducer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
16 //
17 //--------------------------------------------------
18 
20 
21 // Framework
26 
27 // TrackFinder and Specific STA/L2 Trajectory Builder
34 
36 
42 
43 #include <string>
44 
45 using namespace edm;
46 using namespace std;
47 
50  LogTrace("Muon|RecoMuon|L2MuonProducer") << "constructor called" << endl;
51 
52  // Parameter set for the Builder
53  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("L2TrajBuilderParameters");
54 
55  // MuonSeed Collection Label
56  theSeedCollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
57  seedsToken = consumes<edm::View<TrajectorySeed>>(theSeedCollectionLabel);
58  // service parameters
59  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
60 
61  // TrackLoader parameters
62  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
63 
64  // the services
65  theService = new MuonServiceProxy(serviceParameters);
66 
67  MuonTrajectoryBuilder* trajectoryBuilder = nullptr;
68  // instantiate the concrete trajectory builder in the Track Finder
69 
70  edm::ConsumesCollector iC = consumesCollector();
71  string typeOfBuilder = parameterSet.existsAs<string>("MuonTrajectoryBuilder")
72  ? parameterSet.getParameter<string>("MuonTrajectoryBuilder")
73  : "StandAloneMuonTrajectoryBuilder";
74  if (typeOfBuilder == "StandAloneMuonTrajectoryBuilder" || typeOfBuilder.empty())
75  trajectoryBuilder = new StandAloneMuonTrajectoryBuilder(trajectoryBuilderParameters, theService, iC);
76  else if (typeOfBuilder == "Exhaustive")
77  trajectoryBuilder = new ExhaustiveMuonTrajectoryBuilder(trajectoryBuilderParameters, theService, iC);
78  else {
79  LogWarning("Muon|RecoMuon|StandAloneMuonProducer")
80  << "No Trajectory builder associated with " << typeOfBuilder
81  << ". Falling down to the default (StandAloneMuonTrajectoryBuilder)";
82  trajectoryBuilder = new StandAloneMuonTrajectoryBuilder(trajectoryBuilderParameters, theService, iC);
83  }
84  theTrackFinder = new MuonTrackFinder(
85  trajectoryBuilder, new MuonTrackLoader(trackLoaderParameters, iC, theService), new MuonTrajectoryCleaner(true));
86 
87  produces<reco::TrackCollection>();
88  produces<reco::TrackCollection>("UpdatedAtVtx");
89  produces<TrackingRecHitCollection>();
90  produces<reco::TrackExtraCollection>();
91  produces<reco::TrackToTrackMap>();
92 
93  produces<std::vector<Trajectory>>();
94  produces<TrajTrackAssociationCollection>();
95 
96  produces<edm::AssociationMap<edm::OneToMany<std::vector<L2MuonTrajectorySeed>, std::vector<L2MuonTrajectorySeed>>>>();
97 }
98 
101  LogTrace("Muon|RecoMuon|L2eMuonProducer") << "L2MuonProducer destructor called" << endl;
102  delete theService;
103  delete theTrackFinder;
104 }
105 
107 void L2MuonProducer::produce(Event& event, const EventSetup& eventSetup) {
108  const std::string metname = "Muon|RecoMuon|L2MuonProducer";
109 
110  LogTrace(metname) << endl << endl << endl;
111  LogTrace(metname) << "L2 Muon Reconstruction Started" << endl;
112 
113  // Take the seeds container
114  LogTrace(metname) << "Taking the seeds: " << theSeedCollectionLabel.label() << endl;
116  event.getByToken(seedsToken, seeds);
117 
118  // Update the services
119  theService->update(eventSetup);
120 
121  // Reconstruct
122  LogTrace(metname) << "Track Reconstruction" << endl;
123  theTrackFinder->reconstruct(seeds, event, eventSetup);
124 
125  LogTrace(metname) << "Event loaded"
126  << "================================" << endl
127  << endl;
128 }
129 
132  {
134  psd0.addUntracked<std::vector<std::string>>("Propagators",
135  {
136  "hltESPFastSteppingHelixPropagatorAny"
137  "hltESPFastSteppingHelixPropagatorOpposite",
138  });
139  psd0.add<bool>("RPCLayers", true);
140  psd0.addUntracked<bool>("UseMuonNavigation", true);
141  desc.add<edm::ParameterSetDescription>("ServiceParameters", psd0);
142  }
143 
144  desc.add<edm::InputTag>("InputObjects", edm::InputTag("hltL2MuonSeeds"));
145  {
147  psd0.add<std::string>("Fitter", "hltESPKFFittingSmootherForL2Muon");
148  psd0.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
149  psd0.add<unsigned int>("NMinRecHits", 2);
150  psd0.add<bool>("UseSubRecHits", false);
151  psd0.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
152  psd0.add<double>("RescaleError", 100.0);
153  desc.add<edm::ParameterSetDescription>("SeedTransformerParameters", psd0);
154  }
155 
156  {
158  psd0.add<bool>("DoRefit", false);
159  psd0.add<std::string>("SeedPropagator", "hltESPFastSteppingHelixPropagatorAny");
160  {
162  psd1.add<double>("NumberOfSigma", 3.0);
163  psd1.add<std::string>("FitDirection", "insideOut");
164  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
165  psd1.add<double>("MaxChi2", 1000.0);
166  {
168  psd2.add<double>("MaxChi2", 25.0);
169  psd2.add<double>("RescaleErrorFactor", 100.0);
170  psd2.add<int>("Granularity", 0);
171  psd2.add<bool>("ExcludeRPCFromFit", false);
172  psd2.add<bool>("UseInvalidHits", true);
173  psd2.add<bool>("RescaleError", false);
174  psd1.add<edm::ParameterSetDescription>("MuonTrajectoryUpdatorParameters", psd2);
175  }
176  psd1.add<bool>("EnableRPCMeasurement", true);
177  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
178  psd1.add<bool>("EnableDTMeasurement", true);
179  psd1.add<edm::InputTag>("RPCRecSegmentLabel", edm::InputTag("hltRpcRecHits"));
180  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
181  psd1.add<bool>("EnableGEMMeasurement", false);
182  psd1.add<edm::InputTag>("GEMRecSegmentLabel", edm::InputTag("gemRecHits"));
183  psd1.add<bool>("EnableME0Measurement", false);
184  psd1.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
185  psd1.add<bool>("EnableCSCMeasurement", true);
186  psd0.add<edm::ParameterSetDescription>("FilterParameters", psd1);
187  }
188  psd0.add<std::string>("NavigationType", "Standard");
189  {
191  psd1.add<std::string>("Fitter", "hltESPKFFittingSmootherForL2Muon");
192  psd1.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
193  psd1.add<unsigned int>("NMinRecHits", 2);
194  psd1.add<bool>("UseSubRecHits", false);
195  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
196  psd1.add<double>("RescaleError", 100.0);
197  psd0.add<edm::ParameterSetDescription>("SeedTransformerParameters", psd1);
198  }
199  psd0.add<bool>("DoBackwardFilter", true);
200  psd0.add<std::string>("SeedPosition", "in");
201  {
203  psd1.add<double>("NumberOfSigma", 3.0);
204  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
205  psd1.add<std::string>("FitDirection", "outsideIn");
206  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
207  psd1.add<double>("MaxChi2", 100.0);
208  {
210  psd2.add<double>("MaxChi2", 25.0);
211  psd2.add<double>("RescaleErrorFactor", 100.0);
212  psd2.add<int>("Granularity", 0);
213  psd2.add<bool>("ExcludeRPCFromFit", false);
214  psd2.add<bool>("UseInvalidHits", true);
215  psd2.add<bool>("RescaleError", false);
216  psd1.add<edm::ParameterSetDescription>("MuonTrajectoryUpdatorParameters", psd2);
217  }
218  psd1.add<bool>("EnableRPCMeasurement", true);
219  psd1.add<std::string>("BWSeedType", "fromGenerator");
220  psd1.add<bool>("EnableDTMeasurement", true);
221  psd1.add<edm::InputTag>("RPCRecSegmentLabel", edm::InputTag("hltRpcRecHits"));
222  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
223  psd1.add<bool>("EnableGEMMeasurement", false);
224  psd1.add<edm::InputTag>("GEMRecSegmentLabel", edm::InputTag("gemRecHits"));
225  psd1.add<bool>("EnableME0Measurement", false);
226  psd1.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
227  psd1.add<bool>("EnableCSCMeasurement", true);
228  psd0.add<edm::ParameterSetDescription>("BWFilterParameters", psd1);
229  }
230  psd0.add<bool>("DoSeedRefit", false);
231  desc.add<edm::ParameterSetDescription>("L2TrajBuilderParameters", psd0);
232  }
233  desc.add<bool>("DoSeedRefit", false);
234  {
236  psd0.add<std::string>("Smoother", "hltESPKFTrajectorySmootherForMuonTrackLoader");
237  psd0.add<bool>("DoSmoothing", false);
238  psd0.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
239  {
241  psd1.add<double>("MaxChi2", 1000000.0);
242  psd1.add<std::vector<double>>("BeamSpotPosition",
243  {
244  0.0,
245  0.0,
246  0.0,
247  });
248  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorOpposite");
249  psd1.add<std::vector<double>>("BeamSpotPositionErrors",
250  {
251  0.1,
252  0.1,
253  5.3,
254  });
255  psd0.add<edm::ParameterSetDescription>("MuonUpdatorAtVertexParameters", psd1);
256  }
257  psd0.add<bool>("VertexConstraint", true);
258  psd0.add<std::string>("TTRHBuilder", "hltESPTTRHBWithTrackAngle");
259  desc.add<edm::ParameterSetDescription>("TrackLoaderParameters", psd0);
260  }
261  desc.add<std::string>("MuonTrajectoryBuilder", "Exhaustive");
262  descriptions.add("L2MuonProducer", desc);
263 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
const std::string metname
void produce(edm::Event &, const edm::EventSetup &) override
reconstruct muons
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define LogTrace(id)
L2MuonProducer(const edm::ParameterSet &)
constructor with config
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HLT enums.
~L2MuonProducer() override
destructor
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
Definition: event.py:1