32 #include <boost/foreach.hpp>
33 #define foreach BOOST_FOREACH
36 #define dout if(debug_) std::cout
41 typedef std::map<reco::MuonRef, unsigned int>
MuToPFMap;
70 produces<reco::MuonCollection>();
73 produces<reco::MuonTimeExtraMap>(
"combined");
74 produces<reco::MuonTimeExtraMap>(
"dt");
75 produces<reco::MuonTimeExtraMap>(
"csc");
78 if (fillDetectorBasedIsolation_){
84 produces<reco::IsoDepositMap>(theEcalDepositName.instance());
86 produces<reco::IsoDepositMap>(theHcalDepositName.instance());
88 produces<reco::IsoDepositMap>(theHoDepositName.instance());
98 if(fillShoweringInfo_){
103 if(fillCosmicsIdMap_){
115 if(fillPFIsolation_){
120 std::map<std::string,edm::ParameterSet> psetMap;
123 std::vector<std::string> isolationLabels;
124 isolationLabels.push_back(
"pfIsolationR03");
125 isolationLabels.push_back(
"pfIsoMeanDRProfileR03");
126 isolationLabels.push_back(
"pfIsoSumDRProfileR03");
127 isolationLabels.push_back(
"pfIsolationR04");
128 isolationLabels.push_back(
"pfIsoMeanDRProfileR04");
129 isolationLabels.push_back(
"pfIsoSumDRProfileR04");
132 for( std::vector<std::string>::const_iterator
label = isolationLabels.begin();
label != isolationLabels.end();++
label)
138 for(std::map<std::string,edm::ParameterSet>::const_iterator
map = psetMap.begin();
map!= psetMap.end();++
map) {
139 std::map<std::string,edm::InputTag> isoMap;
140 isoMap[
"chargedParticle"] =
map->second.getParameter<
edm::InputTag>(
"chargedParticle");
141 isoMap[
"chargedHadron"] =
map->second.getParameter<
edm::InputTag>(
"chargedHadron");
142 isoMap[
"neutralHadron"] =
map->second.getParameter<
edm::InputTag>(
"neutralHadron");
143 isoMap[
"neutralHadronHighThreshold"] =
map->second.getParameter<
edm::InputTag>(
"neutralHadronHighThreshold");
145 isoMap[
"photonHighThreshold"] =
map->second.getParameter<
edm::InputTag>(
"photonHighThreshold");
192 int nMuons=inputMuons->size();
194 std::vector<reco::MuonTimeExtra> dtTimeColl(nMuons);
195 std::vector<reco::MuonTimeExtra> cscTimeColl(nMuons);
196 std::vector<reco::MuonTimeExtra> combinedTimeColl(nMuons);
204 std::vector<reco::IsoDeposit> trackDepColl(nMuons);
205 std::vector<reco::IsoDeposit> ecalDepColl(nMuons);
206 std::vector<reco::IsoDeposit> hcalDepColl(nMuons);
207 std::vector<reco::IsoDeposit> hoDepColl(nMuons);
208 std::vector<reco::IsoDeposit> jetDepColl(nMuons);
228 std::vector<std::map<std::string,edm::Handle<edm::ValueMap<double> > > > pfIsoMaps;
229 std::vector<std::map<std::string,std::vector<double> > > pfIsoMapVals;
233 std::map<std::string,std::vector<double> > mapVals;
234 std::map<std::string,edm::Handle<edm::ValueMap<double> > > maps;
237 event.getByLabel(
map->second,handleTmp);
238 maps[
map->first]=handleTmp;
239 mapVals[
map->first].resize(nMuons);
241 pfIsoMapVals.push_back(mapVals);
242 pfIsoMaps.push_back(maps);
254 event.getByLabel(*
tag,selectorMaps[s]);
255 selectorMapResults[
s].resize(nMuons);
262 std::vector<reco::MuonShower> showerInfoColl(nMuons);
270 std::vector<reco::MuonCosmicCompatibility> cosmicCompColl(
fillCosmicsIdMap_ ? nMuons : 0);
273 std::vector<reco::MuonRef> muonRefColl(nMuons);
277 if(inputMuons->empty()) {
281 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, combinedTimeColl,
"combined");
282 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, dtTimeColl,
"dt");
283 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, cscTimeColl,
"csc");
326 dout <<
"Number of PFCandidates: " << pfCandidates->size() << endl;
327 for(
unsigned int i=0;
i< pfCandidates->size();++
i)
328 if(
abs(pfCandidates->at(
i).pdgId()) == 13){
329 muToPFMap[pfCandidates->at(
i).muonRef()] =
i;
330 dout <<
"MuonRef: " << pfCandidates->at(
i).muonRef().
id() <<
" " << pfCandidates->at(
i).muonRef().key() <<
" PF p4: " << pfCandidates->at(
i).p4() << endl;
332 dout <<
"Number of PFMuons: " << muToPFMap.size() << endl;
333 dout <<
"Number of Muons in the original collection: " << inputMuons->size() << endl;
338 foreach(
const reco::Muon &inMuon, *inputMuons){
348 MuToPFMap::iterator iter = muToPFMap.find(muRef);
349 if(iter != muToPFMap.end()){
350 outMuon.
setPFP4(pfCandidates->at(iter->second).p4());
351 outMuon.
setP4(pfCandidates->at(iter->second).p4());
352 outMuon.
setBestTrack(pfCandidates->at(iter->second).bestMuonTrackType());
353 muToPFMap.erase(iter);
354 dout <<
"MuonRef: " << muRef.
id() <<
" " << muRef.
key()
355 <<
" Is it PF? " << outMuon.
isPFMuon()
356 <<
" PF p4: " << outMuon.
pfP4() << endl;
360 dout <<
"MuonRef: " << muRef.
id() <<
" " << muRef.
key()
361 <<
" Is it PF? " << outMuon.
isPFMuon() << endl;
366 <<
" p4 " << outMuon.
p4() << endl;
375 (pfIsoMapVals[
j])[
map->first][i] = (*pfIsoMaps[
j][
map->first])[muRef];
382 combinedTimeColl[
i] = (*timeMapCmb)[muRef];
383 dtTimeColl[
i] = (*timeMapDT)[muRef];
384 cscTimeColl[
i] = (*timeMapCSC)[muRef];
388 trackDepColl[
i] = (*trackIsoDepMap)[muRef];
389 ecalDepColl[
i] = (*ecalIsoDepMap)[muRef];
390 hcalDepColl[
i] = (*hcalIsoDepMap)[muRef];
391 hoDepColl[
i] = (*hoIsoDepMap)[muRef];
392 jetDepColl[
i] = (*jetIsoDepMap)[muRef];;
399 selectorMapResults[s][i] = (*selectorMaps[s])[muRef];
406 cosmicIdColl[
i] = (*cosmicIdMap)[muRef];
407 cosmicCompColl[
i] = (*cosmicCompMap)[muRef];
410 outputMuons->push_back(outMuon);
414 dout <<
"Number of Muons in the new muon collection: " << outputMuons->size() << endl;
418 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, combinedTimeColl,
"combined");
419 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, dtTimeColl,
"dt");
420 fillMuonMap<reco::MuonTimeExtra>(
event, muonHandle, cscTimeColl,
"csc");
460 template<
typename TYPE>
463 const std::vector<TYPE>& muonExtra,
469 if(!muonExtra.empty()){
470 FILLER filler(*muonMap);
471 filler.insert(muonHandle, muonExtra.begin(), muonExtra.end());
474 event.put(muonMap,label);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag theTrackDepositName
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
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::map< reco::MuonRef, unsigned int > MuToPFMap
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::vector< std::map< std::string, edm::InputTag > > pfIsoMapNames
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
std::vector< edm::InputTag > InputTags
InputTags theSelectorMapNames
std::string theMuToMuMapName
int embedPFIsolation(reco::Muon &, reco::MuonRef &)
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)
virtual void setBestTrack(MuonTrackType muonType)
virtual void setP4(const LorentzVector &p4) GCC11_FINAL
set 4-momentum
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
edm::InputTag theJetDepositName