#include <SimHitTPAssociationProducer.h>
Public Types | |
typedef std::vector< SimHitTPPair > | SimHitTPAssociationList |
typedef std::pair < TrackingParticleRef, TrackPSimHitRef > | SimHitTPPair |
Public Member Functions | |
SimHitTPAssociationProducer (const edm::ParameterSet &) | |
~SimHitTPAssociationProducer () | |
Static Public Member Functions | |
static bool | simHitTPAssociationListGreater (SimHitTPPair i, SimHitTPPair j) |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
std::vector< edm::InputTag > | _simHitSrc |
edm::InputTag | _trackingParticleSrc |
Definition at line 14 of file SimHitTPAssociationProducer.h.
typedef std::vector<SimHitTPPair> SimHitTPAssociationProducer::SimHitTPAssociationList |
Definition at line 19 of file SimHitTPAssociationProducer.h.
typedef std::pair<TrackingParticleRef, TrackPSimHitRef> SimHitTPAssociationProducer::SimHitTPPair |
Definition at line 18 of file SimHitTPAssociationProducer.h.
SimHitTPAssociationProducer::SimHitTPAssociationProducer | ( | const edm::ParameterSet & | cfg | ) | [explicit] |
Definition at line 17 of file SimHitTPAssociationProducer.cc.
: _simHitSrc(cfg.getParameter<std::vector<edm::InputTag> >("simHitSrc")), _trackingParticleSrc(cfg.getParameter<edm::InputTag>("trackingParticleSrc")) { produces<SimHitTPAssociationList>(); }
SimHitTPAssociationProducer::~SimHitTPAssociationProducer | ( | ) |
Definition at line 24 of file SimHitTPAssociationProducer.cc.
{ }
virtual void SimHitTPAssociationProducer::beginJob | ( | void | ) | [inline, private, virtual] |
virtual void SimHitTPAssociationProducer::endJob | ( | void | ) | [inline, private, virtual] |
void SimHitTPAssociationProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | es | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 27 of file SimHitTPAssociationProducer.cc.
References _simHitSrc, _trackingParticleSrc, edm::Event::getByLabel(), edm::Handle< T >::product(), edm::Event::put(), simHitTPAssociationListGreater(), and python::multivaluedict::sort().
{ std::auto_ptr<SimHitTPAssociationList> simHitTPList(new SimHitTPAssociationList); // TrackingParticle edm::Handle<TrackingParticleCollection> TPCollectionH; iEvent.getByLabel(_trackingParticleSrc, TPCollectionH); // prepare temporary map between SimTrackId and TrackingParticle index std::map<std::pair<size_t, EncodedEventId>, TrackingParticleRef> mapping; for (TrackingParticleCollection::size_type itp = 0; itp < TPCollectionH.product()->size(); ++itp) { TrackingParticleRef trackingParticle(TPCollectionH, itp); // SimTracks inside TrackingParticle EncodedEventId eid(trackingParticle->eventId()); for (auto itrk = trackingParticle->g4Track_begin(); itrk != trackingParticle->g4Track_end(); ++itrk) { std::pair<uint32_t, EncodedEventId> trkid(itrk->trackId(), eid); mapping.insert(std::make_pair(trkid, trackingParticle)); } } // PSimHits for (auto psit=_simHitSrc.begin();psit<_simHitSrc.end();++psit) { edm::Handle<edm::PSimHitContainer> PSimHitCollectionH; iEvent.getByLabel(*psit, PSimHitCollectionH); for (unsigned int psimHit = 0;psimHit != PSimHitCollectionH->size();++psimHit) { TrackPSimHitRef pSimHitRef(PSimHitCollectionH,psimHit); std::pair<uint32_t, EncodedEventId> simTkIds(pSimHitRef->trackId(),pSimHitRef->eventId()); auto ipos = mapping.find(simTkIds); if (ipos != mapping.end()) { simHitTPList->push_back(std::make_pair(ipos->second,pSimHitRef)); } } } std::sort(simHitTPList->begin(),simHitTPList->end(),simHitTPAssociationListGreater); iEvent.put(simHitTPList); }
static bool SimHitTPAssociationProducer::simHitTPAssociationListGreater | ( | SimHitTPPair | i, |
SimHitTPPair | j | ||
) | [inline, static] |
Definition at line 24 of file SimHitTPAssociationProducer.h.
Referenced by RPCRecHitValid::analyze(), TrackAssociatorByPosition::getState(), CosmicParametersDefinerForTP::momentum(), CosmicTrackingParticleSelector::operator()(), produce(), and CosmicParametersDefinerForTP::vertex().
std::vector<edm::InputTag> SimHitTPAssociationProducer::_simHitSrc [private] |
Definition at line 31 of file SimHitTPAssociationProducer.h.
Referenced by produce().
Definition at line 32 of file SimHitTPAssociationProducer.h.
Referenced by produce().