CMS 3D CMS Logo

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