46 std::vector<TFile*>& inputFilesToDelete) {
48 throw cms::Exception(
"PFRecoTauDiscriminationByIsolationMVA2::loadMVA")
55 throw cms::Exception(
"PFRecoTauDiscriminationByIsolationMVA2::loadMVA")
56 <<
" Failed to load MVA = " <<
mvaName.data() <<
" from file = " <<
inputFileName.fullPath().data()
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")
109 <<
" Invalid Configuration Parameter 'mvaOpt' = " << mvaOpt_string <<
" !!\n";
122 consumes<PFTauTIPAssociationByRef>(
cfg.getParameter<
edm::InputTag>(
"srcTauTransverseImpactParameters"));
125 consumes<reco::TauDiscriminatorContainer>(
cfg.getParameter<
edm::InputTag>(
"srcBasicTauDiscriminators"));
198 const std::vector<edm::ParameterSet> psetsFromProvenance =
200 .getParameter<std::vector<edm::ParameterSet>>(
"IDdefinitions");
201 for (
uint i = 0;
i < psetsFromProvenance.size();
i++) {
202 if (psetsFromProvenance[
i].getParameter<std::string>(
"IDname") ==
"ChargedIsoPtSum" +
input_id_name_suffix_)
204 else if (psetsFromProvenance[
i].getParameter<std::string>(
"IDname") ==
207 else if (psetsFromProvenance[
i].getParameter<std::string>(
"IDname") ==
"PUcorrPtSum" +
input_id_name_suffix_)
209 else if (psetsFromProvenance[
i].getParameter<std::string>(
"IDname") ==
212 else if (psetsFromProvenance[
i].getParameter<std::string>(
"IDname") ==
225 if (
tau->leadChargedHadrCand().isNull())
228 int tauDecayMode =
tau->decayMode();
232 (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 10)) ||
235 (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 5 || tauDecayMode == 6 ||
236 tauDecayMode == 10 || tauDecayMode == 11))) {
237 auto const rawValues = (*basicTauDiscriminators_)[
tau].rawValues;
249 float decayDistMag =
std::sqrt(decayDistX * decayDistX + decayDistY * decayDistY + decayDistZ * decayDistZ);
260 float gjAngleDiff = -999;
261 if (tauDecayMode == 10) {
262 double mTau = 1.77682;
263 double mAOne =
tau->p4().M();
264 double pAOneMag =
tau->p();
265 double argumentThetaGJmax = (
std::pow(mTau, 2) -
std::pow(mAOne, 2)) / (2 * mTau * pAOneMag);
266 double argumentThetaGJmeasured =
267 (
tau->p4().px() * decayDistX +
tau->p4().py() * decayDistY +
tau->p4().pz() * decayDistZ) /
268 (pAOneMag * decayDistMag);
269 if (
std::abs(argumentThetaGJmax) <= 1. &&
std::abs(argumentThetaGJmeasured) <= 1.) {
270 double thetaGJmax = std::asin(argumentThetaGJmax);
271 double thetaGJmeasured = std::acos(argumentThetaGJmeasured);
272 gjAngleDiff = thetaGJmeasured - thetaGJmax;
290 mvaInput_[6] = std::copysign(+1.
f, (
float)tauLifetimeInfo.
dxy());
311 mvaInput_[14] = std::copysign(+1.
f, (
float)tauLifetimeInfo.
dxy());
314 mvaInput_[17] = std::copysign(+1.
f, (
float)tauLifetimeInfo.
ip3d());
335 mvaInput_[14] = std::copysign(+1.
f, (
float)tauLifetimeInfo.
dxy());
338 mvaInput_[17] = std::copysign(+1.
f, (
float)tauLifetimeInfo.
ip3d());
358 mvaInput_[13] = std::copysign(+1.
f, (
float)tauLifetimeInfo.
dxy());
361 mvaInput_[16] = std::copysign(+1.
f, (
float)tauLifetimeInfo.
ip3d());
372 edm::LogPrint(
"PFTauDiscByMVAIsol2") <<
"<PFRecoTauDiscriminationByMVAIsolationRun2::discriminate>:";
373 edm::LogPrint(
"PFTauDiscByMVAIsol2") <<
" tau: Pt = " <<
tau->pt() <<
", eta = " <<
tau->eta();
374 edm::LogPrint(
"PFTauDiscByMVAIsol2") <<
" isolation: charged = " << chargedIsoPtSum
375 <<
", neutral = " << neutralIsoPtSum <<
", PUcorr = " << puCorrPtSum;
376 edm::LogPrint(
"PFTauDiscByMVAIsol2") <<
" decay mode = " << tauDecayMode;
377 edm::LogPrint(
"PFTauDiscByMVAIsol2") <<
" impact parameter: distance = " << tauLifetimeInfo.
dxy()
378 <<
", significance = " << tauLifetimeInfo.
dxy_Sig();
381 <<
" distance = " << decayDistMag <<
", significance = " << tauLifetimeInfo.
flightLengthSig();
382 edm::LogPrint(
"PFTauDiscByMVAIsol2") <<
"--> mvaValue = " << mvaValue;
384 result.rawValues.at(0) = mvaValue;
394 desc.add<
bool>(
"loadMVAfromDB",
true);
402 desc.add<
int>(
"verbosity", 0);
406 descriptions.
add(
"pfRecoTauDiscriminationByMVAIsolationRun2",
desc);