CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackAssociatorEDProducer Class Reference
Inheritance diagram for TrackAssociatorEDProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TrackAssociatorEDProducer (const edm::ParameterSet &)
 
 ~TrackAssociatorEDProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

edm::EDGetTokenT< reco::TrackToTrackingParticleAssociatorassociatorToken_
 
bool theIgnoremissingtrackcollection
 
edm::EDGetTokenT< TrackingParticleCollectionTPCollectionToken_
 
edm::EDGetTokenT< edm::View< reco::Track > > trackCollectionToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 35 of file TrackAssociatorEDProducer.cc.

Constructor & Destructor Documentation

TrackAssociatorEDProducer::TrackAssociatorEDProducer ( const edm::ParameterSet pset)
explicit

Definition at line 51 of file TrackAssociatorEDProducer.cc.

References associatorToken_, edm::ParameterSet::getParameter(), TPCollectionToken_, and trackCollectionToken_.

51  :
52  theIgnoremissingtrackcollection(pset.getUntrackedParameter<bool>("ignoremissingtrackcollection",false))
53 {
54  produces<reco::SimToRecoCollection>();
55  produces<reco::RecoToSimCollection>();
56 
57  TPCollectionToken_ = consumes<TrackingParticleCollection>(pset.getParameter< edm::InputTag >("label_tp"));
58  trackCollectionToken_ = consumes<edm::View<reco::Track> >(pset.getParameter< edm::InputTag >("label_tr"));
59  associatorToken_ = consumes<reco::TrackToTrackingParticleAssociator>(pset.getParameter<edm::InputTag>("associator") );
60 
61 }
edm::EDGetTokenT< edm::View< reco::Track > > trackCollectionToken_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > associatorToken_
edm::EDGetTokenT< TrackingParticleCollection > TPCollectionToken_
TrackAssociatorEDProducer::~TrackAssociatorEDProducer ( )
override

Definition at line 64 of file TrackAssociatorEDProducer.cc.

64  {
65 
66 }

Member Function Documentation

void TrackAssociatorEDProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 75 of file TrackAssociatorEDProducer.cc.

References reco::TrackToTrackingParticleAssociator::associateRecoToSim(), reco::TrackToTrackingParticleAssociator::associateSimToReco(), associatorToken_, DEFINE_FWK_MODULE, edm::Event::getByToken(), LogTrace, eostools::move(), edm::Event::put(), str, theIgnoremissingtrackcollection, TPCollectionToken_, findElectronsInSiStrips_cfi::trackCollection, and trackCollectionToken_.

75  {
76  using namespace edm;
77 
79  iEvent.getByToken(associatorToken_,theAssociator);
80 
82  iEvent.getByToken(TPCollectionToken_,TPCollection);
83 
85  bool trackAvailable = iEvent.getByToken(trackCollectionToken_, trackCollection );
86 
87  std::unique_ptr<reco::RecoToSimCollection> rts;
88  std::unique_ptr<reco::SimToRecoCollection> str;
89 
90  if (theIgnoremissingtrackcollection && !trackAvailable){
91  //the track collection is not in the event and we're being told to ignore this.
92  //do not output anything to the event, other wise this would be considered as inefficiency.
93  } else {
94  //associate tracks
95  LogTrace("TrackValidator") << "Calling associateRecoToSim method" << "\n";
96  reco::RecoToSimCollection recSimColl=theAssociator->associateRecoToSim(trackCollection,
97  TPCollection);
98 
99  LogTrace("TrackValidator") << "Calling associateSimToReco method" << "\n";
100  reco::SimToRecoCollection simRecColl=theAssociator->associateSimToReco(trackCollection,
101  TPCollection);
102 
103  rts.reset(new reco::RecoToSimCollection(recSimColl));
104  str.reset(new reco::SimToRecoCollection(simRecColl));
105 
106  iEvent.put(std::move(rts));
107  iEvent.put(std::move(str));
108  }
109 }
edm::EDGetTokenT< edm::View< reco::Track > > trackCollectionToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define LogTrace(id)
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > associatorToken_
HLT enums.
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
#define str(s)
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< TrackingParticleCollection > TPCollectionToken_

Member Data Documentation

edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> TrackAssociatorEDProducer::associatorToken_
private

Definition at line 47 of file TrackAssociatorEDProducer.cc.

Referenced by produce(), and TrackAssociatorEDProducer().

bool TrackAssociatorEDProducer::theIgnoremissingtrackcollection
private

Definition at line 43 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

edm::EDGetTokenT<TrackingParticleCollection> TrackAssociatorEDProducer::TPCollectionToken_
private

Definition at line 45 of file TrackAssociatorEDProducer.cc.

Referenced by produce(), and TrackAssociatorEDProducer().

edm::EDGetTokenT<edm::View<reco::Track> > TrackAssociatorEDProducer::trackCollectionToken_
private

Definition at line 46 of file TrackAssociatorEDProducer.cc.

Referenced by produce(), and TrackAssociatorEDProducer().