CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TtFullHadSignalSelMVATrainer Class Reference

#include <TtFullHadSignalSelMVATrainer.h>

Inheritance diagram for TtFullHadSignalSelMVATrainer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TtFullHadSignalSelMVATrainer (const edm::ParameterSet &)
 
 ~TtFullHadSignalSelMVATrainer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< TtGenEventgenEvtToken_
 
edm::EDGetTokenT< std::vector
< pat::Jet > > 
jetsToken_
 
int maxEv_
 
PhysicsTools::MVAComputerCache mvaComputer
 
int selEv
 
double weight_
 
int whatData_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 25 of file TtFullHadSignalSelMVATrainer.h.

Constructor & Destructor Documentation

TtFullHadSignalSelMVATrainer::TtFullHadSignalSelMVATrainer ( const edm::ParameterSet cfg)
explicit

Definition at line 13 of file TtFullHadSignalSelMVATrainer.cc.

13  :
14  jetsToken_ (consumes< std::vector<pat::Jet> >(cfg.getParameter<edm::InputTag>("jets"))),
15  genEvtToken_ (consumes<TtGenEvent>(edm::InputTag("genEvt"))),
16  whatData_ (cfg.getParameter<int>("whatData")),
17  maxEv_ (cfg.getParameter<int>("maxEv")),
18  weight_ (cfg.getParameter<double>("weight"))
19 {
20 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
edm::EDGetTokenT< TtGenEvent > genEvtToken_
TtFullHadSignalSelMVATrainer::~TtFullHadSignalSelMVATrainer ( )

Definition at line 22 of file TtFullHadSignalSelMVATrainer.cc.

23 {
24 }

Member Function Documentation

void TtFullHadSignalSelMVATrainer::analyze ( const edm::Event evt,
const edm::EventSetup setup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 27 of file TtFullHadSignalSelMVATrainer.cc.

References gather_cfg::cout, evaluateTtFullHadSignalSel(), TtGenEvtProducer_cfi::genEvt, genEvtToken_, edm::Event::getByToken(), fwrapper::jets, jetsToken_, maxEv_, mvaComputer, corrVsCorr::selection, selEv, HcalObjRepresent::setup(), PhysicsTools::MVAComputerCache::update(), weight_, and whatData_.

28 {
29  //communication with CMSSW CondDB
30  mvaComputer.update<TtFullHadSignalSelMVARcd>("trainer", setup, "traintreeSaver");
31 
32  // can occur in the last iteration when the
33  // MVATrainer is about to save the result
34  if(!mvaComputer) return;
35 
36  // get the jets out of the event
38  evt.getByToken(jetsToken_, jets);
39 
40  //count the number of selected events
41  selEv++;
42  //skip event if enough events are already selected
43  if(selEv>maxEv_ && maxEv_!=-1) return;
44 
45  //calculation of InputVariables
46  //see TopQuarkAnalysis/TopTools/interface/TtFullHadSignalSel.h
47  // /src/TtFullHadSignalSel.cc
48  //all objects, jets, which are needed for the calculation
49  //of the input-variables have to be passed to this class
50 
52 
53  if(whatData_==-1) {
54  //your training-file contains both, signal and background events
55 
57  evt.getByToken(genEvtToken_, genEvt);
58 
59  bool isSignal = false;
60  if(genEvt->isTtBar()){
61  if(genEvt->isFullHadronic()) isSignal = true;
62  }
64  }
65  else {
66 
67  if(whatData_==1){
68  //your tree contains only signal events
69 
71  }
72  else if(whatData_==0){
73  //your tree contains only background events
74 
76  }
77  else std::cout<<"Config File Error!! Please check <whatData> in TtFullHadSignalSelMVATrainer_cfi";
78  }
79 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
selection
main part
Definition: corrVsCorr.py:98
vector< PseudoJet > jets
double evaluateTtFullHadSignalSel(PhysicsTools::MVAComputerCache &mvaComputer, const TtFullHadSignalSel &sigsel, double weight=1.0, const bool training=false, const bool isSignal=false)
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
edm::EDGetTokenT< TtGenEvent > genEvtToken_
bool update(const Calibration::MVAComputer *computer)
tuple cout
Definition: gather_cfg.py:121
PhysicsTools::MVAComputerCache mvaComputer
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void TtFullHadSignalSelMVATrainer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file TtFullHadSignalSelMVATrainer.cc.

References gather_cfg::cout, selEv, and whatData_.

81  {
82  selEv = 0;
83  if(whatData_!=-1 && whatData_!=0 && whatData_!=1){
84  std::cout<<"Config File Error!! Please check <whatData> in TtFullHadSignalSelMVATrainer_cfi"<<std::endl;;
85  return;
86  }
87 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

edm::EDGetTokenT<TtGenEvent> TtFullHadSignalSelMVATrainer::genEvtToken_
private

Definition at line 38 of file TtFullHadSignalSelMVATrainer.h.

Referenced by analyze().

edm::EDGetTokenT< std::vector<pat::Jet> > TtFullHadSignalSelMVATrainer::jetsToken_
private

Definition at line 37 of file TtFullHadSignalSelMVATrainer.h.

Referenced by analyze().

int TtFullHadSignalSelMVATrainer::maxEv_
private

Definition at line 41 of file TtFullHadSignalSelMVATrainer.h.

Referenced by analyze().

PhysicsTools::MVAComputerCache TtFullHadSignalSelMVATrainer::mvaComputer
private

Definition at line 45 of file TtFullHadSignalSelMVATrainer.h.

Referenced by analyze().

int TtFullHadSignalSelMVATrainer::selEv
private

Definition at line 42 of file TtFullHadSignalSelMVATrainer.h.

Referenced by analyze(), and beginJob().

double TtFullHadSignalSelMVATrainer::weight_
private

Definition at line 43 of file TtFullHadSignalSelMVATrainer.h.

Referenced by analyze().

int TtFullHadSignalSelMVATrainer::whatData_
private

Definition at line 40 of file TtFullHadSignalSelMVATrainer.h.

Referenced by analyze(), and beginJob().