CMS 3D CMS Logo

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

Public Member Functions

void beginEvent (const edm::Event &, const edm::EventSetup &) override
 
reco::SingleTauDiscriminatorContainer discriminate (const TauRef &) const override
 
 PATTauDiscriminationByMVAIsolationRun2 (const edm::ParameterSet &cfg)
 
 ~PATTauDiscriminationByMVAIsolationRun2 () override
 
- Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator, TauDiscriminatorDataType, ConsumeType >
virtual void endEvent (edm::Event &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 TauDiscriminationProducerBase ()
 
 TauDiscriminationProducerBase (const edm::ParameterSet &iConfig)
 
 ~TauDiscriminationProducerBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () 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, TauDiscriminatorDataType, ConsumeType >
static void fillProducerDescriptions (edm::ParameterSetDescription &desc)
 
static std::string getTauTypeString ()
 helper method to retrieve tau type name, e.g. to build correct cfi getter More...
 

Private Attributes

std::string chargedIsoPtSums_
 
std::string footprintCorrection_
 
edm::FileInPath inputFileName_
 
std::vector< TFile * > inputFilesToDelete_
 
bool loadMVAfromDB_
 
std::string moduleLabel_
 
float * mvaInput_
 
std::string mvaName_
 
int mvaOpt_
 
const GBRForestmvaReader_
 
std::string neutralIsoPtSums_
 
std::string photonPtSumOutsideSignalCone_
 
std::string puCorrPtSums_
 
edm::Handle< TauCollectiontaus_
 
int verbosity_
 

Additional Inherited Members

- Public Types inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator, TauDiscriminatorDataType, ConsumeType >
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, TauDiscriminatorDataType, ConsumeType >
std::string moduleLabel_
 
double prediscriminantFailValue_
 
edm::EDGetTokenT< TauCollectionTau_token
 
size_t tauIndex_
 
edm::InputTag TauProducer_
 

Detailed Description

Definition at line 79 of file PATTauDiscriminationByMVAIsolationRun2.cc.

Constructor & Destructor Documentation

◆ PATTauDiscriminationByMVAIsolationRun2()

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

Definition at line 81 of file PATTauDiscriminationByMVAIsolationRun2.cc.

83  moduleLabel_(cfg.getParameter<std::string>("@module_label")),
84  mvaReader_(nullptr),
85  mvaInput_(nullptr) {
86  mvaName_ = cfg.getParameter<std::string>("mvaName");
87  loadMVAfromDB_ = cfg.getParameter<bool>("loadMVAfromDB");
88  if (!loadMVAfromDB_) {
89  inputFileName_ = cfg.getParameter<edm::FileInPath>("inputFileName");
90  }
91  std::string mvaOpt_string = cfg.getParameter<std::string>("mvaOpt");
92  if (mvaOpt_string == "oldDMwoLT")
94  else if (mvaOpt_string == "oldDMwLT")
96  else if (mvaOpt_string == "newDMwoLT")
98  else if (mvaOpt_string == "newDMwLT")
100  else if (mvaOpt_string == "DBoldDMwLT")
102  else if (mvaOpt_string == "DBnewDMwLT")
104  else if (mvaOpt_string == "PWoldDMwLT")
106  else if (mvaOpt_string == "PWnewDMwLT")
108  else if (mvaOpt_string == "DBoldDMwLTwGJ")
110  else if (mvaOpt_string == "DBnewDMwLTwGJ")
112  else if (mvaOpt_string == "DBnewDMwLTwGJPhase2")
114  else
115  throw cms::Exception("PATTauDiscriminationByMVAIsolationRun2")
116  << " Invalid Configuration Parameter 'mvaOpt' = " << mvaOpt_string << " !!\n";
117 
118  if (mvaOpt_ == kOldDMwoLT || mvaOpt_ == kNewDMwoLT)
119  mvaInput_ = new float[6];
120  else if (mvaOpt_ == kOldDMwLT || mvaOpt_ == kNewDMwLT)
121  mvaInput_ = new float[12];
124  mvaInput_ = new float[23];
125  else if (mvaOpt_ == kDBnewDMwLTwGJPhase2)
126  mvaInput_ = new float[30];
127  else
128  assert(0);
129 
130  chargedIsoPtSums_ = cfg.getParameter<std::string>("srcChargedIsoPtSum");
131  neutralIsoPtSums_ = cfg.getParameter<std::string>("srcNeutralIsoPtSum");
132  puCorrPtSums_ = cfg.getParameter<std::string>("srcPUcorrPtSum");
133  photonPtSumOutsideSignalCone_ = cfg.getParameter<std::string>("srcPhotonPtSumOutsideSignalCone");
134  footprintCorrection_ = cfg.getParameter<std::string>("srcFootprintCorrection");
135 
136  verbosity_ = cfg.getParameter<int>("verbosity");
137  }

References cms::cuda::assert(), looper::cfg, Exception, reco::tau::kDBnewDMwLT, reco::tau::kDBnewDMwLTwGJ, reco::tau::kDBnewDMwLTwGJPhase2, reco::tau::kDBoldDMwLT, reco::tau::kDBoldDMwLTwGJ, reco::tau::kNewDMwLT, reco::tau::kNewDMwoLT, reco::tau::kOldDMwLT, reco::tau::kOldDMwoLT, reco::tau::kPWnewDMwLT, reco::tau::kPWoldDMwLT, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~PATTauDiscriminationByMVAIsolationRun2()

reco::tau::PATTauDiscriminationByMVAIsolationRun2::~PATTauDiscriminationByMVAIsolationRun2 ( )
inlineoverride

Definition at line 143 of file PATTauDiscriminationByMVAIsolationRun2.cc.

143  {
144  if (!loadMVAfromDB_)
145  delete mvaReader_;
146  delete[] mvaInput_;
147  for (std::vector<TFile*>::iterator it = inputFilesToDelete_.begin(); it != inputFilesToDelete_.end(); ++it) {
148  delete (*it);
149  }
150  }

Member Function Documentation

◆ beginEvent()

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

◆ discriminate()

reco::SingleTauDiscriminatorContainer reco::tau::PATTauDiscriminationByMVAIsolationRun2::discriminate ( const TauRef tau) const
overridevirtual

Implements TauDiscriminationProducerBase< TauType, TauDiscriminator, TauDiscriminatorDataType, ConsumeType >.

Definition at line 188 of file PATTauDiscriminationByMVAIsolationRun2.cc.

188  {
189  // CV: define dummy category index in order to use RecoTauDiscriminantCutMultiplexer module to appy WP cuts
191  result.rawValues = {-1.};
192 
193  // CV: computation of MVA value requires presence of leading charged hadron
194  if (tau->leadChargedHadrCand().isNull()) {
195  result.rawValues.at(0) = 0.;
196  return result;
197  }
198 
200  *tau,
201  mvaOpt_,
207  double mvaValue = mvaReader_->GetClassifier(mvaInput_);
208  if (verbosity_) {
209  edm::LogPrint("PATTauDiscByMVAIsolRun2") << "<PATTauDiscriminationByMVAIsolationRun2::discriminate>:";
210  edm::LogPrint("PATTauDiscByMVAIsolRun2") << " tau: Pt = " << tau->pt() << ", eta = " << tau->eta();
211  edm::LogPrint("PATTauDiscByMVAIsolRun2")
212  << " isolation: charged = " << tau->tauID(chargedIsoPtSums_)
213  << ", neutral = " << tau->tauID(neutralIsoPtSums_) << ", PUcorr = " << tau->tauID(puCorrPtSums_);
214  edm::LogPrint("PATTauDiscByMVAIsolRun2") << " decay mode = " << tau->decayMode();
215  edm::LogPrint("PATTauDiscByMVAIsolRun2")
216  << " impact parameter: distance = " << tau->dxy() << ", significance = " << tau->dxy_Sig();
217  edm::LogPrint("PATTauDiscByMVAIsolRun2") << " has decay vertex = " << tau->hasSecondaryVertex() << ":"
218  << ", significance = " << tau->flightLengthSig();
219  edm::LogPrint("PATTauDiscByMVAIsolRun2") << "--> mvaValue = " << mvaValue;
220  }
221  result.rawValues.at(0) = mvaValue;
222  }
223  return result;
224  }

References reco::tau::fillIsoMVARun2Inputs(), mps_fire::result, and metsig::tau.

◆ fillDescriptions()

void reco::tau::PATTauDiscriminationByMVAIsolationRun2::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 226 of file PATTauDiscriminationByMVAIsolationRun2.cc.

226  {
227  // patTauDiscriminationByMVAIsolationRun2
229 
230  desc.add<std::string>("mvaName");
231  desc.add<bool>("loadMVAfromDB");
232  desc.addOptional<edm::FileInPath>("inputFileName");
233  desc.add<std::string>("mvaOpt");
234 
235  desc.add<std::string>("srcChargedIsoPtSum");
236  desc.add<std::string>("srcNeutralIsoPtSum");
237  desc.add<std::string>("srcPUcorrPtSum");
238  desc.add<std::string>("srcPhotonPtSumOutsideSignalCone");
239  desc.add<std::string>("srcFootprintCorrection");
240  desc.add<int>("verbosity", 0);
241 
242  fillProducerDescriptions(desc); // inherited from the base
243 
244  descriptions.add("patTauDiscriminationByMVAIsolationRun2", desc);
245  }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ chargedIsoPtSums_

std::string reco::tau::PATTauDiscriminationByMVAIsolationRun2::chargedIsoPtSums_
private

Definition at line 164 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ footprintCorrection_

std::string reco::tau::PATTauDiscriminationByMVAIsolationRun2::footprintCorrection_
private

Definition at line 168 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ inputFileName_

edm::FileInPath reco::tau::PATTauDiscriminationByMVAIsolationRun2::inputFileName_
private

Definition at line 159 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ inputFilesToDelete_

std::vector<TFile*> reco::tau::PATTauDiscriminationByMVAIsolationRun2::inputFilesToDelete_
private

Definition at line 171 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ loadMVAfromDB_

bool reco::tau::PATTauDiscriminationByMVAIsolationRun2::loadMVAfromDB_
private

Definition at line 158 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ moduleLabel_

std::string reco::tau::PATTauDiscriminationByMVAIsolationRun2::moduleLabel_
private

◆ mvaInput_

float* reco::tau::PATTauDiscriminationByMVAIsolationRun2::mvaInput_
private

Definition at line 162 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ mvaName_

std::string reco::tau::PATTauDiscriminationByMVAIsolationRun2::mvaName_
private

Definition at line 157 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ mvaOpt_

int reco::tau::PATTauDiscriminationByMVAIsolationRun2::mvaOpt_
private

Definition at line 161 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ mvaReader_

const GBRForest* reco::tau::PATTauDiscriminationByMVAIsolationRun2::mvaReader_
private

Definition at line 160 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ neutralIsoPtSums_

std::string reco::tau::PATTauDiscriminationByMVAIsolationRun2::neutralIsoPtSums_
private

Definition at line 165 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ photonPtSumOutsideSignalCone_

std::string reco::tau::PATTauDiscriminationByMVAIsolationRun2::photonPtSumOutsideSignalCone_
private

Definition at line 167 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ puCorrPtSums_

std::string reco::tau::PATTauDiscriminationByMVAIsolationRun2::puCorrPtSums_
private

Definition at line 166 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ taus_

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

Definition at line 170 of file PATTauDiscriminationByMVAIsolationRun2.cc.

◆ verbosity_

int reco::tau::PATTauDiscriminationByMVAIsolationRun2::verbosity_
private

Definition at line 173 of file PATTauDiscriminationByMVAIsolationRun2.cc.

taus_updatedMVAIds_cff.loadMVAfromDB
loadMVAfromDB
Definition: taus_updatedMVAIds_cff.py:17
reco::tau::PATTauDiscriminationByMVAIsolationRun2::footprintCorrection_
std::string footprintCorrection_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:168
reco::tau::kOldDMwoLT
Definition: PFRecoTauClusterVariables.h:59
GBRForest::GetClassifier
double GetClassifier(const float *vector) const
Definition: GBRForest.h:34
reco::tau::PATTauDiscriminationByMVAIsolationRun2::mvaOpt_
int mvaOpt_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:161
reco::tau::PATTauDiscriminationByMVAIsolationRun2::loadMVAfromDB_
bool loadMVAfromDB_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:158
reco::tau::fillIsoMVARun2Inputs
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)
Definition: PFRecoTauClusterVariables.cc:182
metsig::tau
Definition: SignAlgoResolutions.h:49
reco::tau::PATTauDiscriminationByMVAIsolationRun2::mvaName_
std::string mvaName_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:157
reco::tau::kDBoldDMwLT
Definition: PFRecoTauClusterVariables.h:63
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
reco::tau::PATTauDiscriminationByMVAIsolationRun2::taus_
edm::Handle< TauCollection > taus_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:170
cms::cuda::assert
assert(be >=bs)
reco::tau::PATTauDiscriminationByMVAIsolationRun2::mvaReader_
const GBRForest * mvaReader_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:160
reco::tau::PATTauDiscriminationByMVAIsolationRun2::photonPtSumOutsideSignalCone_
std::string photonPtSumOutsideSignalCone_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:167
edm::FileInPath
Definition: FileInPath.h:64
reco::tau::PATTauDiscriminationByMVAIsolationRun2::chargedIsoPtSums_
std::string chargedIsoPtSums_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:164
reco::tau::kNewDMwLT
Definition: PFRecoTauClusterVariables.h:62
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
reco::tau::kDBnewDMwLTwGJPhase2
Definition: PFRecoTauClusterVariables.h:69
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
reco::tau::kDBnewDMwLTwGJ
Definition: PFRecoTauClusterVariables.h:68
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::tau::kPWoldDMwLT
Definition: PFRecoTauClusterVariables.h:65
TauDiscriminationProducerBase::fillProducerDescriptions
static void fillProducerDescriptions(edm::ParameterSetDescription &desc)
Definition: TauDiscriminationProducerBase.cc:173
reco::tau::kDBnewDMwLT
Definition: PFRecoTauClusterVariables.h:64
TauDiscriminationProducerBase::Tau_token
edm::EDGetTokenT< TauCollection > Tau_token
Definition: TauDiscriminationProducerBase.h:107
reco::tau::PATTauDiscriminationByMVAIsolationRun2::moduleLabel_
std::string moduleLabel_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:155
reco::tau::kDBoldDMwLTwGJ
Definition: PFRecoTauClusterVariables.h:67
reco::tau::PATTauDiscriminationByMVAIsolationRun2::verbosity_
int verbosity_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:173
reco::tau::PATTauDiscriminationByMVAIsolationRun2::neutralIsoPtSums_
std::string neutralIsoPtSums_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:165
looper.cfg
cfg
Definition: looper.py:297
reco::tau::PATTauDiscriminationByMVAIsolationRun2::inputFilesToDelete_
std::vector< TFile * > inputFilesToDelete_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:171
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
reco::tau::PATTauDiscriminationByMVAIsolationRun2::puCorrPtSums_
std::string puCorrPtSums_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:166
Exception
Definition: hltDiff.cc:246
reco::tau::kNewDMwoLT
Definition: PFRecoTauClusterVariables.h:61
mps_fire.result
result
Definition: mps_fire.py:311
PATTauDiscriminationContainerProducerBase
TauDiscriminationProducerBase< pat::Tau, reco::TauDiscriminatorContainer, reco::SingleTauDiscriminatorContainer, pat::PATTauDiscriminator > PATTauDiscriminationContainerProducerBase
Definition: TauDiscriminationProducerBase.h:129
reco::tau::kOldDMwLT
Definition: PFRecoTauClusterVariables.h:60
reco::tau::kPWnewDMwLT
Definition: PFRecoTauClusterVariables.h:66
reco::tau::PATTauDiscriminationByMVAIsolationRun2::inputFileName_
edm::FileInPath inputFileName_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:159
reco::tau::PATTauDiscriminationByMVAIsolationRun2::mvaInput_
float * mvaInput_
Definition: PATTauDiscriminationByMVAIsolationRun2.cc:162
reco::SingleTauDiscriminatorContainer
Definition: TauDiscriminatorContainer.h:9