32 #include <boost/foreach.hpp>
33 #define foreach BOOST_FOREACH
36 #define dout if(debug_) std::cout
41 typedef std::map<reco::MuonRef, reco::Candidate::LorentzVector>
MuToPFMap;
69 produces<reco::MuonCollection>();
72 produces<reco::MuonTimeExtraMap>(
"combined");
73 produces<reco::MuonTimeExtraMap>(
"dt");
74 produces<reco::MuonTimeExtraMap>(
"csc");
77 if (fillDetectorBasedIsolation_){
83 produces<reco::IsoDepositMap>(theEcalDepositName.instance());
85 produces<reco::IsoDepositMap>(theHcalDepositName.instance());
87 produces<reco::IsoDepositMap>(theHoDepositName.instance());
97 if(fillShoweringInfo_){
102 if(fillCosmicsIdMap_){
111 if(fillPFIsolation_){
124 theIsoPF04MapNames[
"chargedHadron"] = isoCfg04.getParameter<
edm::InputTag>(
"chargedHadron");
125 theIsoPF04MapNames[
"neutralHadron"] = isoCfg04.getParameter<
edm::InputTag>(
"neutralHadron");
126 theIsoPF04MapNames[
"photon"] = isoCfg04.getParameter<
edm::InputTag>(
"photon");
127 theIsoPF04MapNames[
"pu"] = isoCfg04.getParameter<
edm::InputTag>(
"pu");
129 for(std::map<std::string,edm::InputTag>::const_iterator
map = theIsoPF03MapNames.begin();
map != theIsoPF03MapNames.end(); ++
map)
132 for(std::map<std::string,edm::InputTag>::const_iterator
map = theIsoPF04MapNames.begin();
map != theIsoPF04MapNames.end(); ++
map)
146 const std::string
metname =
"Muon|RecoMuon|MuonIdentification|MuonProducer";
169 int nMuons=inputMuons->size();
171 std::vector<reco::MuonTimeExtra> dtTimeColl(nMuons);
172 std::vector<reco::MuonTimeExtra> cscTimeColl(nMuons);
173 std::vector<reco::MuonTimeExtra> combinedTimeColl(nMuons);
181 std::vector<reco::IsoDeposit> trackDepColl(nMuons);
182 std::vector<reco::IsoDeposit> ecalDepColl(nMuons);
183 std::vector<reco::IsoDeposit> hcalDepColl(nMuons);
184 std::vector<reco::IsoDeposit> hoDepColl(nMuons);
185 std::vector<reco::IsoDeposit> jetDepColl(nMuons);
203 std::map<std::string,edm::Handle<edm::ValueMap<double> > > pfIso03Maps;
204 std::map<std::string,std::vector<double> > pfIso03MapVals;
205 std::map<std::string,edm::Handle<edm::ValueMap<double> > > pfIso04Maps;
206 std::map<std::string,std::vector<double> > pfIso04MapVals;
210 event.getByLabel(
map->second,pfIso03Maps[
map->first]);
211 pfIso03MapVals[
map->first].resize(nMuons);
214 event.getByLabel(
map->second,pfIso04Maps[
map->first]);
215 pfIso04MapVals[
map->first].resize(nMuons);
224 event.getByLabel(*
tag,selectorMaps[s]);
225 selectorMapResults[
s].resize(nMuons);
232 std::vector<reco::MuonShower> showerInfoColl(nMuons);
240 std::vector<reco::MuonCosmicCompatibility> cosmicCompColl(
fillCosmicsIdMap_ ? nMuons : 0);
243 std::vector<reco::MuonRef> muonRefColl(nMuons);
247 if(inputMuons->empty()) {
251 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, combinedTimeColl,
"combined");
252 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, dtTimeColl,
"dt");
253 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, cscTimeColl,
"csc");
297 dout <<
"Number of PFCandidates: " << pfCandidates->size() << endl;
300 muToPFMap[pfCand.
muonRef()] = pfCand.
p4();
303 dout <<
"Number of PFMuons: " << muToPFMap.size() << endl;
304 dout <<
"Number of Muons in the original collection: " << inputMuons->size() << endl;
309 foreach(
const reco::Muon &inMuon, *inputMuons){
319 MuToPFMap::iterator iter = muToPFMap.find(muRef);
320 if(iter != muToPFMap.end()){
322 muToPFMap.erase(iter);
323 dout <<
"MuonRef: " << muRef.
id() <<
" " << muRef.
key()
324 <<
" Is it PF? " << outMuon.
isPFMuon()
325 <<
" PF p4: " << outMuon.
pfP4() << endl;
329 dout <<
"MuonRef: " << muRef.
id() <<
" " << muRef.
key()
330 <<
" Is it PF? " << outMuon.
isPFMuon() << endl;
335 <<
" p4 " << outMuon.
p4() << endl;
342 pfIso03MapVals[
map->first][i] = (*pfIso03Maps[
map->first])[muRef];
344 pfIso04MapVals[
map->first][i] = (*pfIso04Maps[
map->first])[muRef];
350 combinedTimeColl[
i] = (*timeMapCmb)[muRef];
351 dtTimeColl[
i] = (*timeMapDT)[muRef];
352 cscTimeColl[
i] = (*timeMapCSC)[muRef];
356 trackDepColl[
i] = (*trackIsoDepMap)[muRef];
357 ecalDepColl[
i] = (*ecalIsoDepMap)[muRef];
358 hcalDepColl[
i] = (*hcalIsoDepMap)[muRef];
359 hoDepColl[
i] = (*hoIsoDepMap)[muRef];
360 jetDepColl[
i] = (*jetIsoDepMap)[muRef];;
367 selectorMapResults[s][i] = (*selectorMaps[s])[muRef];
374 cosmicIdColl[
i] = (*cosmicIdMap)[muRef];
375 cosmicCompColl[
i] = (*cosmicCompMap)[muRef];
378 outputMuons->push_back(outMuon);
382 dout <<
"Number of Muons in the new muon collection: " << outputMuons->size() << endl;
386 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, combinedTimeColl,
"combined");
387 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, dtTimeColl,
"dt");
388 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, cscTimeColl,
"csc");
426 template<
typename TYPE>
429 const std::vector<TYPE>& muonExtra,
430 const std::string&
label){
435 if(!muonExtra.empty()){
436 FILLER filler(*muonMap);
437 filler.insert(muonHandle, muonExtra.begin(), muonExtra.end());
440 event.put(muonMap,label);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual int pdgId() const
PDG identifier.
edm::InputTag theTrackDepositName
std::map< reco::MuonRef, reco::Candidate::LorentzVector > MuToPFMap
const std::string metname
virtual ~MuonProducer()
Destructor.
bool isTrackerMuon() const
bool isGlobalMuon() const
edm::InputTag theEcalDepositName
bool isStandAloneMuon() const
reco::Candidate::LorentzVector pfP4() const
std::vector< Muon > MuonCollection
collection of Muon objects
edm::ValueMap< reco::MuonShower > MuonShowerMap
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
edm::InputTag thePFCandLabel
std::map< std::string, edm::InputTag > theIsoPF03MapNames
void fillMuonMap(edm::Event &event, const edm::OrphanHandle< reco::MuonCollection > &muonHandle, const std::vector< TYPE > &muonExtra, const std::string &label)
bool fillDetectorBasedIsolation_
void setAlias(std::string alias)
TypeLabelItem const & produces()
declare what type of product will make and with which optional label
edm::InputTag theMuonsCollectionLabel
std::string labelOrInstance(const edm::InputTag &) const
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
edm::InputTag theShowerMapName
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::InputTag theHoDepositName
reco::MuonRef muonRef() const
std::vector< edm::InputTag > InputTags
InputTags theSelectorMapNames
std::string theMuToMuMapName
int embedPFIsolation(reco::Muon &, reco::MuonRef &)
std::map< std::string, edm::InputTag > theIsoPF04MapNames
key_type key() const
Accessor for product key.
virtual void produce(edm::Event &, const edm::EventSetup &)
reconstruct muons
MuPFIsoHelper * thePFIsoHelper
void beginEvent(const edm::Event &iEvent)
Particle reconstructed by the particle flow algorithm.
edm::InputTag theCosmicCompMapName
MuonProducer(const edm::ParameterSet &)
Constructor.
edm::InputTag theHcalDepositName
virtual void setPFP4(const reco::Candidate::LorentzVector &p4_)
ProductID id() const
Accessor for product ID.
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
edm::InputTag theJetDepositName