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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TrackMCQuality (const edm::ParameterSet &)
 
 ~TrackMCQuality ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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
 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
 
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 beginJob () override
 
virtual void endJob () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::string associator
 
edm::InputTag label_tp
 
edm::InputTag label_tr
 
edm::ESHandle
< TrackAssociatorBase
theAssociator
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
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 43 of file TrackMCQuality.cc.

Constructor & Destructor Documentation

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

Definition at line 73 of file TrackMCQuality.cc.

73  :
74  label_tr(pset.getParameter< edm::InputTag >("label_tr")),
75  label_tp(pset.getParameter< edm::InputTag >("label_tp")),
76  associator(pset.getParameter< std::string >("associator"))
77 {
78 
79  produces<reco::TrackCollection>();
80 }
T getParameter(std::string const &) const
std::string associator
edm::InputTag label_tr
edm::InputTag label_tp
TrackMCQuality::~TrackMCQuality ( )

Definition at line 83 of file TrackMCQuality.cc.

84 {
85 }

Member Function Documentation

void TrackMCQuality::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 139 of file TrackMCQuality.cc.

140 {
141 }
void TrackMCQuality::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 145 of file TrackMCQuality.cc.

145  {
146 }
void TrackMCQuality::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 94 of file TrackMCQuality.cc.

References associator, edm::EventSetup::get(), edm::Event::getByLabel(), label_tp, label_tr, edm::Event::put(), reco::TrackBase::qualitySize, theAssociator, and ecalTPGAnalyzer_cfg::TPCollection.

95 {
96 
98 
99 
100  using namespace edm;
103 
104  Handle<edm::View<reco::Track> > trackCollection;
105  iEvent.getByLabel (label_tr, trackCollection );
106 
107  reco::RecoToSimCollection recSimColl=theAssociator->associateRecoToSim(trackCollection,
108  TPCollection,
109  &iEvent,&iSetup);
110 
111  //then loop the track collection
112  std::auto_ptr<reco::TrackCollection> outTracks(new reco::TrackCollection(trackCollection->size()));
113 
114  for (unsigned int iT=0;iT!=trackCollection->size();++iT){
115  edm::RefToBase<reco::Track> track(trackCollection, iT);
116  bool matched=false;
117  //find it in the map
118  if (recSimColl.find(track)!=recSimColl.end()){
119  // you can get the data if you want
120  std::vector<std::pair<TrackingParticleRef, double> > tp= recSimColl[track];
121  matched=true;
122  }
123  else{
124  matched=false;
125  }
126 
127  //copy the track into the new container
128  (*outTracks)[iT] = reco::Track(*track);
129  if (matched){
130  (*outTracks)[iT].setQuality(reco::TrackBase::qualitySize); //is not assigned to any quality. use it as a fake/matched flag
131  }
132  }
133 
134  iEvent.put(outTracks);
135 }
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
std::string associator
edm::InputTag label_tr
edm::InputTag label_tp
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< TrackAssociatorBase > theAssociator

Member Data Documentation

std::string TrackMCQuality::associator
private

Definition at line 58 of file TrackMCQuality.cc.

Referenced by produce().

edm::InputTag TrackMCQuality::label_tp
private

Definition at line 57 of file TrackMCQuality.cc.

Referenced by produce().

edm::InputTag TrackMCQuality::label_tr
private

Definition at line 56 of file TrackMCQuality.cc.

Referenced by produce().

edm::ESHandle<TrackAssociatorBase> TrackMCQuality::theAssociator
private

Definition at line 55 of file TrackMCQuality.cc.

Referenced by produce().