CMS 3D CMS Logo

CandidateBoostedDoubleSecondaryVertexComputer.cc
Go to the documentation of this file.
2 
4 
8 
11  if (parameters.getParameter<bool>("useCondDB")) {
12  cc.setConsumes(gbrForest_,
13  edm::ESInputTag{"",
14  parameters.existsAs<std::string>("gbrForestLabel")
15  ? parameters.getParameter<std::string>("gbrForestLabel")
16  : ""});
17  }
18 }
19 
21  const edm::ParameterSet& parameters, Tokens tokens)
22  : weightFile_(parameters.existsAs<edm::FileInPath>("weightFile")
23  ? parameters.getParameter<edm::FileInPath>("weightFile")
24  : edm::FileInPath()),
25  useGBRForest_(parameters.existsAs<bool>("useGBRForest") ? parameters.getParameter<bool>("useGBRForest") : false),
26  useAdaBoost_(parameters.existsAs<bool>("useAdaBoost") ? parameters.getParameter<bool>("useAdaBoost") : false),
27  tokens_{std::move(tokens)} {
28  uses(0, "svTagInfos");
29 
30  mvaID.reset(new TMVAEvaluator());
31 }
32 
34  // variable names and order need to be the same as in the training
35  std::vector<std::string> variables({"z_ratio",
36  "trackSipdSig_3",
37  "trackSipdSig_2",
38  "trackSipdSig_1",
39  "trackSipdSig_0",
40  "trackSipdSig_1_0",
41  "trackSipdSig_0_0",
42  "trackSipdSig_1_1",
43  "trackSipdSig_0_1",
44  "trackSip2dSigAboveCharm_0",
45  "trackSip2dSigAboveBottom_0",
46  "trackSip2dSigAboveBottom_1",
47  "tau0_trackEtaRel_0",
48  "tau0_trackEtaRel_1",
49  "tau0_trackEtaRel_2",
50  "tau1_trackEtaRel_0",
51  "tau1_trackEtaRel_1",
52  "tau1_trackEtaRel_2",
53  "tau_vertexMass_0",
54  "tau_vertexEnergyRatio_0",
55  "tau_vertexDeltaR_0",
56  "tau_flightDistance2dSig_0",
57  "tau_vertexMass_1",
58  "tau_vertexEnergyRatio_1",
59  "tau_flightDistance2dSig_1",
60  "jetNTracks",
61  "nSV"});
62  // book TMVA readers
63  std::vector<std::string> spectators({"massPruned", "flavour", "nbHadrons", "ptPruned", "etaPruned"});
64 
66  mvaID->initializeGBRForest(&record.get(tokens_.gbrForest_), variables, spectators, useAdaBoost_);
67  } else
68  mvaID->initialize(
69  "Color:Silent:Error", "BDT", weightFile_.fullPath(), variables, spectators, useGBRForest_, useAdaBoost_);
70 }
71 
73  // get the TagInfo
75 
76  // get the TaggingVariables
77  const reco::TaggingVariableList vars = bdsvTagInfo.taggingVariables();
78 
79  // default discriminator value
80  float value = -10.;
81 
82  std::map<std::string, float> inputs;
83  inputs["z_ratio"] = vars.get(reco::btau::z_ratio);
84  inputs["trackSipdSig_3"] = vars.get(reco::btau::trackSip3dSig_3);
85  inputs["trackSipdSig_2"] = vars.get(reco::btau::trackSip3dSig_2);
86  inputs["trackSipdSig_1"] = vars.get(reco::btau::trackSip3dSig_1);
87  inputs["trackSipdSig_0"] = vars.get(reco::btau::trackSip3dSig_0);
88  inputs["trackSipdSig_1_0"] = vars.get(reco::btau::tau2_trackSip3dSig_0);
89  inputs["trackSipdSig_0_0"] = vars.get(reco::btau::tau1_trackSip3dSig_0);
90  inputs["trackSipdSig_1_1"] = vars.get(reco::btau::tau2_trackSip3dSig_1);
91  inputs["trackSipdSig_0_1"] = vars.get(reco::btau::tau1_trackSip3dSig_1);
92  inputs["trackSip2dSigAboveCharm_0"] = vars.get(reco::btau::trackSip2dSigAboveCharm);
93  inputs["trackSip2dSigAboveBottom_0"] = vars.get(reco::btau::trackSip2dSigAboveBottom_0);
94  inputs["trackSip2dSigAboveBottom_1"] = vars.get(reco::btau::trackSip2dSigAboveBottom_1);
95  inputs["tau1_trackEtaRel_0"] = vars.get(reco::btau::tau2_trackEtaRel_0);
96  inputs["tau1_trackEtaRel_1"] = vars.get(reco::btau::tau2_trackEtaRel_1);
97  inputs["tau1_trackEtaRel_2"] = vars.get(reco::btau::tau2_trackEtaRel_2);
98  inputs["tau0_trackEtaRel_0"] = vars.get(reco::btau::tau1_trackEtaRel_0);
99  inputs["tau0_trackEtaRel_1"] = vars.get(reco::btau::tau1_trackEtaRel_1);
100  inputs["tau0_trackEtaRel_2"] = vars.get(reco::btau::tau1_trackEtaRel_2);
101  inputs["tau_vertexMass_0"] = vars.get(reco::btau::tau1_vertexMass);
102  inputs["tau_vertexEnergyRatio_0"] = vars.get(reco::btau::tau1_vertexEnergyRatio);
103  inputs["tau_vertexDeltaR_0"] = vars.get(reco::btau::tau1_vertexDeltaR);
104  inputs["tau_flightDistance2dSig_0"] = vars.get(reco::btau::tau1_flightDistance2dSig);
105  inputs["tau_vertexMass_1"] = vars.get(reco::btau::tau2_vertexMass);
106  inputs["tau_vertexEnergyRatio_1"] = vars.get(reco::btau::tau2_vertexEnergyRatio);
107  inputs["tau_flightDistance2dSig_1"] = vars.get(reco::btau::tau2_flightDistance2dSig);
108  inputs["jetNTracks"] = vars.get(reco::btau::jetNTracks);
110 
111  // evaluate the MVA
112  value = mvaID->evaluate(inputs);
113 
114  // return the final discriminator value
115  return value;
116 }
reco::btau::tau2_trackEtaRel_1
Definition: TaggingVariable.h:145
reco::btau::tau1_vertexEnergyRatio
Definition: TaggingVariable.h:148
electrons_cff.bool
bool
Definition: electrons_cff.py:372
edm::ESInputTag
Definition: ESInputTag.h:87
MessageLogger.h
CandidateBoostedDoubleSecondaryVertexComputer.h
funct::false
false
Definition: Factorize.h:34
edm::ESConsumesCollector
Definition: ESConsumesCollector.h:58
reco::btau::trackSip2dSigAboveBottom_0
Definition: TaggingVariable.h:139
reco::btau::tau2_trackEtaRel_2
Definition: TaggingVariable.h:146
L1TEGammaDiff_cfi.variables
variables
Definition: L1TEGammaDiff_cfi.py:5
edm
HLT enums.
Definition: AlignableModifier.h:19
candidateCombinedMVAV2Computer_cfi.spectators
spectators
Definition: candidateCombinedMVAV2Computer_cfi.py:15
reco::btau::trackSip2dSigAboveCharm
Definition: TaggingVariable.h:90
reco::TaggingVariableList
Definition: TaggingVariable.h:194
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
photons_cff.mvaID
mvaID
Definition: photons_cff.py:99
reco::btau::trackSip2dSigAboveBottom_1
Definition: TaggingVariable.h:140
JetTagComputer::TagInfoHelper
Definition: JetTagComputer.h:16
CandidateBoostedDoubleSecondaryVertexComputer::useGBRForest_
const bool useGBRForest_
Definition: CandidateBoostedDoubleSecondaryVertexComputer.h:24
JetTagComputerRecord
Definition: JetTagComputerRecord.h:10
reco::btau::tau2_trackEtaRel_0
Definition: TaggingVariable.h:144
CandidateBoostedDoubleSecondaryVertexComputer::Tokens::gbrForest_
edm::ESGetToken< GBRForest, GBRWrapperRcd > gbrForest_
Definition: CandidateBoostedDoubleSecondaryVertexComputer.h:14
reco::btau::tau2_flightDistance2dSig
Definition: TaggingVariable.h:153
edm::ESGetToken::isInitialized
constexpr bool isInitialized() const noexcept
Definition: ESGetToken.h:52
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
TMVAEvaluator
Definition: TMVAEvaluator.h:16
BTauGenericMVAJetTagComputerRcd.h
vars
vars
Definition: DeepTauId.cc:158
CandidateBoostedDoubleSecondaryVertexComputer::weightFile_
const edm::FileInPath weightFile_
Definition: CandidateBoostedDoubleSecondaryVertexComputer.h:23
reco::btau::trackSip3dSig_2
Definition: TaggingVariable.h:133
reco::btau::trackSip3dSig_3
Definition: TaggingVariable.h:134
CandidateBoostedDoubleSecondaryVertexComputer::discriminator
float discriminator(const TagInfoHelper &tagInfos) const override
Definition: CandidateBoostedDoubleSecondaryVertexComputer.cc:72
reco::btau::trackSip3dSig_0
Definition: TaggingVariable.h:131
JetTagComputerRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CandidateBoostedDoubleSecondaryVertexComputer::useAdaBoost_
const bool useAdaBoost_
Definition: CandidateBoostedDoubleSecondaryVertexComputer.h:25
CandidateBoostedDoubleSecondaryVertexComputer::tokens_
const Tokens tokens_
Definition: CandidateBoostedDoubleSecondaryVertexComputer.h:26
edm::ParameterSet
Definition: ParameterSet.h:36
reco::btau::z_ratio
Definition: TaggingVariable.h:155
reco::btau::trackSip3dSig_1
Definition: TaggingVariable.h:132
reco::btau::tau1_trackEtaRel_0
Definition: TaggingVariable.h:141
reco::btau::jetNSecondaryVertices
Definition: TaggingVariable.h:72
reco::BoostedDoubleSVTagInfo
Definition: BoostedDoubleSVTagInfo.h:12
reco::btau::tau2_trackSip3dSig_0
Definition: TaggingVariable.h:137
value
Definition: value.py:1
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
reco::btau::tau1_trackEtaRel_1
Definition: TaggingVariable.h:142
cc
reco::btau::tau1_vertexDeltaR
Definition: TaggingVariable.h:150
CandidateBoostedDoubleSecondaryVertexComputer::Tokens
Definition: CandidateBoostedDoubleSecondaryVertexComputer.h:12
reco::btau::tau1_trackSip3dSig_0
Definition: TaggingVariable.h:135
reco::btau::tau2_vertexEnergyRatio
Definition: TaggingVariable.h:152
reco::btau::tau1_trackEtaRel_2
Definition: TaggingVariable.h:143
eostools.move
def move(src, dest)
Definition: eostools.py:511
CandidateBoostedDoubleSecondaryVertexComputer::initialize
void initialize(const JetTagComputerRecord &) override
Definition: CandidateBoostedDoubleSecondaryVertexComputer.cc:33
reco::btau::tau2_vertexMass
Definition: TaggingVariable.h:151
reco::btau::tau2_trackSip3dSig_1
Definition: TaggingVariable.h:138
relativeConstraints.value
value
Definition: relativeConstraints.py:53
reco::BoostedDoubleSVTagInfo::taggingVariables
TaggingVariableList taggingVariables(void) const override
returns a description of the extended informations in a TaggingVariableList
Definition: BoostedDoubleSVTagInfo.h:26
reco::btau::jetNTracks
Definition: TaggingVariable.h:37
dumpRecoGeometry_cfg.tagInfo
tagInfo
Definition: dumpRecoGeometry_cfg.py:194
CandidateBoostedDoubleSecondaryVertexComputer::mvaID
std::unique_ptr< TMVAEvaluator > mvaID
Definition: CandidateBoostedDoubleSecondaryVertexComputer.h:28
reco::btau::tau1_vertexMass
Definition: TaggingVariable.h:147
reco::btau::tau1_trackSip3dSig_1
Definition: TaggingVariable.h:136
CandidateBoostedDoubleSecondaryVertexComputer::Tokens::Tokens
Tokens(const edm::ParameterSet &parameters, edm::ESConsumesCollector &&cc)
Definition: CandidateBoostedDoubleSecondaryVertexComputer.cc:9
BoostedDoubleSVTagInfo.h
reco::btau::tau1_flightDistance2dSig
Definition: TaggingVariable.h:149
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
CandidateBoostedDoubleSecondaryVertexComputer::CandidateBoostedDoubleSecondaryVertexComputer
CandidateBoostedDoubleSecondaryVertexComputer(const edm::ParameterSet &parameters, Tokens tokens)
Definition: CandidateBoostedDoubleSecondaryVertexComputer.cc:20