CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DebugZMCTruth Class Reference
Inheritance diagram for DebugZMCTruth:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DebugZMCTruth (const edm::ParameterSet &pset)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void analyze (const Event &event, const EventSetup &setup) override
 

Private Attributes

EDGetTokenT< GenParticleCollectiongenParticlesToken_
 
EDGetTokenT< GenParticleMatchmatchToken_
 
InputTag src_
 
EDGetTokenT< CandidateViewsrcToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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

Definition at line 14 of file DebugZMCTruth.cc.

Constructor & Destructor Documentation

DebugZMCTruth::DebugZMCTruth ( const edm::ParameterSet pset)

Definition at line 25 of file DebugZMCTruth.cc.

25  :
26  src_(cfg.getParameter<InputTag>("src")),
27  srcToken_(consumes<CandidateView>(src_)),
28  genParticlesToken_(consumes<GenParticleCollection>(cfg.getParameter<InputTag>("genParticles"))),
29  matchToken_(consumes<GenParticleMatch>(cfg.getParameter<InputTag>("mcMatch"))) {
30 }
EDGetTokenT< GenParticleCollection > genParticlesToken_
EDGetTokenT< CandidateView > srcToken_
EDGetTokenT< GenParticleMatch > matchToken_

Member Function Documentation

void DebugZMCTruth::analyze ( const Event event,
const EventSetup setup 
)
overrideprivatevirtual

Definition at line 33 of file DebugZMCTruth.cc.

References gather_cfg::cout, DEFINE_FWK_MODULE, GenHFHadronMatcher_cfi::genParticles, genParticlesToken_, mps_fire::i, edm::Ref< C, T, F >::isNull(), match(), matchToken_, CaloTowersParam_cfi::mc, edm::View< T >::refAt(), edm::View< T >::size(), TrackRefitter_38T_cff::src, src_, and srcToken_.

33  {
35  event.getByToken(genParticlesToken_, genParticles);
37  event.getByToken(srcToken_, src);
38  cout << ">>> event has " << src->size() << " reconstructed particles in {" << src_ << "}" <<endl;
40  event.getByToken(matchToken_, match);
41  cout << ">>> Z matches: ";
42  for(unsigned int i = 0; i < src->size(); ++i) {
43  CandidateBaseRef ref = src->refAt(i);
44  GenParticleRef mc = (*match)[ref];
45  cout << (mc.isNull() ? "(no)" : "(yes)");
46  }
47  cout << endl;
48 }
size_type size() const
RefToBase< value_type > refAt(size_type i) const
bool isNull() const
Checks for null.
Definition: Ref.h:250
EDGetTokenT< GenParticleCollection > genParticlesToken_
EDGetTokenT< CandidateView > srcToken_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
EDGetTokenT< GenParticleMatch > matchToken_

Member Data Documentation

EDGetTokenT<GenParticleCollection> DebugZMCTruth::genParticlesToken_
private

Definition at line 21 of file DebugZMCTruth.cc.

Referenced by analyze().

EDGetTokenT<GenParticleMatch> DebugZMCTruth::matchToken_
private

Definition at line 22 of file DebugZMCTruth.cc.

Referenced by analyze().

InputTag DebugZMCTruth::src_
private

Definition at line 19 of file DebugZMCTruth.cc.

Referenced by analyze().

EDGetTokenT<CandidateView> DebugZMCTruth::srcToken_
private

Definition at line 20 of file DebugZMCTruth.cc.

Referenced by analyze().