CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
CandidateBoostedDoubleSecondaryVertexComputer Class Reference

#include <CandidateBoostedDoubleSecondaryVertexComputer.h>

Inheritance diagram for CandidateBoostedDoubleSecondaryVertexComputer:
JetTagComputer

Classes

struct  Tokens
 

Public Member Functions

 CandidateBoostedDoubleSecondaryVertexComputer (const edm::ParameterSet &parameters, Tokens tokens)
 
float discriminator (const TagInfoHelper &tagInfos) const override
 
void initialize (const JetTagComputerRecord &) override
 
- Public Member Functions inherited from JetTagComputer
const std::vector< std::string > & getInputLabels () const
 
 JetTagComputer ()
 
 JetTagComputer (const edm::ParameterSet &configuration)
 
float operator() (const reco::BaseTagInfo &info) const
 
float operator() (const TagInfoHelper &helper) const
 
void setupDone ()
 
virtual ~JetTagComputer ()
 

Private Attributes

std::unique_ptr< TMVAEvaluatormvaID
 
const Tokens tokens_
 
const bool useAdaBoost_
 
const bool useGBRForest_
 
const edm::FileInPath weightFile_
 

Additional Inherited Members

- Protected Member Functions inherited from JetTagComputer
virtual float discriminator (const reco::BaseTagInfo &) const
 
void uses (unsigned int id, const std::string &label)
 
void uses (const std::string &label)
 

Detailed Description

Definition at line 10 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Constructor & Destructor Documentation

◆ CandidateBoostedDoubleSecondaryVertexComputer()

CandidateBoostedDoubleSecondaryVertexComputer::CandidateBoostedDoubleSecondaryVertexComputer ( const edm::ParameterSet parameters,
Tokens  tokens 
)

Definition at line 21 of file CandidateBoostedDoubleSecondaryVertexComputer.cc.

23  : weightFile_(parameters.existsAs<edm::FileInPath>("weightFile")
24  ? parameters.getParameter<edm::FileInPath>("weightFile")
25  : edm::FileInPath()),
26  useGBRForest_(parameters.existsAs<bool>("useGBRForest") ? parameters.getParameter<bool>("useGBRForest") : false),
27  useAdaBoost_(parameters.existsAs<bool>("useAdaBoost") ? parameters.getParameter<bool>("useAdaBoost") : false),
28  tokens_{tokens} {
29  uses(0, "svTagInfos");
30 
31  mvaID = std::make_unique<TMVAEvaluator>();
32 }
void uses(unsigned int id, const std::string &label)

Member Function Documentation

◆ discriminator()

float CandidateBoostedDoubleSecondaryVertexComputer::discriminator ( const TagInfoHelper tagInfos) const
overridevirtual

Reimplemented from JetTagComputer.

Definition at line 73 of file CandidateBoostedDoubleSecondaryVertexComputer.cc.

References PixelMapPlotter::inputs, reco::btau::jetNSecondaryVertices, reco::btau::jetNTracks, mvaID, reco::BoostedDoubleSVTagInfo::taggingVariables(), dumpRecoGeometry_cfg::tagInfo, reco::btau::tau1_flightDistance2dSig, reco::btau::tau1_trackEtaRel_0, reco::btau::tau1_trackEtaRel_1, reco::btau::tau1_trackEtaRel_2, reco::btau::tau1_trackSip3dSig_0, reco::btau::tau1_trackSip3dSig_1, reco::btau::tau1_vertexDeltaR, reco::btau::tau1_vertexEnergyRatio, reco::btau::tau1_vertexMass, reco::btau::tau2_flightDistance2dSig, reco::btau::tau2_trackEtaRel_0, reco::btau::tau2_trackEtaRel_1, reco::btau::tau2_trackEtaRel_2, reco::btau::tau2_trackSip3dSig_0, reco::btau::tau2_trackSip3dSig_1, reco::btau::tau2_vertexEnergyRatio, reco::btau::tau2_vertexMass, reco::btau::trackSip2dSigAboveBottom_0, reco::btau::trackSip2dSigAboveBottom_1, reco::btau::trackSip2dSigAboveCharm, reco::btau::trackSip3dSig_0, reco::btau::trackSip3dSig_1, reco::btau::trackSip3dSig_2, reco::btau::trackSip3dSig_3, relativeConstraints::value, and reco::btau::z_ratio.

73  {
74  // get the TagInfo
76 
77  // get the TaggingVariables
78  const reco::TaggingVariableList vars = bdsvTagInfo.taggingVariables();
79 
80  // default discriminator value
81  float value = -10.;
82 
83  std::map<std::string, float> inputs;
84  inputs["z_ratio"] = vars.get(reco::btau::z_ratio);
85  inputs["trackSipdSig_3"] = vars.get(reco::btau::trackSip3dSig_3);
86  inputs["trackSipdSig_2"] = vars.get(reco::btau::trackSip3dSig_2);
87  inputs["trackSipdSig_1"] = vars.get(reco::btau::trackSip3dSig_1);
88  inputs["trackSipdSig_0"] = vars.get(reco::btau::trackSip3dSig_0);
89  inputs["trackSipdSig_1_0"] = vars.get(reco::btau::tau2_trackSip3dSig_0);
90  inputs["trackSipdSig_0_0"] = vars.get(reco::btau::tau1_trackSip3dSig_0);
91  inputs["trackSipdSig_1_1"] = vars.get(reco::btau::tau2_trackSip3dSig_1);
92  inputs["trackSipdSig_0_1"] = vars.get(reco::btau::tau1_trackSip3dSig_1);
93  inputs["trackSip2dSigAboveCharm_0"] = vars.get(reco::btau::trackSip2dSigAboveCharm);
94  inputs["trackSip2dSigAboveBottom_0"] = vars.get(reco::btau::trackSip2dSigAboveBottom_0);
95  inputs["trackSip2dSigAboveBottom_1"] = vars.get(reco::btau::trackSip2dSigAboveBottom_1);
96  inputs["tau1_trackEtaRel_0"] = vars.get(reco::btau::tau2_trackEtaRel_0);
97  inputs["tau1_trackEtaRel_1"] = vars.get(reco::btau::tau2_trackEtaRel_1);
98  inputs["tau1_trackEtaRel_2"] = vars.get(reco::btau::tau2_trackEtaRel_2);
99  inputs["tau0_trackEtaRel_0"] = vars.get(reco::btau::tau1_trackEtaRel_0);
100  inputs["tau0_trackEtaRel_1"] = vars.get(reco::btau::tau1_trackEtaRel_1);
101  inputs["tau0_trackEtaRel_2"] = vars.get(reco::btau::tau1_trackEtaRel_2);
102  inputs["tau_vertexMass_0"] = vars.get(reco::btau::tau1_vertexMass);
103  inputs["tau_vertexEnergyRatio_0"] = vars.get(reco::btau::tau1_vertexEnergyRatio);
104  inputs["tau_vertexDeltaR_0"] = vars.get(reco::btau::tau1_vertexDeltaR);
105  inputs["tau_flightDistance2dSig_0"] = vars.get(reco::btau::tau1_flightDistance2dSig);
106  inputs["tau_vertexMass_1"] = vars.get(reco::btau::tau2_vertexMass);
107  inputs["tau_vertexEnergyRatio_1"] = vars.get(reco::btau::tau2_vertexEnergyRatio);
108  inputs["tau_flightDistance2dSig_1"] = vars.get(reco::btau::tau2_flightDistance2dSig);
109  inputs["jetNTracks"] = vars.get(reco::btau::jetNTracks);
111 
112  // evaluate the MVA
113  value = mvaID->evaluate(inputs);
114 
115  // return the final discriminator value
116  return value;
117 }
Definition: value.py:1
TaggingVariableList taggingVariables(void) const override
returns a description of the extended informations in a TaggingVariableList
vars
Definition: DeepTauId.cc:30

◆ initialize()

void CandidateBoostedDoubleSecondaryVertexComputer::initialize ( const JetTagComputerRecord record)
overridevirtual

Reimplemented from JetTagComputer.

Definition at line 34 of file CandidateBoostedDoubleSecondaryVertexComputer.cc.

References edm::FileInPath::fullPath(), CandidateBoostedDoubleSecondaryVertexComputer::Tokens::gbrForest_, edm::ESGetToken< ESProduct, ESRecord >::isInitialized(), mvaID, AlCaHarvesting_cff::record, candidateCombinedMVAV2Computer_cfi::spectators, tokens_, useAdaBoost_, useGBRForest_, L1TEGammaDiff_cfi::variables, and weightFile_.

34  {
35  // variable names and order need to be the same as in the training
36  std::vector<std::string> variables({"z_ratio",
37  "trackSipdSig_3",
38  "trackSipdSig_2",
39  "trackSipdSig_1",
40  "trackSipdSig_0",
41  "trackSipdSig_1_0",
42  "trackSipdSig_0_0",
43  "trackSipdSig_1_1",
44  "trackSipdSig_0_1",
45  "trackSip2dSigAboveCharm_0",
46  "trackSip2dSigAboveBottom_0",
47  "trackSip2dSigAboveBottom_1",
48  "tau0_trackEtaRel_0",
49  "tau0_trackEtaRel_1",
50  "tau0_trackEtaRel_2",
51  "tau1_trackEtaRel_0",
52  "tau1_trackEtaRel_1",
53  "tau1_trackEtaRel_2",
54  "tau_vertexMass_0",
55  "tau_vertexEnergyRatio_0",
56  "tau_vertexDeltaR_0",
57  "tau_flightDistance2dSig_0",
58  "tau_vertexMass_1",
59  "tau_vertexEnergyRatio_1",
60  "tau_flightDistance2dSig_1",
61  "jetNTracks",
62  "nSV"});
63  // book TMVA readers
64  std::vector<std::string> spectators({"massPruned", "flavour", "nbHadrons", "ptPruned", "etaPruned"});
65 
67  mvaID->initializeGBRForest(&record.get(tokens_.gbrForest_), variables, spectators, useAdaBoost_);
68  } else
69  mvaID->initialize(
70  "Color:Silent:Error", "BDT", weightFile_.fullPath(), variables, spectators, useGBRForest_, useAdaBoost_);
71 }
std::string fullPath() const
Definition: FileInPath.cc:161
constexpr bool isInitialized() const noexcept
Definition: ESGetToken.h:72

Member Data Documentation

◆ mvaID

std::unique_ptr<TMVAEvaluator> CandidateBoostedDoubleSecondaryVertexComputer::mvaID
private

Definition at line 28 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by discriminator(), and initialize().

◆ tokens_

const Tokens CandidateBoostedDoubleSecondaryVertexComputer::tokens_
private

Definition at line 26 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().

◆ useAdaBoost_

const bool CandidateBoostedDoubleSecondaryVertexComputer::useAdaBoost_
private

Definition at line 25 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().

◆ useGBRForest_

const bool CandidateBoostedDoubleSecondaryVertexComputer::useGBRForest_
private

Definition at line 24 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().

◆ weightFile_

const edm::FileInPath CandidateBoostedDoubleSecondaryVertexComputer::weightFile_
private

Definition at line 23 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().