#include <MuIsoDepositProducer.h>
Public Member Functions | |
MuIsoDepositProducer (const edm::ParameterSet &) | |
constructor | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
data making method | |
virtual | ~MuIsoDepositProducer () |
destructor | |
Private Attributes | |
edm::ParameterSet | theConfig |
module configuration | |
std::vector< std::string > | theDepositNames |
bool | theExtractForCandidate |
reco::isodeposit::IsoDepositExtractor * | theExtractor |
std::string | theInputType |
bool | theMultipleDepositsFlag |
edm::InputTag | theMuonCollectionTag |
std::string | theMuonTrackRefType |
Definition at line 13 of file MuIsoDepositProducer.h.
MuIsoDepositProducer::MuIsoDepositProducer | ( | const edm::ParameterSet & | par | ) |
constructor
constructor with config
Definition at line 35 of file MuIsoDepositProducer.cc.
References edm::ParameterSet::getParameter(), i, LogDebug, theConfig, theDepositNames, theExtractForCandidate, theInputType, theMultipleDepositsFlag, theMuonCollectionTag, and theMuonTrackRefType.
: theConfig(par), theDepositNames(std::vector<std::string>(1,std::string())), theExtractor(0) { LogDebug("RecoMuon|MuonIsolation")<<" MuIsoDepositProducer CTOR"; edm::ParameterSet ioPSet = par.getParameter<edm::ParameterSet>("IOPSet"); theInputType = ioPSet.getParameter<std::string>("InputType"); theExtractForCandidate = ioPSet.getParameter<bool>("ExtractForCandidate"); theMuonTrackRefType = ioPSet.getParameter<std::string>("MuonTrackRefType"); theMuonCollectionTag = ioPSet.getParameter<edm::InputTag>("inputMuonCollection"); theMultipleDepositsFlag = ioPSet.getParameter<bool>("MultipleDepositsFlag"); if (theMultipleDepositsFlag){ theDepositNames = par.getParameter<edm::ParameterSet>("ExtractorPSet") .getParameter<std::vector<std::string> >("DepositInstanceLabels"); } for (unsigned int i = 0; i < theDepositNames.size(); ++i){ std::string alias = theConfig.getParameter<std::string>("@module_label"); if (theDepositNames[i] != "") alias += "_" + theDepositNames[i]; produces<reco::IsoDepositMap>(theDepositNames[i]).setBranchAlias(alias); } }
MuIsoDepositProducer::~MuIsoDepositProducer | ( | ) | [virtual] |
destructor
Definition at line 65 of file MuIsoDepositProducer.cc.
References LogDebug, and theExtractor.
{ LogDebug("RecoMuon/MuIsoDepositProducer")<<" MuIsoDepositProducer DTOR"; delete theExtractor; }
void MuIsoDepositProducer::produce | ( | edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [virtual] |
data making method
build deposits
read them as RecoCandidates: need to have track() standAloneMuon() etc in the interface
get rid of this at some point and use the cands
expect nMuons set already
OK, now we know how many deps for how many muons each we will create might linearize this at some point (lazy) do it in case some muons are there only
end for (nMuons)
now fill in selectively
some debugging stuff
fill the maps here
now figure out the source handle (see getByLabel above)
now actually fill
end if (nMuons>0)
Implements edm::EDProducer.
Definition at line 71 of file MuIsoDepositProducer.cc.
References begin, reco::isodeposit::IsoDepositExtractor::deposit(), reco::isodeposit::IsoDepositExtractor::deposits(), end, edm::helper::Filler< Map >::fill(), reco::get(), edm::ParameterSet::getParameter(), i, edm::helper::Filler< Map >::insert(), LogDebug, LogTrace, metname, patZpeak::muons, susybsm::HSCParticleType::standAloneMuon, theConfig, theDepositNames, theExtractForCandidate, theExtractor, theInputType, theMultipleDepositsFlag, theMuonCollectionTag, theMuonTrackRefType, and testEve_cfg::tracks.
{ std::string metname = "RecoMuon|MuonIsolationProducers|MuIsoDepositProducer"; LogDebug(metname)<<" Muon Deposit producing..." <<" BEGINING OF EVENT " <<"================================"; if (!theExtractor) { edm::ParameterSet extractorPSet = theConfig.getParameter<edm::ParameterSet>("ExtractorPSet"); std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName"); theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet); LogDebug(metname)<<" Load extractor..."<<extractorName; } unsigned int nDeps = theMultipleDepositsFlag ? theDepositNames.size() : 1; // Take the muon container LogTrace(metname)<<" Taking the muons: "<<theMuonCollectionTag; Handle<View<Track> > tracks; Handle<View<RecoCandidate> > muons; Handle<View<Candidate> > cands; unsigned int nMuons = 0; bool readFromRecoTrack = theInputType == "TrackCollection"; bool readFromRecoMuon = theInputType == "MuonCollection"; bool readFromCandidateView = theInputType == "CandidateView"; if (readFromRecoMuon){ event.getByLabel(theMuonCollectionTag,muons); nMuons = muons->size(); LogDebug(metname) <<"Got Muons of size "<<nMuons; } if (readFromRecoTrack){ event.getByLabel(theMuonCollectionTag,tracks); nMuons = tracks->size(); LogDebug(metname) <<"Got MuonTracks of size "<<nMuons; } if (readFromCandidateView || theExtractForCandidate){ event.getByLabel(theMuonCollectionTag,cands); unsigned int nCands = cands->size(); if (readFromRecoMuon && theExtractForCandidate){ if (nMuons != nCands) edm::LogError(metname)<<"Inconsistent configuration or failure to read Candidate-muon view"; } nMuons = nCands; LogDebug(metname)<< "Got candidate view with size "<<nMuons; } static const unsigned int MAX_DEPS=10; std::auto_ptr<reco::IsoDepositMap> depMaps[MAX_DEPS]; if (nDeps >10 ) LogError(metname)<<"Unable to handle more than 10 input deposits"; for (unsigned int i =0;i<nDeps; ++i){ depMaps[i] = std::auto_ptr<reco::IsoDepositMap>(new reco::IsoDepositMap()); } if (nMuons > 0){ std::vector<std::vector<IsoDeposit> > deps2D(nDeps, std::vector<IsoDeposit>(nMuons)); for (unsigned int i=0; i< nMuons; ++i) { TrackBaseRef muRef; if (readFromRecoMuon){ if (theMuonTrackRefType == "track"){ muRef = TrackBaseRef((*muons)[i].track()); } else if (theMuonTrackRefType == "standAloneMuon"){ muRef = TrackBaseRef((*muons)[i].standAloneMuon()); } else if (theMuonTrackRefType == "combinedMuon"){ muRef = TrackBaseRef((*muons)[i].combinedMuon()); } else if (theMuonTrackRefType == "bestGlbTrkSta"){ if (!(*muons)[i].combinedMuon().isNull()){ muRef = TrackBaseRef((*muons)[i].combinedMuon()); } else if (!(*muons)[i].track().isNull()){ muRef = TrackBaseRef((*muons)[i].track()); } else { muRef = TrackBaseRef((*muons)[i].standAloneMuon()); } } else if (theMuonTrackRefType == "bestTrkSta"){ if (!(*muons)[i].track().isNull()){ muRef = TrackBaseRef((*muons)[i].track()); } else { muRef = TrackBaseRef((*muons)[i].standAloneMuon()); } }else { edm::LogWarning(metname)<<"Wrong track type is supplied: breaking"; break; } } else if (readFromRecoTrack){ muRef = TrackBaseRef(tracks, i); } if (! theMultipleDepositsFlag){ if (readFromCandidateView || theExtractForCandidate) deps2D[0][i] = theExtractor->deposit(event, eventSetup, (*cands)[i]); else deps2D[0][i] = theExtractor->deposit(event, eventSetup, muRef); } else { std::vector<IsoDeposit> deps(nDeps); if (readFromCandidateView || theExtractForCandidate) deps = theExtractor->deposits(event, eventSetup, (*cands)[i]); else deps = theExtractor->deposits(event, eventSetup, muRef); for (unsigned int iDep =0; iDep<nDeps; ++iDep) { deps2D[iDep][i] = deps[iDep]; } } } for (unsigned int iDep=0; iDep < nDeps; ++iDep){ for (unsigned int iMu = 0; iMu< nMuons; ++iMu){ LogTrace(metname)<<"Contents of "<<theDepositNames[iDep] <<" for a muon at index "<<iMu; LogTrace(metname)<<deps2D[iDep][iMu].print(); } reco::IsoDepositMap::Filler filler(*depMaps[iDep]); if (readFromRecoMuon){ filler.insert(muons, deps2D[iDep].begin(), deps2D[iDep].end()); } else if (readFromRecoTrack){ filler.insert(tracks, deps2D[iDep].begin(), deps2D[iDep].end()); } else if (readFromCandidateView){ filler.insert(cands, deps2D[iDep].begin(), deps2D[iDep].end()); } else { edm::LogError(metname)<<"Inconsistent configuration: unknown type requested"; } filler.fill(); } } for (unsigned int iMap = 0; iMap < nDeps; ++iMap){ LogTrace(metname)<<"About to put a deposit named "<<theDepositNames[iMap] <<" of size "<<depMaps[iMap]->size() <<" into edm::Event"; event.put(depMaps[iMap], theDepositNames[iMap]); } LogTrace(metname) <<" END OF EVENT " <<"================================"; }
module configuration
Definition at line 28 of file MuIsoDepositProducer.h.
Referenced by MuIsoDepositProducer(), and produce().
std::vector<std::string> MuIsoDepositProducer::theDepositNames [private] |
Definition at line 38 of file MuIsoDepositProducer.h.
Referenced by MuIsoDepositProducer(), and produce().
bool MuIsoDepositProducer::theExtractForCandidate [private] |
Definition at line 34 of file MuIsoDepositProducer.h.
Referenced by MuIsoDepositProducer(), and produce().
Definition at line 40 of file MuIsoDepositProducer.h.
Referenced by produce(), and ~MuIsoDepositProducer().
std::string MuIsoDepositProducer::theInputType [private] |
input type. Choose from:
Definition at line 32 of file MuIsoDepositProducer.h.
Referenced by MuIsoDepositProducer(), and produce().
bool MuIsoDepositProducer::theMultipleDepositsFlag [private] |
Definition at line 39 of file MuIsoDepositProducer.h.
Referenced by MuIsoDepositProducer(), and produce().
Definition at line 37 of file MuIsoDepositProducer.h.
Referenced by MuIsoDepositProducer(), and produce().
std::string MuIsoDepositProducer::theMuonTrackRefType [private] |
Definition at line 36 of file MuIsoDepositProducer.h.
Referenced by MuIsoDepositProducer(), and produce().