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
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 beginJob () override
 
virtual void endJob () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::InputTag label_associator
 
edm::InputTag label_tp
 
edm::InputTag label_tr
 

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

Constructor & Destructor Documentation

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

Definition at line 71 of file TrackMCQuality.cc.

References label_associator, label_tp, and label_tr.

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

Definition at line 84 of file TrackMCQuality.cc.

85 {
86 }

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

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

96 {
97 
98  using namespace edm;
100  iEvent.getByLabel(label_associator,associator);
101 
104 
107 
108  reco::RecoToSimCollection recSimColl=associator->associateRecoToSim(trackCollection,
109  TPCollection);
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){
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 }
edm::InputTag label_associator
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
edm::InputTag label_tr
edm::InputTag label_tp
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405

Member Data Documentation

edm::InputTag TrackMCQuality::label_associator
private

Definition at line 56 of file TrackMCQuality.cc.

Referenced by produce(), and TrackMCQuality().

edm::InputTag TrackMCQuality::label_tp
private

Definition at line 55 of file TrackMCQuality.cc.

Referenced by produce(), and TrackMCQuality().

edm::InputTag TrackMCQuality::label_tr
private

Definition at line 54 of file TrackMCQuality.cc.

Referenced by produce(), and TrackMCQuality().