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 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
 
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
 
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)
 
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::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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

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

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

Definition at line 56 of file TrackMCQuality.cc.

Constructor & Destructor Documentation

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"))),
74  produces<Product>();
75 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Track > > label_tr
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > label_assoc
edm::EDGetTokenT< TrackingParticleCollection > label_tp
TrackMCQuality::~TrackMCQuality ( )
override

Definition at line 77 of file TrackMCQuality.cc.

77 {}

Member Function Documentation

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

Definition at line 84 of file TrackMCQuality.cc.

References reco::TrackToTrackingParticleAssociator::associateRecoToSim(), ctfWithMaterialTrackMCMatch_cfi::associator, DEFINE_FWK_MODULE, edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), plotBeamSpotDB::first, edm::Event::getByToken(), label_assoc, label_tp, label_tr, eostools::move(), parseEventContent::prod, edm::Event::put(), HiIsolationCommonParameters_cff::track, and findElectronsInSiStrips_cfi::trackCollection.

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 
103  edm::RefToBase<reco::Track> track(trackCollection, iT);
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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
edm::EDGetTokenT< edm::View< reco::Track > > label_tr
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< float > Product
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > label_assoc
HLT enums.
edm::EDGetTokenT< TrackingParticleCollection > label_tp
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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

Definition at line 52 of file TrackMCQuality.cc.

Referenced by produce().

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

Definition at line 53 of file TrackMCQuality.cc.

Referenced by produce().

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

Definition at line 54 of file TrackMCQuality.cc.

Referenced by produce().