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
PatMCMatching Class Reference
Inheritance diagram for PatMCMatching:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 PatMCMatching (const edm::ParameterSet &)
 default constructor More...
 
 ~PatMCMatching ()
 default destructor More...
 
- 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
 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
 
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 analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void endJob () override
 

Private Attributes

std::map< std::string, TH1F * > histContainer_
 
edm::EDGetTokenT< edm::View
< pat::Muon > > 
muonSrcToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 17 of file PatMCMatching.cc.

Constructor & Destructor Documentation

PatMCMatching::PatMCMatching ( const edm::ParameterSet iConfig)
explicit

default constructor

Definition at line 42 of file PatMCMatching.cc.

42  :
45 {
46 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, TH1F * > histContainer_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
PatMCMatching::~PatMCMatching ( )

default destructor

Definition at line 48 of file PatMCMatching.cc.

49 {
50 }

Member Function Documentation

void PatMCMatching::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 53 of file PatMCMatching.cc.

References edm::Event::getByToken(), histContainer_, i, metsig::muon, patZpeak::muons, and muonSrcToken_.

54 {
55 
56  // get muon collection
58  iEvent.getByToken(muonSrcToken_,muons);
59 
60  for(edm::View<pat::Muon>::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon){
61 
62  for(unsigned int i = 0 ; i < muon->genParticleRefs().size() ; ++i ){
63 
64  switch( muon->genParticle(i)->status() ){
65  case 1:
66  histContainer_["DR_status1Match"]->Fill( ROOT::Math::VectorUtil::DeltaR(muon->p4() , muon->genParticle(i)->p4() ) );
67  break;
68  case 3:
69  histContainer_["DR_status3Match"]->Fill( ROOT::Math::VectorUtil::DeltaR(muon->p4() , muon->genParticle(i)->p4() ) );
70  break;
71  default:
72  histContainer_["DR_defaultMatch"]->Fill( ROOT::Math::VectorUtil::DeltaR(muon->p4() , muon->genParticle(i)->p4() ) );
73  break;
74  }
75  }
76  }
77 
78 }
int i
Definition: DBlmapReader.cc:9
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
std::map< std::string, TH1F * > histContainer_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
tuple muons
Definition: patZpeak.py:38
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
void PatMCMatching::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file PatMCMatching.cc.

References histContainer_, and TFileService::make().

82 {
83  // register to the TFileService
85 
86  // book histograms:
87  histContainer_["DR_defaultMatch" ]=fs->make<TH1F>("DR_defaultMatch", "DR_defaultMatch", 100, 0., 0.02);
88  histContainer_["DR_status1Match" ]=fs->make<TH1F>("DR_status1Match", "DR_status1Match", 100, 0., 0.02);
89  histContainer_["DR_status3Match" ]=fs->make<TH1F>("DR_status3Match", "DR_status3Match", 100, 0., 0.02);
90 
91 }
std::map< std::string, TH1F * > histContainer_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
void PatMCMatching::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file PatMCMatching.cc.

95 {
96 }

Member Data Documentation

std::map<std::string,TH1F*> PatMCMatching::histContainer_
private

Definition at line 34 of file PatMCMatching.cc.

Referenced by analyze(), and beginJob().

edm::EDGetTokenT<edm::View<pat::Muon> > PatMCMatching::muonSrcToken_
private

Definition at line 37 of file PatMCMatching.cc.

Referenced by analyze().