1 #ifndef ImpactParameter_TemplatedJetBProbabilityComputer_h
2 #define ImpactParameter_TemplatedJetBProbabilityComputer_h
8 #include "Math/GenVector/VectorUtil.h"
13 template <
class Container,
class Base>
35 if (trackQualityType ==
"any" || trackQualityType ==
"Any" || trackQualityType ==
"ANY")
66 std::vector<float> probabilities;
67 std::vector<float> probabilitiesB;
69 for (std::vector<float>::const_iterator it = allProbabilities.begin(); it != allProbabilities.end(); ++it, i++) {
70 if (fabs(impactParameters[i].distanceToJetAxis.value()) < m_cutMaxDistToAxis &&
71 (impactParameters[i].closestToJetAxis -
pv).mag() < m_cutMaxDecayLen &&
79 if (m_trackSign > 0 || *it < 0)
80 probabilities.push_back(p);
81 if (m_trackSign > 0 && *it >= 0) {
82 probabilitiesB.push_back(*it);
84 if (m_trackSign < 0 && *it <= 0) {
85 probabilitiesB.push_back(-*it);
88 }
else if (m_deltaR < 0 ||
91 if (m_trackSign > 0 || *it < 0)
92 probabilities.push_back(p);
94 if (m_trackSign > 0 && *it >= 0) {
95 probabilitiesB.push_back(*it);
97 if (m_trackSign < 0 && *it <= 0) {
98 probabilitiesB.push_back(-*it);
105 std::sort(probabilitiesB.begin(), probabilitiesB.end());
107 probabilitiesB.resize(m_nbTracks);
110 return -
log(b) / 4 -
log(all) / 4;
114 int ngoodtracks = v.size();
117 for (std::vector<float>::const_iterator
q = v.begin();
q != v.end();
q++) {
122 double Loginvlog = 0;
125 if (ngoodtracks >= 2) {
126 Loginvlog =
log(-SumJet);
130 for (
int l = 1;
l != ngoodtracks;
l++) {
132 Prob +=
exp(
l * Loginvlog -
log(1. * lfact));
134 double LogProb =
log(Prob);
140 std::cout <<
"ProbJet too high: " << ProbJet << std::endl;
161 #endif // ImpactParameter_TemplatedJetBProbabilityComputer_h
const std::vector< float > & probabilities(int ip) const
static std::vector< std::string > checklist log
double jetProbability(const std::vector< float > &v) const
const T & get(unsigned int index=0) const
std::vector< bool > variableJTA(const btag::variableJTAParameters ¶ms) const
reco::IPTagInfo< Container, Base > TagInfo
TrackQuality
track quality
TemplatedJetBProbabilityComputer(const edm::ParameterSet ¶meters)
const Container & selectedTracks() const
auto const & tracks
cannot be loose
Exp< T >::type exp(const T &t)
const reco::Track * toTrack(const reco::TrackBaseRef &t)
const edm::Ref< VertexCollection > & primaryVertex() const
float discriminator(const TagInfoHelper &ti) const override
reco::btag::variableJTAParameters varJTApars
double m_cutMaxDistToAxis
void uses(unsigned int id, const std::string &label)
bool isNull() const
Checks for null.
const std::vector< btag::TrackIPData > & impactParameterData() const
static TrackQuality qualityByName(const std::string &name)
T getParameter(std::string const &) const
bool quality(const TrackQuality) const
Track quality.
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
reco::TrackBase::TrackQuality m_trackQuality