CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PatMCMatching Class Reference

Inheritance diagram for PatMCMatching:
edm::EDAnalyzer

List of all members.

Public Member Functions

 PatMCMatching (const edm::ParameterSet &)
 default constructor
 ~PatMCMatching ()
 default destructor

Private Member Functions

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

Private Attributes

std::map< std::string, TH1F * > histContainer_
edm::InputTag muonSrc_

Detailed Description

Definition at line 15 of file PatMCMatching.cc.


Constructor & Destructor Documentation

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

default constructor

Definition at line 42 of file PatMCMatching.cc.

PatMCMatching::~PatMCMatching ( )

default destructor

Definition at line 48 of file PatMCMatching.cc.

{
}

Member Function Documentation

void PatMCMatching::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 53 of file PatMCMatching.cc.

References edm::Event::getByLabel(), histContainer_, i, metsig::muon, patZpeak::muons, and muonSrc_.

{

  // get muon collection
  edm::Handle<edm::View<pat::Muon> > muons;
  iEvent.getByLabel(muonSrc_,muons);

  for(edm::View<pat::Muon>::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon){
  
      for(unsigned int i = 0 ; i < muon->genParticleRefs().size() ; ++i ){

          switch( muon->genParticle(i)->status() ){     
              case 1:
                  histContainer_["DR_status1Match"]->Fill( ROOT::Math::VectorUtil::DeltaR(muon->p4() , muon->genParticle(i)->p4() ) ); 
                  break;
              case 3:
                  histContainer_["DR_status3Match"]->Fill( ROOT::Math::VectorUtil::DeltaR(muon->p4() , muon->genParticle(i)->p4() ) ); 
                  break;
              default:
                  histContainer_["DR_defaultMatch"]->Fill( ROOT::Math::VectorUtil::DeltaR(muon->p4() , muon->genParticle(i)->p4() ) ); 
                  break;
          }
      }
  }

}
void PatMCMatching::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file PatMCMatching.cc.

References histContainer_.

{
  // register to the TFileService
  edm::Service<TFileService> fs;
  
  // book histograms:
  histContainer_["DR_defaultMatch"  ]=fs->make<TH1F>("DR_defaultMatch",   "DR_defaultMatch", 100,  0.,  0.02);
  histContainer_["DR_status1Match"  ]=fs->make<TH1F>("DR_status1Match",   "DR_status1Match", 100,  0.,  0.02);
  histContainer_["DR_status3Match"  ]=fs->make<TH1F>("DR_status3Match",   "DR_status3Match", 100,  0.,  0.02);

}
void PatMCMatching::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file PatMCMatching.cc.

{
}

Member Data Documentation

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

Definition at line 32 of file PatMCMatching.cc.

Referenced by analyze(), and beginJob().

Definition at line 35 of file PatMCMatching.cc.

Referenced by analyze().