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

Public Member Functions

 PatMCMatchingExtended (const edm::ParameterSet &)
 default constructor More...
 
 ~PatMCMatchingExtended ()
 default destructor More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 

Private Attributes

unsigned int decayInFlight
 
unsigned int diffCharge
 
std::map< std::string, TH1F * > histContainer_
 
edm::InputTag muonSrc_
 
unsigned int noMatch
 
unsigned int numberMuons
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 15 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  :
57  muonSrc_(iConfig.getUntrackedParameter<edm::InputTag>("muonSrc"))
58 {
59 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, TH1F * > histContainer_
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 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 66 of file PatMCMatchingExtended.cc.

References gather_cfg::cout, decayInFlight, diffCharge, edm::Event::getByLabel(), histContainer_, metsig::muon, ExpressReco_HICollisions_FallBack::muons, muonSrc_, noMatch, numberMuons, p4, and ExpressReco_HICollisions_FallBack::pt.

67 {
68 
69  // get muon collection
71  iEvent.getByLabel(muonSrc_,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 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
double p4[4]
Definition: TauolaWrapper.h:92
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
std::map< std::string, TH1F * > histContainer_
tuple cout
Definition: gather_cfg.py:41
void PatMCMatchingExtended::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file PatMCMatchingExtended.cc.

References decayInFlight, diffCharge, histContainer_, TFileDirectory::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 }
std::map< std::string, TH1F * > histContainer_
T * make() const
make new ROOT object
void PatMCMatchingExtended::endJob ( void  )
privatevirtual

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:41

Member Data Documentation

unsigned int PatMCMatchingExtended::decayInFlight
private

Definition at line 44 of file PatMCMatchingExtended.cc.

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

unsigned int PatMCMatchingExtended::diffCharge
private

Definition at line 38 of file PatMCMatchingExtended.cc.

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

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

Definition at line 32 of file PatMCMatchingExtended.cc.

Referenced by analyze(), and beginJob().

edm::InputTag PatMCMatchingExtended::muonSrc_
private

Definition at line 35 of file PatMCMatchingExtended.cc.

Referenced by analyze().

unsigned int PatMCMatchingExtended::noMatch
private

Definition at line 41 of file PatMCMatchingExtended.cc.

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

unsigned int PatMCMatchingExtended::numberMuons
private

Definition at line 47 of file PatMCMatchingExtended.cc.

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