#include <MuonAssociatorEDProducer.h>
Public Member Functions | |
MuonAssociatorEDProducer (const edm::ParameterSet &) | |
~MuonAssociatorEDProducer () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
MuonAssociatorByHits * | associatorByHits |
bool | ignoreMissingTrackCollection |
edm::ParameterSet | parset_ |
edm::InputTag | tpTag |
edm::InputTag | tracksTag |
Definition at line 12 of file MuonAssociatorEDProducer.h.
MuonAssociatorEDProducer::MuonAssociatorEDProducer | ( | const edm::ParameterSet & | parset | ) | [explicit] |
Perform some sanity checks of the configuration
Definition at line 7 of file MuonAssociatorEDProducer.cc.
References edm::ParameterSet::addParameter(), edm::ParameterSet::dump(), edm::ParameterSet::getParameter(), edm::InputTag::instance(), edm::InputTag::label(), LogTrace, parset_, tpTag, and tracksTag.
: tracksTag(parset.getParameter< edm::InputTag >("tracksTag")), tpTag(parset.getParameter< edm::InputTag >("tpTag")), ignoreMissingTrackCollection(parset.getUntrackedParameter<bool>("ignoreMissingTrackCollection",false)), parset_(parset) { LogTrace("MuonAssociatorEDProducer") << "constructing MuonAssociatorEDProducer" << parset_.dump(); produces<reco::RecoToSimCollection>(); produces<reco::SimToRecoCollection>(); edm::LogVerbatim("MuonAssociatorByHits") << "constructing MuonAssociatorByHits" << parset_.dump(); edm::LogVerbatim("MuonAssociatorByHits") << "\n MuonAssociatorByHits will associate reco::Tracks with "<<tracksTag << "\n\t\t and TrackingParticles with "<<tpTag; const std::string recoTracksLabel = tracksTag.label(); const std::string recoTracksInstance = tracksTag.instance(); // check and fix inconsistent input settings // tracks with hits only on muon detectors if (recoTracksLabel == "standAloneMuons" || recoTracksLabel == "standAloneSETMuons" || recoTracksLabel == "cosmicMuons" || recoTracksLabel == "hltL2Muons") { if (parset_.getParameter<bool>("UseTracker")) { edm::LogWarning("MuonAssociatorByHits") <<"\n*** WARNING : inconsistent input tracksTag = "<<tracksTag <<"\n with UseTracker = true"<<"\n ---> setting UseTracker = false "; parset_.addParameter<bool>("UseTracker",false); } if (!parset_.getParameter<bool>("UseMuon")) { edm::LogWarning("MuonAssociatorByHits") <<"\n*** WARNING : inconsistent input tracksTag = "<<tracksTag <<"\n with UseMuon = false"<<"\n ---> setting UseMuon = true "; parset_.addParameter<bool>("UseMuon",true); } } // tracks with hits only on tracker if (recoTracksLabel == "generalTracks" || recoTracksLabel == "ctfWithMaterialTracksP5LHCNavigation" || recoTracksLabel == "hltL3TkTracksFromL2" || (recoTracksLabel == "hltL3Muons" && recoTracksInstance == "L2Seeded")) { if (parset_.getParameter<bool>("UseMuon")) { edm::LogWarning("MuonAssociatorByHits") <<"\n*** WARNING : inconsistent input tracksTag = "<<tracksTag <<"\n with UseMuon = true"<<"\n ---> setting UseMuon = false "; parset_.addParameter<bool>("UseMuon",false); } if (!parset_.getParameter<bool>("UseTracker")) { edm::LogWarning("MuonAssociatorByHits") <<"\n*** WARNING : inconsistent input tracksTag = "<<tracksTag <<"\n with UseTracker = false"<<"\n ---> setting UseTracker = true "; parset_.addParameter<bool>("UseTracker",true); } } }
MuonAssociatorEDProducer::~MuonAssociatorEDProducer | ( | ) |
Definition at line 62 of file MuonAssociatorEDProducer.cc.
{}
void MuonAssociatorEDProducer::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 64 of file MuonAssociatorEDProducer.cc.
References associatorByHits, LogTrace, and parset_.
{ LogTrace("MuonAssociatorEDProducer") << "MuonAssociatorEDProducer::beginJob : constructing MuonAssociatorByHits"; associatorByHits = new MuonAssociatorByHits(parset_); }
void MuonAssociatorEDProducer::endJob | ( | void | ) | [private, virtual] |
void MuonAssociatorEDProducer::produce | ( | edm::Event & | event, |
const edm::EventSetup & | setup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 71 of file MuonAssociatorEDProducer.cc.
References MuonAssociatorByHits::associateRecoToSim(), MuonAssociatorByHits::associateSimToReco(), associatorByHits, ignoreMissingTrackCollection, edm::InputTag::instance(), edm::InputTag::label(), LogTrace, ecalTPGAnalyzer_cfg::TPCollection, tpTag, and tracksTag.
{ using namespace edm; Handle<TrackingParticleCollection> TPCollection ; LogTrace("MuonAssociatorEDProducer") <<"getting TrackingParticle collection - "<<tpTag; event.getByLabel(tpTag, TPCollection); LogTrace("MuonAssociatorEDProducer") <<"\t... size = "<<TPCollection->size(); Handle<edm::View<reco::Track> > trackCollection; LogTrace("MuonAssociatorEDProducer") <<"getting reco::Track collection - "<<tracksTag; bool trackAvailable = event.getByLabel (tracksTag, trackCollection); if (trackAvailable) LogTrace("MuonAssociatorEDProducer") <<"\t... size = "<<trackCollection->size(); else LogTrace("MuonAssociatorEDProducer") <<"\t... NOT FOUND."; std::auto_ptr<reco::RecoToSimCollection> rts; std::auto_ptr<reco::SimToRecoCollection> str; if (ignoreMissingTrackCollection && !trackAvailable) { //the track collection is not in the event and we're being told to ignore this. //do not output anything to the event, other wise this would be considered as inefficiency. LogTrace("MuonAssociatorEDProducer") << "\n ignoring missing track collection." << "\n"; } else { edm::LogVerbatim("MuonAssociatorEDProducer") <<"\n >>> RecoToSim association <<< \n" <<" Track collection : " <<tracksTag.label()<<":"<<tracksTag.instance()<<" (size = "<<trackCollection->size()<<") \n" <<" TrackingParticle collection : " <<tpTag.label()<<":"<<tpTag.instance()<<" (size = "<<TPCollection->size()<<")"; reco::RecoToSimCollection recSimColl = associatorByHits->associateRecoToSim(trackCollection,TPCollection,&event,&setup); edm::LogVerbatim("MuonAssociatorEDProducer") <<"\n >>> SimToReco association <<< \n" <<" TrackingParticle collection : " <<tpTag.label()<<":"<<tpTag.instance()<<" (size = "<<TPCollection->size()<<") \n" <<" Track collection : " <<tracksTag.label()<<":"<<tracksTag.instance()<<" (size = "<<trackCollection->size()<<")"; reco::SimToRecoCollection simRecColl = associatorByHits->associateSimToReco(trackCollection,TPCollection,&event,&setup); rts.reset(new reco::RecoToSimCollection(recSimColl)); str.reset(new reco::SimToRecoCollection(simRecColl)); event.put(rts); event.put(str); } }
Definition at line 26 of file MuonAssociatorEDProducer.h.
Referenced by beginJob(), and produce().
bool MuonAssociatorEDProducer::ignoreMissingTrackCollection [private] |
Definition at line 24 of file MuonAssociatorEDProducer.h.
Referenced by produce().
Definition at line 25 of file MuonAssociatorEDProducer.h.
Referenced by beginJob(), and MuonAssociatorEDProducer().
edm::InputTag MuonAssociatorEDProducer::tpTag [private] |
Definition at line 23 of file MuonAssociatorEDProducer.h.
Referenced by MuonAssociatorEDProducer(), and produce().
Definition at line 22 of file MuonAssociatorEDProducer.h.
Referenced by MuonAssociatorEDProducer(), and produce().