1 #ifndef RecoBTag_IPProducer
2 #define RecoBTag_IPProducer
10 #include "boost/bind.hpp"
68 std::vector<reco::JTATagInfo> bases;
71 it != jetTracksAssociation->
end();
86 maxDeltaR(iConfig.getParameter<double>(
"maxDeltaR")),
93 std::vector<reco::JetTagInfo> bases;
105 for (
size_t j = 0;
j < it->numberOfDaughters(); ++
j) {
106 if (it->daughterPtr(
j)->bestTrack() !=
nullptr && it->daughterPtr(
j)->charge() != 0) {
107 m_map[
i].push_back(it->daughterPtr(
j));
111 for (
size_t j = 0;
j <
cands->size(); ++
j) {
112 if ((*
cands)[
j].bestTrack() !=
nullptr && (*cands)[
j].charge() != 0 && (*cands)[
j].pt() > 0 &&
121 std::vector<std::vector<reco::CandidatePtr> >
m_map;
128 template <
class Container,
class Base,
class Helper>
131 typedef std::vector<reco::IPTagInfo<Container, Base> >
Product;
186 template <
class Container,
class Base,
class Helper>
188 : m_config(iConfig), m_helper(iConfig, consumesCollector()) {
208 produces<reco::TrackCollection>(
"ghostTracks");
212 template <
class Container,
class Base,
class Helper>
219 template <
class Container,
class Base,
class Helper>
222 if (m_computeProbabilities)
223 checkEventSetup(iSetup);
233 auto result = std::make_unique<Product>();
235 std::unique_ptr<reco::TrackCollection> ghostTracks;
237 if (m_computeGhostTrack) {
238 ghostTracks = std::make_unique<reco::TrackCollection>();
252 e(0, 0) = 0.0015 * 0.0015;
253 e(1, 1) = 0.0015 * 0.0015;
259 std::vector<Base> baseTagInfos = m_helper.makeBaseVector(
iEvent);
260 for (
typename std::vector<Base>::const_iterator it = baseTagInfos.begin(); it != baseTagInfos.end(); it++) {
264 if (m_directionWithTracks) {
266 for (
typename Container::const_iterator itTrack =
tracks.begin(); itTrack !=
tracks.end(); ++itTrack)
268 jetMomentum += (*itTrack)->momentum();
272 std::vector<reco::TransientTrack> transientTracks;
274 for (
typename Container::const_iterator itTrack =
tracks.begin(); itTrack !=
tracks.end(); ++itTrack) {
284 if (
track.pt() > m_cutMinPt &&
285 track.hitPattern().numberOfValidHits() >= m_cutTotalHits &&
286 track.hitPattern().numberOfValidPixelHits() >= m_cutPixelHits &&
287 track.normalizedChi2() < m_cutMaxChiSquared &&
std::abs(
track.dxy(
pv->position())) < m_cutMaxTIP &&
291 transientTracks.push_back(transientTrack);
295 GlobalVector direction(jetMomentum.x(), jetMomentum.y(), jetMomentum.z());
297 std::unique_ptr<reco::GhostTrack> ghostTrack;
299 if (m_computeGhostTrack) {
322 ghostTrackRef =
reco::TrackRef(ghostTrackRefProd, ghostTracks->size());
323 ghostTracks->push_back(*ghostTrack);
325 if (m_directionWithGhostTrack) {
327 double lambda = pred.
lambda(origin);
338 std::vector<float> prob2D, prob3D;
339 std::vector<reco::btag::TrackIPData> ipData;
341 for (
unsigned int ind = 0; ind < transientTracks.size(); ind++) {
357 if (ghostTrack.get()) {
358 const std::vector<reco::GhostTrackState>& states = ghostTrack->states();
359 std::vector<reco::GhostTrackState>::const_iterator
pos = std::find_if(
364 if (
pos != states.end() &&
pos->isValid()) {
383 ipData.push_back(trackIP);
385 if (m_computeProbabilities) {
387 std::pair<bool, double> probability = m_probabilityEstimator->probability(
388 m_useTrackQuality, 0, ipData.back().ip3d.significance(),
track, *(it->jet()), *
pv);
389 prob3D.push_back(probability.first ? probability.second : -1.);
392 probability = m_probabilityEstimator->probability(
393 m_useTrackQuality, 1, ipData.back().ip2d.significance(),
track, *(it->jet()), *
pv);
394 prob2D.push_back(probability.first ? probability.second : -1.);
402 if (m_computeGhostTrack)
414 template <
class Container,
class Base,
class Helper>
419 unsigned long long cacheId3D = re3D.cacheIdentifier();
421 if (cacheId2D != m_calibrationCacheId2D || cacheId3D != m_calibrationCacheId3D)
434 m_calibrationCacheId3D = cacheId3D;
435 m_calibrationCacheId2D = cacheId2D;
444 desc.
add<
double>(
"maximumTransverseImpactParameter", 0.2);
445 desc.
add<
int>(
"minimumNumberOfHits", 8);
446 desc.
add<
double>(
"minimumTransverseMomentum", 1.0);
448 desc.
add<
double>(
"maximumLongitudinalImpactParameter", 17.0);
449 desc.
add<
bool>(
"computeGhostTrack",
true);
450 desc.
add<
double>(
"ghostTrackPriorDeltaR", 0.03);
452 desc.
add<
bool>(
"jetDirectionUsingGhostTrack",
false);
453 desc.
add<
int>(
"minimumNumberOfPixelHits", 2);
454 desc.
add<
bool>(
"jetDirectionUsingTracks",
false);
455 desc.
add<
bool>(
"computeProbabilities",
true);
456 desc.
add<
bool>(
"useTrackQuality",
false);
457 desc.
add<
double>(
"maximumChiSquared", 5.0);
465 desc.
add<
double>(
"maximumTransverseImpactParameter", 0.2);
466 desc.
add<
int>(
"minimumNumberOfHits", 8);
467 desc.
add<
double>(
"minimumTransverseMomentum", 1.0);
469 desc.
add<
double>(
"maximumLongitudinalImpactParameter", 17.0);
470 desc.
add<
bool>(
"computeGhostTrack",
true);
471 desc.
add<
double>(
"maxDeltaR", 0.4);
473 desc.
add<
bool>(
"jetDirectionUsingGhostTrack",
false);
474 desc.
add<
int>(
"minimumNumberOfPixelHits", 2);
475 desc.
add<
bool>(
"jetDirectionUsingTracks",
false);
476 desc.
add<
bool>(
"computeProbabilities",
true);
477 desc.
add<
bool>(
"useTrackQuality",
false);
479 desc.
add<
double>(
"ghostTrackPriorDeltaR", 0.03);
480 desc.
add<
double>(
"maximumChiSquared", 5.0);