50 std::vector<TFile*>& inputFilesToDelete) {
52 throw cms::Exception(
"PATTauDiscriminationByIsolationMVARun2::loadMVA")
59 throw cms::Exception(
"PATTauDiscriminationByIsolationMVARun2::loadMVA")
60 <<
" Failed to load MVA = " <<
mvaName.data() <<
" from file = " <<
inputFileName.fullPath().data()
76 moduleLabel_(
cfg.getParameter<
std::
string>(
"@module_label")),
80 loadMVAfromDB_ =
cfg.getParameter<
bool>(
"loadMVAfromDB");
81 if (!loadMVAfromDB_) {
87 if (mvaOpt_string ==
"oldDMwoLT")
89 else if (mvaOpt_string ==
"oldDMwLT")
91 else if (mvaOpt_string ==
"newDMwoLT")
93 else if (mvaOpt_string ==
"newDMwLT")
95 else if (mvaOpt_string ==
"DBoldDMwLT")
97 else if (mvaOpt_string ==
"DBnewDMwLT")
99 else if (mvaOpt_string ==
"PWoldDMwLT")
101 else if (mvaOpt_string ==
"PWnewDMwLT")
103 else if (mvaOpt_string ==
"DBoldDMwLTwGJ")
105 else if (mvaOpt_string ==
"DBnewDMwLTwGJ")
107 else if (mvaOpt_string ==
"DBnewDMwLTwGJPhase2")
111 <<
" Invalid Configuration Parameter 'mvaOpt' = " << mvaOpt_string <<
" !!\n";
114 mvaInput_ =
new float[6];
116 mvaInput_ =
new float[12];
119 mvaInput_ =
new float[23];
121 mvaInput_ =
new float[30];
125 chargedIsoPtSums_ =
cfg.getParameter<
std::string>(
"srcChargedIsoPtSum");
126 neutralIsoPtSums_ =
cfg.getParameter<
std::string>(
"srcNeutralIsoPtSum");
128 photonPtSumOutsideSignalCone_ =
cfg.getParameter<
std::string>(
"srcPhotonPtSumOutsideSignalCone");
129 footprintCorrection_ =
cfg.getParameter<
std::string>(
"srcFootprintCorrection");
131 verbosity_ =
cfg.getParameter<
int>(
"verbosity");
142 for (std::vector<TFile*>::iterator it = inputFilesToDelete_.begin(); it != inputFilesToDelete_.end(); ++it) {
174 if (loadMVAfromDB_) {
175 mvaReader_ = &es.
getData(mvaToken_);
177 mvaReader_ = loadMVAfromFile(inputFileName_, mvaName_, inputFilesToDelete_);
190 if (
tau->leadChargedHadrCand().isNull()) {
191 result.rawValues.at(0) = 0.;
201 photonPtSumOutsideSignalCone_,
202 footprintCorrection_)) {
203 double mvaValue = mvaReader_->GetClassifier(mvaInput_);
205 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
"<PATTauDiscriminationByMVAIsolationRun2::discriminate>:";
206 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
" tau: Pt = " <<
tau->pt() <<
", eta = " <<
tau->eta();
208 <<
" isolation: charged = " <<
tau->tauID(chargedIsoPtSums_)
209 <<
", neutral = " <<
tau->tauID(neutralIsoPtSums_) <<
", PUcorr = " <<
tau->tauID(puCorrPtSums_);
210 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
" decay mode = " <<
tau->decayMode();
212 <<
" impact parameter: distance = " <<
tau->dxy() <<
", significance = " <<
tau->dxy_Sig();
213 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
" has decay vertex = " <<
tau->hasSecondaryVertex() <<
":" 214 <<
", significance = " <<
tau->flightLengthSig();
215 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
"--> mvaValue = " << mvaValue;
217 result.rawValues.at(0) = mvaValue;
227 desc.add<
bool>(
"loadMVAfromDB");
236 desc.add<
int>(
"verbosity", 0);
238 fillProducerDescriptions(
desc);
240 descriptions.
add(
"patTauDiscriminationByMVAIsolationRun2",
desc);
std::string footprintCorrection_
edm::Handle< TauCollection > taus_
const GBRForest * mvaReader_
bool fillIsoMVARun2Inputs(float *mvaInput, const pat::Tau &tau, int mvaOpt, const std::string &nameCharged, const std::string &nameNeutral, const std::string &namePu, const std::string &nameOutside, const std::string &nameFootprint)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::string photonPtSumOutsideSignalCone_
edm::ESGetToken< GBRForest, GBRWrapperRcd > mvaToken_
std::string chargedIsoPtSums_
PATTauDiscriminationByMVAIsolationRun2(const edm::ParameterSet &cfg)
~PATTauDiscriminationByMVAIsolationRun2() override
#define DEFINE_FWK_MODULE(type)
bool getData(T &iHolder) const
Log< level::Warning, true > LogPrint
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::string neutralIsoPtSums_
std::vector< TFile * > inputFilesToDelete_
std::string puCorrPtSums_
edm::FileInPath inputFileName_