#include <TtFullHadSignalSelMVATrainer.h>
Public Member Functions | |
TtFullHadSignalSelMVATrainer (const edm::ParameterSet &) | |
~TtFullHadSignalSelMVATrainer () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &evt, const edm::EventSetup &setup) |
virtual void | beginJob () |
Private Attributes | |
edm::InputTag | jets_ |
int | maxEv_ |
PhysicsTools::MVAComputerCache | mvaComputer |
int | selEv |
double | weight_ |
int | whatData_ |
Definition at line 24 of file TtFullHadSignalSelMVATrainer.h.
TtFullHadSignalSelMVATrainer::TtFullHadSignalSelMVATrainer | ( | const edm::ParameterSet & | cfg | ) | [explicit] |
Definition at line 16 of file TtFullHadSignalSelMVATrainer.cc.
: jets_ (cfg.getParameter<edm::InputTag>("jets")), whatData_ (cfg.getParameter<int>("whatData")), maxEv_ (cfg.getParameter<int>("maxEv")), weight_ (cfg.getParameter<double>("weight")) { }
TtFullHadSignalSelMVATrainer::~TtFullHadSignalSelMVATrainer | ( | ) |
Definition at line 24 of file TtFullHadSignalSelMVATrainer.cc.
{ }
void TtFullHadSignalSelMVATrainer::analyze | ( | const edm::Event & | evt, |
const edm::EventSetup & | setup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 29 of file TtFullHadSignalSelMVATrainer.cc.
References gather_cfg::cout, evaluateTtFullHadSignalSel(), TtGenEvtProducer_cfi::genEvt, edm::Event::getByLabel(), fwrapper::jets, jets_, maxEv_, mvaComputer, corrVsCorr::selection, selEv, HcalObjRepresent::setup(), PhysicsTools::MVAComputerCache::update(), weight_, and whatData_.
{ //communication with CMSSW CondDB mvaComputer.update<TtFullHadSignalSelMVARcd>("trainer", setup, "traintreeSaver"); // can occur in the last iteration when the // MVATrainer is about to save the result if(!mvaComputer) return; // get the jets out of the event edm::Handle< std::vector<pat::Jet> > jets; evt.getByLabel(jets_, jets); //count the number of selected events selEv++; //skip event if enough events are already selected if(selEv>maxEv_ && maxEv_!=-1) return; //calculation of InputVariables //see TopQuarkAnalysis/TopTools/interface/TtFullHadSignalSel.h // /src/TtFullHadSignalSel.cc //all objects, jets, which are needed for the calculation //of the input-variables have to be passed to this class TtFullHadSignalSel selection(*jets); if(whatData_==-1) { //your training-file contains both, signal and background events edm::Handle<TtGenEvent> genEvt; evt.getByLabel("genEvt", genEvt); bool isSignal = false; if(genEvt->isTtBar()){ if(genEvt->isFullHadronic()) isSignal = true; } evaluateTtFullHadSignalSel(mvaComputer, selection, weight_, true, isSignal); } else { if(whatData_==1){ //your tree contains only signal events evaluateTtFullHadSignalSel(mvaComputer, selection, weight_, true, true); } else if(whatData_==0){ //your tree contains only background events evaluateTtFullHadSignalSel(mvaComputer, selection, weight_, true, false); } else std::cout<<"Config File Error!! Please check <whatData> in TtFullHadSignalSelMVATrainer_cfi"; } }
void TtFullHadSignalSelMVATrainer::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 83 of file TtFullHadSignalSelMVATrainer.cc.
References gather_cfg::cout, selEv, and whatData_.
Definition at line 36 of file TtFullHadSignalSelMVATrainer.h.
Referenced by analyze().
int TtFullHadSignalSelMVATrainer::maxEv_ [private] |
Definition at line 39 of file TtFullHadSignalSelMVATrainer.h.
Referenced by analyze().
Definition at line 43 of file TtFullHadSignalSelMVATrainer.h.
Referenced by analyze().
int TtFullHadSignalSelMVATrainer::selEv [private] |
Definition at line 40 of file TtFullHadSignalSelMVATrainer.h.
Referenced by analyze(), and beginJob().
double TtFullHadSignalSelMVATrainer::weight_ [private] |
Definition at line 41 of file TtFullHadSignalSelMVATrainer.h.
Referenced by analyze().
int TtFullHadSignalSelMVATrainer::whatData_ [private] |
Definition at line 38 of file TtFullHadSignalSelMVATrainer.h.
Referenced by analyze(), and beginJob().