CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/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   m_eleIDSwitches.m_useOneOverEMinusOneOverP = cfg.getParameter<bool> ("useOneOverEMinusOneOverP") ;
00020 
00021 }
00022 
00023 
00024 // ----------------------------------------------------
00025 
00026 
00027 ElectronLikelihoodESSource::~ElectronLikelihoodESSource() {
00028 }
00029 
00030 
00031 // ----------------------------------------------------
00032 
00033 
00034 ElectronLikelihoodESSource::ReturnType
00035 ElectronLikelihoodESSource::produce (const ElectronLikelihoodRcd & iRecord) 
00036 {
00037 
00038   const ElectronLikelihoodCalibration *calibration = readPdfFromDB (iRecord) ;
00039 
00040   ReturnType LHAlgo (new ElectronLikelihood (&(*calibration), 
00041                                              m_eleIDSwitches,
00042                                              m_signalWeightSplitting, m_backgroundWeightSplitting,
00043                                              m_splitSignalPdfs, m_splitBackgroundPdfs
00044                                              ) ); 
00045 
00046   return LHAlgo;
00047 }
00048 
00049 
00050 // ----------------------------------------------------
00051 
00052 
00053 void 
00054 ElectronLikelihoodESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
00055                                            const edm::IOVSyncValue&,
00056                                            edm::ValidityInterval& oInterval ) {
00057   // the same PDF's is valid for any time
00058   oInterval = edm::ValidityInterval (edm::IOVSyncValue::beginOfTime (), 
00059                                      edm::IOVSyncValue::endOfTime ()) ;
00060 }
00061 
00062 
00063 // ----------------------------------------------------
00064 
00065 const ElectronLikelihoodCalibration*
00066 ElectronLikelihoodESSource::readPdfFromDB( const ElectronLikelihoodRcd & iRecord ) {
00067 
00068   // setup the PDF's from DB
00069   const ElectronLikelihoodCalibration *calibration = 0;
00070   edm::ESHandle<ElectronLikelihoodCalibration> calibHandle;
00071   iRecord.getRecord<ElectronLikelihoodPdfsRcd>().get(calibHandle);
00072   calibration = calibHandle.product();
00073 
00074   return calibration;
00075 }