8 int ecalsubdet,
int ptbin)
20 std::vector<LikelihoodSpecies*>::iterator specItr;
50 std::vector<LikelihoodSpecies*>::const_iterator specItr;
53 if(strcmp(species->
getName(),specname)==0) {
66 const char* catName,
float frac) {
67 std::vector<LikelihoodSpecies*>::const_iterator specItr;
70 if(strcmp(species->
getName(),specname)==0) {
81 const std::vector<float>& measurements,
84 float sigProb=0, bkgProb=0;
85 std::vector<LikelihoodSpecies*>::const_iterator specItr;
89 std::map<std::string,float>::const_iterator iter = splitFractions.find(gsfClass);
91 float splitFr= (splitFractions.empty()) ? 1. : iter->second;
92 if(strcmp(species->
getName(),specname)==0) {
100 return sigProb/(sigProb+bkgProb);
109 const std::vector<float>& measurements,
113 float priorWeight=1.;
114 std::vector<LikelihoodSpecies*>::const_iterator specItr;
117 if(strcmp(species->
getName(),specName)==0) {
118 for(
unsigned int ipdf=0; ipdf< species->
getListOfPdfs().size(); ipdf++) {
119 bareProb*=species->
getListOfPdfs()[ipdf]->getVal(measurements.at(ipdf),gsfClass);
125 edm::LogInfo(
"LikelihoodPdfProduct") <<
"Species: " << specName
126 <<
" bare probability = " << bareProb
127 <<
" with a priori probability = " << priorWeight;
128 return priorWeight*bareProb;
void initFromDB(const ElectronLikelihoodCalibration *calibration)
initialize the PDFs from CondDB
void setSplitFraction(std::pair< std::string, float > splitfrac)
void setSplitFrac(const char *specname, const char *catName, float frac=1.0)
set the fraction of one category for a given species
void addSpecies(const char *name, float priorWeight=1.)
add a species (hypothesis) to the likelihood, with a priori probability
std::vector< const LikelihoodPdf * > const & getListOfPdfs() const
LikelihoodPdfProduct(const char *name, int ecalsubdet, int ptbin)
float getSpeciesProb(const char *specName, const std::vector< float > &measurements, const std::string &gsfClass) const
std::map< std::string, float > const & getSplitFractions() const
void initFromDB(const ElectronLikelihoodCalibration *calibration)
initialize PDFs from CondDB
std::vector< LikelihoodSpecies * > _specList
void split(const std::map< std::string, float > &splitFractions, bool splitPdf=false)
void addPdf(const char *specname, const char *name, bool splitPdf=false)
add a pdf for a species, splitted or not
void addPdf(const LikelihoodPdf *pdf)
const char * getName() const
const ElectronLikelihoodCalibration * _calibration
float getRatio(const char *specName, const std::vector< float > &measurements, const std::string &) const
get the likelihood ratio p(a priori) * L(specName) / L_tot