CMS 3D CMS Logo

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

#include <SimTracker/TrackMCQuality/src/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
 
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

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 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

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 72 of file TrackMCQuality.cc.

72  :
73  label_assoc(consumes<reco::TrackToTrackingParticleAssociator>(pset.getParameter< edm::InputTag >("associator"))),
74  label_tp(consumes<TrackingParticleCollection>(pset.getParameter< edm::InputTag >("trackingParticles"))),
76 {
77  produces<Product>();
78 }
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 81 of file TrackMCQuality.cc.

82 {
83 }

Member Function Documentation

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

Definition at line 92 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.

93 {
94 
95  using namespace edm;
97  iEvent.getByToken(label_assoc,associator);
98 
100  iEvent.getByToken(label_tp, TPCollection);
101 
103  iEvent.getByToken(label_tr, trackCollection );
104 
105  reco::RecoToSimCollection recSimColl=associator->associateRecoToSim(trackCollection,
106  TPCollection);
107 
108  //then loop the track collection
109  std::unique_ptr<Product> product(new Product(trackCollection->size(),0));
110 
111 
112  for (unsigned int iT=0;iT!=trackCollection->size();++iT){
113  auto & prod = (*product)[iT];
114 
115  edm::RefToBase<reco::Track> track(trackCollection, iT);
116 
117  //find it in the map
118  if (recSimColl.find(track)==recSimColl.end()) continue;
119 
120  auto const & tp = recSimColl[track];
121 
122  if (tp.empty()) continue; // can it be?
123  // nSimHits = tp[0].first->numberOfTrackerHits();
124  prod = tp[0].second;
125  // if (tp[0].first->charge() != track->charge()) isChargeMatched = false;
126  if ( (tp[0].first->eventId().event() != 0) || (tp[0].first->eventId().bunchCrossing() != 0) ) prod=-prod;
127 
128 
129  }
130 
131  iEvent.put(std::move(product));
132 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
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:579
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< float > Product
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > label_assoc
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
HLT enums.
edm::EDGetTokenT< TrackingParticleCollection > label_tp
def move(src, dest)
Definition: eostools.py:510

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().