Public Member Functions | |
JetCorrectorOnTheFly (const edm::ParameterSet &) | |
~JetCorrectorOnTheFly () | |
Private Types | |
typedef std::vector< Jet > | JetCollection |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
virtual void | endJob () |
Private Attributes | |
edm::Service< TFileService > | fs |
TH1F * | mCorPt |
bool | mDebug |
std::string | mJetCorService |
std::string | mJetName |
double | mMinRawJetPt |
TH1F * | mRawPt |
Definition at line 29 of file JetCorrectorOnTheFly.cc.
typedef std::vector<Jet> JetCorrectorOnTheFly< Jet >::JetCollection [private] |
Definition at line 35 of file JetCorrectorOnTheFly.cc.
JetCorrectorOnTheFly< Jet >::JetCorrectorOnTheFly | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 52 of file JetCorrectorOnTheFly.cc.
References edm::ParameterSet::getParameter().
{ mJetCorService = iConfig.getParameter<std::string> ("JetCorrectionService"); mJetName = iConfig.getParameter<std::string> ("JetCollectionName"); mMinRawJetPt = iConfig.getParameter<double> ("MinRawJetPt"); mDebug = iConfig.getParameter<bool> ("Debug"); }
JetCorrectorOnTheFly< Jet >::~JetCorrectorOnTheFly | ( | ) |
Definition at line 61 of file JetCorrectorOnTheFly.cc.
{ }
void JetCorrectorOnTheFly< Jet >::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 67 of file JetCorrectorOnTheFly.cc.
References JetCorrector::correction(), gather_cfg::cout, edm::Event::getByLabel(), JetCorrector::getJetCorrector(), getHLTprescales::index, and analyzePatCleaning_cfg::jets.
{ const JetCorrector* corrector = JetCorrector::getJetCorrector(mJetCorService,iSetup); Handle<JetCollection> jets; iEvent.getByLabel(mJetName,jets); edm::Handle<reco::VertexCollection> recVtxs; iEvent.getByLabel("offlinePrimaryVertices",recVtxs); int NPV(0); for(unsigned int ind=0;ind<recVtxs->size();ind++) { if (!((*recVtxs)[ind].isFake())) { NPV++; } } typename JetCollection::const_iterator i_jet; for(i_jet = jets->begin(); i_jet != jets->end(); i_jet++) { int index = i_jet-jets->begin(); edm::RefToBase<reco::Jet> jetRef(edm::Ref<JetCollection>(jets,index)); if (i_jet->pt() < mMinRawJetPt) continue; //double scale = corrector->correction(i_jet->p4()); double scale = corrector->correction(*i_jet,jetRef,iEvent,iSetup); if (mDebug) { std::cout<<"energy = "<<i_jet->energy()<<", " <<"eta = "<<i_jet->eta()<<", " <<"raw pt = "<<i_jet->pt()<<", " <<"NPV = "<<NPV<<", " <<"correction = "<<scale<<", " <<"cor pt = "<<scale*i_jet->pt()<<endl; } mRawPt->Fill(i_jet->pt()); mCorPt->Fill(scale*i_jet->pt()); } }
void JetCorrectorOnTheFly< Jet >::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 105 of file JetCorrectorOnTheFly.cc.
void JetCorrectorOnTheFly< Jet >::endJob | ( | void | ) | [private, virtual] |
edm::Service<TFileService> JetCorrectorOnTheFly< Jet >::fs [private] |
Definition at line 40 of file JetCorrectorOnTheFly.cc.
TH1F * JetCorrectorOnTheFly< Jet >::mCorPt [private] |
Definition at line 45 of file JetCorrectorOnTheFly.cc.
bool JetCorrectorOnTheFly< Jet >::mDebug [private] |
Definition at line 44 of file JetCorrectorOnTheFly.cc.
std::string JetCorrectorOnTheFly< Jet >::mJetCorService [private] |
Definition at line 41 of file JetCorrectorOnTheFly.cc.
std::string JetCorrectorOnTheFly< Jet >::mJetName [private] |
Definition at line 42 of file JetCorrectorOnTheFly.cc.
double JetCorrectorOnTheFly< Jet >::mMinRawJetPt [private] |
Definition at line 43 of file JetCorrectorOnTheFly.cc.
TH1F* JetCorrectorOnTheFly< Jet >::mRawPt [private] |
Definition at line 45 of file JetCorrectorOnTheFly.cc.