CMS 3D CMS Logo

Public Member Functions | Private Attributes

PartonJetCorrectionExample Class Reference

Inheritance diagram for PartonJetCorrectionExample:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 PartonJetCorrectionExample (const edm::ParameterSet &fParameters)
virtual ~PartonJetCorrectionExample ()

Private Attributes

std::string m_bJ_CorrectorName
std::string m_bT_CorrectorName
std::string m_gJ_CorrectorName
std::string m_qJ_CorrectorName
edm::InputTag mInput

Detailed Description

Definition at line 11 of file PartonJetCorrectionExample.cc.


Constructor & Destructor Documentation

PartonJetCorrectionExample::PartonJetCorrectionExample ( const edm::ParameterSet fParameters) [explicit]

Definition at line 37 of file PartonJetCorrectionExample.cc.

  : mInput (fConfig.getParameter <edm::InputTag> ("src")),
    m_gJ_CorrectorName (fConfig.getParameter <std::string> ("gJetCorrector")),
    m_qJ_CorrectorName (fConfig.getParameter <std::string> ("qJetCorrector")),
    m_bJ_CorrectorName (fConfig.getParameter <std::string> ("bJetCorrector")),
    m_bT_CorrectorName (fConfig.getParameter <std::string> ("bTopCorrector"))
{}
virtual PartonJetCorrectionExample::~PartonJetCorrectionExample ( ) [inline, virtual]

Definition at line 14 of file PartonJetCorrectionExample.cc.

{}

Member Function Documentation

void PartonJetCorrectionExample::analyze ( const edm::Event fEvent,
const edm::EventSetup fSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 45 of file PartonJetCorrectionExample.cc.

References JetCorrector::correction(), gather_cfg::cout, reco::LeafCandidate::eta(), edm::Event::getByLabel(), JetCorrector::getJetCorrector(), metsig::jet, fwrapper::jets, m_bJ_CorrectorName, m_bT_CorrectorName, m_gJ_CorrectorName, m_qJ_CorrectorName, mInput, reco::LeafCandidate::phi(), and reco::LeafCandidate::pt().

                                                                                            {
  // get all correctors
  const JetCorrector* gJetCorrector = JetCorrector::getJetCorrector (m_gJ_CorrectorName, fSetup);
  const JetCorrector* qJetCorrector = JetCorrector::getJetCorrector (m_qJ_CorrectorName, fSetup);
  const JetCorrector* bJetCorrector = JetCorrector::getJetCorrector (m_bJ_CorrectorName, fSetup);
  const JetCorrector* bTopCorrector = JetCorrector::getJetCorrector (m_bT_CorrectorName, fSetup);
  const JetCorrector* corrector = 0;
  
  // get input jets (supposed to be MC corrected already)
  edm::Handle<CaloJetCollection> jets;                    
  fEvent.getByLabel (mInput, jets);
  // loop over jets                      
  for (unsigned ijet = 0; ijet < jets->size(); ++ijet) {
    const CaloJet& jet = (*jets)[ijet];
    std::cout << "PartonJetCorrectionExample::analize-> jet #" << ijet;
    if (ijet%4 == 0) { // assume it is gluon from diJet
      std::cout << ": use gJ corrections" << std::endl;
      corrector = gJetCorrector;
    }
    else if (ijet%4 == 1) { // assume it is light quark from diJet
      std::cout << ": use qJ corrections" << std::endl;
      corrector = qJetCorrector;
    }
    else if (ijet%4 == 2) { // assume it is b quark from diJet
      std::cout << ": use bJ corrections" << std::endl;
      corrector = bJetCorrector;
    }
    else { // assume it is b quark from ttbar
      std::cout << ": use bT corrections" << std::endl;
      corrector = bTopCorrector;
    }
    // get selected correction for the jet
    double correction = corrector->correction (jet);
    // dump it
    std::cout << "  jet pt/eta/phi: " << jet.pt() << '/' <<  jet.eta() << '/' << jet.phi() 
              << " -> correction factor: " << correction 
              << ", corrected pt: " << jet.pt()*correction
              << std::endl;
  }
}

Member Data Documentation

Definition at line 20 of file PartonJetCorrectionExample.cc.

Referenced by analyze().

Definition at line 21 of file PartonJetCorrectionExample.cc.

Referenced by analyze().

Definition at line 18 of file PartonJetCorrectionExample.cc.

Referenced by analyze().

Definition at line 19 of file PartonJetCorrectionExample.cc.

Referenced by analyze().

Definition at line 17 of file PartonJetCorrectionExample.cc.

Referenced by analyze().