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

Public Member Functions

 TrackMCQuality (const edm::ParameterSet &)
 
 ~TrackMCQuality ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 44 of file TrackMCQuality.cc.

Constructor & Destructor Documentation

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

Definition at line 74 of file TrackMCQuality.cc.

74  :
75  label_tr(pset.getParameter< edm::InputTag >("label_tr")),
76  label_tp(pset.getParameter< edm::InputTag >("label_tp")),
77  associator(pset.getParameter< std::string >("associator"))
78 {
79 
80  produces<reco::TrackCollection>();
81 }
T getParameter(std::string const &) const
std::string 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  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 140 of file TrackMCQuality.cc.

141 {
142 }
void TrackMCQuality::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 146 of file TrackMCQuality.cc.

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

Implements edm::EDProducer.

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

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

Member Data Documentation

std::string TrackMCQuality::associator
private

Definition at line 59 of file TrackMCQuality.cc.

Referenced by produce().

edm::InputTag TrackMCQuality::label_tp
private

Definition at line 58 of file TrackMCQuality.cc.

Referenced by produce().

edm::InputTag TrackMCQuality::label_tr
private

Definition at line 57 of file TrackMCQuality.cc.

Referenced by produce().

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

Definition at line 56 of file TrackMCQuality.cc.

Referenced by produce().