CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackMCQuality Class Reference

#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 ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< edm::View
< reco::Track > > 
label_associator
 
edm::EDGetTokenT
< TrackingParticleCollection
label_tp
 
edm::EDGetTokenT
< reco::TrackToTrackingParticleAssociator
label_tr
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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.

Constructor & Destructor Documentation

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

Definition at line 69 of file TrackMCQuality.cc.

69  :
70  label_tr(consumes<reco::TrackToTrackingParticleAssociator>(pset.getParameter< edm::InputTag >("label_tr"))),
71  label_tp(consumes<TrackingParticleCollection>(pset.getParameter< edm::InputTag >("label_tp"))),
73 {
74  produces<reco::TrackCollection>();
75 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Track > > label_associator
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< TrackingParticleCollection > label_tp
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > label_tr
TrackMCQuality::~TrackMCQuality ( )

Definition at line 78 of file TrackMCQuality.cc.

79 {
80 }

Member Function Documentation

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

Implements edm::global::EDProducerBase.

Definition at line 89 of file TrackMCQuality.cc.

References edm::Event::getByToken(), label_associator, label_tp, label_tr, edm::Event::put(), reco::TrackBase::qualitySize, ecalTPGAnalyzer_cfg::TPCollection, and HLT_50ns_5e33_v1_cff::trackCollection.

90 {
91 
92  using namespace edm;
94  iEvent.getByToken(label_associator,associator);
95 
98 
101 
102  reco::RecoToSimCollection recSimColl=associator->associateRecoToSim(trackCollection,
103  TPCollection);
104 
105  //then loop the track collection
106  std::auto_ptr<reco::TrackCollection> outTracks(new reco::TrackCollection(trackCollection->size()));
107 
108  for (unsigned int iT=0;iT!=trackCollection->size();++iT){
110  bool matched=false;
111  //find it in the map
112  if (recSimColl.find(track)!=recSimColl.end()){
113  // you can get the data if you want
114  std::vector<std::pair<TrackingParticleRef, double> > tp= recSimColl[track];
115  matched=true;
116  }
117  else{
118  matched=false;
119  }
120 
121  //copy the track into the new container
122  (*outTracks)[iT] = reco::Track(*track);
123  if (matched){
124  (*outTracks)[iT].setQuality(reco::TrackBase::qualitySize); //is not assigned to any quality. use it as a fake/matched flag
125  }
126  }
127 
128  iEvent.put(outTracks);
129 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
edm::EDGetTokenT< edm::View< reco::Track > > label_associator
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
edm::EDGetTokenT< TrackingParticleCollection > label_tp
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > label_tr

Member Data Documentation

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

Definition at line 54 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<reco::TrackToTrackingParticleAssociator> TrackMCQuality::label_tr
private

Definition at line 52 of file TrackMCQuality.cc.

Referenced by produce().