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.existsAs<string>("MuonTrajectoryBuilder")
95  ? parameterSet.getParameter<string>("MuonTrajectoryBuilder")
96  : "StandAloneMuonTrajectoryBuilder";
97  if (typeOfBuilder == "StandAloneMuonTrajectoryBuilder" || typeOfBuilder.empty())
98  trajectoryBuilder =
99  std::make_unique<StandAloneMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
100  else if (typeOfBuilder == "Exhaustive")
101  trajectoryBuilder =
102  std::make_unique<ExhaustiveMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
103  else {
104  edm::LogWarning("Muon|RecoMuon|StandAloneMuonProducer")
105  << "No Trajectory builder associated with " << typeOfBuilder
106  << ". Falling down to the default (StandAloneMuonTrajectoryBuilder)";
107  trajectoryBuilder =
108  std::make_unique<StandAloneMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
109  }
111  std::make_unique<MuonTrackFinder>(std::move(trajectoryBuilder),
112  std::make_unique<MuonTrackLoader>(trackLoaderParameters, iC, theService.get()),
113  std::make_unique<MuonTrajectoryCleaner>(true),
114  iC);
115 
116  produces<reco::TrackCollection>();
117  produces<reco::TrackCollection>("UpdatedAtVtx");
118  produces<TrackingRecHitCollection>();
119  produces<reco::TrackExtraCollection>();
120  produces<reco::TrackToTrackMap>();
121 
122  produces<std::vector<Trajectory>>();
123  produces<TrajTrackAssociationCollection>();
124 
125  produces<edm::AssociationMap<edm::OneToMany<std::vector<L2MuonTrajectorySeed>, std::vector<L2MuonTrajectorySeed>>>>();
126 }
127 
130  LogTrace("Muon|RecoMuon|L2eMuonProducer") << "L2MuonProducer destructor called" << endl;
131 }
132 
135  const std::string metname = "Muon|RecoMuon|L2MuonProducer";
136 
137  LogTrace(metname) << endl << endl << endl;
138  LogTrace(metname) << "L2 Muon Reconstruction Started" << endl;
139 
140  // Take the seeds container
141  LogTrace(metname) << "Taking the seeds: " << theSeedCollectionLabel.label() << endl;
143  event.getByToken(seedsToken, seeds);
144 
145  // Update the services
146  theService->update(eventSetup);
147 
148  // Reconstruct
149  LogTrace(metname) << "Track Reconstruction" << endl;
150  theTrackFinder->reconstruct(seeds, event, eventSetup);
151 
152  LogTrace(metname) << "edm::Event loaded"
153  << "================================" << endl
154  << endl;
155 }
156 
159  {
161  psd0.addUntracked<std::vector<std::string>>("Propagators",
162  {
163  "hltESPFastSteppingHelixPropagatorAny"
164  "hltESPFastSteppingHelixPropagatorOpposite",
165  });
166  psd0.add<bool>("RPCLayers", true);
167  psd0.addUntracked<bool>("UseMuonNavigation", true);
168  desc.add<edm::ParameterSetDescription>("ServiceParameters", psd0);
169  }
170 
171  desc.add<edm::InputTag>("InputObjects", edm::InputTag("hltL2MuonSeeds"));
172  {
174  psd0.add<std::string>("Fitter", "hltESPKFFittingSmootherForL2Muon");
175  psd0.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
176  psd0.add<unsigned int>("NMinRecHits", 2);
177  psd0.add<bool>("UseSubRecHits", false);
178  psd0.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
179  psd0.add<double>("RescaleError", 100.0);
180  desc.add<edm::ParameterSetDescription>("SeedTransformerParameters", psd0);
181  }
182 
183  {
185  psd0.add<bool>("DoRefit", false);
186  psd0.add<std::string>("SeedPropagator", "hltESPFastSteppingHelixPropagatorAny");
187  {
189  psd1.add<double>("NumberOfSigma", 3.0);
190  psd1.add<std::string>("FitDirection", "insideOut");
191  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
192  psd1.add<double>("MaxChi2", 1000.0);
193  {
195  psd2.add<double>("MaxChi2", 25.0);
196  psd2.add<double>("RescaleErrorFactor", 100.0);
197  psd2.add<int>("Granularity", 0);
198  psd2.add<bool>("ExcludeRPCFromFit", false);
199  psd2.add<bool>("UseInvalidHits", true);
200  psd2.add<bool>("RescaleError", false);
201  psd1.add<edm::ParameterSetDescription>("MuonTrajectoryUpdatorParameters", psd2);
202  }
203  psd1.add<bool>("EnableRPCMeasurement", true);
204  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
205  psd1.add<bool>("EnableDTMeasurement", true);
206  psd1.add<edm::InputTag>("RPCRecSegmentLabel", edm::InputTag("hltRpcRecHits"));
207  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
208  psd1.add<bool>("EnableGEMMeasurement", false);
209  psd1.add<edm::InputTag>("GEMRecSegmentLabel", edm::InputTag("gemRecHits"));
210  psd1.add<bool>("EnableME0Measurement", false);
211  psd1.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
212  psd1.add<bool>("EnableCSCMeasurement", true);
213  psd0.add<edm::ParameterSetDescription>("FilterParameters", psd1);
214  }
215  psd0.add<std::string>("NavigationType", "Standard");
216  {
218  psd1.add<std::string>("Fitter", "hltESPKFFittingSmootherForL2Muon");
219  psd1.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
220  psd1.add<unsigned int>("NMinRecHits", 2);
221  psd1.add<bool>("UseSubRecHits", false);
222  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
223  psd1.add<double>("RescaleError", 100.0);
224  psd0.add<edm::ParameterSetDescription>("SeedTransformerParameters", psd1);
225  }
226  psd0.add<bool>("DoBackwardFilter", true);
227  psd0.add<std::string>("SeedPosition", "in");
228  {
230  psd1.add<double>("NumberOfSigma", 3.0);
231  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
232  psd1.add<std::string>("FitDirection", "outsideIn");
233  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
234  psd1.add<double>("MaxChi2", 100.0);
235  {
237  psd2.add<double>("MaxChi2", 25.0);
238  psd2.add<double>("RescaleErrorFactor", 100.0);
239  psd2.add<int>("Granularity", 0);
240  psd2.add<bool>("ExcludeRPCFromFit", false);
241  psd2.add<bool>("UseInvalidHits", true);
242  psd2.add<bool>("RescaleError", false);
243  psd1.add<edm::ParameterSetDescription>("MuonTrajectoryUpdatorParameters", psd2);
244  }
245  psd1.add<bool>("EnableRPCMeasurement", true);
246  psd1.add<std::string>("BWSeedType", "fromGenerator");
247  psd1.add<bool>("EnableDTMeasurement", true);
248  psd1.add<edm::InputTag>("RPCRecSegmentLabel", edm::InputTag("hltRpcRecHits"));
249  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
250  psd1.add<bool>("EnableGEMMeasurement", false);
251  psd1.add<edm::InputTag>("GEMRecSegmentLabel", edm::InputTag("gemRecHits"));
252  psd1.add<bool>("EnableME0Measurement", false);
253  psd1.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
254  psd1.add<bool>("EnableCSCMeasurement", true);
255  psd0.add<edm::ParameterSetDescription>("BWFilterParameters", psd1);
256  }
257  psd0.add<bool>("DoSeedRefit", false);
258  desc.add<edm::ParameterSetDescription>("L2TrajBuilderParameters", psd0);
259  }
260  desc.add<bool>("DoSeedRefit", false);
261  {
263  psd0.add<std::string>("Smoother", "hltESPKFTrajectorySmootherForMuonTrackLoader");
264  psd0.add<bool>("DoSmoothing", false);
265  psd0.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
266  {
268  psd1.add<double>("MaxChi2", 1000000.0);
269  psd1.add<std::vector<double>>("BeamSpotPosition",
270  {
271  0.0,
272  0.0,
273  0.0,
274  });
275  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorOpposite");
276  psd1.add<std::vector<double>>("BeamSpotPositionErrors",
277  {
278  0.1,
279  0.1,
280  5.3,
281  });
282  psd0.add<edm::ParameterSetDescription>("MuonUpdatorAtVertexParameters", psd1);
283  }
284  psd0.add<bool>("VertexConstraint", true);
285  psd0.add<std::string>("TTRHBuilder", "hltESPTTRHBWithTrackAngle");
286  desc.add<edm::ParameterSetDescription>("TrackLoaderParameters", psd0);
287  }
288  desc.add<std::string>("MuonTrajectoryBuilder", "Exhaustive");
289  descriptions.add("L2MuonProducer", desc);
290 }
291 
292 // declare as a framework plugin
ConfigurationDescriptions.h
Handle.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
MuonTrajectoryCleaner.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
edm::Handle
Definition: AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
L2MuonProducer::theService
std::unique_ptr< MuonServiceProxy > theService
the event setup proxy, it takes care the services update
Definition: L2MuonProducer.cc:65
L2MuonTrajectorySeedCollection.h
MakerMacros.h
Track.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
MuonTrackLoader.h
L2MuonProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
reconstruct muons
Definition: L2MuonProducer.cc:134
L2MuonProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: L2MuonProducer.cc:157
ParameterSetDescription.h
TrajTrackAssociation.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
MuonTrackFinder.h
edm::stream::EDProducer
Definition: EDProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
L2MuonProducer::~L2MuonProducer
~L2MuonProducer() override
destructor
Definition: L2MuonProducer.cc:129
TrajectorySeedCollection.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
InputTag.h
ExhaustiveMuonTrajectoryBuilder.h
L2MuonProducer::theTrackFinder
std::unique_ptr< MuonTrackFinder > theTrackFinder
the track finder
Definition: L2MuonProducer.cc:62
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetachedQuadStep_cff.seeds
seeds
Definition: DetachedQuadStep_cff.py:195
L2MuonProducer::seedsToken
edm::EDGetTokenT< edm::View< TrajectorySeed > > seedsToken
Definition: L2MuonProducer.cc:67
L2MuonProducer::L2MuonProducer
L2MuonProducer(const edm::ParameterSet &)
constructor with config
Definition: L2MuonProducer.cc:71
MuonServiceProxy.h
L2MuonProducer::theSeedCollectionLabel
edm::InputTag theSeedCollectionLabel
Definition: L2MuonProducer.cc:59
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ConsumesCollector.h
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
View.h
ParameterSet.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
TrackToTrackMap.h
StandAloneTrajectoryBuilder.h
L2MuonProducer
Definition: L2MuonProducer.cc:45
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40