CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes
reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2 Class Reference
Inheritance diagram for reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2:
TauDiscriminationProducerBase< TauType, TauDiscriminator > edm::stream::EDProducer<>

Public Member Functions

void beginEvent (const edm::Event &, const edm::EventSetup &) override
 
double discriminate (const PFTauRef &) const override
 
void endEvent (edm::Event &) override
 
 PFRecoTauDiscriminationByMVAIsolationRun2 (const edm::ParameterSet &cfg)
 
 ~PFRecoTauDiscriminationByMVAIsolationRun2 () override
 
- Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
virtual double discriminate (const TauRef &tau) const =0
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 TauDiscriminationProducerBase (const edm::ParameterSet &iConfig)
 
 TauDiscriminationProducerBase ()
 
 ~TauDiscriminationProducerBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
static void fillProducerDescriptions (edm::ParameterSetDescription &desc)
 

Private Types

typedef edm::AssociationVector< reco::PFTauRefProd, std::vector< reco::PFTauTransverseImpactParameterRef > > PFTauTIPAssociationByRef
 

Private Attributes

std::unique_ptr< PFTauDiscriminatorcategory_output_
 
edm::EDGetTokenT< reco::PFTauDiscriminatorChargedIsoPtSum_token
 
edm::Handle< reco::PFTauDiscriminatorchargedIsoPtSums_
 
edm::Handle< reco::PFTauDiscriminatorfootprintCorrection_
 
edm::EDGetTokenT< reco::PFTauDiscriminatorFootprintCorrection_token
 
edm::FileInPath inputFileName_
 
std::vector< TFile * > inputFilesToDelete_
 
bool loadMVAfromDB_
 
std::string moduleLabel_
 
float * mvaInput_
 
std::string mvaName_
 
int mvaOpt_
 
const GBRForestmvaReader_
 
edm::EDGetTokenT< reco::PFTauDiscriminatorNeutralIsoPtSum_token
 
edm::Handle< reco::PFTauDiscriminatorneutralIsoPtSums_
 
edm::Handle< reco::PFTauDiscriminatorphotonPtSumOutsideSignalCone_
 
edm::EDGetTokenT< reco::PFTauDiscriminatorPhotonPtSumOutsideSignalCone_token
 
edm::EDGetTokenT< reco::PFTauDiscriminatorPUcorrPtSum_token
 
edm::Handle< reco::PFTauDiscriminatorpuCorrPtSums_
 
edm::Handle< PFTauTIPAssociationByReftauLifetimeInfos
 
edm::Handle< TauCollectiontaus_
 
edm::EDGetTokenT< PFTauTIPAssociationByRefTauTransverseImpactParameters_token
 
int verbosity_
 

Additional Inherited Members

- Public Types inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
typedef std::vector< TauType > TauCollection
 
typedef edm::Ref< TauCollectionTauRef
 
typedef edm::RefProd< TauCollectionTauRefProd
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Protected Attributes inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
std::string moduleLabel_
 
double prediscriminantFailValue_
 
edm::EDGetTokenT< TauCollectionTau_token
 
size_t tauIndex_
 
edm::InputTag TauProducer_
 

Detailed Description

Definition at line 72 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Member Typedef Documentation

Constructor & Destructor Documentation

reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::PFRecoTauDiscriminationByMVAIsolationRun2 ( const edm::ParameterSet cfg)
inlineexplicit

Definition at line 74 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

References beginEvent(), ChargedIsoPtSum_token, discriminate(), endEvent(), Exception, FootprintCorrection_token, edm::ParameterSet::getParameter(), inputFileName_, reco::tau::kDBnewDMwLT, reco::tau::kDBnewDMwLTwGJ, reco::tau::kDBoldDMwLT, reco::tau::kDBoldDMwLTwGJ, reco::tau::kNewDMwLT, reco::tau::kNewDMwoLT, reco::tau::kOldDMwLT, reco::tau::kOldDMwoLT, reco::tau::kPWnewDMwLT, reco::tau::kPWoldDMwLT, loadMVAfromDB_, mvaInput_, mvaName_, mvaOpt_, NeutralIsoPtSum_token, PhotonPtSumOutsideSignalCone_token, PUcorrPtSum_token, AlCaHLTBitMon_QueryRunRegistry::string, TauTransverseImpactParameters_token, and verbosity_.

76  moduleLabel_(cfg.getParameter<std::string>("@module_label")),
77  mvaReader_(nullptr),
78  mvaInput_(nullptr),
80  mvaName_ = cfg.getParameter<std::string>("mvaName");
81  loadMVAfromDB_ = cfg.getParameter<bool>("loadMVAfromDB");
82  if (!loadMVAfromDB_) {
83  inputFileName_ = cfg.getParameter<edm::FileInPath>("inputFileName");
84  }
85  std::string mvaOpt_string = cfg.getParameter<std::string>("mvaOpt");
86  if (mvaOpt_string == "oldDMwoLT")
88  else if (mvaOpt_string == "oldDMwLT")
90  else if (mvaOpt_string == "newDMwoLT")
92  else if (mvaOpt_string == "newDMwLT")
94  else if (mvaOpt_string == "DBoldDMwLT")
96  else if (mvaOpt_string == "DBnewDMwLT")
98  else if (mvaOpt_string == "PWoldDMwLT")
100  else if (mvaOpt_string == "PWnewDMwLT")
102  else if (mvaOpt_string == "DBoldDMwLTwGJ")
104  else if (mvaOpt_string == "DBnewDMwLTwGJ")
106  else
107  throw cms::Exception("PFRecoTauDiscriminationByMVAIsolationRun2")
108  << " Invalid Configuration Parameter 'mvaOpt' = " << mvaOpt_string << " !!\n";
109 
110  if (mvaOpt_ == kOldDMwoLT || mvaOpt_ == kNewDMwoLT)
111  mvaInput_ = new float[6];
112  else if (mvaOpt_ == kOldDMwLT || mvaOpt_ == kNewDMwLT)
113  mvaInput_ = new float[12];
116  mvaInput_ = new float[23];
117  else
118  assert(0);
119 
121  consumes<PFTauTIPAssociationByRef>(cfg.getParameter<edm::InputTag>("srcTauTransverseImpactParameters"));
122 
124  consumes<reco::PFTauDiscriminator>(cfg.getParameter<edm::InputTag>("srcChargedIsoPtSum"));
126  consumes<reco::PFTauDiscriminator>(cfg.getParameter<edm::InputTag>("srcNeutralIsoPtSum"));
127  PUcorrPtSum_token = consumes<reco::PFTauDiscriminator>(cfg.getParameter<edm::InputTag>("srcPUcorrPtSum"));
129  consumes<reco::PFTauDiscriminator>(cfg.getParameter<edm::InputTag>("srcPhotonPtSumOutsideSignalCone"));
131  consumes<reco::PFTauDiscriminator>(cfg.getParameter<edm::InputTag>("srcFootprintCorrection"));
132 
133  verbosity_ = cfg.getParameter<int>("verbosity");
134 
135  produces<PFTauDiscriminator>("category");
136  }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::PFTauDiscriminator > PhotonPtSumOutsideSignalCone_token
edm::EDGetTokenT< PFTauTIPAssociationByRef > TauTransverseImpactParameters_token
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::~PFRecoTauDiscriminationByMVAIsolationRun2 ( )
inlineoverride

Member Function Documentation

void reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::beginEvent ( const edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 189 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

References category_output_, ChargedIsoPtSum_token, chargedIsoPtSums_, footprintCorrection_, FootprintCorrection_token, edm::Event::getByToken(), inputFileName_, inputFilesToDelete_, taus_updatedMVAIds_cff::loadMVAfromDB, loadMVAfromDB_, mvaName_, mvaReader_, NeutralIsoPtSum_token, neutralIsoPtSums_, photonPtSumOutsideSignalCone_, PhotonPtSumOutsideSignalCone_token, PUcorrPtSum_token, puCorrPtSums_, TauDiscriminationProducerBase< TauType, TauDiscriminator >::Tau_token, tauLifetimeInfos, taus_, and TauTransverseImpactParameters_token.

Referenced by PFRecoTauDiscriminationByMVAIsolationRun2().

189  {
190  if (!mvaReader_) {
191  if (loadMVAfromDB_) {
193  } else {
195  }
196  }
197 
199 
205 
206  evt.getByToken(Tau_token, taus_);
208  }
edm::EDGetTokenT< reco::PFTauDiscriminator > PhotonPtSumOutsideSignalCone_token
edm::RefProd< TauCollection > TauRefProd
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< TauCollection > Tau_token
edm::EDGetTokenT< PFTauTIPAssociationByRef > TauTransverseImpactParameters_token
double reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::discriminate ( const PFTauRef tau) const
override

Definition at line 210 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

References funct::abs(), taus_updatedMVAIds_cff::category, category_output_, tauProducer_cfi::chargedIsoPtSum, reco::PFTauTransverseImpactParameter::dxy(), reco::PFTauTransverseImpactParameter::dxy_Sig(), MillePedeFileConverter_cfg::e, reco::tau::eratio(), f, reco::PFTauTransverseImpactParameter::flightLength(), reco::PFTauTransverseImpactParameter::flightLengthSig(), dqmMemoryStats::float, tauProducer_cfi::footprintCorrection, GBRForest::GetClassifier(), reco::PFTauTransverseImpactParameter::hasSecondaryVertex(), reco::PFTauTransverseImpactParameter::ip3d(), reco::PFTauTransverseImpactParameter::ip3d_Sig(), edm::Ref< C, T, F >::isNull(), reco::tau::kDBnewDMwLT, reco::tau::kDBnewDMwLTwGJ, reco::tau::kDBoldDMwLT, reco::tau::kDBoldDMwLTwGJ, reco::tau::kNewDMwLT, reco::tau::kNewDMwoLT, reco::tau::kOldDMwLT, reco::tau::kOldDMwoLT, reco::tau::kPWnewDMwLT, reco::tau::kPWoldDMwLT, reco::tau::lead_track_chi2(), dqm-mbProfile::log, SiStripPI::max, min(), mvaInput_, mvaOpt_, mvaReader_, reco::tau::n_photons_total(), tauProducer_cfi::neutralIsoPtSum, tauProducer_cfi::photonPtSumOutsideSignalCone, funct::pow(), reco::tau::pt_weighted_deta_strip(), reco::tau::pt_weighted_dphi_strip(), reco::tau::pt_weighted_dr_iso(), reco::tau::pt_weighted_dr_signal(), tauProducer_cfi::puCorrPtSum, mathSSE::sqrt(), metsig::tau, TauDiscriminationProducerBase< TauType, TauDiscriminator >::tauIndex_, and verbosity_.

Referenced by PFRecoTauDiscriminationByMVAIsolationRun2().

210  {
211  // CV: define dummy category index in order to use RecoTauDiscriminantCutMultiplexer module to appy WP cuts
212  double category = 0.;
213  category_output_->setValue(tauIndex_, category);
214 
215  // CV: computation of MVA value requires presence of leading charged hadron
216  if (tau->leadChargedHadrCand().isNull())
217  return 0.;
218 
219  int tauDecayMode = tau->decayMode();
220 
222  mvaOpt_ == kDBoldDMwLTwGJ) &&
223  (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 10)) ||
225  mvaOpt_ == kDBnewDMwLTwGJ) &&
226  (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 5 || tauDecayMode == 6 ||
227  tauDecayMode == 10 || tauDecayMode == 11))) {
228  float chargedIsoPtSum = (*chargedIsoPtSums_)[tau];
229  float neutralIsoPtSum = (*neutralIsoPtSums_)[tau];
230  float puCorrPtSum = (*puCorrPtSums_)[tau];
231  float photonPtSumOutsideSignalCone = (*photonPtSumOutsideSignalCone_)[tau];
232  float footprintCorrection = (*footprintCorrection_)[tau];
233 
234  const reco::PFTauTransverseImpactParameter& tauLifetimeInfo = *(*tauLifetimeInfos)[tau];
235 
236  float decayDistX = tauLifetimeInfo.flightLength().x();
237  float decayDistY = tauLifetimeInfo.flightLength().y();
238  float decayDistZ = tauLifetimeInfo.flightLength().z();
239  float decayDistMag = std::sqrt(decayDistX * decayDistX + decayDistY * decayDistY + decayDistZ * decayDistZ);
240 
241  float nPhoton = (float)reco::tau::n_photons_total(*tau);
242  float ptWeightedDetaStrip = reco::tau::pt_weighted_deta_strip(*tau, tauDecayMode);
243  float ptWeightedDphiStrip = reco::tau::pt_weighted_dphi_strip(*tau, tauDecayMode);
244  float ptWeightedDrSignal = reco::tau::pt_weighted_dr_signal(*tau, tauDecayMode);
245  float ptWeightedDrIsolation = reco::tau::pt_weighted_dr_iso(*tau, tauDecayMode);
246  float leadingTrackChi2 = reco::tau::lead_track_chi2(*tau);
247  float eRatio = reco::tau::eratio(*tau);
248 
249  // Difference between measured and maximally allowed Gottfried-Jackson angle
250  float gjAngleDiff = -999;
251  if (tauDecayMode == 10) {
252  double mTau = 1.77682;
253  double mAOne = tau->p4().M();
254  double pAOneMag = tau->p();
255  double argumentThetaGJmax = (std::pow(mTau, 2) - std::pow(mAOne, 2)) / (2 * mTau * pAOneMag);
256  double argumentThetaGJmeasured =
257  (tau->p4().px() * decayDistX + tau->p4().py() * decayDistY + tau->p4().pz() * decayDistZ) /
258  (pAOneMag * decayDistMag);
259  if (std::abs(argumentThetaGJmax) <= 1. && std::abs(argumentThetaGJmeasured) <= 1.) {
260  double thetaGJmax = std::asin(argumentThetaGJmax);
261  double thetaGJmeasured = std::acos(argumentThetaGJmeasured);
262  gjAngleDiff = thetaGJmeasured - thetaGJmax;
263  }
264  }
265 
266  if (mvaOpt_ == kOldDMwoLT || mvaOpt_ == kNewDMwoLT) {
267  mvaInput_[0] = std::log(std::max(1.f, (float)tau->pt()));
268  mvaInput_[1] = std::abs((float)tau->eta());
269  mvaInput_[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
270  mvaInput_[3] = std::log(std::max(1.e-2f, neutralIsoPtSum - 0.125f * puCorrPtSum));
271  mvaInput_[4] = std::log(std::max(1.e-2f, puCorrPtSum));
272  mvaInput_[5] = tauDecayMode;
273  } else if (mvaOpt_ == kOldDMwLT || mvaOpt_ == kNewDMwLT) {
274  mvaInput_[0] = std::log(std::max(1.f, (float)tau->pt()));
275  mvaInput_[1] = std::abs((float)tau->eta());
276  mvaInput_[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
277  mvaInput_[3] = std::log(std::max(1.e-2f, neutralIsoPtSum - 0.125f * puCorrPtSum));
278  mvaInput_[4] = std::log(std::max(1.e-2f, puCorrPtSum));
279  mvaInput_[5] = tauDecayMode;
280  mvaInput_[6] = std::copysign(+1.f, (float)tauLifetimeInfo.dxy());
281  mvaInput_[7] = std::sqrt(std::abs(std::min(1.f, (float)tauLifetimeInfo.dxy())));
282  mvaInput_[8] = std::min(10.f, std::abs((float)tauLifetimeInfo.dxy_Sig()));
283  mvaInput_[9] = (tauLifetimeInfo.hasSecondaryVertex()) ? 1. : 0.;
284  mvaInput_[10] = std::sqrt(decayDistMag);
285  mvaInput_[11] = std::min(10.f, (float)tauLifetimeInfo.flightLengthSig());
286  } else if (mvaOpt_ == kDBoldDMwLT || mvaOpt_ == kDBnewDMwLT) {
287  mvaInput_[0] = std::log(std::max(1.f, (float)tau->pt()));
288  mvaInput_[1] = std::abs((float)tau->eta());
289  mvaInput_[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
290  mvaInput_[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
291  mvaInput_[4] = std::log(std::max(1.e-2f, puCorrPtSum));
292  mvaInput_[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
293  mvaInput_[6] = tauDecayMode;
294  mvaInput_[7] = std::min(30.f, nPhoton);
295  mvaInput_[8] = std::min(0.5f, ptWeightedDetaStrip);
296  mvaInput_[9] = std::min(0.5f, ptWeightedDphiStrip);
297  mvaInput_[10] = std::min(0.5f, ptWeightedDrSignal);
298  mvaInput_[11] = std::min(0.5f, ptWeightedDrIsolation);
299  mvaInput_[12] = std::min(100.f, leadingTrackChi2);
300  mvaInput_[13] = std::min(1.f, eRatio);
301  mvaInput_[14] = std::copysign(+1.f, (float)tauLifetimeInfo.dxy());
302  mvaInput_[15] = std::sqrt(std::min(1.f, std::abs((float)tauLifetimeInfo.dxy())));
303  mvaInput_[16] = std::min(10.f, std::abs((float)tauLifetimeInfo.dxy_Sig()));
304  mvaInput_[17] = std::copysign(+1.f, (float)tauLifetimeInfo.ip3d());
305  mvaInput_[18] = std::sqrt(std::min(1.f, std::abs((float)tauLifetimeInfo.ip3d())));
306  mvaInput_[19] = std::min(10.f, std::abs((float)tauLifetimeInfo.ip3d_Sig()));
307  mvaInput_[20] = (tauLifetimeInfo.hasSecondaryVertex()) ? 1. : 0.;
308  mvaInput_[21] = std::sqrt(decayDistMag);
309  mvaInput_[22] = std::min(10.f, (float)tauLifetimeInfo.flightLengthSig());
310  } else if (mvaOpt_ == kPWoldDMwLT || mvaOpt_ == kPWnewDMwLT) {
311  mvaInput_[0] = std::log(std::max(1.f, (float)tau->pt()));
312  mvaInput_[1] = std::abs((float)tau->eta());
313  mvaInput_[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
314  mvaInput_[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
315  mvaInput_[4] = std::log(std::max(1.e-2f, footprintCorrection));
316  mvaInput_[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
317  mvaInput_[6] = tauDecayMode;
318  mvaInput_[7] = std::min(30.f, nPhoton);
319  mvaInput_[8] = std::min(0.5f, ptWeightedDetaStrip);
320  mvaInput_[9] = std::min(0.5f, ptWeightedDphiStrip);
321  mvaInput_[10] = std::min(0.5f, ptWeightedDrSignal);
322  mvaInput_[11] = std::min(0.5f, ptWeightedDrIsolation);
323  mvaInput_[12] = std::min(100.f, leadingTrackChi2);
324  mvaInput_[13] = std::min(1.f, eRatio);
325  mvaInput_[14] = std::copysign(+1.f, (float)tauLifetimeInfo.dxy());
326  mvaInput_[15] = std::sqrt(std::min(1.f, std::abs((float)tauLifetimeInfo.dxy())));
327  mvaInput_[16] = std::min(10.f, std::abs((float)tauLifetimeInfo.dxy_Sig()));
328  mvaInput_[17] = std::copysign(+1.f, (float)tauLifetimeInfo.ip3d());
329  mvaInput_[18] = std::sqrt(std::min(1.f, std::abs((float)tauLifetimeInfo.ip3d())));
330  mvaInput_[19] = std::min(10.f, std::abs((float)tauLifetimeInfo.ip3d_Sig()));
331  mvaInput_[20] = (tauLifetimeInfo.hasSecondaryVertex()) ? 1. : 0.;
332  mvaInput_[21] = std::sqrt(decayDistMag);
333  mvaInput_[22] = std::min(10.f, (float)tauLifetimeInfo.flightLengthSig());
334  } else if (mvaOpt_ == kDBoldDMwLTwGJ || mvaOpt_ == kDBnewDMwLTwGJ) {
335  mvaInput_[0] = std::log(std::max(1.f, (float)tau->pt()));
336  mvaInput_[1] = std::abs((float)tau->eta());
337  mvaInput_[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
338  mvaInput_[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
339  mvaInput_[4] = std::log(std::max(1.e-2f, puCorrPtSum));
340  mvaInput_[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
341  mvaInput_[6] = tauDecayMode;
342  mvaInput_[7] = std::min(30.f, nPhoton);
343  mvaInput_[8] = std::min(0.5f, ptWeightedDetaStrip);
344  mvaInput_[9] = std::min(0.5f, ptWeightedDphiStrip);
345  mvaInput_[10] = std::min(0.5f, ptWeightedDrSignal);
346  mvaInput_[11] = std::min(0.5f, ptWeightedDrIsolation);
347  mvaInput_[12] = std::min(1.f, eRatio);
348  mvaInput_[13] = std::copysign(+1.f, (float)tauLifetimeInfo.dxy());
349  mvaInput_[14] = std::sqrt(std::min(1.f, std::abs((float)tauLifetimeInfo.dxy())));
350  mvaInput_[15] = std::min(10.f, std::abs((float)tauLifetimeInfo.dxy_Sig()));
351  mvaInput_[16] = std::copysign(+1.f, (float)tauLifetimeInfo.ip3d());
352  mvaInput_[17] = std::sqrt(std::min(1.f, std::abs((float)tauLifetimeInfo.ip3d())));
353  mvaInput_[18] = std::min(10.f, std::abs((float)tauLifetimeInfo.ip3d_Sig()));
354  mvaInput_[19] = (tauLifetimeInfo.hasSecondaryVertex()) ? 1. : 0.;
355  mvaInput_[20] = std::sqrt(decayDistMag);
356  mvaInput_[21] = std::min(10.f, (float)tauLifetimeInfo.flightLengthSig());
357  mvaInput_[22] = std::max(-1.f, gjAngleDiff);
358  }
359 
360  double mvaValue = mvaReader_->GetClassifier(mvaInput_);
361  if (verbosity_) {
362  edm::LogPrint("PFTauDiscByMVAIsol2") << "<PFRecoTauDiscriminationByMVAIsolationRun2::discriminate>:";
363  edm::LogPrint("PFTauDiscByMVAIsol2") << " tau: Pt = " << tau->pt() << ", eta = " << tau->eta();
364  edm::LogPrint("PFTauDiscByMVAIsol2") << " isolation: charged = " << chargedIsoPtSum
365  << ", neutral = " << neutralIsoPtSum << ", PUcorr = " << puCorrPtSum;
366  edm::LogPrint("PFTauDiscByMVAIsol2") << " decay mode = " << tauDecayMode;
367  edm::LogPrint("PFTauDiscByMVAIsol2") << " impact parameter: distance = " << tauLifetimeInfo.dxy()
368  << ", significance = " << tauLifetimeInfo.dxy_Sig();
369  edm::LogPrint("PFTauDiscByMVAIsol2")
370  << " has decay vertex = " << tauLifetimeInfo.hasSecondaryVertex() << ":"
371  << " distance = " << decayDistMag << ", significance = " << tauLifetimeInfo.flightLengthSig();
372  edm::LogPrint("PFTauDiscByMVAIsol2") << "--> mvaValue = " << mvaValue;
373  }
374  return mvaValue;
375  } else {
376  return -1.;
377  }
378  }
unsigned int n_photons_total(const reco::PFTau &tau)
return total number of pf photon candidates with pT>500 MeV, which are associated to signal ...
float pt_weighted_dr_signal(const reco::PFTau &tau, int dm)
float pt_weighted_deta_strip(const reco::PFTau &tau, int dm)
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float pt_weighted_dr_iso(const reco::PFTau &tau, int dm)
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
bool isNull() const
Checks for null.
Definition: Ref.h:235
float pt_weighted_dphi_strip(const reco::PFTau &tau, int dm)
float eratio(const reco::PFTau &tau)
return ratio of energy in ECAL over sum of energy in ECAL and HCAL
float lead_track_chi2(const reco::PFTau &tau)
return chi2 of the leading track ==> deprecated? <==
double GetClassifier(const float *vector) const
Definition: GBRForest.h:34
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
void reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::endEvent ( edm::Event evt)
overridevirtual

Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 380 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

References category_output_, eostools::move(), and edm::Event::put().

Referenced by PFRecoTauDiscriminationByMVAIsolationRun2().

380  {
381  // add all category indices to event
382  evt.put(std::move(category_output_), "category");
383  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
def move(src, dest)
Definition: eostools.py:511
void reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 385 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addOptional(), DEFINE_FWK_MODULE, TauDiscriminationProducerBase< TauType, TauDiscriminator >::fillProducerDescriptions(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~PFRecoTauDiscriminationByMVAIsolationRun2().

385  {
386  // pfRecoTauDiscriminationByMVAIsolationRun2
388 
389  desc.add<std::string>("mvaName");
390  desc.add<bool>("loadMVAfromDB");
391  desc.addOptional<edm::FileInPath>("inputFileName");
392  desc.add<std::string>("mvaOpt");
393 
394  desc.add<edm::InputTag>("srcTauTransverseImpactParameters");
395  desc.add<edm::InputTag>("srcChargedIsoPtSum");
396  desc.add<edm::InputTag>("srcNeutralIsoPtSum");
397  desc.add<edm::InputTag>("srcPUcorrPtSum");
398 
399  desc.add<edm::InputTag>("srcPhotonPtSumOutsideSignalCone");
400  desc.add<edm::InputTag>("srcFootprintCorrection");
401 
402  desc.add<int>("verbosity", 0);
403 
404  fillProducerDescriptions(desc); // inherited from the base
405 
406  descriptions.add("pfRecoTauDiscriminationByMVAIsolationRun2", desc);
407  }
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
static void fillProducerDescriptions(edm::ParameterSetDescription &desc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

std::unique_ptr<PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::category_output_
private
edm::EDGetTokenT<reco::PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::ChargedIsoPtSum_token
private
edm::Handle<reco::PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::chargedIsoPtSums_
private

Definition at line 171 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Referenced by beginEvent().

edm::Handle<reco::PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::footprintCorrection_
private

Definition at line 179 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Referenced by beginEvent().

edm::EDGetTokenT<reco::PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::FootprintCorrection_token
private
edm::FileInPath reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::inputFileName_
private
std::vector<TFile*> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::inputFilesToDelete_
private
bool reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::loadMVAfromDB_
private
std::string reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::moduleLabel_
private
float* reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::mvaInput_
private
std::string reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::mvaName_
private
int reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::mvaOpt_
private
const GBRForest* reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::mvaReader_
private
edm::EDGetTokenT<reco::PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::NeutralIsoPtSum_token
private
edm::Handle<reco::PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::neutralIsoPtSums_
private

Definition at line 173 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Referenced by beginEvent().

edm::Handle<reco::PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::photonPtSumOutsideSignalCone_
private

Definition at line 177 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Referenced by beginEvent().

edm::EDGetTokenT<reco::PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::PhotonPtSumOutsideSignalCone_token
private
edm::EDGetTokenT<reco::PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::PUcorrPtSum_token
private
edm::Handle<reco::PFTauDiscriminator> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::puCorrPtSums_
private

Definition at line 175 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Referenced by beginEvent().

edm::Handle<PFTauTIPAssociationByRef> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::tauLifetimeInfos
private

Definition at line 168 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Referenced by beginEvent().

edm::Handle<TauCollection> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::taus_
private

Definition at line 181 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Referenced by beginEvent().

edm::EDGetTokenT<PFTauTIPAssociationByRef> reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::TauTransverseImpactParameters_token
private
int reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::verbosity_
private