CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/TopQuarkAnalysis/TopEventSelection/plugins/TtFullHadSignalSelMVAComputer.cc

Go to the documentation of this file.
00001 #include "PhysicsTools/JetMCUtils/interface/combination.h"
00002 
00003 #include "TopQuarkAnalysis/TopEventSelection/plugins/TtFullHadSignalSelMVAComputer.h"
00004 #include "TopQuarkAnalysis/TopEventSelection/interface/TtFullHadSignalSelEval.h"
00005 
00006 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00007 #include "DataFormats/PatCandidates/interface/Jet.h"
00008 
00009 #include "DataFormats/Common/interface/TriggerResults.h"
00010 #include "FWCore/Framework/interface/TriggerNamesService.h"
00011 #include "FWCore/ServiceRegistry/interface/Service.h"
00012 #include "DataFormats/PatCandidates/interface/Flags.h"
00013 
00014 
00015 TtFullHadSignalSelMVAComputer::TtFullHadSignalSelMVAComputer(const edm::ParameterSet& cfg):
00016   jets_    (cfg.getParameter<edm::InputTag>("jets"))
00017 {
00018   produces< double >("DiscSel");
00019 }
00020 
00021   
00022 
00023 TtFullHadSignalSelMVAComputer::~TtFullHadSignalSelMVAComputer()
00024 {
00025 }
00026 
00027 void
00028 TtFullHadSignalSelMVAComputer::produce(edm::Event& evt, const edm::EventSetup& setup)
00029 {
00030   std::auto_ptr< double > pOutDisc (new double);
00031  
00032   mvaComputer.update<TtFullHadSignalSelMVARcd>(setup, "ttFullHadSignalSelMVA");
00033 
00034   // read name of the last processor in the MVA calibration
00035   // (to be used as meta information)
00036   edm::ESHandle<PhysicsTools::Calibration::MVAComputerContainer> calibContainer;
00037   setup.get<TtFullHadSignalSelMVARcd>().get( calibContainer );
00038   std::vector<PhysicsTools::Calibration::VarProcessor*> processors
00039     = (calibContainer->find("ttFullHadSignalSelMVA")).getProcessors();
00040 
00041   edm::Handle< std::vector<pat::Jet> > jets;
00042   evt.getByLabel(jets_, jets);
00043   
00044   //calculation of InputVariables
00045   //see TopQuarkAnalysis/TopTools/interface/TtFullHadSignalSel.h
00046   //                             /src/TtFullHadSignalSel.cc
00047   //all objects, jets, which are needed for the calculation
00048   //of the input-variables have to be passed to this class
00049   TtFullHadSignalSel selection(*jets);
00050 
00051   double discrim = evaluateTtFullHadSignalSel(mvaComputer, selection);
00052 
00053   *pOutDisc = discrim;
00054   
00055   evt.put(pOutDisc, "DiscSel");
00056   
00057   DiscSel = discrim;
00058 }
00059 
00060 void 
00061 TtFullHadSignalSelMVAComputer::beginJob()
00062 {
00063 }
00064 
00065 void 
00066 TtFullHadSignalSelMVAComputer::endJob()
00067 {
00068 }
00069 
00070 // implement the plugins for the computer container
00071 // -> register TtFullHadSignalSelMVARcd
00072 // -> define TtFullHadSignalSelMVAFileSource
00073 MVA_COMPUTER_CONTAINER_IMPLEMENT(TtFullHadSignalSelMVA);