CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
PFRecoTauDiscriminationByMVAIsolationRun2 Class Reference
Inheritance diagram for PFRecoTauDiscriminationByMVAIsolationRun2:
TauDiscriminationProducerBase< TauType, TauDiscriminator > edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

enum  {
  kOldDMwoLT, kOldDMwLT, kNewDMwoLT, kNewDMwLT,
  kDBoldDMwLT, kDBnewDMwLT, kPWoldDMwLT, kPWnewDMwLT,
  kDBoldDMwLTwGJ, kDBnewDMwLTwGJ
}
 
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_
 
TauIdMVAAuxiliaries clusterVariables_
 
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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- 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 65 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Member Typedef Documentation

Member Enumeration Documentation

anonymous enum
private
Enumerator
kOldDMwoLT 
kOldDMwLT 
kNewDMwoLT 
kNewDMwLT 
kDBoldDMwLT 
kDBnewDMwLT 
kPWoldDMwLT 
kPWnewDMwLT 
kDBoldDMwLTwGJ 
kDBnewDMwLTwGJ 

Definition at line 141 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Constructor & Destructor Documentation

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

Definition at line 68 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

References Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

70  moduleLabel_(cfg.getParameter<std::string>("@module_label")),
71  mvaReader_(nullptr),
72  mvaInput_(nullptr),
74  {
75  mvaName_ = cfg.getParameter<std::string>("mvaName");
76  loadMVAfromDB_ = cfg.exists("loadMVAfromDB") ? cfg.getParameter<bool>("loadMVAfromDB") : false;
77  if ( !loadMVAfromDB_ ) {
78  if(cfg.exists("inputFileName")){
79  inputFileName_ = cfg.getParameter<edm::FileInPath>("inputFileName");
80  }else throw cms::Exception("MVA input not defined") << "Requested to load tau MVA input from ROOT file but no file provided in cfg file";
81  }
82  std::string mvaOpt_string = cfg.getParameter<std::string>("mvaOpt");
83  if ( mvaOpt_string == "oldDMwoLT" ) mvaOpt_ = kOldDMwoLT;
84  else if ( mvaOpt_string == "oldDMwLT" ) mvaOpt_ = kOldDMwLT;
85  else if ( mvaOpt_string == "newDMwoLT" ) mvaOpt_ = kNewDMwoLT;
86  else if ( mvaOpt_string == "newDMwLT" ) mvaOpt_ = kNewDMwLT;
87  else if ( mvaOpt_string == "DBoldDMwLT" ) mvaOpt_ = kDBoldDMwLT;
88  else if ( mvaOpt_string == "DBnewDMwLT" ) mvaOpt_ = kDBnewDMwLT;
89  else if ( mvaOpt_string == "PWoldDMwLT" ) mvaOpt_ = kPWoldDMwLT;
90  else if ( mvaOpt_string == "PWnewDMwLT" ) mvaOpt_ = kPWnewDMwLT;
91  else if ( mvaOpt_string == "DBoldDMwLTwGJ" ) mvaOpt_ = kDBoldDMwLTwGJ;
92  else if ( mvaOpt_string == "DBnewDMwLTwGJ" ) mvaOpt_ = kDBnewDMwLTwGJ;
93  else throw cms::Exception("PFRecoTauDiscriminationByMVAIsolationRun2")
94  << " Invalid Configuration Parameter 'mvaOpt' = " << mvaOpt_string << " !!\n";
95 
96  if ( mvaOpt_ == kOldDMwoLT || mvaOpt_ == kNewDMwoLT ) mvaInput_ = new float[6];
97  else if ( mvaOpt_ == kOldDMwLT || mvaOpt_ == kNewDMwLT ) mvaInput_ = new float[12];
98  else if ( mvaOpt_ == kDBoldDMwLT || mvaOpt_ == kDBnewDMwLT ||
100  mvaOpt_ == kDBoldDMwLTwGJ || mvaOpt_ == kDBnewDMwLTwGJ) mvaInput_ = new float[23];
101  else assert(0);
102 
103  TauTransverseImpactParameters_token = consumes<PFTauTIPAssociationByRef>(cfg.getParameter<edm::InputTag>("srcTauTransverseImpactParameters"));
104 
105  ChargedIsoPtSum_token = consumes<reco::PFTauDiscriminator>(cfg.getParameter<edm::InputTag>("srcChargedIsoPtSum"));
106  NeutralIsoPtSum_token = consumes<reco::PFTauDiscriminator>(cfg.getParameter<edm::InputTag>("srcNeutralIsoPtSum"));
107  PUcorrPtSum_token = consumes<reco::PFTauDiscriminator>(cfg.getParameter<edm::InputTag>("srcPUcorrPtSum"));
108  PhotonPtSumOutsideSignalCone_token = consumes<reco::PFTauDiscriminator>(cfg.getParameter<edm::InputTag>("srcPhotonPtSumOutsideSignalCone"));
109  FootprintCorrection_token = consumes<reco::PFTauDiscriminator>(cfg.getParameter<edm::InputTag>("srcFootprintCorrection"));
110 
111  verbosity_ = ( cfg.exists("verbosity") ) ?
112  cfg.getParameter<int>("verbosity") : 0;
113 
114  produces<PFTauDiscriminator>("category");
115  }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::PFTauDiscriminator > NeutralIsoPtSum_token
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< reco::PFTauDiscriminator > PhotonPtSumOutsideSignalCone_token
edm::EDGetTokenT< reco::PFTauDiscriminator > FootprintCorrection_token
edm::EDGetTokenT< PFTauTIPAssociationByRef > TauTransverseImpactParameters_token
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
edm::EDGetTokenT< reco::PFTauDiscriminator > ChargedIsoPtSum_token
edm::EDGetTokenT< reco::PFTauDiscriminator > PUcorrPtSum_token
PFRecoTauDiscriminationByMVAIsolationRun2::~PFRecoTauDiscriminationByMVAIsolationRun2 ( )
inlineoverride

Definition at line 123 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

124  {
125  if(!loadMVAfromDB_) delete mvaReader_;
126  delete[] mvaInput_;
127  for ( std::vector<TFile*>::iterator it = inputFilesToDelete_.begin();
128  it != inputFilesToDelete_.end(); ++it ) {
129  delete (*it);
130  }
131  }

Member Function Documentation

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

Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 169 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

References edm::Event::getByToken(), and taus_updatedMVAIds_cff::loadMVAfromDB.

170 {
171  if ( !mvaReader_ ) {
172  if ( loadMVAfromDB_ ) {
174  } else {
176  }
177  }
178 
180 
186 
187  evt.getByToken(Tau_token, taus_);
189 }
edm::RefProd< TauCollection > TauRefProd
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
edm::EDGetTokenT< reco::PFTauDiscriminator > NeutralIsoPtSum_token
edm::EDGetTokenT< reco::PFTauDiscriminator > PhotonPtSumOutsideSignalCone_token
edm::EDGetTokenT< reco::PFTauDiscriminator > FootprintCorrection_token
edm::EDGetTokenT< PFTauTIPAssociationByRef > TauTransverseImpactParameters_token
edm::EDGetTokenT< TauCollection > Tau_token
edm::EDGetTokenT< reco::PFTauDiscriminator > ChargedIsoPtSum_token
edm::Handle< reco::PFTauDiscriminator > photonPtSumOutsideSignalCone_
edm::EDGetTokenT< reco::PFTauDiscriminator > PUcorrPtSum_token
double PFRecoTauDiscriminationByMVAIsolationRun2::discriminate ( const PFTauRef tau) const
override

Definition at line 191 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

References funct::abs(), taus_updatedMVAIds_cff::category, tauProducer_cfi::chargedIsoPtSum, reco::PFTauTransverseImpactParameter::dxy(), reco::PFTauTransverseImpactParameter::dxy_Sig(), MillePedeFileConverter_cfg::e, f, reco::PFTauTransverseImpactParameter::flightLength(), reco::PFTauTransverseImpactParameter::flightLengthSig(), objects.autophobj::float, tauProducer_cfi::footprintCorrection, reco::PFTauTransverseImpactParameter::hasSecondaryVertex(), reco::PFTauTransverseImpactParameter::ip3d(), reco::PFTauTransverseImpactParameter::ip3d_Sig(), edm::Ref< C, T, F >::isNull(), cmsBatch::log, SiStripPI::max, min(), tauProducer_cfi::neutralIsoPtSum, tauProducer_cfi::photonPtSumOutsideSignalCone, funct::pow(), tauProducer_cfi::puCorrPtSum, mathSSE::sqrt(), and metsig::tau.

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

Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 356 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

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

357 {
358  // add all category indices to event
359  evt.put(std::move(category_output_), "category");
360 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

std::unique_ptr<PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::category_output_
private
edm::EDGetTokenT<reco::PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::ChargedIsoPtSum_token
private
edm::Handle<reco::PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::chargedIsoPtSums_
private
TauIdMVAAuxiliaries PFRecoTauDiscriminationByMVAIsolationRun2::clusterVariables_
private
edm::Handle<reco::PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::footprintCorrection_
private
edm::EDGetTokenT<reco::PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::FootprintCorrection_token
private
edm::FileInPath PFRecoTauDiscriminationByMVAIsolationRun2::inputFileName_
private
std::vector<TFile*> PFRecoTauDiscriminationByMVAIsolationRun2::inputFilesToDelete_
private
bool PFRecoTauDiscriminationByMVAIsolationRun2::loadMVAfromDB_
private
std::string PFRecoTauDiscriminationByMVAIsolationRun2::moduleLabel_
private
float* PFRecoTauDiscriminationByMVAIsolationRun2::mvaInput_
private
std::string PFRecoTauDiscriminationByMVAIsolationRun2::mvaName_
private
int PFRecoTauDiscriminationByMVAIsolationRun2::mvaOpt_
private
const GBRForest* PFRecoTauDiscriminationByMVAIsolationRun2::mvaReader_
private
edm::EDGetTokenT<reco::PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::NeutralIsoPtSum_token
private
edm::Handle<reco::PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::neutralIsoPtSums_
private
edm::Handle<reco::PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::photonPtSumOutsideSignalCone_
private
edm::EDGetTokenT<reco::PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::PhotonPtSumOutsideSignalCone_token
private
edm::EDGetTokenT<reco::PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::PUcorrPtSum_token
private
edm::Handle<reco::PFTauDiscriminator> PFRecoTauDiscriminationByMVAIsolationRun2::puCorrPtSums_
private
edm::Handle<PFTauTIPAssociationByRef> PFRecoTauDiscriminationByMVAIsolationRun2::tauLifetimeInfos
private
edm::Handle<TauCollection> PFRecoTauDiscriminationByMVAIsolationRun2::taus_
private
edm::EDGetTokenT<PFTauTIPAssociationByRef> PFRecoTauDiscriminationByMVAIsolationRun2::TauTransverseImpactParameters_token
private
int PFRecoTauDiscriminationByMVAIsolationRun2::verbosity_
private