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 Types | Private Member Functions | Private Attributes
GenTrackMatcher Class Reference
Inheritance diagram for GenTrackMatcher:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 GenTrackMatcher (const edm::ParameterSet &)
 constructor More...
 
- 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 Types

typedef edm::Association
< reco::GenParticleCollection
GenParticleMatch
 

Private Member Functions

void produce (edm::Event &evt, const edm::EventSetup &es)
 

Private Attributes

edm::InputTag genParticles_
 
TrackHistory tracer_
 
edm::InputTag tracks_
 

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

Author
Luca Lista, INFN
Victor E. Bazterra, UIC
Version
Id:
GenTrackMatcher.cc,v 1.6 2008/07/23 01:40:41 bazterra Exp

Definition at line 21 of file GenTrackMatcher.cc.

Member Typedef Documentation

Definition at line 31 of file GenTrackMatcher.cc.

Constructor & Destructor Documentation

GenTrackMatcher::GenTrackMatcher ( const edm::ParameterSet p)

constructor

Definition at line 44 of file GenTrackMatcher.cc.

44  :
45  tracer_(p),
46  tracks_(p.getUntrackedParameter<edm::InputTag>("trackProducer")),
48 {
49  produces<GenParticleMatch>();
50 }
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag genParticles_
edm::InputTag tracks_
TrackHistory tracer_

Member Function Documentation

void GenTrackMatcher::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 52 of file GenTrackMatcher.cc.

References b, alignCSCRings::e, TrackHistory::evaluate(), edm::hlt::Exception, f, edm::helper::Filler< Map >::fill(), spr::find(), configurableAnalysis::GenParticle, HistoryBase::genParticle(), genParticleCandidates2GenParticles_cfi::genParticles, genParticles_, edm::Event::getByLabel(), i, errorMatrix2Lands::indices, edm::helper::Filler< Map >::insert(), edm::errors::InvalidReference, match(), n, TrackHistory::newEvent(), edm::Event::put(), tracer_, testEve_cfg::tracks, and tracks_.

53 {
55  evt.getByLabel(tracks_, tracks);
56  Handle<vector<int> > barCodes;
57  evt.getByLabel(genParticles_, barCodes);
59  evt.getByLabel(genParticles_, genParticles);
60  auto_ptr<GenParticleMatch> match(new GenParticleMatch(GenParticleRefProd(genParticles)));
62  size_t n = tracks->size();
63  vector<int> indices(n,-1);
64  tracer_.newEvent(evt, es);
65  for (size_t i = 0; i < n; ++ i )
66  {
67  RefToBase<Track> track(tracks, i);
68  if (tracer_.evaluate(track))
69  {
70  const HepMC::GenParticle * particle = tracer_.genParticle();
71  if (particle)
72  {
73  int barCode = particle->barcode();
74  vector<int>::const_iterator b = barCodes->begin(), e = barCodes->end(), f = find( b, e, barCode );
76  << "found matching particle with barcode" << *f
77  << " which has not been found in " << genParticles_;
78  indices[i] = *f;
79  }
80  }
81  }
82  filler.insert(tracks, indices.begin(), indices.end());
83  filler.fill();
84  evt.put(match);
85 }
int i
Definition: DBlmapReader.cc:9
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
Definition: TrackHistory.cc:32
edm::RefProd< GenParticleCollection > GenParticleRefProd
persistent reference to a GenParticle collection
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
edm::InputTag genParticles_
double f[11][100]
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple tracks
Definition: testEve_cfg.py:39
double b
Definition: hdecay.h:120
edm::InputTag tracks_
TrackHistory tracer_
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: TrackHistory.h:39
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
edm::Association< reco::GenParticleCollection > GenParticleMatch
const HepMC::GenParticle * genParticle() const
Returns a pointer to most primitive status 1 or 2 particle.
Definition: HistoryBase.h:89

Member Data Documentation

edm::InputTag GenTrackMatcher::genParticles_
private

Definition at line 30 of file GenTrackMatcher.cc.

Referenced by produce().

TrackHistory GenTrackMatcher::tracer_
private

Definition at line 29 of file GenTrackMatcher.cc.

Referenced by produce().

edm::InputTag GenTrackMatcher::tracks_
private

Definition at line 30 of file GenTrackMatcher.cc.

Referenced by produce().