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

Public Member Functions

 PatMCMatchingExtended (const edm::ParameterSet &)
 default constructor More...
 
 ~PatMCMatchingExtended ()
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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

unsigned int decayInFlight
 
unsigned int diffCharge
 
std::map< std::string, TH1F * > histContainer_
 
edm::EDGetTokenT< edm::View
< pat::Muon > > 
muonSrcToken_
 
unsigned int noMatch
 
unsigned int numberMuons
 

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 17 of file PatMCMatchingExtended.cc.

Constructor & Destructor Documentation

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

default constructor

Definition at line 55 of file PatMCMatchingExtended.cc.

55  :
58 {
59 }
T getUntrackedParameter(std::string const &, T const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::map< std::string, TH1F * > histContainer_
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
PatMCMatchingExtended::~PatMCMatchingExtended ( )

default destructor

Definition at line 61 of file PatMCMatchingExtended.cc.

62 {
63 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 66 of file PatMCMatchingExtended.cc.

References gather_cfg::cout, decayInFlight, HLT_25ns14e33_v1_cff::DeltaR, diffCharge, edm::Event::getByToken(), histContainer_, metsig::muon, patZpeak::muons, muonSrcToken_, noMatch, numberMuons, p4, and EnergyCorrector::pt.

67 {
68 
69  // get muon collection
71  iEvent.getByToken(muonSrcToken_,muons);
72 
73  for(edm::View<pat::Muon>::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon){
74  if(muon->genParticleById(0,1).isNonnull() ){
75  histContainer_["DR_status1Match"]->Fill( ROOT::Math::VectorUtil::DeltaR(muon->p4() , (muon->genParticleById(0,1) )->p4() ) );
76  histContainer_["DPt_status1Match"]->Fill(muon->pt() - (muon->genParticleById(0,1) )->pt() );
77  }
78  if(muon->genParticleById(0,3).isNonnull() ){
79  histContainer_["DR_status3Match"]->Fill( ROOT::Math::VectorUtil::DeltaR(muon->p4() , (muon->genParticleById(0,3) )->p4() ) );
80  histContainer_["DPt_status3Match"]->Fill(muon->pt() - (muon->genParticleById(0,3) )->pt() );
81  }
82  if(muon->genParticleById(0,-1).isNonnull() ){
83  histContainer_["DR_defaultMatch"]->Fill( ROOT::Math::VectorUtil::DeltaR(muon->p4() , (muon->genParticleById(0,-1) )->p4() ) );
84  histContainer_["DPt_defaultMatch"]->Fill(muon->pt() - (muon->genParticleById(0,-1) )->pt() );
85  }
86  if(muon->genParticleById(0,1).isNull() && muon->genParticleById(0,3).isNull() && muon->genParticleById(0,-1).isNull()) noMatch++;
87  if(muon->genParticleById(0,1).isNull() && muon->genParticleById(0,3).isNull() && muon->genParticleById(0,-1).isNonnull())decayInFlight++;
88 
89 
90 
91  if( muon->genParticleById(-13,0, 1).isNonnull() ){
92  diffCharge++;
93  std::cout<<" DIFF CHARGE!!! charge gen: "<< muon->genParticleById(-13,0, true)->charge()<< " charge reco: "<< muon->charge()<<std::endl;
94  }
95  numberMuons++;
96  }
97 
98 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
double p4[4]
Definition: TauolaWrapper.h:92
std::map< std::string, TH1F * > histContainer_
tuple muons
Definition: patZpeak.py:38
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:85
tuple cout
Definition: gather_cfg.py:121
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
void PatMCMatchingExtended::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file PatMCMatchingExtended.cc.

References decayInFlight, diffCharge, histContainer_, TFileService::make(), noMatch, and numberMuons.

102 {
103  // register to the TFileService
105 
106  // book histograms:
107  //DR
108  histContainer_["DR_defaultMatch" ]=fs->make<TH1F>("DR_defaultMatch", "DR_defaultMatch", 100, 0, 0.02);
109  histContainer_["DR_status1Match" ]=fs->make<TH1F>("DR_status1Match", "DR_status1Match", 100, 0, 0.02);
110  histContainer_["DR_status3Match" ]=fs->make<TH1F>("DR_status3Match", "DR_status3Match", 100, 0, 0.02);
111  //DPT
112  histContainer_["DPt_defaultMatch" ]=fs->make<TH1F>("DPt_defaultMatch", "DPt_defaultMatch", 10, 0, 1.2);
113  histContainer_["DPt_status1Match" ]=fs->make<TH1F>("DPt_status1Match", "DPt_status1Match", 10, 0, 1.2);
114  histContainer_["DPt_status3Match" ]=fs->make<TH1F>("DPt_status3Match", "DPt_status3Match", 10, 0, 1.2);
115  //some counters
116  diffCharge=0;
117  noMatch=0;
118  decayInFlight=0;
119  numberMuons=0;
120 
121 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::map< std::string, TH1F * > histContainer_
void PatMCMatchingExtended::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file PatMCMatchingExtended.cc.

References gather_cfg::cout, decayInFlight, diffCharge, noMatch, and numberMuons.

125 {
126  std::cout<<"diffcharge: "<< diffCharge <<std::endl;
127  std::cout<<"noMatch: "<< noMatch <<std::endl;
128  std::cout<<"decayInFlight: "<< decayInFlight <<std::endl;
129  std::cout<<"numberMuons: "<< numberMuons <<std::endl;
130 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

unsigned int PatMCMatchingExtended::decayInFlight
private

Definition at line 46 of file PatMCMatchingExtended.cc.

Referenced by analyze(), beginJob(), and endJob().

unsigned int PatMCMatchingExtended::diffCharge
private

Definition at line 40 of file PatMCMatchingExtended.cc.

Referenced by analyze(), beginJob(), and endJob().

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

Definition at line 34 of file PatMCMatchingExtended.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 37 of file PatMCMatchingExtended.cc.

Referenced by analyze().

unsigned int PatMCMatchingExtended::noMatch
private

Definition at line 43 of file PatMCMatchingExtended.cc.

Referenced by analyze(), beginJob(), and endJob().

unsigned int PatMCMatchingExtended::numberMuons
private

Definition at line 49 of file PatMCMatchingExtended.cc.

Referenced by analyze(), beginJob(), and endJob().