CMS 3D CMS Logo

MuonProducer.cc
Go to the documentation of this file.
1 
8 
13 
14 #ifndef dout
15 #define dout \
16  if (debug_) \
17  std::cout
18 #endif
19 
20 using std::endl;
21 
22 typedef std::map<reco::MuonRef, unsigned int> MuToPFMap;
23 
24 namespace reco {
26 }
27 
30  : debug_(pSet.getUntrackedParameter<bool>("ActivateDebug", false)) {
31  setAlias(pSet.getParameter<std::string>("@module_label"));
32 
33  fastLabelling_ = pSet.getUntrackedParameter<bool>("FastLabelling", true);
34 
36  theMuonsCollectionToken_ = consumes<reco::MuonCollection>(theMuonsCollectionLabel);
37 
38  thePFCandLabel = pSet.getParameter<edm::InputTag>("PFCandidates");
39  thePFCandToken_ = consumes<reco::PFCandidateCollection>(thePFCandLabel);
40 
41  // Variables to switch on-off the differnt parts
42  fillSelectors_ = pSet.getParameter<bool>("FillSelectorMaps");
43  fillCosmicsIdMap_ = pSet.getParameter<bool>("FillCosmicsIdMap");
44  fillPFMomentum_ = pSet.getParameter<bool>("FillPFMomentumAndAssociation");
45  fillPFIsolation_ = pSet.getParameter<bool>("FillPFIsolation");
46  fillDetectorBasedIsolation_ = pSet.getParameter<bool>("FillDetectorBasedIsolation");
47  fillShoweringInfo_ = pSet.getParameter<bool>("FillShoweringInfo");
48  fillTimingInfo_ = pSet.getParameter<bool>("FillTimingInfo");
49  computeStandardSelectors_ = pSet.getParameter<bool>("ComputeStandardSelectors");
50 
51  produces<reco::MuonCollection>();
52 
53  if (fillTimingInfo_) {
54  timeMapCmbToken_ = consumes<reco::MuonTimeExtraMap>(edm::InputTag(theMuonsCollectionLabel.label(), "combined"));
55  timeMapDTToken_ = consumes<reco::MuonTimeExtraMap>(edm::InputTag(theMuonsCollectionLabel.label(), "dt"));
56  timeMapCSCToken_ = consumes<reco::MuonTimeExtraMap>(edm::InputTag(theMuonsCollectionLabel.label(), "csc"));
57 
58  produces<reco::MuonTimeExtraMap>("combined");
59  produces<reco::MuonTimeExtraMap>("dt");
60  produces<reco::MuonTimeExtraMap>("csc");
61  }
62 
64  theTrackDepositName = pSet.getParameter<edm::InputTag>("TrackIsoDeposits");
65  theTrackDepositToken_ = consumes<reco::IsoDepositMap>(theTrackDepositName);
66  produces<reco::IsoDepositMap>(labelOrInstance(theTrackDepositName));
67 
68  theJetDepositName = pSet.getParameter<edm::InputTag>("JetIsoDeposits");
69  theJetDepositToken_ = consumes<reco::IsoDepositMap>(theJetDepositName);
70  produces<reco::IsoDepositMap>(labelOrInstance(theJetDepositName));
71 
72  theEcalDepositName = pSet.getParameter<edm::InputTag>("EcalIsoDeposits");
73  theEcalDepositToken_ = consumes<reco::IsoDepositMap>(theEcalDepositName);
74  produces<reco::IsoDepositMap>(theEcalDepositName.instance());
75 
76  theHcalDepositName = pSet.getParameter<edm::InputTag>("HcalIsoDeposits");
77  theHcalDepositToken_ = consumes<reco::IsoDepositMap>(theHcalDepositName);
78  produces<reco::IsoDepositMap>(theHcalDepositName.instance());
79 
80  theHoDepositName = pSet.getParameter<edm::InputTag>("HoIsoDeposits");
81  theHoDepositToken_ = consumes<reco::IsoDepositMap>(theHoDepositName);
82 
83  produces<reco::IsoDepositMap>(theHoDepositName.instance());
84  }
85 
86  if (fillSelectors_) {
87  theSelectorMapNames = pSet.getParameter<InputTags>("SelectorMaps");
88 
89  for (InputTags::const_iterator tag = theSelectorMapNames.begin(); tag != theSelectorMapNames.end(); ++tag) {
90  theSelectorMapTokens_.push_back(consumes<edm::ValueMap<bool>>(*tag));
91  produces<edm::ValueMap<bool>>(labelOrInstance(*tag));
92  }
93  }
94 
95  if (fillShoweringInfo_) {
96  theShowerMapName = pSet.getParameter<edm::InputTag>("ShowerInfoMap");
97  theShowerMapToken_ = consumes<reco::MuonShowerMap>(theShowerMapName);
98  produces<edm::ValueMap<reco::MuonShower>>(labelOrInstance(theShowerMapName));
99  }
100 
101  if (fillCosmicsIdMap_) {
102  theCosmicCompMapName = pSet.getParameter<edm::InputTag>("CosmicIdMap");
103  theCosmicIdMapToken_ = consumes<edm::ValueMap<unsigned int>>(theCosmicCompMapName);
104  theCosmicCompMapToken_ = consumes<edm::ValueMap<reco::MuonCosmicCompatibility>>(theCosmicCompMapName);
105 
106  produces<edm::ValueMap<reco::MuonCosmicCompatibility>>(labelOrInstance(theCosmicCompMapName));
107  produces<edm::ValueMap<unsigned int>>(labelOrInstance(theCosmicCompMapName));
108  }
109 
111  produces<edm::ValueMap<reco::MuonRef>>(theMuToMuMapName);
112 
113  if (fillPFIsolation_) {
114  edm::ParameterSet pfIsoPSet = pSet.getParameter<edm::ParameterSet>("PFIsolation");
115 
116  //Define a map between the isolation and the PSet for the PFHelper
117  std::map<std::string, edm::ParameterSet> psetMap;
118 
119  //First declare what isolation you are going to read
120  std::vector<std::string> isolationLabels;
121  isolationLabels.push_back("pfIsolationR03");
122  isolationLabels.push_back("pfIsoMeanDRProfileR03");
123  isolationLabels.push_back("pfIsoSumDRProfileR03");
124  isolationLabels.push_back("pfIsolationR04");
125  isolationLabels.push_back("pfIsoMeanDRProfileR04");
126  isolationLabels.push_back("pfIsoSumDRProfileR04");
127 
128  //Fill the label,pet map and initialize MuPFIsoHelper
129  for (std::vector<std::string>::const_iterator label = isolationLabels.begin(); label != isolationLabels.end();
130  ++label)
131  psetMap[*label] = pfIsoPSet.getParameter<edm::ParameterSet>(*label);
132 
133  thePFIsoHelper = new MuPFIsoHelper(psetMap, consumesCollector());
134 
135  //Now loop on the mass read for each PSet the parameters and save them to the mapNames for later
136 
137  for (std::map<std::string, edm::ParameterSet>::const_iterator map = psetMap.begin(); map != psetMap.end(); ++map) {
138  std::map<std::string, edm::InputTag> isoMap;
139  isoMap["chargedParticle"] = map->second.getParameter<edm::InputTag>("chargedParticle");
140  isoMap["chargedHadron"] = map->second.getParameter<edm::InputTag>("chargedHadron");
141  isoMap["neutralHadron"] = map->second.getParameter<edm::InputTag>("neutralHadron");
142  isoMap["neutralHadronHighThreshold"] = map->second.getParameter<edm::InputTag>("neutralHadronHighThreshold");
143  isoMap["photon"] = map->second.getParameter<edm::InputTag>("photon");
144  isoMap["photonHighThreshold"] = map->second.getParameter<edm::InputTag>("photonHighThreshold");
145  isoMap["pu"] = map->second.getParameter<edm::InputTag>("pu");
146 
147  std::map<std::string, edm::EDGetTokenT<edm::ValueMap<double>>> isoMapToken;
148  isoMapToken["chargedParticle"] = consumes<edm::ValueMap<double>>(isoMap["chargedParticle"]);
149  isoMapToken["chargedHadron"] = consumes<edm::ValueMap<double>>(isoMap["chargedHadron"]);
150  isoMapToken["neutralHadron"] = consumes<edm::ValueMap<double>>(isoMap["neutralHadron"]);
151  isoMapToken["neutralHadronHighThreshold"] = consumes<edm::ValueMap<double>>(isoMap["neutralHadronHighThreshold"]);
152  isoMapToken["photon"] = consumes<edm::ValueMap<double>>(isoMap["photon"]);
153  isoMapToken["photonHighThreshold"] = consumes<edm::ValueMap<double>>(isoMap["photonHighThreshold"]);
154  isoMapToken["pu"] = consumes<edm::ValueMap<double>>(isoMap["pu"]);
155 
156  pfIsoMapNames.push_back(isoMap);
157  pfIsoMapTokens_.push_back(isoMapToken);
158  }
159 
160  for (unsigned int j = 0; j < pfIsoMapNames.size(); ++j) {
161  for (std::map<std::string, edm::InputTag>::const_iterator map = pfIsoMapNames.at(j).begin();
162  map != pfIsoMapNames.at(j).end();
163  ++map)
164  produces<edm::ValueMap<double>>(labelOrInstance(map->second));
165  }
166  }
167 
169  vertexes_ = consumes<reco::VertexCollection>(pSet.getParameter<edm::InputTag>("vertices"));
170  }
171 }
172 
176  delete thePFIsoHelper;
177 }
178 
181  const std::string metname = "Muon|RecoMuon|MuonIdentification|MuonProducer";
182 
183  // the muon collection, it will be loaded in the event
184  auto outputMuons = std::make_unique<reco::MuonCollection>();
185  reco::MuonRefProd outputMuonsRefProd = event.getRefBeforePut<reco::MuonCollection>();
186 
188  event.getByToken(theMuonsCollectionToken_, inputMuons);
189  edm::OrphanHandle<reco::MuonCollection> inputMuonsOH(inputMuons.product(), inputMuons.id());
190 
192  event.getByToken(thePFCandToken_, pfCandidates);
193 
195  const reco::Vertex* vertex(nullptr);
197  event.getByToken(vertexes_, primaryVertices);
198  if (!primaryVertices->empty())
199  vertex = &(primaryVertices->front());
200  }
201 
202  // fetch collections for PFIso
203  if (fillPFIsolation_)
205 
206  // Fill timing information
210 
211  int nMuons = inputMuons->size();
212 
213  std::vector<reco::MuonTimeExtra> dtTimeColl(nMuons);
214  std::vector<reco::MuonTimeExtra> cscTimeColl(nMuons);
215  std::vector<reco::MuonTimeExtra> combinedTimeColl(nMuons);
216 
217  if (fillTimingInfo_) {
218  event.getByToken(timeMapCmbToken_, timeMapCmb);
219  event.getByToken(timeMapDTToken_, timeMapDT);
220  event.getByToken(timeMapCSCToken_, timeMapCSC);
221  }
222 
223  std::vector<reco::IsoDeposit> trackDepColl(nMuons);
224  std::vector<reco::IsoDeposit> ecalDepColl(nMuons);
225  std::vector<reco::IsoDeposit> hcalDepColl(nMuons);
226  std::vector<reco::IsoDeposit> hoDepColl(nMuons);
227  std::vector<reco::IsoDeposit> jetDepColl(nMuons);
228 
229  edm::Handle<reco::IsoDepositMap> trackIsoDepMap;
230  edm::Handle<reco::IsoDepositMap> ecalIsoDepMap;
231  edm::Handle<reco::IsoDepositMap> hcalIsoDepMap;
234 
236  event.getByToken(theTrackDepositToken_, trackIsoDepMap);
237  event.getByToken(theEcalDepositToken_, ecalIsoDepMap);
238  event.getByToken(theHcalDepositToken_, hcalIsoDepMap);
239  event.getByToken(theHoDepositToken_, hoIsoDepMap);
240  event.getByToken(theJetDepositToken_, jetIsoDepMap);
241  }
242 
243  std::vector<std::map<std::string, edm::Handle<edm::ValueMap<double>>>> pfIsoMaps;
244  std::vector<std::map<std::string, std::vector<double>>> pfIsoMapVals;
245 
246  if (fillPFIsolation_) {
247  for (unsigned int j = 0; j < pfIsoMapNames.size(); ++j) {
248  std::map<std::string, std::vector<double>> mapVals;
249  std::map<std::string, edm::Handle<edm::ValueMap<double>>> maps;
250  for (std::map<std::string, edm::InputTag>::const_iterator map = pfIsoMapNames.at(j).begin();
251  map != pfIsoMapNames.at(j).end();
252  ++map) {
254  event.getByToken(pfIsoMapTokens_.at(j)[map->first], handleTmp);
255  maps[map->first] = handleTmp;
256  mapVals[map->first].resize(nMuons);
257  }
258  pfIsoMapVals.push_back(mapVals);
259  pfIsoMaps.push_back(maps);
260  }
261  }
262 
263  std::vector<edm::Handle<edm::ValueMap<bool>>> selectorMaps(fillSelectors_ ? theSelectorMapNames.size() : 0);
264  std::vector<std::vector<bool>> selectorMapResults(fillSelectors_ ? theSelectorMapNames.size() : 0);
265  if (fillSelectors_) {
266  unsigned int s = 0;
267  for (InputTags::const_iterator tag = theSelectorMapNames.begin(); tag != theSelectorMapNames.end(); ++tag, ++s) {
268  event.getByToken(theSelectorMapTokens_.at(s), selectorMaps[s]);
269  selectorMapResults[s].resize(nMuons);
270  }
271  }
272 
273  edm::Handle<reco::MuonShowerMap> showerInfoMap;
274  if (fillShoweringInfo_)
275  event.getByToken(theShowerMapToken_, showerInfoMap);
276 
277  std::vector<reco::MuonShower> showerInfoColl(nMuons);
278 
280  if (fillCosmicsIdMap_)
281  event.getByToken(theCosmicIdMapToken_, cosmicIdMap);
282  std::vector<unsigned int> cosmicIdColl(fillCosmicsIdMap_ ? nMuons : 0);
283 
285  if (fillCosmicsIdMap_)
286  event.getByToken(theCosmicCompMapToken_, cosmicCompMap);
287  std::vector<reco::MuonCosmicCompatibility> cosmicCompColl(fillCosmicsIdMap_ ? nMuons : 0);
288 
289  std::vector<reco::MuonRef> muonRefColl(nMuons);
290 
291  if (inputMuons->empty()) {
292  edm::OrphanHandle<reco::MuonCollection> muonHandle = event.put(std::move(outputMuons));
293 
294  if (fillTimingInfo_) {
295  fillMuonMap<reco::MuonTimeExtra>(event, muonHandle, combinedTimeColl, "combined");
296  fillMuonMap<reco::MuonTimeExtra>(event, muonHandle, dtTimeColl, "dt");
297  fillMuonMap<reco::MuonTimeExtra>(event, muonHandle, cscTimeColl, "csc");
298  }
299 
301  fillMuonMap<reco::IsoDeposit>(event, muonHandle, trackDepColl, labelOrInstance(theTrackDepositName));
302  fillMuonMap<reco::IsoDeposit>(event, muonHandle, jetDepColl, labelOrInstance(theJetDepositName));
303  fillMuonMap<reco::IsoDeposit>(event, muonHandle, ecalDepColl, theEcalDepositName.instance());
304  fillMuonMap<reco::IsoDeposit>(event, muonHandle, hcalDepColl, theHcalDepositName.instance());
305  fillMuonMap<reco::IsoDeposit>(event, muonHandle, hoDepColl, theHoDepositName.instance());
306  }
307 
308  if (fillSelectors_) {
309  unsigned int s = 0;
310  for (InputTags::const_iterator tag = theSelectorMapNames.begin(); tag != theSelectorMapNames.end(); ++tag, ++s) {
311  fillMuonMap<bool>(event, muonHandle, selectorMapResults[s], labelOrInstance(*tag));
312  }
313  }
314 
315  if (fillShoweringInfo_)
316  fillMuonMap<reco::MuonShower>(event, muonHandle, showerInfoColl, labelOrInstance(theShowerMapName));
317 
318  if (fillCosmicsIdMap_) {
319  fillMuonMap<unsigned int>(event, muonHandle, cosmicIdColl, labelOrInstance(theCosmicCompMapName));
320  fillMuonMap<reco::MuonCosmicCompatibility>(
321  event, muonHandle, cosmicCompColl, labelOrInstance(theCosmicCompMapName));
322  }
323 
324  fillMuonMap<reco::MuonRef>(event, inputMuonsOH, muonRefColl, theMuToMuMapName);
325 
326  if (fillPFIsolation_) {
327  for (unsigned int j = 0; j < pfIsoMapNames.size(); ++j)
328  for (std::map<std::string, edm::InputTag>::const_iterator map = pfIsoMapNames.at(j).begin();
329  map != pfIsoMapNames.at(j).end();
330  ++map) {
331  fillMuonMap<double>(event, muonHandle, pfIsoMapVals.at(j)[map->first], labelOrInstance(map->second));
332  }
333  }
334  return;
335  }
336 
337  // FIXME: add the option to swith off the Muon-PF "info association".
338 
339  MuToPFMap muToPFMap;
340 
341  if (fillPFMomentum_) {
342  dout << "Number of PFCandidates: " << pfCandidates->size() << endl;
343  for (unsigned int i = 0; i < pfCandidates->size(); ++i)
344  if (abs(pfCandidates->at(i).pdgId()) == 13) {
345  muToPFMap[pfCandidates->at(i).muonRef()] = i;
346  dout << "MuonRef: " << pfCandidates->at(i).muonRef().id() << " " << pfCandidates->at(i).muonRef().key()
347  << " PF p4: " << pfCandidates->at(i).p4() << endl;
348  }
349  dout << "Number of PFMuons: " << muToPFMap.size() << endl;
350  dout << "Number of Muons in the original collection: " << inputMuons->size() << endl;
351  }
352 
353  reco::MuonRef::key_type muIndex = 0;
354  unsigned int i = 0;
355  for (auto const& inMuon : *inputMuons) {
356  reco::MuonRef muRef(inputMuons, muIndex);
357  muonRefColl[i] = reco::MuonRef(outputMuonsRefProd, muIndex++);
358 
359  // Copy the muon
360  reco::Muon outMuon = inMuon;
361 
362  if (fillPFMomentum_) {
363  // search for the corresponding pf candidate
364  MuToPFMap::iterator iter = muToPFMap.find(muRef);
365  if (iter != muToPFMap.end()) {
366  const auto& pfMu = pfCandidates->at(iter->second);
367  outMuon.setPFP4(pfMu.p4());
368  outMuon.setP4(pfMu.p4()); //PF is the default
369  outMuon.setCharge(pfMu.charge()); //PF is the default
370  outMuon.setPdgId(-13 * pfMu.charge());
371  outMuon.setBestTrack(pfMu.bestMuonTrackType());
372  muToPFMap.erase(iter);
373  dout << "MuonRef: " << muRef.id() << " " << muRef.key() << " Is it PF? " << outMuon.isPFMuon()
374  << " PF p4: " << outMuon.pfP4() << endl;
375  }
376 
377  dout << "MuonRef: " << muRef.id() << " " << muRef.key() << " Is it PF? " << outMuon.isPFMuon() << endl;
378 
379  dout << "GLB " << outMuon.isGlobalMuon() << " TM " << outMuon.isTrackerMuon() << " STA "
380  << outMuon.isStandAloneMuon() << " p4 " << outMuon.p4() << endl;
381  }
382 
383  // Add PF isolation info
384  if (fillPFIsolation_) {
385  thePFIsoHelper->embedPFIsolation(outMuon, muRef);
386 
387  for (unsigned int j = 0; j < pfIsoMapNames.size(); ++j) {
388  for (std::map<std::string, edm::InputTag>::const_iterator map = pfIsoMapNames[j].begin();
389  map != pfIsoMapNames[j].end();
390  ++map) {
391  (pfIsoMapVals[j])[map->first][i] = (*pfIsoMaps[j][map->first])[muRef];
392  }
393  }
394  }
395 
396  // Fill timing information
397  if (fillTimingInfo_) {
398  combinedTimeColl[i] = (*timeMapCmb)[muRef];
399  dtTimeColl[i] = (*timeMapDT)[muRef];
400  cscTimeColl[i] = (*timeMapCSC)[muRef];
401  }
402 
404  trackDepColl[i] = (*trackIsoDepMap)[muRef];
405  ecalDepColl[i] = (*ecalIsoDepMap)[muRef];
406  hcalDepColl[i] = (*hcalIsoDepMap)[muRef];
407  hoDepColl[i] = (*hoIsoDepMap)[muRef];
408  jetDepColl[i] = (*jetIsoDepMap)[muRef];
409  ;
410  }
411 
412  if (fillSelectors_) {
413  unsigned int s = 0;
414  for (InputTags::const_iterator tag = theSelectorMapNames.begin(); tag != theSelectorMapNames.end(); ++tag, ++s)
415  selectorMapResults[s][i] = (*selectorMaps[s])[muRef];
416  }
417 
418  // Fill the Showering Info
419  if (fillShoweringInfo_)
420  showerInfoColl[i] = (*showerInfoMap)[muRef];
421 
422  if (fillCosmicsIdMap_) {
423  cosmicIdColl[i] = (*cosmicIdMap)[muRef];
424  cosmicCompColl[i] = (*cosmicCompMap)[muRef];
425  }
426 
427  // Standard Selectors - keep it at the end so that all inputs are available
429  outMuon.setSelectors(0); // reset flags
430  bool isRun2016BCDEF = (272728 <= event.run() && event.run() <= 278808);
431  outMuon.setSelectors(muon::makeSelectorBitset(outMuon, vertex, isRun2016BCDEF));
432  }
433 
434  outputMuons->push_back(outMuon);
435  ++i;
436  }
437 
438  dout << "Number of Muons in the new muon collection: " << outputMuons->size() << endl;
439  edm::OrphanHandle<reco::MuonCollection> muonHandle = event.put(std::move(outputMuons));
440 
441  if (fillTimingInfo_) {
442  fillMuonMap<reco::MuonTimeExtra>(event, muonHandle, combinedTimeColl, "combined");
443  fillMuonMap<reco::MuonTimeExtra>(event, muonHandle, dtTimeColl, "dt");
444  fillMuonMap<reco::MuonTimeExtra>(event, muonHandle, cscTimeColl, "csc");
445  }
446 
448  fillMuonMap<reco::IsoDeposit>(event, muonHandle, trackDepColl, labelOrInstance(theTrackDepositName));
449  fillMuonMap<reco::IsoDeposit>(event, muonHandle, jetDepColl, labelOrInstance(theJetDepositName));
450  fillMuonMap<reco::IsoDeposit>(event, muonHandle, ecalDepColl, theEcalDepositName.instance());
451  fillMuonMap<reco::IsoDeposit>(event, muonHandle, hcalDepColl, theHcalDepositName.instance());
452  fillMuonMap<reco::IsoDeposit>(event, muonHandle, hoDepColl, theHoDepositName.instance());
453  }
454 
455  if (fillPFIsolation_) {
456  for (unsigned int j = 0; j < pfIsoMapNames.size(); ++j) {
457  for (std::map<std::string, edm::InputTag>::const_iterator map = pfIsoMapNames[j].begin();
458  map != pfIsoMapNames[j].end();
459  ++map)
460  fillMuonMap<double>(event, muonHandle, pfIsoMapVals[j][map->first], labelOrInstance(map->second));
461  }
462  }
463 
464  if (fillSelectors_) {
465  unsigned int s = 0;
466  for (InputTags::const_iterator tag = theSelectorMapNames.begin(); tag != theSelectorMapNames.end(); ++tag, ++s)
467  fillMuonMap<bool>(event, muonHandle, selectorMapResults[s], labelOrInstance(*tag));
468  }
469 
470  if (fillShoweringInfo_)
471  fillMuonMap<reco::MuonShower>(event, muonHandle, showerInfoColl, labelOrInstance(theShowerMapName));
472 
473  if (fillCosmicsIdMap_) {
474  fillMuonMap<unsigned int>(event, muonHandle, cosmicIdColl, labelOrInstance(theCosmicCompMapName));
475  fillMuonMap<reco::MuonCosmicCompatibility>(
476  event, muonHandle, cosmicCompColl, labelOrInstance(theCosmicCompMapName));
477  }
478 
479  fillMuonMap<reco::MuonRef>(event, inputMuonsOH, muonRefColl, theMuToMuMapName);
480 }
481 
482 template <typename TYPE>
484  const edm::OrphanHandle<reco::MuonCollection>& muonHandle,
485  const std::vector<TYPE>& muonExtra,
486  const std::string& label) {
487  typedef typename edm::ValueMap<TYPE>::Filler FILLER;
488 
489  auto muonMap = std::make_unique<edm::ValueMap<TYPE>>();
490  if (!muonExtra.empty()) {
491  FILLER filler(*muonMap);
492  filler.insert(muonHandle, muonExtra.begin(), muonExtra.end());
493  filler.fill();
494  }
495  event.put(std::move(muonMap), label);
496 }
497 
499  if (fastLabelling_)
500  return input.label();
501 
502  return input.label() != theMuonsCollectionLabel.label() ? input.label() : input.instance();
503 }
std::string labelOrInstance(const edm::InputTag &) const
edm::EDGetTokenT< reco::MuonTimeExtraMap > timeMapCSCToken_
Definition: MuonProducer.h:126
edm::InputTag theTrackDepositName
Definition: MuonProducer.h:99
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
edm::EDGetTokenT< edm::ValueMap< unsigned int > > theCosmicIdMapToken_
Definition: MuonProducer.h:118
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
edm::EDGetTokenT< reco::MuonTimeExtraMap > timeMapDTToken_
Definition: MuonProducer.h:125
const std::string metname
std::string const & instance() const
Definition: InputTag.h:37
std::vector< std::map< std::string, edm::EDGetTokenT< edm::ValueMap< double > > > > pfIsoMapTokens_
Definition: MuonProducer.h:129
bool fillSelectors_
Definition: MuonProducer.h:90
#define dout
Definition: MuonProducer.cc:15
std::string theAlias
Definition: MuonProducer.h:69
edm::EDGetTokenT< edm::ValueMap< reco::MuonShower > > theShowerMapToken_
Definition: MuonProducer.h:115
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag theEcalDepositName
Definition: MuonProducer.h:100
reco::Muon::Selector makeSelectorBitset(reco::Muon const &muon, reco::Vertex const *vertex=nullptr, bool run2016_hip_mitigation=false)
void produce(edm::Event &, const edm::EventSetup &) override
reconstruct muons
std::vector< edm::EDGetTokenT< edm::ValueMap< bool > > > theSelectorMapTokens_
Definition: MuonProducer.h:112
edm::EDGetTokenT< reco::IsoDepositMap > theJetDepositToken_
Definition: MuonProducer.h:109
const LorentzVector & p4() const final
four-momentum Lorentz vector
std::map< reco::MuonRef, unsigned int > MuToPFMap
Definition: MuonProducer.cc:22
key_type key() const
Accessor for product key.
Definition: Ref.h:250
bool isTrackerMuon() const override
Definition: Muon.h:303
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
bool fillCosmicsIdMap_
Definition: MuonProducer.h:91
edm::ValueMap< reco::MuonShower > MuonShowerMap
Definition: MuonProducer.cc:25
static std::string const input
Definition: EdmProvDump.cc:47
edm::EDGetTokenT< reco::IsoDepositMap > theHoDepositToken_
Definition: MuonProducer.h:108
edm::InputTag thePFCandLabel
Definition: MuonProducer.h:85
T getUntrackedParameter(std::string const &, T const &) const
void setCharge(Charge q) final
set electric charge
edm::EDGetTokenT< reco::PFCandidateCollection > thePFCandToken_
Definition: MuonProducer.h:86
char const * label
void fillMuonMap(edm::Event &event, const edm::OrphanHandle< reco::MuonCollection > &muonHandle, const std::vector< TYPE > &muonExtra, const std::string &label)
reco::Candidate::LorentzVector pfP4() const
Definition: Muon.h:97
void setSelectors(uint64_t selectors)
Definition: Muon.h:243
edm::EDGetTokenT< reco::IsoDepositMap > theTrackDepositToken_
Definition: MuonProducer.h:105
bool fillDetectorBasedIsolation_
Definition: MuonProducer.h:94
void setAlias(std::string alias)
Definition: MuonProducer.h:71
bool isPFMuon() const
Definition: Muon.h:306
edm::InputTag theMuonsCollectionLabel
Definition: MuonProducer.h:82
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
Definition: MuonFwd.h:13
edm::InputTag theShowerMapName
Definition: MuonProducer.h:114
edm::EDGetTokenT< reco::MuonTimeExtraMap > timeMapCmbToken_
Definition: MuonProducer.h:124
edm::InputTag theHoDepositName
Definition: MuonProducer.h:102
bool fillTimingInfo_
Definition: MuonProducer.h:96
edm::EDGetTokenT< reco::VertexCollection > vertexes_
Definition: MuonProducer.h:131
bool computeStandardSelectors_
Definition: MuonProducer.h:97
std::vector< edm::InputTag > InputTags
Definition: MuonProducer.h:59
bool fillPFIsolation_
Definition: MuonProducer.h:93
InputTags theSelectorMapNames
Definition: MuonProducer.h:111
edm::EDGetTokenT< reco::MuonCollection > theMuonsCollectionToken_
Definition: MuonProducer.h:83
std::string theMuToMuMapName
Definition: MuonProducer.h:120
bool fillShoweringInfo_
Definition: MuonProducer.h:95
edm::EDGetTokenT< reco::IsoDepositMap > theEcalDepositToken_
Definition: MuonProducer.h:106
int embedPFIsolation(reco::Muon &, reco::MuonRef &)
edm::EDGetTokenT< edm::ValueMap< reco::MuonCosmicCompatibility > > theCosmicCompMapToken_
Definition: MuonProducer.h:119
MuPFIsoHelper * thePFIsoHelper
Definition: MuonProducer.h:122
void beginEvent(const edm::Event &iEvent)
std::vector< std::map< std::string, edm::InputTag > > pfIsoMapNames
Definition: MuonProducer.h:128
fixed size matrix
virtual void setBestTrack(MuonTrackType muonType)
Definition: Muon.h:86
edm::EDGetTokenT< reco::IsoDepositMap > theHcalDepositToken_
Definition: MuonProducer.h:107
edm::InputTag theCosmicCompMapName
Definition: MuonProducer.h:117
MuonProducer(const edm::ParameterSet &)
Constructor.
Definition: MuonProducer.cc:29
bool fastLabelling_
Definition: MuonProducer.h:80
virtual void setPFP4(const reco::Candidate::LorentzVector &p4_)
edm::InputTag theHcalDepositName
Definition: MuonProducer.h:101
bool fillPFMomentum_
Definition: MuonProducer.h:92
~MuonProducer() override
Destructor.
void setPdgId(int pdgId) final
edm::InputTag theJetDepositName
Definition: MuonProducer.h:103
bool isGlobalMuon() const override
Definition: Muon.h:302
void setP4(const LorentzVector &p4) final
set 4-momentum
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
bool isStandAloneMuon() const override
Definition: Muon.h:304