Skip to content

Commit

Permalink
Merge pull request #3774 from cms-btv-pog/newMVAtaggers_backport_from…
Browse files Browse the repository at this point in the history
…_71X_to_70X

New MVA taggers backport from 71X to 70X
  • Loading branch information
davidlange6 committed Jun 18, 2014
2 parents a2356bb + 7172aef commit bf95dbd
Show file tree
Hide file tree
Showing 21 changed files with 1,218 additions and 54 deletions.
42 changes: 31 additions & 11 deletions DataFormats/BTauReco/interface/TaggingVariable.h
Expand Up @@ -44,14 +44,15 @@ namespace reco {
trackDecayLenSig, // track decay length significance
trackJetDistVal, // minimum track approach distance to jet axis
trackJetDistSig, // minimum track approach distance to jet axis significance
trackGhostTrackDistVal, // minimum approach distance to ghost track
trackGhostTrackDistSig, // minimum approach distance to ghost track significance
trackGhostTrackWeight, // weight of track participation in ghost track fit
trackGhostTrackDistVal, // minimum approach distance to ghost track
trackGhostTrackDistSig, // minimum approach distance to ghost track significance
trackGhostTrackWeight, // weight of track participation in ghost track fit

trackSumJetEtRatio, // ratio of track sum transverse energy over jet energy
trackSumJetDeltaR, // pseudoangular distance between jet axis and track fourvector sum

vertexCategory, // category of secondary vertex (Reco, Pseudo, No)
vertexLeptonCategory, // category of secondary vertex & soft lepton (RecoNo, PseudoNo, NoNo, RecoMu, PseudoMu, NoMu, RecoEl, PseudoEl, NoEl)

jetNSecondaryVertices, // number of reconstructed possible secondary vertices in jet
jetNSingleTrackVertices, // number of single-track ghost-track vertices
Expand All @@ -73,22 +74,41 @@ namespace reco {
trackSip3dValAboveCharm, // track 3D signed impact parameter of first track lifting mass above charm
trackSip3dSigAboveCharm, // track 3D signed impact parameter significance of first track lifting mass above charm

neutralEnergy, // neutral ECAL clus. energy sum
neutralEnergyOverCombinedEnergy, // neutral ECAL clus. energy sum/(neutral ECAL clus. energy sum + pion tracks energy)
neutralIsolEnergy, // neutral ECAL clus. energy sum in isolation band
neutralIsolEnergyOverCombinedEnergy, // neutral ECAL clus. energy sum in isolation band/(neutral ECAL clus. energy sum + pion tracks energy)
neutralEnergyRatio, // ratio of neutral ECAL clus. energy sum in isolation band over neutral ECAL clus. energy sum
neutralclusterNumber, // number of neutral ECAL clus.
neutralclusterRadius, // mean DR between neutral ECAL clus. and lead.track

leptonQuality, // lepton identification quality
leptonQuality2, // lepton identification quality 2

trackP0Par, // track momentum along the jet axis, in the jet rest frame
trackP0ParRatio, // track momentum along the jet axis, in the jet rest frame, normalized to its energy"
trackChi2, // track fit chi2
trackNTotalHits, // number of valid total hits
trackNPixelHits, // number of valid pixel hits

chargedHadronEnergyFraction, // fraction of the jet energy coming from charged hadrons
neutralHadronEnergyFraction, // fraction of the jet energy coming from neutral hadrons
photonEnergyFraction, // fraction of the jet energy coming from photons
electronEnergyFraction, // fraction of the jet energy coming from electrons
muonEnergyFraction, // fraction of the jet energy coming from muons
chargedHadronMultiplicity, // number of charged hadrons in the jet
neutralHadronMultiplicity, // number of neutral hadrons in the jet
photonMultiplicity, // number of photons in the jet
electronMultiplicity, // number of electrons in the jet
muonMultiplicity, // number of muons in the jet
hadronMultiplicity, // sum of number of charged and neutral hadrons in the jet
hadronPhotonMultiplicity, // sum of number of charged and neutral hadrons and photons in the jet
totalMultiplicity, // sum of number of charged and neutral hadrons, photons, electrons and muons in the jet

massVertexEnergyFraction, // vertexmass times fraction of the vertex energy w.r.t. the jet energy
vertexBoostOverSqrtJetPt, // variable related to the boost of the vertex system in flight direction

leptonSip2d, // 2D signed impact parameter of the soft lepton
leptonSip3d, // 3D signed impact parameter of the soft lepton
leptonPtRel, // transverse momentum of the soft lepton wrt. the jet axis
leptonP0Par, // momentum of the soft lepton along the jet direction, in the jet rest frame
leptonEtaRel, // pseudo)rapidity of the soft lepton along jet axis
leptonDeltaR, // pseudo)angular distance of the soft lepton to jet axis
leptonRatio, // momentum of the soft lepton over jet energy
leptonRatioRel, // momentum of the soft lepton parallel to jet axis over jet energy

algoDiscriminator, // discriminator output of an algorithm

lastTaggingVariable
Expand Down
93 changes: 67 additions & 26 deletions DataFormats/BTauReco/src/TaggingVariable.cc
Expand Up @@ -44,6 +44,7 @@ const char* TaggingVariableDescription[] = {
/* [trackSumJetDeltaR] = */ "pseudoangular distance between jet axis and track fourvector sum",

/* [vertexCategory] = */ "category of secondary vertex (Reco, Pseudo, No)",
/* [vertexLeptonCategory] = */ "category of secondary vertex & soft lepton (RecoNo, PseudoNo, NoNo, RecoMu, PseudoMu, NoMu, RecoEl, PseudoEl, NoEl)",

/* [jetNSecondaryVertices] = */ "number of reconstructed possible secondary vertices in jet",
/* [jetNSingleTrackVertices] = */ "number of single-track ghost-track vertices",
Expand All @@ -65,23 +66,42 @@ const char* TaggingVariableDescription[] = {
/* [trackSip3dValAboveCharm] = */ "track 3D signed impact parameter of first track lifting mass above charm",
/* [trackSip3dSigAboveCharm] = */ "track 3D signed impact parameter significance of first track lifting mass above charm",

/* [neutralEnergy] = */ "neutral ECAL clus. energy sum",
/* [neutralEnergyOverCombinedEnergy] = */ "neutral ECAL clus. energy sum/(neutral ECAL clus. energy sum + pion tracks energy)",
/* [neutralIsolEnergy] = */ "neutral ECAL clus. energy sum in isolation band",
/* [neutralIsolEnergyOverCombinedEnergy] = */ "neutral ECAL clus. energy sum in isolation band/(neutral ECAL clus. energy sum + pion tracks energy)",
/* [neutralEnergyRatio] = */ "ratio of neutral ECAL clus. energy sum in isolation band over neutral ECAL clus. energy sum",
/* [neutralclusterNumber] = */ "number of neutral ECAL clus.",
/* [neutralclusterRadius] = */ "mean DR between neutral ECAL clus. and lead.track",

/* [leptonQuality] = */ "lepton identification quality",
/* [leptonQuality2] = */ "lepton identification quality 2",
/* [trackP0Par] = */ "track momentum along the jet axis, in the jet rest frame",
/* [trackP0ParRatio] = */ "track momentum along the jet axis, in the jet rest frame, normalized to its energy"
/* [trackChi2] = */ "chi2 of the track fit",
/* [trackNTotalHits], = */ "number of valid total hits",
/* [trackNPixelHits], = */ "number of valid pixel hits",
/* [trackNTotalHits] = */ "number of valid total hits",
/* [trackNPixelHits] = */ "number of valid pixel hits",

/* [algoDiscriminator], = */ "discriminator output of an algorithm",
/* [leptonQuality] = */ "lepton identification quality",
/* [leptonQuality2] = */ "lepton identification quality 2",

/* [chargedHadronEnergyFraction] = */ "fraction of the jet energy coming from charged hadrons",
/* [neutralHadronEnergyFraction] = */ "fraction of the jet energy coming from neutral hadrons",
/* [photonEnergyFraction] = */ "fraction of the jet energy coming from photons",
/* [electronEnergyFraction] = */ "fraction of the jet energy coming from electrons",
/* [muonEnergyFraction] = */ "fraction of the jet energy coming from muons",
/* [chargedHadronMultiplicity] = */ "number of charged hadrons in the jet",
/* [neutralHadronMultiplicity] = */ "number of neutral hadrons in the jet",
/* [photonMultiplicity] = */ "number of photons in the jet",
/* [electronMultiplicity] = */ "number of electrons in the jet",
/* [muonMultiplicity] = */ "number of muons in the jet",
/* [hadronMultiplicity] = */ "total number of charged and neutral hadrons in the jet",
/* [hadronPhotonMultiplicity] = */ "total number of photons, charged and neutral hadrons in the jet",
/* [totalMultiplicity] = */ "total number of photons, electrons, muons, charged and neutral hadrons in the jet",

/* [massVertexEnergyFraction] = */ "vertexmass times fraction of the vertex energy w.r.t. the jet energy",
/* [vertexBoostOverSqrtJetPt] = */ "variable related to the boost of the vertex system in flight direction",

/* [leptonSip2d] = */ "2D signed impact parameter of the soft lepton",
/* [leptonSip3d] = */ "3D signed impact parameter of the soft lepton",
/* [leptonPtRel] = */ "transverse momentum of the soft lepton wrt. the jet axis",
/* [leptonP0Par] = */ "momentum of the soft lepton along the jet direction, in the jet rest frame",
/* [leptonEtaRel] = */ "pseudo)rapidity of the soft lepton along jet axis",
/* [leptonDeltaR] = */ "pseudo)angular distance of the soft lepton to jet axis",
/* [leptonRatio], = */ "momentum of the soft lepton over jet energy",
/* [leptonRatioRel] = */ "momentum of the soft lepton parallel to jet axis over jet energy",

/* [algoDiscriminator] = */ "discriminator output of an algorithm",

/* [lastTaggingVariable] = */ ""
};
Expand Down Expand Up @@ -112,7 +132,7 @@ const char* TaggingVariableTokens[] = {
/* [trackSip3dSig] = */ "trackSip3dSig",
/* [trackDecayLenVal] = */ "trackDecayLenVal",
/* [trackDecayLenSig] = */ "trackDecayLenSig",
/* [trackJetDistVal] = */ "trackJetDist", //FIXME
/* [trackJetDistVal] = */ "trackJetDist", //FIXME
/* [trackJetDistSig] = */ "trackJetDistSig",
/* [trackGhostTrackDistVal] = */ "trackGhostTrackDistVal",
/* [trackGhostTrackDistSig] = */ "trackGhostTrackDistSig",
Expand All @@ -122,6 +142,7 @@ const char* TaggingVariableTokens[] = {
/* [trackSumJetDeltaR] = */ "trackSumJetDeltaR",

/* [vertexCategory] = */ "vertexCategory",
/* [vertexLeptonCategory] = */ "vertexLeptonCategory",

/* [jetNSecondaryVertices] = */ "jetNSecondaryVertices",
/* [jetNSingleTrackVertices] = */ "jetNSingleTrackVertices",
Expand All @@ -143,23 +164,43 @@ const char* TaggingVariableTokens[] = {
/* [trackSip3dValAboveCharm] = */ "trackSip3dValAboveCharm",
/* [trackSip3dSigAboveCharm] = */ "trackSip3dSigAboveCharm",

/* [neutralEnergy] = */ "neutralEnergy",
/* [neutralEnergyOverCombinedEnergy] = */ "neutralEnergyOverCombinedEnergy",
/* [neutralIsolEnergy] = */ "neutralIsolEnergy",
/* [neutralIsolEnergyOverCombinedEnergy] = */ "neutralIsolEnergyOverCombinedEnergy",
/* [neutralEnergyRatio] = */ "neutralEnergyRatio",
/* [neutralclusterNumber] = */ "neutralclusterNumber",
/* [neutralclusterRadius] = */ "neutralclusterRadius",

/* [leptonQuality] = */ "leptonQuality",
/* [leptonQuality2] = */ "leptonQuality2",

/* [trackP0Par] = */ "trackP0Par",
/* [trackP0ParRatio] = */ "trackP0ParRatio",
/* [trackChi2] = */ "trackChi2",
/* [trackNTotalHits], = */ "trackNTotalHits",
/* [trackNPixelHits], = */ "trackNPixelHits",

/* [algoDiscriminator], = */ "algoDiscriminator",
/* [trackNTotalHits] = */ "trackNTotalHits",
/* [trackNPixelHits] = */ "trackNPixelHits",


/* [chargedHadronEnergyFraction] = */ "chargedHadronEnergyFraction",
/* [neutralHadronEnergyFraction] = */ "neutralHadronEnergyFraction",
/* [photonEnergyFraction] = */ "photonEnergyFraction",
/* [electronEnergyFraction] = */ "electronEnergyFraction",
/* [muonEnergyFraction], = */ "muonEnergyFraction",
/* [chargedHadronMultiplicity], = */ "chargedHadronMultiplicity",
/* [neutralHadronMultiplicity], = */ "neutralHadronMultiplicity",
/* [photonMultiplicity] = */ "photonMultiplicity",
/* [electronMultiplicity] = */ "electronMultiplicity",
/* [muonMultiplicity], = */ "muonMultiplicity",
/* [hadronMultiplicity], = */ "hadronMultiplicity",
/* [hadronPhotonMultiplicity], = */ "hadronPhotonMultiplicity",
/* [totalMultiplicity] = */ "totalMultiplicity",

/* [massVertexEnergyFraction], = */ "massVertexEnergyFraction",
/* [vertexBoostOverSqrtJetPt], = */ "vertexBoostOverSqrtJetPt",

/* [leptonSip2d] = */ "leptonSip2d",
/* [leptonSip3d] = */ "leptonSip3d",
/* [leptonPtRel] = */ "leptonPtRel",
/* [leptonP0Par] = */ "leptonP0Par",
/* [leptonEtaRel] = */ "leptonEtaRel",
/* [leptonDeltaR] = */ "leptonDeltaR",
/* [leptonRatio] = */ "leptonRatio",
/* [leptonRatioRel], = */ "leptonRatioRel",

/* [algoDiscriminator] = */ "algoDiscriminator",

/* [lastTaggingVariable] = */ "lastTaggingVariable"
};
Expand Down
26 changes: 13 additions & 13 deletions PhysicsTools/MVAComputer/src/MVAComputer.cc
Expand Up @@ -62,6 +62,7 @@ MVAComputer::MVAComputer(std::istream &is) :

void MVAComputer::setup(const Calibration::MVAComputer *calib)
{

nVars = calib->inputSet.size();
output = calib->output;

Expand Down Expand Up @@ -121,22 +122,21 @@ void MVAComputer::setup(const Calibration::MVAComputer *calib)

std::set<InputVar> variables;
unsigned int i = 0;
for(std::vector<Calibration::Variable>::const_iterator iter =
calib->inputSet.begin(); iter != calib->inputSet.end();
++iter, i++) {
for(std::vector<Calibration::Variable>::const_iterator iter = calib->inputSet.begin(); iter != calib->inputSet.end(); ++iter, i++) {
InputVar var;
var.var = Variable(iter->name, config[i].mask);
var.index = i;
var.multiplicity = 0;
var.multiplicity = 0;
variables.insert(var);
}

inputVariables.resize(i);
std::copy(variables.begin(), variables.end(),
inputVariables.begin());

std::copy(variables.begin(), variables.end(), inputVariables.begin());

for(unsigned int j = 0; j < i; j++)
inputVariables[j].multiplicity = config[j].origin;
inputVariables[j].multiplicity = config[j].origin;

}

MVAComputer::~MVAComputer()
Expand All @@ -145,9 +145,8 @@ MVAComputer::~MVAComputer()

unsigned int MVAComputer::getVariableId(AtomicId name) const
{
std::vector<InputVar>::const_iterator pos =
std::lower_bound(inputVariables.begin(), inputVariables.end(),
name);

std::vector<InputVar>::const_iterator pos = std::lower_bound(inputVariables.begin(), inputVariables.end(), name);

if (pos == inputVariables.end() || pos->var.getName() != name)
throw cms::Exception("InvalidVariable")
Expand All @@ -160,6 +159,7 @@ unsigned int MVAComputer::getVariableId(AtomicId name) const
template<class T>
void MVAComputer::evalInternal(T &ctx) const
{

double *output = ctx.values() + ctx.n();
int *outConf = ctx.conf() + inputVariables.size();

Expand Down Expand Up @@ -187,9 +187,9 @@ void MVAComputer::evalInternal(T &ctx) const
? next->nOutput : 0;

#ifdef DEBUG_EVAL
std::string demangledName;
edm::typeDemangle(typeid(*iter->processor).name(), demangledName);
std::cout << demangledName << std::endl;
std::string demangledName;
edm::typeDemangle(typeid(*iter->processor).name(), demangledName);
std::cout << demangledName << std::endl;
#endif
if (status != VarProcessor::kSkip)
ctx.eval(&*iter->processor, outConf, output,
Expand Down
1 change: 1 addition & 0 deletions RecoBTag/SecondaryVertex/BuildFile.xml
Expand Up @@ -4,6 +4,7 @@
<use name="DataFormats/TrackReco"/>
<use name="DataFormats/VertexReco"/>
<use name="DataFormats/BTauReco"/>
<use name="DataFormats/PatCandidates"/>
<use name="rootmath"/>
<export>
<lib name="1"/>
Expand Down

0 comments on commit bf95dbd

Please sign in to comment.