CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
TrackMCQuality Class Referencefinal

#include <TrackMCQuality.cc>

Inheritance diagram for TrackMCQuality:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TrackMCQuality (const edm::ParameterSet &)
 
 ~TrackMCQuality () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

using Product = std::vector< float >
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< reco::TrackToTrackingParticleAssociatorlabel_assoc
 
edm::EDGetTokenT< TrackingParticleCollectionlabel_tp
 
edm::EDGetTokenT< edm::View< reco::Track > > label_tr
 

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::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

SimTracker/TrackMCQuality/src/TrackMCQuality.cc

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 42 of file TrackMCQuality.cc.

Member Typedef Documentation

◆ Product

using TrackMCQuality::Product = std::vector<float>
private

Definition at line 56 of file TrackMCQuality.cc.

Constructor & Destructor Documentation

◆ TrackMCQuality()

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

Definition at line 70 of file TrackMCQuality.cc.

71  : label_assoc(consumes<reco::TrackToTrackingParticleAssociator>(pset.getParameter<edm::InputTag>("associator"))),
72  label_tp(consumes<TrackingParticleCollection>(pset.getParameter<edm::InputTag>("trackingParticles"))),
73  label_tr(consumes<edm::View<reco::Track>>(pset.getParameter<edm::InputTag>("tracks"))) {
74  produces<Product>();
75 }

◆ ~TrackMCQuality()

TrackMCQuality::~TrackMCQuality ( )
override

Definition at line 77 of file TrackMCQuality.cc.

77 {}

Member Function Documentation

◆ produce()

void TrackMCQuality::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 84 of file TrackMCQuality.cc.

84  {
85  using namespace edm;
87  iEvent.getByToken(label_assoc, associator);
88 
90  iEvent.getByToken(label_tp, TPCollection);
91 
93  iEvent.getByToken(label_tr, trackCollection);
94 
95  reco::RecoToSimCollection recSimColl = associator->associateRecoToSim(trackCollection, TPCollection);
96 
97  // then loop the track collection
98  std::unique_ptr<Product> product(new Product(trackCollection->size(), 0));
99 
100  for (unsigned int iT = 0; iT != trackCollection->size(); ++iT) {
101  auto &prod = (*product)[iT];
102 
104 
105  // find it in the map
106  if (recSimColl.find(track) == recSimColl.end())
107  continue;
108 
109  auto const &tp = recSimColl[track];
110 
111  if (tp.empty())
112  continue; // can it be?
113  // nSimHits = tp[0].first->numberOfTrackerHits();
114  prod = tp[0].second;
115  // if (tp[0].first->charge() != track->charge()) isChargeMatched = false;
116  if ((tp[0].first->eventId().event() != 0) || (tp[0].first->eventId().bunchCrossing() != 0))
117  prod = -prod;
118  }
119 
120  iEvent.put(std::move(product));
121 }

References ctfWithMaterialTrackMCMatch_cfi::associator, edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), dqmdumpme::first, iEvent, label_assoc, label_tp, label_tr, eostools::move(), dumpMFGeometry_cfg::prod, cmsswSequenceInfo::tp, HLT_2018_cff::track, and duplicaterechits_cfi::trackCollection.

Member Data Documentation

◆ label_assoc

edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> TrackMCQuality::label_assoc
private

Definition at line 52 of file TrackMCQuality.cc.

Referenced by produce().

◆ label_tp

edm::EDGetTokenT<TrackingParticleCollection> TrackMCQuality::label_tp
private

Definition at line 53 of file TrackMCQuality.cc.

Referenced by produce().

◆ label_tr

edm::EDGetTokenT<edm::View<reco::Track> > TrackMCQuality::label_tr
private

Definition at line 54 of file TrackMCQuality.cc.

Referenced by produce().

TrackMCQuality::label_tr
edm::EDGetTokenT< edm::View< reco::Track > > label_tr
Definition: TrackMCQuality.cc:54
edm::AssociationMap::find
const_iterator find(const key_type &k) const
find element with specified reference key
Definition: AssociationMap.h:173
TrackMCQuality::Product
std::vector< float > Product
Definition: TrackMCQuality.cc:56
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackMCQuality::label_assoc
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > label_assoc
Definition: TrackMCQuality.cc:52
edm::Handle< reco::TrackToTrackingParticleAssociator >
dqmdumpme.first
first
Definition: dqmdumpme.py:55
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
ctfWithMaterialTrackMCMatch_cfi.associator
associator
Definition: ctfWithMaterialTrackMCMatch_cfi.py:7
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
edm::View
Definition: CaloClusterFwd.h:14
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > >
iEvent
int iEvent
Definition: GenABIO.cc:224
TrackMCQuality::label_tp
edm::EDGetTokenT< TrackingParticleCollection > label_tp
Definition: TrackMCQuality.cc:53
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::RefToBase< reco::Track >
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27