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
reco::modulesNew::MCTruthCompositeMatcher Class Reference
Inheritance diagram for reco::modulesNew::MCTruthCompositeMatcher:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 MCTruthCompositeMatcher (const edm::ParameterSet &)
 
 ~MCTruthCompositeMatcher ()
 
- 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

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

Private Attributes

std::vector< edm::InputTagmatchMaps_
 
std::vector< int > pdgId_
 
edm::InputTag src_
 

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

Definition at line 19 of file MCTruthCompositeMatcherNew.cc.

Constructor & Destructor Documentation

Definition at line 30 of file MCTruthCompositeMatcherNew.cc.

30  :
31  src_(cfg.getParameter<edm::InputTag>("src")),
32  matchMaps_(cfg.getParameter<std::vector<edm::InputTag> >("matchMaps")),
33  pdgId_(cfg.getParameter<std::vector<int> >("matchPDGId")) {
34  produces<reco::GenParticleMatch>();
35  }
T getParameter(std::string const &) const

Definition at line 37 of file MCTruthCompositeMatcherNew.cc.

37  {
38  }

Member Function Documentation

void MCTruthCompositeMatcher< C1, C2 >::produce ( edm::Event evt,
const edm::EventSetup  
)
privatevirtual

Implements edm::EDProducer.

Definition at line 40 of file MCTruthCompositeMatcherNew.cc.

References abs, begin, end, edm::helper::Filler< Map >::fill(), spr::find(), newFWLiteAna::found, edm::Event::getByLabel(), i, errorMatrix2Lands::indices, edm::helper::Filler< Map >::insert(), edm::Ref< C, T, F >::isNull(), edm::Ref< C, T, F >::key(), match(), matchMaps_, pdgId_, edm::Event::put(), reco::utilsNew::CandMatcher< C >::ref(), findQualityFiles::size, and src_.

40  {
41  using namespace edm;
42  using namespace std;
44  evt.getByLabel(src_, cands);
45  size_t nMaps = matchMaps_.size();
46  std::vector<const GenParticleMatch *> maps;
47  maps.reserve( nMaps );
48  for( size_t i = 0; i != nMaps; ++ i ) {
50  evt.getByLabel(matchMaps_[i], matchMap);
51  maps.push_back(& * matchMap);
52  }
53  utilsNew::CandMatcher<GenParticleCollection> match(maps);
54  auto_ptr<GenParticleMatch> matchMap(new GenParticleMatch(match.ref()));
55  int size = cands->size();
56  vector<int>::const_iterator begin = pdgId_.begin(), end = pdgId_.end();
57  if(size != 0) {
58  GenParticleMatch::Filler filler(*matchMap);
59  vector<int> indices(size);
60  for(int i = 0; i != size; ++ i) {
61  const Candidate & cand = (* cands)[i];
62  GenParticleRef mc = match[cand];
63  if(mc.isNull()) {
64  indices[i] = -1;
65  } else {
66  bool found = true;
67  if(begin!=end) found = find(begin, end, std::abs(mc->pdgId())) != end;
68  indices[i] = found ? int(mc.key()) : -1;
69  }
70  }
71  CandidateBaseRefProd ref(cands->refAt(0));
72  filler.insert(ref, indices.begin(), indices.end());
73  filler.fill();
74  }
75  evt.put(matchMap);
76  }
int i
Definition: DBlmapReader.cc:9
#define abs(x)
Definition: mlp_lapack.h:159
edm::RefToBaseProd< Candidate > CandidateBaseRefProd
vector of references to objects in the same collection of Candidate objects via base type ...
Definition: CandidateFwd.h:39
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
bool isNull() const
Checks for null.
Definition: Ref.h:247
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
#define end
Definition: vmac.h:38
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:157
key_type key() const
Accessor for product key.
Definition: Ref.h:266
#define begin
Definition: vmac.h:31
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
tuple size
Write out results.
edm::Association< GenParticleCollection > GenParticleMatch
vector of reference to GenParticle in the same collection

Member Data Documentation

std::vector<edm::InputTag> reco::modulesNew::MCTruthCompositeMatcher::matchMaps_
private

Definition at line 25 of file MCTruthCompositeMatcherNew.cc.

Referenced by produce().

std::vector<int> reco::modulesNew::MCTruthCompositeMatcher::pdgId_
private

Definition at line 26 of file MCTruthCompositeMatcherNew.cc.

Referenced by produce().

edm::InputTag reco::modulesNew::MCTruthCompositeMatcher::src_
private

Definition at line 24 of file MCTruthCompositeMatcherNew.cc.

Referenced by produce().