CMS 3D CMS Logo

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

Public Member Functions

 GenTrackMatcher (const edm::ParameterSet &)
 constructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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 Types

typedef edm::Association< reco::GenParticleCollectionGenParticleMatch
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< vector< int > > genParticleInts_
 
edm::EDGetTokenT< GenParticleCollectiongenParticles_
 
TrackHistory tracer_
 
edm::EDGetTokenT< View< Track > > tracks_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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::stream::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

Author
Luca Lista, INFN
Victor E. Bazterra, UIC

Definition at line 24 of file GenTrackMatcher.cc.

Member Typedef Documentation

Definition at line 36 of file GenTrackMatcher.cc.

Constructor & Destructor Documentation

GenTrackMatcher::GenTrackMatcher ( const edm::ParameterSet p)

constructor

Definition at line 45 of file GenTrackMatcher.cc.

45  :
48  genParticles_(consumes<GenParticleCollection>(p.getUntrackedParameter<edm::InputTag>("genParticles"))),
49  genParticleInts_(consumes<vector<int>>(p.getUntrackedParameter<edm::InputTag>("genParticles")))
50 {
51  produces<GenParticleMatch>();
52 }
T getUntrackedParameter(std::string const &, T const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< GenParticleCollection > genParticles_
edm::EDGetTokenT< vector< int > > genParticleInts_
edm::EDGetTokenT< View< Track > > tracks_
TrackHistory tracer_

Member Function Documentation

void GenTrackMatcher::produce ( edm::Event evt,
const edm::EventSetup es 
)
overrideprivate

Definition at line 54 of file GenTrackMatcher.cc.

References b, DEFINE_FWK_MODULE, MillePedeFileConverter_cfg::e, TrackHistory::evaluate(), Exception, f, edm::helper::Filler< Map >::fill(), objects.autophobj::filler, spr::find(), GenParticle::GenParticle, HistoryBase::genParticle(), GenHFHadronMatcher_cfi::genParticles, genParticles_, edm::Event::getByToken(), mps_fire::i, edm::helper::Filler< Map >::insert(), edm::errors::InvalidReference, tablePrinter::labels, edm::EDConsumerBase::labelsForToken(), match(), edm::ProductLabels::module, eostools::move(), gen::n, TrackHistory::newEvent(), edm::Event::put(), tracer_, HiIsolationCommonParameters_cff::track, l1t::tracks, and tracks_.

55 {
57  evt.getByToken(tracks_, tracks);
58  Handle<vector<int> > barCodes;
59  evt.getByToken(genParticles_, barCodes);
61  evt.getByToken(genParticles_, genParticles);
62  unique_ptr<GenParticleMatch> match(new GenParticleMatch(GenParticleRefProd(genParticles)));
64  size_t n = tracks->size();
65  vector<int> indices(n,-1);
66  tracer_.newEvent(evt, es);
67  for (size_t i = 0; i < n; ++ i )
68  {
69  RefToBase<Track> track(tracks, i);
70  if (tracer_.evaluate(track))
71  {
72  const HepMC::GenParticle * particle = tracer_.genParticle();
73  if (particle)
74  {
75  int barCode = particle->barcode();
76  vector<int>::const_iterator b = barCodes->begin(), e = barCodes->end(), f = find( b, e, barCode );
77  if (f == e) {
81  << "found matching particle with barcode" << *f
82  << " which has not been found in " << labels.module;
83  }
84  indices[i] = *f;
85  }
86  }
87  }
88  filler.insert(tracks, indices.begin(), indices.end());
89  filler.fill();
90  evt.put(std::move(match));
91 }
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
Definition: TrackHistory.cc:39
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
edm::RefProd< GenParticleCollection > GenParticleRefProd
persistent reference to a GenParticle collection
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
edm::EDGetTokenT< GenParticleCollection > genParticles_
double f[11][100]
char const * module
Definition: ProductLabels.h:5
double b
Definition: hdecay.h:120
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
edm::EDGetTokenT< View< Track > > tracks_
TrackHistory tracer_
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: TrackHistory.h:41
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
def move(src, dest)
Definition: eostools.py:510
edm::Association< reco::GenParticleCollection > GenParticleMatch
const HepMC::GenParticle * genParticle() const
Returns a pointer to most primitive status 1 or 2 particle in the genParticleTrail_.
Definition: HistoryBase.h:101

Member Data Documentation

edm::EDGetTokenT<vector<int> > GenTrackMatcher::genParticleInts_
private

Definition at line 35 of file GenTrackMatcher.cc.

edm::EDGetTokenT<GenParticleCollection> GenTrackMatcher::genParticles_
private

Definition at line 34 of file GenTrackMatcher.cc.

Referenced by produce().

TrackHistory GenTrackMatcher::tracer_
private

Definition at line 32 of file GenTrackMatcher.cc.

Referenced by produce().

edm::EDGetTokenT<View<Track> > GenTrackMatcher::tracks_
private

Definition at line 33 of file GenTrackMatcher.cc.

Referenced by produce().