CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/RecoEgamma/ElectronIdentification/plugins/ElectronLikelihoodESSource.cc

Go to the documentation of this file.
00001 #include "RecoEgamma/ElectronIdentification/plugins/ElectronLikelihoodESSource.h"
00002 
00003 ElectronLikelihoodESSource::ElectronLikelihoodESSource (const edm::ParameterSet& cfg) :
00004   m_signalWeightSplitting (cfg.getParameter<std::string> ("signalWeightSplitting")) ,
00005   m_backgroundWeightSplitting (cfg.getParameter<std::string> ("backgroundWeightSplitting")) ,
00006   m_splitSignalPdfs (cfg.getParameter<bool> ("splitSignalPdfs")) ,
00007   m_splitBackgroundPdfs (cfg.getParameter<bool> ("splitBackgroundPdfs"))
00008 {
00009   setWhatProduced (this) ;
00010   findingRecord<ElectronLikelihoodRcd> () ;
00011 
00012   m_eleIDSwitches.m_useDeltaEta     = cfg.getParameter<bool> ("useDeltaEta") ;
00013   m_eleIDSwitches.m_useDeltaPhi     = cfg.getParameter<bool> ("useDeltaPhi") ;
00014   m_eleIDSwitches.m_useHoverE       = cfg.getParameter<bool> ("useHoverE") ;
00015   m_eleIDSwitches.m_useEoverP       = cfg.getParameter<bool> ("useEoverP") ;
00016   m_eleIDSwitches.m_useSigmaEtaEta  = cfg.getParameter<bool> ("useSigmaEtaEta") ;
00017   m_eleIDSwitches.m_useSigmaPhiPhi  = cfg.getParameter<bool> ("useSigmaPhiPhi") ;
00018   m_eleIDSwitches.m_useFBrem        = cfg.getParameter<bool> ("useFBrem") ;
00019 
00020 }
00021 
00022 
00023 // ----------------------------------------------------
00024 
00025 
00026 ElectronLikelihoodESSource::~ElectronLikelihoodESSource() {
00027 }
00028 
00029 
00030 // ----------------------------------------------------
00031 
00032 
00033 ElectronLikelihoodESSource::ReturnType
00034 ElectronLikelihoodESSource::produce (const ElectronLikelihoodRcd & iRecord) 
00035 {
00036 
00037   const ElectronLikelihoodCalibration *calibration = readPdfFromDB (iRecord) ;
00038 
00039   ReturnType LHAlgo (new ElectronLikelihood (&(*calibration), 
00040                                              m_eleIDSwitches,
00041                                              m_signalWeightSplitting, m_backgroundWeightSplitting,
00042                                              m_splitSignalPdfs, m_splitBackgroundPdfs
00043                                              ) ); 
00044 
00045   return LHAlgo;
00046 }
00047 
00048 
00049 // ----------------------------------------------------
00050 
00051 
00052 void 
00053 ElectronLikelihoodESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
00054                                            const edm::IOVSyncValue&,
00055                                            edm::ValidityInterval& oInterval ) {
00056   // the same PDF's is valid for any time
00057   oInterval = edm::ValidityInterval (edm::IOVSyncValue::beginOfTime (), 
00058                                      edm::IOVSyncValue::endOfTime ()) ;
00059 }
00060 
00061 
00062 // ----------------------------------------------------
00063 
00064 const ElectronLikelihoodCalibration*
00065 ElectronLikelihoodESSource::readPdfFromDB( const ElectronLikelihoodRcd & iRecord ) {
00066 
00067   // setup the PDF's from DB
00068   const ElectronLikelihoodCalibration *calibration = 0;
00069   edm::ESHandle<ElectronLikelihoodCalibration> calibHandle;
00070   iRecord.getRecord<ElectronLikelihoodPdfsRcd>().get(calibHandle);
00071   calibration = calibHandle.product();
00072 
00073   return calibration;
00074 }