CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( 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 }
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
void uses(unsigned int id, const std::string &label)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

Member Function Documentation

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

Reimplemented from JetTagComputer.

Definition at line 73 of file CandidateBoostedDoubleSecondaryVertexComputer.cc.

References JetTagComputer::TagInfoHelper::get(), PixelMapPlotter::inputs, reco::btau::jetNSecondaryVertices, reco::btau::jetNTracks, mvaID, reco::BoostedDoubleSVTagInfo::taggingVariables(), 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);
110  inputs["nSV"] = vars.get(reco::btau::jetNSecondaryVertices);
111 
112  // evaluate the MVA
113  value = mvaID->evaluate(inputs);
114 
115  // return the final discriminator value
116  return value;
117 }
TaggingVariableList taggingVariables(void) const override
returns a description of the extended informations in a TaggingVariableList
vars
Definition: DeepTauId.cc:164
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::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::ESGetToken< T, R >::isInitialized(), mvaID, 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 }
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
constexpr bool isInitialized() const noexcept
Definition: ESGetToken.h:72
std::string fullPath() const
Definition: FileInPath.cc:161

Member Data Documentation

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

Definition at line 28 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by discriminator(), and initialize().

const Tokens CandidateBoostedDoubleSecondaryVertexComputer::tokens_
private

Definition at line 26 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().

const bool CandidateBoostedDoubleSecondaryVertexComputer::useAdaBoost_
private

Definition at line 25 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().

const bool CandidateBoostedDoubleSecondaryVertexComputer::useGBRForest_
private

Definition at line 24 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().

const edm::FileInPath CandidateBoostedDoubleSecondaryVertexComputer::weightFile_
private

Definition at line 23 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().