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") : "StandAloneMuonTrajectoryBuilder";
73  if(typeOfBuilder == "StandAloneMuonTrajectoryBuilder" || typeOfBuilder == "")
74  trajectoryBuilder = new StandAloneMuonTrajectoryBuilder(trajectoryBuilderParameters,theService,iC);
75  else if(typeOfBuilder == "Exhaustive")
76  trajectoryBuilder = new ExhaustiveMuonTrajectoryBuilder(trajectoryBuilderParameters,theService,iC);
77  else{
78  LogWarning("Muon|RecoMuon|StandAloneMuonProducer") << "No Trajectory builder associated with "<<typeOfBuilder
79  << ". Falling down to the default (StandAloneMuonTrajectoryBuilder)";
80  trajectoryBuilder = new StandAloneMuonTrajectoryBuilder(trajectoryBuilderParameters,theService,iC);
81  }
82  theTrackFinder = new MuonTrackFinder(trajectoryBuilder,
83  new MuonTrackLoader(trackLoaderParameters, iC, theService),
84  new MuonTrajectoryCleaner(true));
85 
86  produces<reco::TrackCollection>();
87  produces<reco::TrackCollection>("UpdatedAtVtx");
88  produces<TrackingRecHitCollection>();
89  produces<reco::TrackExtraCollection>();
90  produces<reco::TrackToTrackMap>();
91 
92  produces<std::vector<Trajectory> >();
93  produces<TrajTrackAssociationCollection>();
94 
95  produces<edm::AssociationMap<edm::OneToMany<std::vector<L2MuonTrajectorySeed>, std::vector<L2MuonTrajectorySeed> > > >();
96 }
97 
100  LogTrace("Muon|RecoMuon|L2eMuonProducer")<<"L2MuonProducer destructor called"<<endl;
101  delete theService;
102  delete theTrackFinder;
103 }
104 
105 
107 void L2MuonProducer::produce(Event& event, const EventSetup& eventSetup){
108 
109  const std::string metname = "Muon|RecoMuon|L2MuonProducer";
110 
111  LogTrace(metname)<<endl<<endl<<endl;
112  LogTrace(metname)<<"L2 Muon Reconstruction Started"<<endl;
113 
114  // Take the seeds container
115  LogTrace(metname)<<"Taking the seeds: "<<theSeedCollectionLabel.label()<<endl;
117  event.getByToken(seedsToken,seeds);
118 
119  // Update the services
120  theService->update(eventSetup);
121 
122  // Reconstruct
123  LogTrace(metname)<<"Track Reconstruction"<<endl;
124  theTrackFinder->reconstruct(seeds,event, eventSetup);
125 
126  LogTrace(metname)<<"Event loaded"
127  <<"================================"
128  <<endl<<endl;
129 }
130 
133  {
135  psd0.addUntracked<std::vector<std::string>>("Propagators", {
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 
145  desc.add<edm::InputTag>("InputObjects", edm::InputTag("hltL2MuonSeeds"));
146  {
148  psd0.add<std::string>("Fitter", "hltESPKFFittingSmootherForL2Muon");
149  psd0.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
150  psd0.add<unsigned int>("NMinRecHits",2);
151  psd0.add<bool>("UseSubRecHits", false);
152  psd0.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
153  psd0.add<double>("RescaleError", 100.0);
154  desc.add<edm::ParameterSetDescription>("SeedTransformerParameters", psd0);
155  }
156 
157  {
159  psd0.add<bool>("DoRefit", false);
160  psd0.add<std::string>("SeedPropagator", "hltESPFastSteppingHelixPropagatorAny");
161  {
163  psd1.add<double>("NumberOfSigma", 3.0);
164  psd1.add<std::string>("FitDirection", "insideOut");
165  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
166  psd1.add<double>("MaxChi2", 1000.0);
167  {
169  psd2.add<double>("MaxChi2", 25.0);
170  psd2.add<double>("RescaleErrorFactor", 100.0);
171  psd2.add<int>("Granularity", 0);
172  psd2.add<bool>("ExcludeRPCFromFit", false);
173  psd2.add<bool>("UseInvalidHits", true);
174  psd2.add<bool>("RescaleError", false);
175  psd1.add<edm::ParameterSetDescription>("MuonTrajectoryUpdatorParameters", psd2);
176  }
177  psd1.add<bool>("EnableRPCMeasurement", true);
178  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
179  psd1.add<bool>("EnableDTMeasurement", true);
180  psd1.add<edm::InputTag>("RPCRecSegmentLabel", edm::InputTag("hltRpcRecHits"));
181  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
182  psd1.add<bool>("EnableGEMMeasurement", false);
183  psd1.add<edm::InputTag>("GEMRecSegmentLabel", edm::InputTag("gemRecHits"));
184  psd1.add<bool>("EnableME0Measurement", false);
185  psd1.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
186  psd1.add<bool>("EnableCSCMeasurement", true);
187  psd0.add<edm::ParameterSetDescription>("FilterParameters", psd1);
188  }
189  psd0.add<std::string>("NavigationType", "Standard");
190  {
192  psd1.add<std::string>("Fitter", "hltESPKFFittingSmootherForL2Muon");
193  psd1.add<std::string>("MuonRecHitBuilder", "hltESPMuonTransientTrackingRecHitBuilder");
194  psd1.add<unsigned int>("NMinRecHits",2);
195  psd1.add<bool>("UseSubRecHits", false);
196  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
197  psd1.add<double>("RescaleError", 100.0);
198  psd0.add<edm::ParameterSetDescription>("SeedTransformerParameters", psd1);
199  }
200  psd0.add<bool>("DoBackwardFilter", true);
201  psd0.add<std::string>("SeedPosition", "in");
202  {
204  psd1.add<double>("NumberOfSigma", 3.0);
205  psd1.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("hltCscSegments"));
206  psd1.add<std::string>("FitDirection", "outsideIn");
207  psd1.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("hltDt4DSegments"));
208  psd1.add<double>("MaxChi2", 100.0);
209  {
211  psd2.add<double>("MaxChi2", 25.0);
212  psd2.add<double>("RescaleErrorFactor", 100.0);
213  psd2.add<int>("Granularity", 0);
214  psd2.add<bool>("ExcludeRPCFromFit", false);
215  psd2.add<bool>("UseInvalidHits", true);
216  psd2.add<bool>("RescaleError", false);
217  psd1.add<edm::ParameterSetDescription>("MuonTrajectoryUpdatorParameters", psd2);
218  }
219  psd1.add<bool>("EnableRPCMeasurement", true);
220  psd1.add<std::string>("BWSeedType", "fromGenerator");
221  psd1.add<bool>("EnableDTMeasurement", true);
222  psd1.add<edm::InputTag>("RPCRecSegmentLabel", edm::InputTag("hltRpcRecHits"));
223  psd1.add<std::string>("Propagator", "hltESPFastSteppingHelixPropagatorAny");
224  psd1.add<bool>("EnableGEMMeasurement", false);
225  psd1.add<edm::InputTag>("GEMRecSegmentLabel", edm::InputTag("gemRecHits"));
226  psd1.add<bool>("EnableME0Measurement", false);
227  psd1.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
228  psd1.add<bool>("EnableCSCMeasurement", true);
229  psd0.add<edm::ParameterSetDescription>("BWFilterParameters", psd1);
230  }
231  psd0.add<bool>("DoSeedRefit", false);
232  desc.add<edm::ParameterSetDescription>("L2TrajBuilderParameters", psd0);
233  }
234  desc.add<bool>("DoSeedRefit", false);
235  {
237  psd0.add<std::string>("Smoother", "hltESPKFTrajectorySmootherForMuonTrackLoader");
238  psd0.add<bool>("DoSmoothing", false);
239  psd0.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
240  {
242  psd1.add<double>("MaxChi2", 1000000.0);
243  psd1.add<std::vector<double>>("BeamSpotPosition", {
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  0.1,
251  0.1,
252  5.3,
253  });
254  psd0.add<edm::ParameterSetDescription>("MuonUpdatorAtVertexParameters", psd1);
255  }
256  psd0.add<bool>("VertexConstraint", true);
257  psd0.add<std::string>("TTRHBuilder", "hltESPTTRHBWithTrackAngle");
258  desc.add<edm::ParameterSetDescription>("TrackLoaderParameters", psd0);
259  }
260  desc.add<std::string>("MuonTrajectoryBuilder", "Exhaustive");
261  descriptions.add("L2MuonProducer", desc);
262 }
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:185
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