CMS 3D CMS Logo

Public Member Functions | Private Attributes

FlavorJetCorrectionExample Class Reference

Inheritance diagram for FlavorJetCorrectionExample:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Attributes

std::string mBCorrectorName
std::string mCCorrectorName
edm::InputTag mInput
std::string mUDSCorrectorName

Detailed Description

Definition at line 11 of file FlavorJetCorrectionExample.cc.


Constructor & Destructor Documentation

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

Definition at line 36 of file FlavorJetCorrectionExample.cc.

  : mInput (fConfig.getParameter <edm::InputTag> ("src")),
    mUDSCorrectorName (fConfig.getParameter <std::string> ("UDSQuarksCorrector")),
    mCCorrectorName (fConfig.getParameter <std::string> ("CQuarkCorrector")),
    mBCorrectorName (fConfig.getParameter <std::string> ("BQuarkCorrector"))
{}
virtual FlavorJetCorrectionExample::~FlavorJetCorrectionExample ( ) [inline, virtual]

Definition at line 14 of file FlavorJetCorrectionExample.cc.

{}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 43 of file FlavorJetCorrectionExample.cc.

References JetCorrector::correction(), gather_cfg::cout, reco::LeafCandidate::eta(), edm::Event::getByLabel(), JetCorrector::getJetCorrector(), metsig::jet, analyzePatCleaning_cfg::jets, mBCorrectorName, mCCorrectorName, mInput, mUDSCorrectorName, reco::LeafCandidate::phi(), and reco::LeafCandidate::pt().

                                                                                            {
  // get all correctors
  const JetCorrector* udsJetCorrector = JetCorrector::getJetCorrector (mUDSCorrectorName, fSetup);
  const JetCorrector* cQuarkJetCorrector = JetCorrector::getJetCorrector (mCCorrectorName, fSetup);
  const JetCorrector* bQuarkJetCorrector = JetCorrector::getJetCorrector (mBCorrectorName, 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 << "FlavorJetCorrectionExample::analize-> jet #" << ijet;
    if (ijet%3 == 0) { // assume it is light quark
      std::cout << ": use USD quark corrections" << std::endl;
      corrector = udsJetCorrector;
    }
    else if (ijet%3 == 1) { // assume it is c quark
      std::cout << ": use c quark corrections" << std::endl;
      corrector = cQuarkJetCorrector;
    }
    else { // assume it is b quark
      std::cout << ": use b quark corrections" << std::endl;
      corrector = bQuarkJetCorrector;
    }
    // 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 FlavorJetCorrectionExample.cc.

Referenced by analyze().

Definition at line 19 of file FlavorJetCorrectionExample.cc.

Referenced by analyze().

Definition at line 17 of file FlavorJetCorrectionExample.cc.

Referenced by analyze().

Definition at line 18 of file FlavorJetCorrectionExample.cc.

Referenced by analyze().