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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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::InputTag jets_
 
int maxEv_
 
PhysicsTools::MVAComputerCache mvaComputer
 
int selEv
 
double weight_
 
int whatData_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 24 of file TtFullHadSignalSelMVATrainer.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file TtFullHadSignalSelMVATrainer.cc.

16  :
17  jets_ (cfg.getParameter<edm::InputTag>("jets")),
18  whatData_ (cfg.getParameter<int>("whatData")),
19  maxEv_ (cfg.getParameter<int>("maxEv")),
20  weight_ (cfg.getParameter<double>("weight"))
21 {
22 }
T getParameter(std::string const &) const
TtFullHadSignalSelMVATrainer::~TtFullHadSignalSelMVATrainer ( )

Definition at line 24 of file TtFullHadSignalSelMVATrainer.cc.

25 {
26 }

Member Function Documentation

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

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_.

30 {
31  //communication with CMSSW CondDB
32  mvaComputer.update<TtFullHadSignalSelMVARcd>("trainer", setup, "traintreeSaver");
33 
34  // can occur in the last iteration when the
35  // MVATrainer is about to save the result
36  if(!mvaComputer) return;
37 
38  // get the jets out of the event
40  evt.getByLabel(jets_, jets);
41 
42  //count the number of selected events
43  selEv++;
44  //skip event if enough events are already selected
45  if(selEv>maxEv_ && maxEv_!=-1) return;
46 
47  //calculation of InputVariables
48  //see TopQuarkAnalysis/TopTools/interface/TtFullHadSignalSel.h
49  // /src/TtFullHadSignalSel.cc
50  //all objects, jets, which are needed for the calculation
51  //of the input-variables have to be passed to this class
52 
54 
55  if(whatData_==-1) {
56  //your training-file contains both, signal and background events
57 
59  evt.getByLabel("genEvt", genEvt);
60 
61  bool isSignal = false;
62  if(genEvt->isTtBar()){
63  if(genEvt->isFullHadronic()) isSignal = true;
64  }
66  }
67  else {
68 
69  if(whatData_==1){
70  //your tree contains only signal events
71 
73  }
74  else if(whatData_==0){
75  //your tree contains only background events
76 
78  }
79  else std::cout<<"Config File Error!! Please check <whatData> in TtFullHadSignalSelMVATrainer_cfi";
80  }
81 }
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)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
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 83 of file TtFullHadSignalSelMVATrainer.cc.

References gather_cfg::cout, selEv, and whatData_.

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

Member Data Documentation

edm::InputTag TtFullHadSignalSelMVATrainer::jets_
private

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().

PhysicsTools::MVAComputerCache TtFullHadSignalSelMVATrainer::mvaComputer
private

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().