CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &)
 
double discriminate (const PFTauRef &) const
 
void endEvent (edm::Event &)
 
 PFRecoTauDiscriminationByMVAIsolationRun2 (const edm::ParameterSet &cfg)
 
 ~PFRecoTauDiscriminationByMVAIsolationRun2 ()
 
- Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
virtual double discriminate (const TauRef &tau) const =0
 
void produce (edm::Event &, const edm::EventSetup &)
 
 TauDiscriminationProducerBase (const edm::ParameterSet &iConfig)
 
 TauDiscriminationProducerBase ()
 
virtual ~TauDiscriminationProducerBase ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & 
itemsToGetFromEvent () 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
}
 
typedef edm::AssociationVector
< reco::PFTauRefProd,
std::vector
< reco::PFTauTransverseImpactParameterRef > > 
PFTauTIPAssociationByRef
 

Private Attributes

std::unique_ptr
< PFTauDiscriminator
category_output_
 
edm::EDGetTokenT
< reco::PFTauDiscriminator
ChargedIsoPtSum_token
 
edm::Handle
< reco::PFTauDiscriminator
chargedIsoPtSums_
 
TauIdMVAAuxiliaries clusterVariables_
 
edm::Handle
< reco::PFTauDiscriminator
footprintCorrection_
 
edm::EDGetTokenT
< reco::PFTauDiscriminator
FootprintCorrection_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::PFTauDiscriminator
NeutralIsoPtSum_token
 
edm::Handle
< reco::PFTauDiscriminator
neutralIsoPtSums_
 
edm::Handle
< reco::PFTauDiscriminator
photonPtSumOutsideSignalCone_
 
edm::EDGetTokenT
< reco::PFTauDiscriminator
PhotonPtSumOutsideSignalCone_token
 
edm::EDGetTokenT
< reco::PFTauDiscriminator
PUcorrPtSum_token
 
edm::Handle
< reco::PFTauDiscriminator
puCorrPtSums_
 
edm::Handle
< PFTauTIPAssociationByRef
tauLifetimeInfos
 
edm::Handle< TauCollectiontaus_
 
edm::EDGetTokenT
< PFTauTIPAssociationByRef
TauTransverseImpactParameters_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
< TauCollection
TauRefProd
 
- 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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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 66 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

Member Typedef Documentation

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

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

Definition at line 69 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

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

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

Definition at line 121 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

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

Member Function Documentation

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

Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 167 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

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

168 {
169  if ( !mvaReader_ ) {
170  if ( loadMVAfromDB_ ) {
172  } else {
174  }
175  }
176 
178 
184 
185  evt.getByToken(Tau_token, taus_);
187 }
edm::RefProd< TauCollection > TauRefProd
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
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_
tuple loadMVAfromDB
Definition: mvaPFMET_cff.py:84
edm::EDGetTokenT< reco::PFTauDiscriminator > PUcorrPtSum_token
double PFRecoTauDiscriminationByMVAIsolationRun2::discriminate ( const PFTauRef tau) const

Definition at line 189 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

References python.rootplot.argparse::category, PFRecoTauDiscriminationByMVAIsolation2_cff::chargedIsoPtSum, reco::PFTauTransverseImpactParameter::dxy(), reco::PFTauTransverseImpactParameter::dxy_Sig(), alignCSCRings::e, reco::PFTauTransverseImpactParameter::flightLength(), reco::PFTauTransverseImpactParameter::flightLengthSig(), PFRecoTauDiscriminationByMVAIsolationRun2_cff::footprintCorrection, reco::PFTauTransverseImpactParameter::hasSecondaryVertex(), reco::PFTauTransverseImpactParameter::ip3d(), reco::PFTauTransverseImpactParameter::ip3d_Sig(), edm::Ref< C, T, F >::isNull(), dqm-mbProfile::log, bookConverter::max, min(), PFRecoTauDiscriminationByMVAIsolation2_cff::neutralIsoPtSum, PFRecoTauDiscriminationByMVAIsolationRun2_cff::photonPtSumOutsideSignalCone, PFRecoTauDiscriminationByMVAIsolation2_cff::puCorrPtSum, Sign(), mathSSE::sqrt(), and metsig::tau.

190 {
191  // CV: define dummy category index in order to use RecoTauDiscriminantCutMultiplexer module to appy WP cuts
192  double category = 0.;
193  category_output_->setValue(tauIndex_, category);
194 
195  // CV: computation of MVA value requires presence of leading charged hadron
196  if ( tau->leadPFChargedHadrCand().isNull() ) return 0.;
197 
198  int tauDecayMode = tau->decayMode();
199 
200  if ( ((mvaOpt_ == kOldDMwoLT || mvaOpt_ == kOldDMwLT || mvaOpt_ == kDBoldDMwLT || mvaOpt_ == kPWoldDMwLT) && (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 10)) ||
201  ((mvaOpt_ == kNewDMwoLT || mvaOpt_ == kNewDMwLT || mvaOpt_ == kDBnewDMwLT || mvaOpt_ == kPWnewDMwLT) && (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 5 || tauDecayMode == 6 || tauDecayMode == 10)) ) {
202 
203  float chargedIsoPtSum = (*chargedIsoPtSums_)[tau];
204  float neutralIsoPtSum = (*neutralIsoPtSums_)[tau];
205  float puCorrPtSum = (*puCorrPtSums_)[tau];
206  float photonPtSumOutsideSignalCone = (*photonPtSumOutsideSignalCone_)[tau];
207  float footprintCorrection = (*footprintCorrection_)[tau];
208 
209  const reco::PFTauTransverseImpactParameter& tauLifetimeInfo = *(*tauLifetimeInfos)[tau];
210 
211  float decayDistX = tauLifetimeInfo.flightLength().x();
212  float decayDistY = tauLifetimeInfo.flightLength().y();
213  float decayDistZ = tauLifetimeInfo.flightLength().z();
214  float decayDistMag = std::sqrt(decayDistX*decayDistX + decayDistY*decayDistY + decayDistZ*decayDistZ);
215 
216  float nPhoton = (float)clusterVariables_.tau_n_photons_total(*tau);
217  float ptWeightedDetaStrip = clusterVariables_.tau_pt_weighted_deta_strip(*tau, tauDecayMode);
218  float ptWeightedDphiStrip = clusterVariables_.tau_pt_weighted_dphi_strip(*tau, tauDecayMode);
219  float ptWeightedDrSignal = clusterVariables_.tau_pt_weighted_dr_signal(*tau, tauDecayMode);
220  float ptWeightedDrIsolation = clusterVariables_.tau_pt_weighted_dr_iso(*tau, tauDecayMode);
221  float leadingTrackChi2 = clusterVariables_.tau_leadTrackChi2(*tau);
222  float eRatio = clusterVariables_.tau_Eratio(*tau);
223 
224  if ( mvaOpt_ == kOldDMwoLT || mvaOpt_ == kNewDMwoLT ) {
225  mvaInput_[0] = std::log(std::max((float)1., (float)tau->pt()));
226  mvaInput_[1] = std::fabs((float)tau->eta());
227  mvaInput_[2] = std::log(std::max((float)1.e-2, chargedIsoPtSum));
228  mvaInput_[3] = std::log(std::max((float)1.e-2, neutralIsoPtSum - (float)0.125*puCorrPtSum));
229  mvaInput_[4] = std::log(std::max((float)1.e-2, puCorrPtSum));
230  mvaInput_[5] = tauDecayMode;
231  } else if ( mvaOpt_ == kOldDMwLT || mvaOpt_ == kNewDMwLT ) {
232  mvaInput_[0] = std::log(std::max((float)1., (float)tau->pt()));
233  mvaInput_[1] = std::fabs((float)tau->eta());
234  mvaInput_[2] = std::log(std::max((float)1.e-2, chargedIsoPtSum));
235  mvaInput_[3] = std::log(std::max((float)1.e-2, neutralIsoPtSum - (float)0.125*puCorrPtSum));
236  mvaInput_[4] = std::log(std::max((float)1.e-2, puCorrPtSum));
237  mvaInput_[5] = tauDecayMode;
238  mvaInput_[6] = TMath::Sign((float)+1., (float)tauLifetimeInfo.dxy());
239  mvaInput_[7] = std::sqrt(std::fabs(std::min((float)1., (float)tauLifetimeInfo.dxy())));
240  mvaInput_[8] = std::min((float)10., std::fabs((float)tauLifetimeInfo.dxy_Sig()));
241  mvaInput_[9] = ( tauLifetimeInfo.hasSecondaryVertex() ) ? 1. : 0.;
242  mvaInput_[10] = std::sqrt(decayDistMag);
243  mvaInput_[11] = std::min((float)10., (float)tauLifetimeInfo.flightLengthSig());
244  } else if ( mvaOpt_ == kDBoldDMwLT || mvaOpt_ == kDBnewDMwLT ) {
245  mvaInput_[0] = std::log(std::max((float)1., (float)tau->pt()));
246  mvaInput_[1] = std::fabs((float)tau->eta());
247  mvaInput_[2] = std::log(std::max((float)1.e-2, chargedIsoPtSum));
248  mvaInput_[3] = std::log(std::max((float)1.e-2, neutralIsoPtSum));
249  mvaInput_[4] = std::log(std::max((float)1.e-2, puCorrPtSum));
250  mvaInput_[5] = std::log(std::max((float)1.e-2, photonPtSumOutsideSignalCone));
251  mvaInput_[6] = tauDecayMode;
252  mvaInput_[7] = std::min((float)30., nPhoton);
253  mvaInput_[8] = std::min((float)0.5, ptWeightedDetaStrip);
254  mvaInput_[9] = std::min((float)0.5, ptWeightedDphiStrip);
255  mvaInput_[10] = std::min((float)0.5, ptWeightedDrSignal);
256  mvaInput_[11] = std::min((float)0.5, ptWeightedDrIsolation);
257  mvaInput_[12] = std::min((float)100., leadingTrackChi2);
258  mvaInput_[13] = std::min((float)1., eRatio);
259  mvaInput_[14] = TMath::Sign((float)+1., (float)tauLifetimeInfo.dxy());
260  mvaInput_[15] = std::sqrt(std::fabs(std::min((float)1., std::fabs((float)tauLifetimeInfo.dxy()))));
261  mvaInput_[16] = std::min((float)10., std::fabs((float)tauLifetimeInfo.dxy_Sig()));
262  mvaInput_[17] = TMath::Sign((float)+1., (float)tauLifetimeInfo.ip3d());
263  mvaInput_[18] = std::sqrt(std::fabs(std::min((float)1., std::fabs((float)tauLifetimeInfo.ip3d()))));
264  mvaInput_[19] = std::min((float)10., std::fabs((float)tauLifetimeInfo.ip3d_Sig()));
265  mvaInput_[20] = ( tauLifetimeInfo.hasSecondaryVertex() ) ? 1. : 0.;
266  mvaInput_[21] = std::sqrt(decayDistMag);
267  mvaInput_[22] = std::min((float)10., (float)tauLifetimeInfo.flightLengthSig());
268  } else if ( mvaOpt_ == kPWoldDMwLT || mvaOpt_ == kPWnewDMwLT ) {
269  mvaInput_[0] = std::log(std::max((float)1., (float)tau->pt()));
270  mvaInput_[1] = std::fabs((float)tau->eta());
271  mvaInput_[2] = std::log(std::max((float)1.e-2, chargedIsoPtSum));
272  mvaInput_[3] = std::log(std::max((float)1.e-2, neutralIsoPtSum));
273  mvaInput_[4] = std::log(std::max((float)1.e-2, footprintCorrection));
274  mvaInput_[5] = std::log(std::max((float)1.e-2, photonPtSumOutsideSignalCone));
275  mvaInput_[6] = tauDecayMode;
276  mvaInput_[7] = std::min((float)30., nPhoton);
277  mvaInput_[8] = std::min((float)0.5, ptWeightedDetaStrip);
278  mvaInput_[9] = std::min((float)0.5, ptWeightedDphiStrip);
279  mvaInput_[10] = std::min((float)0.5, ptWeightedDrSignal);
280  mvaInput_[11] = std::min((float)0.5, ptWeightedDrIsolation);
281  mvaInput_[12] = std::min((float)100., leadingTrackChi2);
282  mvaInput_[13] = std::min((float)1., eRatio);
283  mvaInput_[14] = TMath::Sign((float)+1., (float)tauLifetimeInfo.dxy());
284  mvaInput_[15] = std::sqrt(std::fabs(std::min((float)1., std::fabs((float)tauLifetimeInfo.dxy()))));
285  mvaInput_[16] = std::min((float)10., std::fabs((float)tauLifetimeInfo.dxy_Sig()));
286  mvaInput_[17] = TMath::Sign((float)+1., (float)tauLifetimeInfo.ip3d());
287  mvaInput_[18] = std::sqrt(std::fabs(std::min((float)1., std::fabs((float)tauLifetimeInfo.ip3d()))));
288  mvaInput_[19] = std::min((float)10., std::fabs((float)tauLifetimeInfo.ip3d_Sig()));
289  mvaInput_[20] = ( tauLifetimeInfo.hasSecondaryVertex() ) ? 1. : 0.;
290  mvaInput_[21] = std::sqrt(decayDistMag);
291  mvaInput_[22] = std::min((float)10., (float)tauLifetimeInfo.flightLengthSig());
292  }
293 
294  double mvaValue = mvaReader_->GetClassifier(mvaInput_);
295  if ( verbosity_ ) {
296  edm::LogPrint("PFTauDiscByMVAIsol2") << "<PFRecoTauDiscriminationByMVAIsolationRun2::discriminate>:";
297  edm::LogPrint("PFTauDiscByMVAIsol2") << " tau: Pt = " << tau->pt() << ", eta = " << tau->eta();
298  edm::LogPrint("PFTauDiscByMVAIsol2") << " isolation: charged = " << chargedIsoPtSum << ", neutral = " << neutralIsoPtSum << ", PUcorr = " << puCorrPtSum;
299  edm::LogPrint("PFTauDiscByMVAIsol2") << " decay mode = " << tauDecayMode;
300  edm::LogPrint("PFTauDiscByMVAIsol2") << " impact parameter: distance = " << tauLifetimeInfo.dxy() << ", significance = " << tauLifetimeInfo.dxy_Sig();
301  edm::LogPrint("PFTauDiscByMVAIsol2") << " has decay vertex = " << tauLifetimeInfo.hasSecondaryVertex() << ":"
302  << " distance = " << decayDistMag << ", significance = " << tauLifetimeInfo.flightLengthSig();
303  edm::LogPrint("PFTauDiscByMVAIsol2") << "--> mvaValue = " << mvaValue;
304  }
305  return mvaValue;
306  } else {
307  return -1.;
308  }
309 }
float tau_Eratio(const reco::PFTau &tau) const
return ratio of energy in ECAL over sum of energy in ECAL and HCAL
T Sign(T A, T B)
Definition: MathUtil.h:54
T sqrt(T t)
Definition: SSEVec.h:18
float tau_pt_weighted_dphi_strip(const reco::PFTau &tau, int dm) const
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 ==&gt; deprecated? &lt;==
bool isNull() const
Checks for null.
Definition: Ref.h:249
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
unsigned int tau_n_photons_total(const reco::PFTau &tau) const
return total number of pf photon candidates with pT&gt;500 MeV, which are associated to signal ...
void PFRecoTauDiscriminationByMVAIsolationRun2::endEvent ( edm::Event evt)
virtual

Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 311 of file PFRecoTauDiscriminationByMVAIsolationRun2.cc.

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

312 {
313  // add all category indices to event
314  evt.put(std::move(category_output_), "category");
315 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
def move
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