10 #include <boost/iterator/transform_iterator.hpp> 55 #include "fastjet/JetDefinition.hh" 56 #include "fastjet/ClusterSequence.hh" 57 #include "fastjet/PseudoJet.hh" 63 typedef boost::shared_ptr<fastjet::JetDefinition>
JetDefPtr;
69 class VertexInfo :
public fastjet::PseudoJet::UserInfoBase{
72 m_vertexIndex(vertexIndex) { }
74 inline const int vertexIndex()
const {
return m_vertexIndex; }
81 struct RefToBaseLess {
85 return r1.
id() < r2.
id() ||
103 template <
class IPTI,
class VTX>
109 typedef std::vector<TemplatedSecondaryVertexTagInfo<IPTI,VTX> >
Product;
117 template<
class CONTAINER>
119 const std::vector<fastjet::PseudoJet>& matchedJets,
120 std::vector<int>& matchedIndices,
124 std::vector<int>& matchedIndices);
125 void matchSubjets(
const std::vector<int>& groomedIndices,
128 std::vector<std::vector<int> >& matchedIndices);
131 std::vector<std::vector<int> >& matchedIndices);
142 CONSTRAINT_PV_PRIMARIES_IN_FIT
176 void markUsedTracks(TrackDataVector & trackData,
const input_container & trackRefs,
const SecondaryVertex &
sv,
size_t idx);
183 double minTrackWeight) :
184 pv(pv), direction(direction),
185 withPVError(withPVError),
186 minTrackWeight(minTrackWeight) {}
189 SecondaryVertex operator () (
const VTX &sv)
const 203 filter(filter), pv(pv), direction(direction) {}
205 inline bool operator () (
const SecondaryVertex &
sv)
const 206 {
return !
filter(
pv, sv, direction); }
213 template <
class IPTI,
class VTX>
218 return CONSTRAINT_NONE;
219 else if (name ==
"BeamSpot")
220 return CONSTRAINT_BEAMSPOT;
221 else if (name ==
"BeamSpot+PVPosition")
222 return CONSTRAINT_PV_BEAMSPOT_SIZE;
223 else if (name ==
"BeamSpotZ+PVErrorScaledXY")
224 return CONSTRAINT_PV_BS_Z_ERRORS_SCALED;
225 else if (name ==
"PVErrorScaled")
226 return CONSTRAINT_PV_ERROR_SCALED;
227 else if (name ==
"BeamSpot+PVTracksInFit")
228 return CONSTRAINT_PV_PRIMARIES_IN_FIT;
231 <<
"TemplatedSecondaryVertexProducer: ``constraint'' parameter " 232 "value \"" << name <<
"\" not understood." 239 if (name ==
"AlwaysWithGhostTrack")
241 else if (name ==
"SingleTracksWithGhostTrack")
243 else if (name ==
"RefitGhostTrackWithVertices")
247 <<
"TemplatedSecondaryVertexProducer: ``fitType'' " 248 "parameter value \"" << name <<
"\" for " 249 "GhostTrackVertexFinder settings not " 250 "understood." << std::endl;
253 template <
class IPTI,
class VTX>
257 trackSelector(params.getParameter<
edm::
ParameterSet>(
"trackSelection")),
259 constraintScaling(1.0),
261 useGhostTrack(vtxRecoPSet.getParameter<
std::
string>(
"finder") ==
"gtvr"),
262 withPVError(params.getParameter<
bool>(
"usePVError")),
263 minTrackWeight(params.getParameter<double>(
"minimumTrackWeight")),
265 vertexSorting(params.getParameter<
edm::
ParameterSet>(
"vertexSelection"))
287 if( useSVClustering )
303 throw cms::Exception(
"InvalidJetAlgorithm") <<
"Jet clustering algorithm is invalid: " <<
jetAlgorithm <<
", use CambridgeAachen | Kt | AntiKt" << std::endl;
314 template <
class IPTI,
class VTX>
319 template <
class IPTI,
class VTX>
326 typedef std::map<const Track *, TransientTrack> TransientTrackMap;
350 if( groomedFatJetsHandle->size() > fatJetsHandle->size() )
351 edm::LogError(
"TooManyGroomedJets") <<
"There are more groomed (" << groomedFatJetsHandle->size() <<
") than original fat jets (" << fatJetsHandle->size() <<
"). Please check that the two jet collections belong to each other.";
356 unsigned int bsCovSrc[7] = { 0, };
357 double sigmaZ = 0.0, beamWidth = 0.0;
361 bsCovSrc[3] = bsCovSrc[4] = bsCovSrc[5] = bsCovSrc[6] = 1;
362 sigmaZ = beamSpot->
sigmaZ();
368 bsCovSrc[0] = bsCovSrc[1] = 2;
369 bsCovSrc[3] = bsCovSrc[4] = bsCovSrc[5] = 1;
370 sigmaZ = beamSpot->
sigmaZ();
374 bsCovSrc[0] = bsCovSrc[1] = bsCovSrc[2] = 2;
387 std::vector<std::vector<int> > clusteredSVs(trackIPTagInfos->size(),std::vector<int>());
391 std::vector<fastjet::PseudoJet> fjInputs;
397 std::vector<edm::Ptr<reco::Candidate> > constituents = it->getJetConstituents();
398 std::vector<edm::Ptr<reco::Candidate> >::const_iterator
m;
399 for( m = constituents.begin(); m != constituents.end(); ++
m )
402 if(constit->
pt() == 0)
404 edm::LogWarning(
"NullTransverseMomentum") <<
"dropping input candidate with pt=0";
407 fjInputs.push_back(fastjet::PseudoJet(constit->
px(),constit->
py(),constit->
pz(),constit->
energy()));
413 for(
typename std::vector<IPTI>::const_iterator it = trackIPTagInfos->begin(); it != trackIPTagInfos->end(); ++it)
415 std::vector<edm::Ptr<reco::Candidate> > constituents = it->jet()->getJetConstituents();
416 std::vector<edm::Ptr<reco::Candidate> >::const_iterator
m;
417 for( m = constituents.begin(); m != constituents.end(); ++
m )
420 if(constit->
pt() == 0)
422 edm::LogWarning(
"NullTransverseMomentum") <<
"dropping input candidate with pt=0";
425 fjInputs.push_back(fastjet::PseudoJet(constit->
px(),constit->
py(),constit->
pz(),constit->
energy()));
432 const reco::Vertex &
pv = *(trackIPTagInfos->front().primaryVertex());
435 fastjet::PseudoJet
p(dir.
x(),dir.
y(),dir.
z(),dir.
mag());
437 p = fastjet::PseudoJet(it->p4().px(),it->p4().py(),it->p4().pz(),it->p4().energy());
439 p.set_user_info(
new VertexInfo( it - extSecVertex->begin() ));
440 fjInputs.push_back(p);
446 std::vector<fastjet::PseudoJet> inclusiveJets = fastjet::sorted_by_pt(
fjClusterSeq->inclusive_jets(
jetPtMin) );
450 if( inclusiveJets.size() < fatJetsHandle->size() )
451 edm::LogError(
"TooFewReclusteredJets") <<
"There are fewer reclustered (" << inclusiveJets.size() <<
") than original fat jets (" << fatJetsHandle->size() <<
"). Please check that the jet algorithm and jet size match those used for the original jet collection.";
454 std::vector<int> reclusteredIndices;
455 matchReclusteredJets<edm::View<reco::Jet> >(fatJetsHandle,inclusiveJets,reclusteredIndices,
"fat");
458 std::vector<int> groomedIndices;
463 std::vector<std::vector<int> > subjetIndices;
465 matchSubjets(groomedIndices,groomedFatJetsHandle,trackIPTagInfos,subjetIndices);
467 matchSubjets(fatJetsHandle,trackIPTagInfos,subjetIndices);
470 for(
size_t i=0;
i<fatJetsHandle->size(); ++
i)
472 if( reclusteredIndices.at(
i) < 0 )
continue;
474 if( fatJetsHandle->at(
i).pt() == 0 )
476 edm::LogWarning(
"NullTransverseMomentum") <<
"The original fat jet " <<
i <<
" has Pt=0. This is not expected so the jet will be skipped.";
480 if( subjetIndices.at(
i).empty() )
continue;
483 if( (
std::abs( inclusiveJets.at(reclusteredIndices.at(
i)).
pt() - fatJetsHandle->at(
i).pt() ) / fatJetsHandle->at(
i).pt() ) >
relPtTolerance )
485 if( fatJetsHandle->at(
i).pt() < 10. )
486 edm::LogWarning(
"JetPtMismatchAtLowPt") <<
"The reclustered and original fat jet " <<
i <<
" have different Pt's (" << inclusiveJets.at(reclusteredIndices.at(
i)).
pt() <<
" vs " << fatJetsHandle->at(
i).pt() <<
" GeV, respectively).\n" 487 <<
"Please check that the jet algorithm and jet size match those used for the original fat jet collection and also make sure the original fat jets are uncorrected. In addition, make sure you are not using CaloJets which are presently not supported.\n" 488 <<
"Since the mismatch is at low Pt, it is ignored and only a warning is issued.\n" 489 <<
"\nIn extremely rare instances the mismatch could be caused by a difference in the machine precision in which case make sure the original jet collection is produced and reclustering is performed in the same job.";
491 edm::LogError(
"JetPtMismatch") <<
"The reclustered and original fat jet " <<
i <<
" have different Pt's (" << inclusiveJets.at(reclusteredIndices.at(
i)).
pt() <<
" vs " << fatJetsHandle->at(
i).pt() <<
" GeV, respectively).\n" 492 <<
"Please check that the jet algorithm and jet size match those used for the original fat jet collection and also make sure the original fat jets are uncorrected. In addition, make sure you are not using CaloJets which are presently not supported.\n" 493 <<
"\nIn extremely rare instances the mismatch could be caused by a difference in the machine precision in which case make sure the original jet collection is produced and reclustering is performed in the same job.";
497 std::vector<fastjet::PseudoJet> constituents = inclusiveJets.at(reclusteredIndices.at(
i)).constituents();
499 std::vector<int> svIndices;
501 for(std::vector<fastjet::PseudoJet>::const_iterator it = constituents.begin(); it != constituents.end(); ++it)
503 if( !it->has_user_info() )
continue;
505 svIndices.push_back( it->user_info<VertexInfo>().vertexIndex() );
509 for(
size_t sv=0;
sv<svIndices.size(); ++
sv)
511 const reco::Vertex &
pv = *(trackIPTagInfos->front().primaryVertex());
512 const VTX &extSV = (*extSecVertex)[ svIndices.at(
sv) ];
515 fastjet::PseudoJet
p(dir.
x(),dir.
y(),dir.
z(),dir.
mag());
517 p = fastjet::PseudoJet(extSV.p4().px(),extSV.p4().py(),extSV.p4().pz(),extSV.p4().energy());
519 std::vector<double> dR2toSubjets;
521 for(
size_t sj=0; sj<subjetIndices.at(
i).size(); ++sj)
522 dR2toSubjets.push_back(
Geom::deltaR2(
p.rapidity(),
p.phi_std(), trackIPTagInfos->at(subjetIndices.at(
i).at(sj)).
jet()->rapidity(), trackIPTagInfos->at(subjetIndices.at(
i).at(sj)).
jet()->phi() ) );
525 int closestSubjetIdx =
std::distance( dR2toSubjets.begin(), std::min_element(dR2toSubjets.begin(), dR2toSubjets.end()) );
527 clusteredSVs.at(subjetIndices.at(
i).at(closestSubjetIdx)).push_back( svIndices.at(
sv) );
533 if( inclusiveJets.size() < trackIPTagInfos->size() )
534 edm::LogError(
"TooFewReclusteredJets") <<
"There are fewer reclustered (" << inclusiveJets.size() <<
") than original jets (" << trackIPTagInfos->size() <<
"). Please check that the jet algorithm and jet size match those used for the original jet collection.";
537 std::vector<int> reclusteredIndices;
538 matchReclusteredJets<std::vector<IPTI> >(
trackIPTagInfos,inclusiveJets,reclusteredIndices);
541 for(
size_t i=0;
i<trackIPTagInfos->size(); ++
i)
543 if( reclusteredIndices.at(
i) < 0 )
continue;
545 if( trackIPTagInfos->at(
i).jet()->pt() == 0 )
547 edm::LogWarning(
"NullTransverseMomentum") <<
"The original jet " <<
i <<
" has Pt=0. This is not expected so the jet will be skipped.";
552 if( (
std::abs( inclusiveJets.at(reclusteredIndices.at(
i)).
pt() - trackIPTagInfos->at(
i).jet()->pt() ) / trackIPTagInfos->at(
i).jet()->pt() ) >
relPtTolerance )
554 if( trackIPTagInfos->at(
i).jet()->pt() < 10. )
555 edm::LogWarning(
"JetPtMismatchAtLowPt") <<
"The reclustered and original jet " <<
i <<
" have different Pt's (" << inclusiveJets.at(reclusteredIndices.at(
i)).
pt() <<
" vs " << trackIPTagInfos->at(
i).jet()->pt() <<
" GeV, respectively).\n" 556 <<
"Please check that the jet algorithm and jet size match those used for the original jet collection and also make sure the original jets are uncorrected. In addition, make sure you are not using CaloJets which are presently not supported.\n" 557 <<
"Since the mismatch is at low Pt, it is ignored and only a warning is issued.\n" 558 <<
"\nIn extremely rare instances the mismatch could be caused by a difference in the machine precision in which case make sure the original jet collection is produced and reclustering is performed in the same job.";
560 edm::LogError(
"JetPtMismatch") <<
"The reclustered and original jet " <<
i <<
" have different Pt's (" << inclusiveJets.at(reclusteredIndices.at(
i)).
pt() <<
" vs " << trackIPTagInfos->at(
i).jet()->pt() <<
" GeV, respectively).\n" 561 <<
"Please check that the jet algorithm and jet size match those used for the original jet collection and also make sure the original jets are uncorrected. In addition, make sure you are not using CaloJets which are presently not supported.\n" 562 <<
"\nIn extremely rare instances the mismatch could be caused by a difference in the machine precision in which case make sure the original jet collection is produced and reclustering is performed in the same job.";
566 std::vector<fastjet::PseudoJet> constituents = inclusiveJets.at(reclusteredIndices.at(
i)).constituents();
569 for(std::vector<fastjet::PseudoJet>::const_iterator it = constituents.begin(); it != constituents.end(); ++it)
571 if( !it->has_user_info() )
continue;
573 clusteredSVs.at(
i).push_back( it->user_info<VertexInfo>().vertexIndex() );
582 std::vector<int> groomedIndices;
587 std::vector<std::vector<int> > subjetIndices;
589 matchSubjets(groomedIndices,groomedFatJetsHandle,trackIPTagInfos,subjetIndices);
591 matchSubjets(fatJetsHandle,trackIPTagInfos,subjetIndices);
594 for(
size_t i=0;
i<fatJetsHandle->size(); ++
i)
596 if( fatJetsHandle->at(
i).pt() == 0 )
598 edm::LogWarning(
"NullTransverseMomentum") <<
"The original fat jet " <<
i <<
" has Pt=0. This is not expected so the jet will be skipped.";
602 if( subjetIndices.at(
i).empty() )
continue;
608 size_t sv = ( it - extSecVertex->begin() );
610 const reco::Vertex &
pv = *(trackIPTagInfos->front().primaryVertex());
611 const VTX &extSV = (*extSecVertex)[
sv];
614 fatJetsHandle->at(
i).py(),
615 fatJetsHandle->at(
i).pz());
621 fastjet::PseudoJet
p(dir.
x(),dir.
y(),dir.
z(),dir.
mag());
623 p = fastjet::PseudoJet(extSV.p4().px(),extSV.p4().py(),extSV.p4().pz(),extSV.p4().energy());
625 std::vector<double> dR2toSubjets;
627 for(
size_t sj=0; sj<subjetIndices.at(
i).size(); ++sj)
628 dR2toSubjets.push_back(
Geom::deltaR2(
p.rapidity(),
p.phi_std(), trackIPTagInfos->at(subjetIndices.at(
i).at(sj)).
jet()->rapidity(), trackIPTagInfos->at(subjetIndices.at(
i).at(sj)).
jet()->phi() ) );
631 int closestSubjetIdx =
std::distance( dR2toSubjets.begin(), std::min_element(dR2toSubjets.begin(), dR2toSubjets.end()) );
633 clusteredSVs.at(subjetIndices.at(
i).at(closestSubjetIdx)).push_back(sv);
639 std::unique_ptr<ConfigurableVertexReconstructor>
vertexReco;
640 std::unique_ptr<GhostTrackVertexFinder> vertexRecoGT;
652 TransientTrackMap primariesMap;
656 auto tagInfos = std::make_unique<Product>();
658 for(
typename std::vector<IPTI>::const_iterator iterJets =
659 trackIPTagInfos->begin(); iterJets != trackIPTagInfos->end();
664 const Vertex &
pv = *iterJets->primaryVertex();
666 std::set<TransientTrack> primaries;
670 TransientTrackMap::iterator
pos =
671 primariesMap.lower_bound(iter->get());
673 if (pos != primariesMap.end() &&
674 pos->first == iter->get())
675 primaries.insert(pos->second);
680 primariesMap.insert(pos,
681 std::make_pair(iter->get(),
track));
682 primaries.insert(track);
690 jetRef->momentum().y(),
691 jetRef->momentum().z());
693 std::vector<std::size_t> indices =
698 const std::vector<reco::btag::TrackIPData> &ipData =
699 iterJets->impactParameterData();
703 std::vector<TransientTrack> fitTracks;
704 std::vector<GhostTrackState> gtStates;
705 std::unique_ptr<GhostTrackPrediction> gtPred;
708 *iterJets->ghostTrack()));
710 for(
unsigned int i = 0;
i < indices.size();
i++) {
716 trackData.back().first = indices[
i];
723 trackData.back().second.svStatus =
728 TransientTrackMap::const_iterator
pos =
731 if (pos != primariesMap.end()) {
732 primaries.erase(pos->second);
733 fitTrack = pos->second;
735 fitTrack = trackBuilder->
build(trackRef);
736 fitTracks.push_back(fitTrack);
738 trackData.back().second.svStatus =
744 ipData[indices[
i]].closestToGhostTrack;
746 gtPred->lambda(pos));
747 gtState.
setWeight(ipData[indices[i]].ghostTrackWeight);
748 gtStates.push_back(gtState);
752 std::unique_ptr<GhostTrack> ghostTrack;
759 iterJets->ghostTrack()->px(),
760 iterJets->ghostTrack()->py(),
761 iterJets->ghostTrack()->pz()),
764 iterJets->ghostTrack()->chi2(),
765 iterJets->ghostTrack()->ndof()));
770 std::vector<VTX> extAssoCollection;
771 std::vector<TransientVertex> fittedSVs;
772 std::vector<SecondaryVertex> SVs;
777 fittedSVs = vertexRecoGT->vertices(
780 fittedSVs = vertexReco->vertices(fitTracks);
785 fittedSVs = vertexRecoGT->vertices(
786 pv, *beamSpot, *ghostTrack);
788 fittedSVs = vertexReco->vertices(fitTracks,
796 for(
unsigned int i = 0;
i < 7;
i++) {
797 unsigned int covSrc = bsCovSrc[
i];
798 for(
unsigned int j = 0; j < 7; j++) {
800 if (!covSrc || bsCovSrc[j] != covSrc)
802 else if (covSrc == 1)
817 fittedSVs = vertexRecoGT->vertices(
818 pv, bs, *ghostTrack);
820 fittedSVs = vertexReco->vertices(fitTracks, bs);
824 std::vector<TransientTrack> primaries_(
825 primaries.begin(), primaries.end());
827 fittedSVs = vertexRecoGT->vertices(
828 pv, *beamSpot, primaries_,
831 fittedSVs = vertexReco->vertices(
832 primaries_, fitTracks,
838 std::remove_copy_if(boost::make_transform_iterator(
839 fittedSVs.begin(), svBuilder),
840 boost::make_transform_iterator(
841 fittedSVs.end(), svBuilder),
842 std::back_inserter(SVs),
847 size_t jetIdx = ( iterJets - trackIPTagInfos->begin() );
849 for(
size_t iExtSv = 0; iExtSv < clusteredSVs.at(jetIdx).size(); iExtSv++){
850 const VTX & extVertex = (*extSecVertex)[ clusteredSVs.at(jetIdx).at(iExtSv) ];
851 if( extVertex.p4().M() < 0.3 )
853 extAssoCollection.push_back( extVertex );
857 for(
size_t iExtSv = 0; iExtSv < extSecVertex->size(); iExtSv++){
858 const VTX & extVertex = (*extSecVertex)[iExtSv];
861 extAssoCollection.push_back( extVertex );
867 std::remove_copy_if(boost::make_transform_iterator( extAssoCollection.begin(), svBuilder),
868 boost::make_transform_iterator(extAssoCollection.end(), svBuilder),
869 std::back_inserter(SVs),
878 extAssoCollection.clear();
884 std::vector<typename TemplatedSecondaryVertexTagInfo<IPTI,VTX>::VertexData> svData;
886 svData.resize(vtxIndices.size());
887 for(
unsigned int idx = 0;
idx < vtxIndices.size();
idx++) {
890 svData[
idx].vertex =
sv;
903 trackData, svData, SVs.size(),
905 iterJets - trackIPTagInfos->begin())));
919 typename input_container::const_iterator
pos =
920 std::find(trackRefs.begin(), trackRefs.end(),
923 if (pos == trackRefs.end() ) {
926 <<
"Could not find track from secondary " 927 "vertex in original tracks." 930 unsigned int index = pos - trackRefs.begin();
931 trackData[
index].second.svStatus =
933 ((
unsigned int)btag::TrackData::trackAssociatedToVertex +
idx);
940 for(
typename input_container::const_iterator iter = sv.daughterPtrVector().begin(); iter != sv.daughterPtrVector().end(); ++iter)
942 typename input_container::const_iterator
pos =
943 std::find(trackRefs.begin(), trackRefs.end(), *iter);
945 if (pos != trackRefs.end() )
947 unsigned int index = pos - trackRefs.begin();
948 trackData[
index].second.svStatus =
950 ((
unsigned int)btag::TrackData::trackAssociatedToVertex +
idx);
964 edm::LogError(
"UnexpectedInputs") <<
"Building from Candidates, should not happen!";
975 edm::LogError(
"UnexpectedInputs") <<
"Building from Tracks, should not happen!";
1000 edm::LogError(
"DynamicCastingFailed") <<
"Casting of TransientTrack to CandidatePtrTransientTrack failed!";
1007 vtxCompPtrCand.
setP4(p4);
1014 template<
class IPTI,
class VTX>
1015 template<
class CONTAINER>
1017 const std::vector<fastjet::PseudoJet>& reclusteredJets,
1018 std::vector<int>& matchedIndices,
1023 std::vector<bool> matchedLocks(reclusteredJets.size(),
false);
1025 for(
size_t j=0; j<jets->size(); ++j)
1027 double matchedDR2 = 1e9;
1028 int matchedIdx = -1;
1030 for(
size_t rj=0; rj<reclusteredJets.size(); ++rj)
1032 if( matchedLocks.at(rj) )
continue;
1034 double tempDR2 =
Geom::deltaR2(
toJet(jets->at(j))->rapidity(),
toJet(jets->at(j))->
phi(), reclusteredJets.at(rj).rapidity(), reclusteredJets.at(rj).phi_std() );
1035 if( tempDR2 < matchedDR2 )
1037 matchedDR2 = tempDR2;
1046 edm::LogError(
"JetMatchingFailed") <<
"Matched reclustered jet " << matchedIdx <<
" and original " << type <<
"jet " << j <<
" are separated by dR=" <<
sqrt(matchedDR2) <<
" which is greater than the jet size R=" << rParam <<
".\n" 1047 <<
"This is not expected so please check that the jet algorithm and jet size match those used for the original " << type <<
"jet collection.";
1050 matchedLocks.at(matchedIdx) =
true;
1053 edm::LogError(
"JetMatchingFailed") <<
"Matching reclustered to original " << type <<
"jets failed. Please check that the jet algorithm and jet size match those used for the original " << type <<
"jet collection.";
1055 matchedIndices.push_back(matchedIdx);
1060 template<
class IPTI,
class VTX>
1063 std::vector<int>& matchedIndices)
1065 std::vector<bool> jetLocks(
jets->size(),
false);
1066 std::vector<int> jetIndices;
1068 for(
size_t gj=0; gj<groomedJets->size(); ++gj)
1070 double matchedDR2 = 1e9;
1071 int matchedIdx = -1;
1073 if( groomedJets->at(gj).pt()>0. )
1075 for(
size_t j=0; j<
jets->size(); ++j)
1077 if( jetLocks.at(j) )
continue;
1079 double tempDR2 =
Geom::deltaR2(
jets->at(j).rapidity(),
jets->at(j).phi(), groomedJets->at(gj).rapidity(), groomedJets->at(gj).phi() );
1080 if( tempDR2 < matchedDR2 )
1082 matchedDR2 = tempDR2;
1092 edm::LogWarning(
"MatchedJetsFarApart") <<
"Matched groomed jet " << gj <<
" and original jet " << matchedIdx <<
" are separated by dR=" <<
sqrt(matchedDR2) <<
" which is greater than the jet size R=" << rParam <<
".\n" 1093 <<
"This is not expected so the matching of these two jets has been discarded. Please check that the two jet collections belong to each other.";
1097 jetLocks.at(matchedIdx) =
true;
1099 jetIndices.push_back(matchedIdx);
1102 for(
size_t j=0; j<
jets->size(); ++j)
1104 std::vector<int>::iterator matchedIndex =
std::find( jetIndices.begin(), jetIndices.end(), j );
1106 matchedIndices.push_back( matchedIndex != jetIndices.end() ?
std::distance(jetIndices.begin(),matchedIndex) : -1 );
1111 template<
class IPTI,
class VTX>
1115 std::vector<std::vector<int> >& matchedIndices)
1117 for(
size_t g=0;
g<groomedIndices.size(); ++
g)
1119 std::vector<int> subjetIndices;
1121 if( groomedIndices.at(
g)>=0 )
1123 for(
size_t s=0;
s<groomedJets->at(groomedIndices.at(
g)).numberOfDaughters(); ++
s)
1127 for(
size_t sj=0; sj<subjets->size(); ++sj)
1132 subjetIndices.push_back(sj);
1138 if( subjetIndices.empty() )
1139 edm::LogError(
"SubjetMatchingFailed") <<
"Matching subjets to original fat jets failed. Please check that the groomed fat jet and subjet collections belong to each other.";
1141 matchedIndices.push_back(subjetIndices);
1144 matchedIndices.push_back(subjetIndices);
1149 template<
class IPTI,
class VTX>
1152 std::vector<std::vector<int> >& matchedIndices)
1154 for(
size_t fj=0; fj<fatJets->size(); ++fj)
1156 std::vector<int> subjetIndices;
1157 size_t nSubjetCollections = 0;
1158 size_t nSubjets = 0;
1160 const pat::Jet * fatJet =
dynamic_cast<const pat::Jet *
>( fatJets->ptrAt(fj).get() );
1164 if( fj==0 )
edm::LogError(
"WrongJetType") <<
"Wrong jet type for input fat jets. Please check that the input fat jets are of the pat::Jet type.";
1166 matchedIndices.push_back(subjetIndices);
1173 if( nSubjetCollections>0 )
1179 for(
size_t fjsj=0; fjsj<fatJetSubjets.size(); ++fjsj)
1183 for(
size_t sj=0; sj<subjets->size(); ++sj)
1185 const pat::Jet * subJet =
dynamic_cast<const pat::Jet *
>( subjets->at(sj).jet().get() );
1189 if( fj==0 &&
coll==0 && fjsj==0 && sj==0 )
edm::LogError(
"WrongJetType") <<
"Wrong jet type for input subjets. Please check that the input subjets are of the pat::Jet type.";
1195 if( subJet->
originalObjectRef() == fatJetSubjets.at(fjsj)->originalObjectRef() )
1197 subjetIndices.push_back(sj);
1205 if( subjetIndices.empty() && nSubjets > 0)
1206 edm::LogError(
"SubjetMatchingFailed") <<
"Matching subjets to fat jets failed. Please check that the fat jet and subjet collections belong to each other.";
1208 matchedIndices.push_back(subjetIndices);
1211 matchedIndices.push_back(subjetIndices);
1217 template<
class IPTI,
class VTX>
1221 desc.
add<
double>(
"extSVDeltaRToJet",0.3);
1225 vertexReco.
add<
double>(
"primcut",1.8);
1226 vertexReco.
add<
double>(
"seccut",6.0);
1245 vertexCuts.
add<
double>(
"distSig3dMax",99999.9);
1246 vertexCuts.
add<
double>(
"fracPV",0.65);
1247 vertexCuts.
add<
double>(
"distVal2dMax",2.5);
1248 vertexCuts.
add<
bool>(
"useTrackWeights",
true);
1249 vertexCuts.
add<
double>(
"maxDeltaRToJetAxis",0.4);
1252 v0Filter.
add<
double>(
"k0sMassWindow",0.05);
1255 vertexCuts.
add<
double>(
"distSig2dMin",3.0);
1256 vertexCuts.
add<
unsigned int>(
"multiplicityMin",2);
1257 vertexCuts.
add<
double>(
"distVal2dMin",0.01);
1258 vertexCuts.
add<
double>(
"distSig2dMax",99999.9);
1259 vertexCuts.
add<
double>(
"distVal3dMax",99999.9);
1260 vertexCuts.
add<
double>(
"minimumTrackWeight",0.5);
1261 vertexCuts.
add<
double>(
"distVal3dMin",-99999.9);
1262 vertexCuts.
add<
double>(
"massMax",6.5);
1263 vertexCuts.
add<
double>(
"distSig3dMin",-99999.9);
1266 desc.
add<
bool>(
"useExternalSV",
false);
1267 desc.
add<
double>(
"minimumTrackWeight",0.5);
1268 desc.
add<
bool>(
"usePVError",
true);
1271 trackSelection.
add<
double>(
"b_pT",0.3684);
1272 trackSelection.
add<
double>(
"max_pT",500);
1273 trackSelection.
add<
bool>(
"useVariableJTA",
false);
1274 trackSelection.
add<
double>(
"maxDecayLen",99999.9);
1275 trackSelection.
add<
double>(
"sip3dValMin",-99999.9);
1276 trackSelection.
add<
double>(
"max_pT_dRcut",0.1);
1277 trackSelection.
add<
double>(
"a_pT",0.005263);
1278 trackSelection.
add<
unsigned int>(
"totalHitsMin",8);
1279 trackSelection.
add<
double>(
"jetDeltaRMax",0.3);
1280 trackSelection.
add<
double>(
"a_dR",-0.001053);
1281 trackSelection.
add<
double>(
"maxDistToAxis",0.2);
1282 trackSelection.
add<
double>(
"ptMin",1.0);
1284 trackSelection.
add<
unsigned int>(
"pixelHitsMin",2);
1285 trackSelection.
add<
double>(
"sip2dValMax",99999.9);
1286 trackSelection.
add<
double>(
"max_pT_trackPTcut",3);
1287 trackSelection.
add<
double>(
"sip2dValMin",-99999.9);
1288 trackSelection.
add<
double>(
"normChi2Max",99999.9);
1289 trackSelection.
add<
double>(
"sip3dValMax",99999.9);
1290 trackSelection.
add<
double>(
"sip3dSigMin",-99999.9);
1291 trackSelection.
add<
double>(
"min_pT",120);
1292 trackSelection.
add<
double>(
"min_pT_dRcut",0.5);
1293 trackSelection.
add<
double>(
"sip2dSigMax",99999.9);
1294 trackSelection.
add<
double>(
"sip3dSigMax",99999.9);
1295 trackSelection.
add<
double>(
"sip2dSigMin",-99999.9);
1296 trackSelection.
add<
double>(
"b_dR",0.6263);
std::shared_ptr< fastjet::JetDefinition > JetDefPtr
math::Error< dimension >::type CovarianceMatrix
reco::Vertex::Point convertPos(const GlobalPoint &p)
value_type const * get() const
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Jet > > token_fatJets
const math::XYZPoint & position(const reco::Vertex &sv)
reco::btag::SortCriteria getCriterium(const std::string &name)
boost::shared_ptr< fastjet::JetDefinition > JetDefPtr
virtual double pz() const =0
z coordinate of momentum vector
TemplatedSecondaryVertex< reco::Vertex > SecondaryVertex
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
TrackSelector trackSelector
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
trackRef_iterator tracks_end() const
last iterator over tracks
TemplatedSecondaryVertexProducer(const edm::ParameterSet ¶ms)
void produce(edm::Event &event, const edm::EventSetup &es) override
const GlobalVector & direction
ClusterSequencePtr fjClusterSeq
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::BeamSpot > token_BeamSpot
const AlgebraicSymMatrix33 matrix() const
double y() const
y coordinate
Base class for all types of Jets.
float totalChiSquared() const
reco::Vertex::Error convertError(const GlobalError &ge)
Measurement1D dist3d() const
reco::TransientTrack build(const reco::Track *p) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
Measurement1D dist2d() const
void setWeight(double weight)
SVFilter(const VertexFilter &filter, const Vertex &pv, const GlobalVector &direction)
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
VertexFilter vertexFilter
reco::btag::SortCriteria sortCriterium
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const reco::Track * toTrack(const reco::TrackBaseRef &t)
const Point & position() const
position
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
TemplatedSecondaryVertexProducer< TrackIPTagInfo, reco::Vertex > SecondaryVertexProducer
void setVertex(const Point &vertex) override
set vertex
static GhostTrackVertexFinder::FitType getGhostTrackFitType(const std::string &name)
void matchReclusteredJets(const edm::Handle< CONTAINER > &jets, const std::vector< fastjet::PseudoJet > &matchedJets, std::vector< int > &matchedIndices, const std::string &jetType="")
ConstraintType constraint
double dydz() const
dydz slope
edm::EDGetTokenT< std::vector< IPTI > > token_trackIPTagInfo
IPTI::input_container::value_type input_item
virtual double energy() const =0
energy
virtual double py() const =0
y coordinate of momentum vector
Container::value_type value_type
reco::btag::IndexedTrackData IndexedTrackData
void addDefault(ParameterSetDescription const &psetDescription)
GlobalVector flightDirection(const reco::Vertex &pv, const reco::Vertex &sv)
std::vector< reco::TransientTrack > const & originalTracks() const
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
float degreesOfFreedom() const
const reco::Jet * toJet(const IPTI &j)
GlobalPoint position() const
std::vector< edm::Ptr< pat::Jet > > JetPtrCollection
const Point & vertex() const override
vertex position (overwritten by PF...)
boost::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
Abs< T >::type abs(const T &t)
double z() const
z coordinate
Measurement1D dist1d() const
ParameterDescriptionNode * addOptionalNode(ParameterDescriptionNode const &node, bool writeToCfi)
double BeamWidthX() const
beam width X
VertexSorting< SecondaryVertex > vertexSorting
std::vector< std::string > const & subjetCollectionNames() const
Subjet collection names.
static ConstraintType getConstraintType(const std::string &name)
const edm::Ptr< reco::Candidate > & originalObjectRef() const
reference to original object. Returns a null reference if not available
ParameterDescriptionBase * add(U const &iLabel, T const &value)
float trackWeight(const reco::TransientTrack &track) const
CandidatePtr candidate() const override
void matchGroomedJets(const edm::Handle< edm::View< reco::Jet > > &jets, const edm::Handle< edm::View< reco::Jet > > &matchedJets, std::vector< int > &matchedIndices)
void matchSubjets(const std::vector< int > &groomedIndices, const edm::Handle< edm::View< reco::Jet > > &groomedJets, const edm::Handle< std::vector< IPTI > > &subjets, std::vector< std::vector< int > > &matchedIndices)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double dxdz() const
dxdz slope
void markUsedTracks(TrackDataVector &trackData, const input_container &trackRefs, const SecondaryVertex &sv, size_t idx)
edm::EDGetTokenT< edm::View< VTX > > token_extSVCollection
Vector3DBase unit() const
SVBuilder(const reco::Vertex &pv, const GlobalVector &direction, bool withPVError, double minTrackWeight)
double x() const
x coordinate
std::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TemplatedSecondaryVertex< VTX > SecondaryVertex
edm::ParameterSet vtxRecoPSet
edm::EDGetTokenT< edm::View< reco::Jet > > token_groomedFatJets
virtual double pt() const =0
transverse momentum
bool linearize(const GhostTrackPrediction &pred, bool initial=false, double lambda=0.)
XYZPointD XYZPoint
point in space with cartesian internal representation
double sigmaZ() const
sigma z
Analysis-level calorimeter jet class.
SecondaryVertex operator()(const TransientVertex &sv) const
Error error() const
return SMatrix
TemplatedSecondaryVertexProducer< CandIPTagInfo, reco::VertexCompositePtrCandidate > CandSecondaryVertexProducer
math::XYZTLorentzVector LorentzVector
Lorentz vector.
double covariance(int i, int j) const
(i,j)-th element of error matrix
std::vector< reco::btag::IndexedTrackData > TrackDataVector
const GlobalVector & direction
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::vector< TemplatedSecondaryVertexTagInfo< IPTI, VTX > > Product
void setCovariance(const CovarianceMatrix &m)
set covariance matrix
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
void addDaughter(const CandidatePtr &)
add a daughter via a reference
const VertexFilter & filter
math::XYZPoint Point
point in the space
GlobalError error() const
void setChi2AndNdof(double chi2, double ndof)
set chi2 and ndof
trackRef_iterator tracks_begin() const
first iterator over tracks
virtual double px() const =0
x coordinate of momentum vector
JetDefPtr fjJetDefinition
VertexState const & vertexState() const
~TemplatedSecondaryVertexProducer() override
pat::JetPtrCollection const & subjets(unsigned int index=0) const
Access to subjet list.
void setP4(const LorentzVector &p4) final
set 4-momentum
const reco::Jet * toJet(const reco::Jet &j)
std::pair< unsigned int, TrackData > IndexedTrackData
Global3DVector GlobalVector
IPTI::input_container input_container