1 #ifndef RecoBTag_IPProducer 2 #define RecoBTag_IPProducer 10 #include "boost/bind.hpp" 70 std::vector<reco::JTATagInfo> bases;
73 jetTracksAssociation->
begin();
74 it != jetTracksAssociation->
end(); it++, i++) {
86 token_cands(iC.consumes<
edm::
View<
reco::
Candidate> >(iConfig.getParameter<
edm::InputTag>(
"candidates"))),
maxDeltaR(iConfig.getParameter<double>(
"maxDeltaR")),
87 explicitJTA(iConfig.existsAs<bool>(
"explicitJTA") ? iConfig.getParameter<bool>(
"explicitJTA") :
false) {}
91 return m_map[it.
jet().
key()];
96 std::vector<reco::JetTagInfo> bases;
101 m_map.resize(jets->size());
105 it != jets->end(); it++, i++) {
110 for(
size_t j=0;j<it->numberOfDaughters();++j) {
111 if( it->daughterPtr(j)->bestTrack()!=0 && it->daughterPtr(j)->charge() !=0 ){
112 m_map[
i].push_back(it->daughterPtr(j));
118 for(
size_t j=0;j<cands->size();++j) {
119 if( (*cands)[j].bestTrack()!=0 && (*cands)[j].charge() !=0 && (*cands)[j].pt() > 0 &&
Geom::deltaR2((*cands)[j],(*jets)[i]) < maxDeltaR2 ){
120 m_map[
i].push_back(cands->ptrAt(j));
127 std::vector<std::vector<reco::CandidatePtr> >
m_map;
134 template <
class Container,
class Base,
class Helper>
137 typedef std::vector<reco::IPTagInfo<Container,Base> >
Product;
197 m_config(iConfig),m_helper(iConfig,consumesCollector())
217 if (m_computeGhostTrack)
218 produces<reco::TrackCollection>(
"ghostTracks");
230 template <
class Container,
class Base,
class Helper>
void 246 auto result = std::make_unique<Product>();
248 std::unique_ptr<reco::TrackCollection> ghostTracks;
251 ghostTracks = std::make_unique<reco::TrackCollection>();
259 if (primaryVertex->size() != 0) {
260 pv = &*primaryVertex->begin();
265 e(0, 0) = 0.0015 * 0.0015;
266 e(1, 1) = 0.0015 * 0.0015;
272 std::vector<Base> baseTagInfos =
m_helper.makeBaseVector(iEvent);
273 for(
typename std::vector<Base>::const_iterator it = baseTagInfos.begin(); it != baseTagInfos.end(); it++) {
279 for(
typename Container::const_iterator itTrack = tracks.begin();
280 itTrack != tracks.end(); ++itTrack)
282 jetMomentum += (*itTrack)->momentum();
286 std::vector<reco::TransientTrack> transientTracks;
288 for(
typename Container::const_iterator itTrack = tracks.begin();
289 itTrack != tracks.end(); ++itTrack) {
306 selectedTracks.push_back(*itTrack);
307 transientTracks.push_back(transientTrack);
311 GlobalVector direction(jetMomentum.x(), jetMomentum.y(), jetMomentum.z());
313 std::auto_ptr<reco::GhostTrack> ghostTrack;
339 ghostTrackRef =
reco::TrackRef(ghostTrackRefProd, ghostTracks->size());
340 ghostTracks->push_back(*ghostTrack);
344 double lambda = pred.
lambda(origin);
353 std::vector<float> prob2D, prob3D;
354 std::vector<reco::btag::TrackIPData> ipData;
356 for(
unsigned int ind = 0; ind < transientTracks.size(); ind++) {
367 transientTrack.
field());
374 if (ghostTrack.get()) {
375 const std::vector<reco::GhostTrackState> &states = ghostTrack->states();
376 std::vector<reco::GhostTrackState>::const_iterator
pos =
377 std::find_if(states.begin(), states.end(),
378 bind(std::equal_to<reco::TransientTrack>(),
382 if (pos != states.end() && pos->isValid()) {
402 ipData.push_back(trackIP);
407 prob3D.push_back(probability.first ? probability.second : -1.);
411 prob2D.push_back(probability.first ? probability.second : -1.);
416 *it, pvRef, direction, ghostTrackRef));
438 unsigned long long cacheId3D= re3D.cacheIdentifier();
464 desc.
add<
double>(
"maximumTransverseImpactParameter",0.2);
465 desc.
add<
int>(
"minimumNumberOfHits",8);
466 desc.
add<
double>(
"minimumTransverseMomentum",1.0);
468 desc.
add<
double>(
"maximumLongitudinalImpactParameter",17.0);
469 desc.
add<
bool>(
"computeGhostTrack",
true);
470 desc.
add<
double>(
"ghostTrackPriorDeltaR",0.03);
472 desc.
add<
bool>(
"jetDirectionUsingGhostTrack",
false);
473 desc.
add<
int>(
"minimumNumberOfPixelHits",2);
474 desc.
add<
bool>(
"jetDirectionUsingTracks",
false);
475 desc.
add<
bool>(
"computeProbabilities",
true);
476 desc.
add<
bool>(
"useTrackQuality",
false);
477 desc.
add<
double>(
"maximumChiSquared",5.0);
485 desc.
add<
double>(
"maximumTransverseImpactParameter",0.2);
486 desc.
add<
int>(
"minimumNumberOfHits",8);
487 desc.
add<
double>(
"minimumTransverseMomentum",1.0);
489 desc.
add<
double>(
"maximumLongitudinalImpactParameter",17.0);
490 desc.
add<
bool>(
"computeGhostTrack",
true);
491 desc.
add<
double>(
"maxDeltaR",0.4);
493 desc.
add<
bool>(
"jetDirectionUsingGhostTrack",
false);
494 desc.
add<
int>(
"minimumNumberOfPixelHits",2);
495 desc.
add<
bool>(
"jetDirectionUsingTracks",
false);
496 desc.
add<
bool>(
"computeProbabilities",
true);
497 desc.
add<
bool>(
"useTrackQuality",
false);
499 desc.
add<
double>(
"ghostTrackPriorDeltaR",0.03);
500 desc.
add<
double>(
"maximumChiSquared",5.0);
virtual Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const
reco::Vertex::Point convertPos(const GlobalPoint &p)
T getParameter(std::string const &) const
unsigned long long cacheIdentifier() const
double m_cutMaxChiSquared
std::vector< reco::JTATagInfo > makeBaseVector(const edm::Event &iEvent)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
bool m_directionWithGhostTrack
virtual edm::RefToBase< Jet > jet(void) const
returns a polymorphic reference to the tagged jet
double lambda(const GlobalPoint &point) const
transient_vector_type::const_iterator const_iterator
unsigned long long m_calibrationCacheId3D
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
const TransientTrack & track() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int numberOfValidHits() const
JetTracksAssociation::Container JetTracksAssociationCollection
typedefs for backward compatibility
FromJetAndCands(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC, const std::string &jets="jets")
unsigned long long m_calibrationCacheId2D
reco::Vertex::Error convertError(const GlobalError &ge)
std::vector< Track > TrackCollection
collection of Tracks
reco::TransientTrack build(const reco::Track *p) const
const_iterator end() const
math::Error< dimension >::type Error
covariance error matrix (3x3)
GlobalPoint globalPosition() const
const MagneticField * field() const
std::auto_ptr< HistogramProbabilityEstimator > m_probabilityEstimator
const reco::Track * toTrack(const reco::TrackBaseRef &t)
const Point & position() const
position
std::vector< reco::IPTagInfo< Container, Base > > Product
double m_ghostTrackPriorDeltaR
GhostTrack fit(const GlobalPoint &priorPosition, const GlobalError &priorError, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
std::vector< std::vector< reco::CandidatePtr > > m_map
virtual TrackRefVector tracks(void) const
returns a list of tracks associated to the jet
void checkEventSetup(const edm::EventSetup &iSetup)
const std::vector< reco::CandidatePtr > & tracks(const reco::JetTagInfo &it)
Container::value_type value_type
void addDefault(ParameterSetDescription const &psetDescription)
Measurement1D distanceToGhostTrack
FromJTA(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
double pt() const
track transverse momentum
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
reco::TrackRefVector tracks(const reco::JTATagInfo &it)
math::XYZPoint Point
point in the space
unsigned short numberOfValidHits() const
number of valid hits found
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< reco::JetTracksAssociationCollection > token_associator
bool m_directionWithTracks
RefProd< PROD > getRefBeforePut()
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
const edm::ParameterSet & m_config
GlobalPoint closestToJetAxis
const Track & track() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
Error error() const
return SMatrix
Measurement1D distanceToJetAxis
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
const Vector & prediction() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void produce(edm::Event &, const edm::EventSetup &)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
IPProducer(const edm::ParameterSet &)
GlobalPoint position(double lambda=0.) const
GlobalPoint closestToGhostTrack
edm::EDGetTokenT< edm::View< reco::Candidate > > token_cands
std::vector< reco::JetTagInfo > makeBaseVector(const edm::Event &iEvent)
int numberOfValidPixelHits() const
TrajectoryStateOnSurface impactPointState() const
bool m_computeProbabilities
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
const_iterator begin() const
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
T const * product() const
GlobalError positionError(double lambda=0.) const
const GlobalVector direction() const