CMS 3D CMS Logo

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

#include <CandidateBoostedDoubleSecondaryVertexComputer.h>

Inheritance diagram for CandidateBoostedDoubleSecondaryVertexComputer:
JetTagComputer

Public Member Functions

 CandidateBoostedDoubleSecondaryVertexComputer (const edm::ParameterSet &parameters)
 
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

const std::string gbrForestLabel_
 
std::unique_ptr< TMVAEvaluatormvaID
 
const bool useAdaBoost_
 
const bool useCondDB_
 
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 9 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Constructor & Destructor Documentation

CandidateBoostedDoubleSecondaryVertexComputer::CandidateBoostedDoubleSecondaryVertexComputer ( const edm::ParameterSet parameters)

Definition at line 12 of file CandidateBoostedDoubleSecondaryVertexComputer.cc.

References mvaID, and JetTagComputer::uses().

12  :
13  useCondDB_(parameters.getParameter<bool>("useCondDB")),
14  gbrForestLabel_(parameters.existsAs<std::string>("gbrForestLabel") ? parameters.getParameter<std::string>("gbrForestLabel") : ""),
15  weightFile_(parameters.existsAs<edm::FileInPath>("weightFile") ? parameters.getParameter<edm::FileInPath>("weightFile") : edm::FileInPath()),
16  useGBRForest_(parameters.existsAs<bool>("useGBRForest") ? parameters.getParameter<bool>("useGBRForest") : false),
17  useAdaBoost_(parameters.existsAs<bool>("useAdaBoost") ? parameters.getParameter<bool>("useAdaBoost") : false)
18 {
19  uses(0, "svTagInfos");
20 
21  mvaID.reset(new TMVAEvaluator());
22 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
void uses(unsigned int id, const std::string &label)

Member Function Documentation

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

Reimplemented from JetTagComputer.

Definition at line 52 of file CandidateBoostedDoubleSecondaryVertexComputer.cc.

References JetTagComputer::TagInfoHelper::get(), PatBasicFWLiteJetAnalyzer_Selector_cfg::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.

53 {
54  // get the TagInfo
55  const reco::BoostedDoubleSVTagInfo & bdsvTagInfo = tagInfo.get<reco::BoostedDoubleSVTagInfo>(0);
56 
57  // get the TaggingVariables
58  const reco::TaggingVariableList vars = bdsvTagInfo.taggingVariables();
59 
60  // default discriminator value
61  float value = -10.;
62 
63  std::map<std::string,float> inputs;
64  inputs["z_ratio"] = vars.get(reco::btau::z_ratio);
65  inputs["trackSipdSig_3"] = vars.get(reco::btau::trackSip3dSig_3);
66  inputs["trackSipdSig_2"] = vars.get(reco::btau::trackSip3dSig_2);
67  inputs["trackSipdSig_1"] = vars.get(reco::btau::trackSip3dSig_1);
68  inputs["trackSipdSig_0"] = vars.get(reco::btau::trackSip3dSig_0);
69  inputs["trackSipdSig_1_0"] = vars.get(reco::btau::tau2_trackSip3dSig_0);
70  inputs["trackSipdSig_0_0"] = vars.get(reco::btau::tau1_trackSip3dSig_0);
71  inputs["trackSipdSig_1_1"] = vars.get(reco::btau::tau2_trackSip3dSig_1);
72  inputs["trackSipdSig_0_1"] = vars.get(reco::btau::tau1_trackSip3dSig_1);
73  inputs["trackSip2dSigAboveCharm_0"] = vars.get(reco::btau::trackSip2dSigAboveCharm);
74  inputs["trackSip2dSigAboveBottom_0"] = vars.get(reco::btau::trackSip2dSigAboveBottom_0);
75  inputs["trackSip2dSigAboveBottom_1"] = vars.get(reco::btau::trackSip2dSigAboveBottom_1);
76  inputs["tau1_trackEtaRel_0"] = vars.get(reco::btau::tau2_trackEtaRel_0);
77  inputs["tau1_trackEtaRel_1"] = vars.get(reco::btau::tau2_trackEtaRel_1);
78  inputs["tau1_trackEtaRel_2"] = vars.get(reco::btau::tau2_trackEtaRel_2);
79  inputs["tau0_trackEtaRel_0"] = vars.get(reco::btau::tau1_trackEtaRel_0);
80  inputs["tau0_trackEtaRel_1"] = vars.get(reco::btau::tau1_trackEtaRel_1);
81  inputs["tau0_trackEtaRel_2"] = vars.get(reco::btau::tau1_trackEtaRel_2);
82  inputs["tau_vertexMass_0"] = vars.get(reco::btau::tau1_vertexMass);
83  inputs["tau_vertexEnergyRatio_0"] = vars.get(reco::btau::tau1_vertexEnergyRatio);
84  inputs["tau_vertexDeltaR_0"] = vars.get(reco::btau::tau1_vertexDeltaR);
85  inputs["tau_flightDistance2dSig_0"] = vars.get(reco::btau::tau1_flightDistance2dSig);
86  inputs["tau_vertexMass_1"] = vars.get(reco::btau::tau2_vertexMass);
87  inputs["tau_vertexEnergyRatio_1"] = vars.get(reco::btau::tau2_vertexEnergyRatio);
88  inputs["tau_flightDistance2dSig_1"] = vars.get(reco::btau::tau2_flightDistance2dSig);
89  inputs["jetNTracks"] = vars.get(reco::btau::jetNTracks);
90  inputs["nSV"] = vars.get(reco::btau::jetNSecondaryVertices);
91 
92  // evaluate the MVA
93  value = mvaID->evaluate(inputs);
94 
95  // return the final discriminator value
96  return value;
97 }
Definition: value.py:1
virtual TaggingVariableList taggingVariables(void) const
returns a description of the extended informations in a TaggingVariableList
void CandidateBoostedDoubleSecondaryVertexComputer::initialize ( const JetTagComputerRecord record)
overridevirtual

Reimplemented from JetTagComputer.

Definition at line 24 of file CandidateBoostedDoubleSecondaryVertexComputer.cc.

References edm::FileInPath::fullPath(), gbrForestLabel_, edm::eventsetup::EventSetupRecord::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), mvaID, candidateCombinedMVAV2Computer_cfi::spectators, useAdaBoost_, useCondDB_, useGBRForest_, objects.autophobj::variables, and weightFile_.

25 {
26  // variable names and order need to be the same as in the training
27  std::vector<std::string> variables({"z_ratio",
28  "trackSipdSig_3","trackSipdSig_2","trackSipdSig_1","trackSipdSig_0",
29  "trackSipdSig_1_0","trackSipdSig_0_0","trackSipdSig_1_1","trackSipdSig_0_1",
30  "trackSip2dSigAboveCharm_0","trackSip2dSigAboveBottom_0","trackSip2dSigAboveBottom_1",
31  "tau0_trackEtaRel_0","tau0_trackEtaRel_1","tau0_trackEtaRel_2",
32  "tau1_trackEtaRel_0","tau1_trackEtaRel_1","tau1_trackEtaRel_2",
33  "tau_vertexMass_0","tau_vertexEnergyRatio_0","tau_vertexDeltaR_0","tau_flightDistance2dSig_0",
34  "tau_vertexMass_1","tau_vertexEnergyRatio_1","tau_flightDistance2dSig_1",
35  "jetNTracks","nSV"});
36  // book TMVA readers
37  std::vector<std::string> spectators({"massPruned", "flavour", "nbHadrons", "ptPruned", "etaPruned"});
38 
39  if (useCondDB_)
40  {
41  const GBRWrapperRcd & gbrWrapperRecord = record.getRecord<GBRWrapperRcd>();
42 
43  edm::ESHandle<GBRForest> gbrForestHandle;
44  gbrWrapperRecord.get(gbrForestLabel_.c_str(), gbrForestHandle);
45 
46  mvaID->initializeGBRForest(gbrForestHandle.product(), variables, spectators, useAdaBoost_);
47  }
48  else
49  mvaID->initialize("Color:Silent:Error", "BDT", weightFile_.fullPath(), variables, spectators, useGBRForest_, useAdaBoost_);
50 }
void get(HolderT &iHolder) const
std::string fullPath() const
Definition: FileInPath.cc:184

Member Data Documentation

const std::string CandidateBoostedDoubleSecondaryVertexComputer::gbrForestLabel_
private

Definition at line 19 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().

std::unique_ptr<TMVAEvaluator> CandidateBoostedDoubleSecondaryVertexComputer::mvaID
private
const bool CandidateBoostedDoubleSecondaryVertexComputer::useAdaBoost_
private

Definition at line 22 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().

const bool CandidateBoostedDoubleSecondaryVertexComputer::useCondDB_
private

Definition at line 18 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().

const bool CandidateBoostedDoubleSecondaryVertexComputer::useGBRForest_
private

Definition at line 21 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().

const edm::FileInPath CandidateBoostedDoubleSecondaryVertexComputer::weightFile_
private

Definition at line 20 of file CandidateBoostedDoubleSecondaryVertexComputer.h.

Referenced by initialize().