10 #include <boost/iterator/transform_iterator.hpp>
54 #include "fastjet/JetDefinition.hh"
55 #include "fastjet/ClusterSequence.hh"
56 #include "fastjet/PseudoJet.hh"
62 typedef boost::shared_ptr<fastjet::JetDefinition>
JetDefPtr;
68 class VertexInfo :
public fastjet::PseudoJet::UserInfoBase{
70 VertexInfo(
const int vertexIndex) :
71 m_vertexIndex(vertexIndex) { }
73 inline const int vertexIndex()
const {
return m_vertexIndex; }
80 struct RefToBaseLess :
public std::binary_function<edm::RefToBase<T>,
86 return r1.
id() < r2.
id() ||
104 template <
class IPTI,
class VTX>
110 typedef std::vector<TemplatedSecondaryVertexTagInfo<IPTI,VTX> >
Product;
118 template<
class CONTAINER>
120 const std::vector<fastjet::PseudoJet>& matchedJets,
121 std::vector<int>& matchedIndices,
125 std::vector<int>& matchedIndices);
126 void matchSubjets(
const std::vector<int>& groomedIndices,
129 std::vector<std::vector<int> >& matchedIndices);
140 CONSTRAINT_PV_PRIMARIES_IN_FIT
176 public std::unary_function<const VTX&, SecondaryVertex> {
181 double minTrackWeight) :
182 pv(pv), direction(direction),
183 withPVError(withPVError),
184 minTrackWeight(minTrackWeight) {}
198 public std::unary_function<const SecondaryVertex&, bool> {
202 filter(filter), pv(pv), direction(direction) {}
205 {
return !
filter(
pv, sv, direction); }
212 template <
class IPTI,
class VTX>
217 return CONSTRAINT_NONE;
218 else if (name ==
"BeamSpot")
219 return CONSTRAINT_BEAMSPOT;
220 else if (name ==
"BeamSpot+PVPosition")
221 return CONSTRAINT_PV_BEAMSPOT_SIZE;
222 else if (name ==
"BeamSpotZ+PVErrorScaledXY")
223 return CONSTRAINT_PV_BS_Z_ERRORS_SCALED;
224 else if (name ==
"PVErrorScaled")
225 return CONSTRAINT_PV_ERROR_SCALED;
226 else if (name ==
"BeamSpot+PVTracksInFit")
227 return CONSTRAINT_PV_PRIMARIES_IN_FIT;
230 <<
"TemplatedSecondaryVertexProducer: ``constraint'' parameter "
231 "value \"" << name <<
"\" not understood."
238 if (name ==
"AlwaysWithGhostTrack")
240 else if (name ==
"SingleTracksWithGhostTrack")
242 else if (name ==
"RefitGhostTrackWithVertices")
246 <<
"TemplatedSecondaryVertexProducer: ``fitType'' "
247 "parameter value \"" << name <<
"\" for "
248 "GhostTrackVertexFinder settings not "
249 "understood." << std::endl;
252 template <
class IPTI,
class VTX>
255 sortCriterium(TrackSorting::
getCriterium(params.getParameter<std::
string>(
"trackSort"))),
257 constraint(getConstraintType(params.getParameter<std::
string>(
"constraint"))),
258 constraintScaling(1.0),
259 vtxRecoPSet(params.getParameter<edm::
ParameterSet>(
"vertexReco")),
260 useGhostTrack(vtxRecoPSet.getParameter<std::
string>(
"finder") ==
"gtvr"),
261 withPVError(params.getParameter<bool>(
"usePVError")),
262 minTrackWeight(params.getParameter<double>(
"minimumTrackWeight")),
263 vertexFilter(params.getParameter<edm::
ParameterSet>(
"vertexCuts")),
264 vertexSorting(params.getParameter<edm::
ParameterSet>(
"vertexSelection"))
301 throw cms::Exception(
"InvalidJetAlgorithm") <<
"Jet clustering algorithm is invalid: " <<
jetAlgorithm <<
", use CambridgeAachen | Kt | AntiKt" << std::endl;
311 template <
class IPTI,
class VTX>
316 template <
class IPTI,
class VTX>
323 typedef std::map<const Track *, TransientTrack> TransientTrackMap;
331 event.getByToken(token_trackIPTagInfo, trackIPTagInfos);
335 if(
useExternalSV)
event.getByToken(token_extSVCollection,extSecVertex);
341 event.getByToken(token_fatJets, fatJetsHandle);
342 event.getByToken(token_groomedFatJets, groomedFatJetsHandle);
344 if( groomedFatJetsHandle->size() > fatJetsHandle->size() )
345 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.";
349 unsigned int bsCovSrc[7] = { 0, };
350 double sigmaZ = 0.0, beamWidth = 0.0;
352 case CONSTRAINT_PV_BEAMSPOT_SIZE:
353 event.getByToken(token_BeamSpot,beamSpot);
354 bsCovSrc[3] = bsCovSrc[4] = bsCovSrc[5] = bsCovSrc[6] = 1;
355 sigmaZ = beamSpot->sigmaZ();
356 beamWidth = beamSpot->BeamWidthX();
359 case CONSTRAINT_PV_BS_Z_ERRORS_SCALED:
360 event.getByToken(token_BeamSpot,beamSpot);
361 bsCovSrc[0] = bsCovSrc[1] = 2;
362 bsCovSrc[3] = bsCovSrc[4] = bsCovSrc[5] = 1;
363 sigmaZ = beamSpot->sigmaZ();
366 case CONSTRAINT_PV_ERROR_SCALED:
367 bsCovSrc[0] = bsCovSrc[1] = bsCovSrc[2] = 2;
370 case CONSTRAINT_BEAMSPOT:
371 case CONSTRAINT_PV_PRIMARIES_IN_FIT:
372 event.getByToken(token_BeamSpot,beamSpot);
380 std::vector<std::vector<int> > clusteredSVs(trackIPTagInfos->size(),std::vector<int>());
381 if(
useExternalSV && useSVClustering && trackIPTagInfos->size()>0 )
384 std::vector<fastjet::PseudoJet> fjInputs;
390 std::vector<edm::Ptr<reco::Candidate> > constituents = it->getJetConstituents();
391 std::vector<edm::Ptr<reco::Candidate> >::const_iterator
m;
392 for( m = constituents.begin(); m != constituents.end(); ++
m )
395 if(constit->pt() == 0)
397 edm::LogWarning(
"NullTransverseMomentum") <<
"dropping input candidate with pt=0";
400 fjInputs.push_back(fastjet::PseudoJet(constit->px(),constit->py(),constit->pz(),constit->energy()));
406 for(
typename std::vector<IPTI>::const_iterator it = trackIPTagInfos->begin(); it != trackIPTagInfos->end(); ++it)
408 std::vector<edm::Ptr<reco::Candidate> > constituents = it->jet()->getJetConstituents();
409 std::vector<edm::Ptr<reco::Candidate> >::const_iterator
m;
410 for( m = constituents.begin(); m != constituents.end(); ++
m )
413 if(constit->pt() == 0)
415 edm::LogWarning(
"NullTransverseMomentum") <<
"dropping input candidate with pt=0";
418 fjInputs.push_back(fastjet::PseudoJet(constit->px(),constit->py(),constit->pz(),constit->energy()));
425 const reco::Vertex &
pv = *(trackIPTagInfos->front().primaryVertex());
428 fastjet::PseudoJet
p(dir.
x(),dir.
y(),dir.
z(),dir.
mag());
430 p = fastjet::PseudoJet(it->p4().px(),it->p4().py(),it->p4().pz(),it->p4().energy());
432 p.set_user_info(
new VertexInfo( it - extSecVertex->begin() ));
433 fjInputs.push_back(p);
437 fjClusterSeq =
ClusterSequencePtr(
new fastjet::ClusterSequence( fjInputs, *fjJetDefinition ) );
439 std::vector<fastjet::PseudoJet> inclusiveJets = fastjet::sorted_by_pt( fjClusterSeq->inclusive_jets(
jetPtMin) );
443 if( inclusiveJets.size() < fatJetsHandle->size() )
444 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.";
447 std::vector<int> reclusteredIndices;
448 matchReclusteredJets<edm::View<reco::Jet> >(fatJetsHandle,inclusiveJets,reclusteredIndices,
"fat");
451 std::vector<int> groomedIndices;
452 matchGroomedJets(fatJetsHandle,groomedFatJetsHandle,groomedIndices);
455 std::vector<std::vector<int> > subjetIndices;
456 matchSubjets(groomedIndices,groomedFatJetsHandle,trackIPTagInfos,subjetIndices);
459 for(
size_t i=0;
i<fatJetsHandle->size(); ++
i)
461 if( reclusteredIndices.at(
i) < 0 )
continue;
463 if( fatJetsHandle->at(
i).pt() == 0 )
465 edm::LogWarning(
"NullTransverseMomentum") <<
"The original fat jet " <<
i <<
" has Pt=0. This is not expected so the jet will be skipped.";
469 if( subjetIndices.at(
i).size()==0 )
continue;
472 if( (
std::abs( inclusiveJets.at(reclusteredIndices.at(
i)).
pt() - fatJetsHandle->at(
i).pt() ) / fatJetsHandle->at(
i).pt() ) > relPtTolerance )
474 if( fatJetsHandle->at(
i).pt() < 10. )
475 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"
476 <<
"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"
477 <<
"Since the mismatch is at low Pt, it is ignored and only a warning is issued.\n"
478 <<
"\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.";
480 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"
481 <<
"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"
482 <<
"\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.";
486 std::vector<fastjet::PseudoJet> constituents = inclusiveJets.at(reclusteredIndices.at(
i)).constituents();
488 std::vector<int> svIndices;
490 for(std::vector<fastjet::PseudoJet>::const_iterator it = constituents.begin(); it != constituents.end(); ++it)
492 if( !it->has_user_info() )
continue;
494 svIndices.push_back( it->user_info<VertexInfo>().vertexIndex() );
498 for(
size_t sv=0; sv<svIndices.size(); ++sv)
500 const reco::Vertex &
pv = *(trackIPTagInfos->front().primaryVertex());
501 const VTX &extSV = (*extSecVertex)[ svIndices.at(sv) ];
504 fastjet::PseudoJet
p(dir.
x(),dir.
y(),dir.
z(),dir.
mag());
506 p = fastjet::PseudoJet(extSV.p4().px(),extSV.p4().py(),extSV.p4().pz(),extSV.p4().energy());
508 std::vector<double> dR2toSubjets;
510 for(
size_t sj=0; sj<subjetIndices.at(
i).size(); ++sj)
511 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() ) );
514 int closestSubjetIdx =
std::distance( dR2toSubjets.begin(), std::min_element(dR2toSubjets.begin(), dR2toSubjets.end()) );
516 clusteredSVs.at(subjetIndices.at(
i).at(closestSubjetIdx)).push_back( svIndices.at(sv) );
522 if( inclusiveJets.size() < trackIPTagInfos->size() )
523 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.";
526 std::vector<int> reclusteredIndices;
527 matchReclusteredJets<std::vector<IPTI> >(
trackIPTagInfos,inclusiveJets,reclusteredIndices);
530 for(
size_t i=0;
i<trackIPTagInfos->size(); ++
i)
532 if( reclusteredIndices.at(
i) < 0 )
continue;
534 if( trackIPTagInfos->at(
i).jet()->pt() == 0 )
536 edm::LogWarning(
"NullTransverseMomentum") <<
"The original jet " <<
i <<
" has Pt=0. This is not expected so the jet will be skipped.";
541 if( (
std::abs( inclusiveJets.at(reclusteredIndices.at(
i)).
pt() - trackIPTagInfos->at(
i).jet()->pt() ) / trackIPTagInfos->at(
i).jet()->pt() ) > relPtTolerance )
543 if( trackIPTagInfos->at(
i).jet()->pt() < 10. )
544 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"
545 <<
"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"
546 <<
"Since the mismatch is at low Pt, it is ignored and only a warning is issued.\n"
547 <<
"\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.";
549 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"
550 <<
"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"
551 <<
"\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.";
555 std::vector<fastjet::PseudoJet> constituents = inclusiveJets.at(reclusteredIndices.at(
i)).constituents();
558 for(std::vector<fastjet::PseudoJet>::const_iterator it = constituents.begin(); it != constituents.end(); ++it)
560 if( !it->has_user_info() )
continue;
562 clusteredSVs.at(
i).push_back( it->user_info<VertexInfo>().vertexIndex() );
569 std::auto_ptr<ConfigurableVertexReconstructor>
vertexReco;
570 std::auto_ptr<GhostTrackVertexFinder> vertexRecoGT;
573 vtxRecoPSet.getParameter<
double>(
"maxFitChi2"),
574 vtxRecoPSet.getParameter<
double>(
"mergeThreshold"),
575 vtxRecoPSet.getParameter<
double>(
"primcut"),
576 vtxRecoPSet.getParameter<
double>(
"seccut"),
582 TransientTrackMap primariesMap;
588 for(
typename std::vector<IPTI>::const_iterator iterJets =
589 trackIPTagInfos->begin(); iterJets != trackIPTagInfos->end();
594 const Vertex &
pv = *iterJets->primaryVertex();
596 std::set<TransientTrack> primaries;
597 if (
constraint == CONSTRAINT_PV_PRIMARIES_IN_FIT) {
600 TransientTrackMap::iterator pos =
601 primariesMap.lower_bound(
iter->get());
603 if (pos != primariesMap.end() &&
604 pos->first ==
iter->get())
605 primaries.insert(pos->second);
610 primariesMap.insert(pos,
611 std::make_pair(
iter->get(), track));
612 primaries.insert(track);
623 std::vector<std::size_t> indices =
624 iterJets->sortedIndexes(sortCriterium);
628 const std::vector<reco::btag::TrackIPData> &ipData =
629 iterJets->impactParameterData();
633 std::vector<TransientTrack> fitTracks;
634 std::vector<GhostTrackState> gtStates;
635 std::auto_ptr<GhostTrackPrediction> gtPred;
638 *iterJets->ghostTrack()));
640 for(
unsigned int i = 0;
i < indices.size();
i++) {
646 trackData.back().first = indices[
i];
653 trackData.back().second.svStatus =
658 TransientTrackMap::const_iterator pos =
661 if (pos != primariesMap.end()) {
662 primaries.erase(pos->second);
663 fitTrack = pos->second;
665 fitTrack = trackBuilder->build(trackRef);
666 fitTracks.push_back(fitTrack);
668 trackData.back().second.svStatus =
674 ipData[indices[
i]].closestToGhostTrack;
676 gtPred->lambda(pos));
677 gtState.
setWeight(ipData[indices[i]].ghostTrackWeight);
678 gtStates.push_back(gtState);
682 std::auto_ptr<GhostTrack> ghostTrack;
689 iterJets->ghostTrack()->px(),
690 iterJets->ghostTrack()->py(),
691 iterJets->ghostTrack()->pz()),
694 iterJets->ghostTrack()->chi2(),
695 iterJets->ghostTrack()->ndof()));
700 std::vector<VTX> extAssoCollection;
701 std::vector<TransientVertex> fittedSVs;
702 std::vector<SecondaryVertex> SVs;
705 case CONSTRAINT_NONE:
707 fittedSVs = vertexRecoGT->vertices(
710 fittedSVs = vertexReco->vertices(fitTracks);
713 case CONSTRAINT_BEAMSPOT:
715 fittedSVs = vertexRecoGT->vertices(
716 pv, *beamSpot, *ghostTrack);
718 fittedSVs = vertexReco->vertices(fitTracks,
722 case CONSTRAINT_PV_BEAMSPOT_SIZE:
723 case CONSTRAINT_PV_BS_Z_ERRORS_SCALED:
724 case CONSTRAINT_PV_ERROR_SCALED: {
726 for(
unsigned int i = 0;
i < 7;
i++) {
727 unsigned int covSrc = bsCovSrc[
i];
728 for(
unsigned int j = 0;
j < 7;
j++) {
730 if (!covSrc || bsCovSrc[
j] != covSrc)
732 else if (covSrc == 1)
733 v = beamSpot->covariance(
i,
j);
742 beamSpot.
isValid() ? beamSpot->dxdz() : 0.,
743 beamSpot.
isValid() ? beamSpot->dydz() : 0.,
747 fittedSVs = vertexRecoGT->vertices(
748 pv, bs, *ghostTrack);
750 fittedSVs = vertexReco->vertices(fitTracks, bs);
753 case CONSTRAINT_PV_PRIMARIES_IN_FIT: {
754 std::vector<TransientTrack> primaries_(
755 primaries.begin(), primaries.end());
757 fittedSVs = vertexRecoGT->vertices(
758 pv, *beamSpot, primaries_,
761 fittedSVs = vertexReco->vertices(
762 primaries_, fitTracks,
767 SVBuilder svBuilder(pv, jetDir, withPVError, minTrackWeight);
768 std::remove_copy_if(boost::make_transform_iterator(
769 fittedSVs.begin(), svBuilder),
770 boost::make_transform_iterator(
771 fittedSVs.end(), svBuilder),
772 std::back_inserter(SVs),
773 SVFilter(vertexFilter, pv, jetDir));
776 if( !useSVClustering ) {
777 for(
size_t iExtSv = 0; iExtSv < extSecVertex->size(); iExtSv++){
778 const VTX & extVertex = (*extSecVertex)[iExtSv];
781 extAssoCollection.push_back( extVertex );
786 size_t jetIdx = ( iterJets - trackIPTagInfos->begin() );
788 for(
size_t iExtSv = 0; iExtSv < clusteredSVs.at(jetIdx).size(); iExtSv++){
789 const VTX & extVertex = (*extSecVertex)[ clusteredSVs.at(jetIdx).at(iExtSv) ];
790 if( extVertex.p4().M() < 0.3 )
792 extAssoCollection.push_back( extVertex );
796 SVBuilder svBuilder(pv, jetDir, withPVError, minTrackWeight);
797 std::remove_copy_if(boost::make_transform_iterator( extAssoCollection.begin(), svBuilder),
798 boost::make_transform_iterator(extAssoCollection.end(), svBuilder),
799 std::back_inserter(SVs),
800 SVFilter(vertexFilter, pv, jetDir));
808 extAssoCollection.clear();
812 std::vector<unsigned int> vtxIndices = vertexSorting(SVs);
814 std::vector<typename TemplatedSecondaryVertexTagInfo<IPTI,VTX>::VertexData> svData;
816 svData.resize(vtxIndices.size());
817 for(
unsigned int idx = 0;
idx < vtxIndices.size();
idx++) {
820 svData[
idx].vertex = sv;
825 markUsedTracks(trackData,trackRefs,sv,
idx);
832 trackData, svData, SVs.size(),
834 iterJets - trackIPTagInfos->begin())));
845 if (sv.trackWeight(*
iter) < minTrackWeight)
848 typename input_container::const_iterator pos =
849 std::find(trackRefs.begin(), trackRefs.end(),
852 if (pos == trackRefs.end() ) {
855 <<
"Could not find track from secondary "
856 "vertex in original tracks."
859 unsigned int index = pos - trackRefs.begin();
860 trackData[
index].second.svStatus =
862 ((
unsigned int)btag::TrackData::trackAssociatedToVertex +
idx);
869 for(
typename input_container::const_iterator
iter = sv.daughterPtrVector().begin();
iter != sv.daughterPtrVector().end(); ++
iter)
871 typename input_container::const_iterator pos =
874 if (pos != trackRefs.end() )
876 unsigned int index = pos - trackRefs.begin();
877 trackData[
index].second.svStatus =
879 ((
unsigned int)btag::TrackData::trackAssociatedToVertex +
idx);
893 edm::LogError(
"UnexpectedInputs") <<
"Building from Candidates, should not happen!";
904 edm::LogError(
"UnexpectedInputs") <<
"Building from Tracks, should not happen!";
929 edm::LogError(
"DynamicCastingFailed") <<
"Casting of TransientTrack to CandidatePtrTransientTrack failed!";
936 vtxCompPtrCand.
setP4(p4);
943 template<
class IPTI,
class VTX>
944 template<
class CONTAINER>
946 const std::vector<fastjet::PseudoJet>& reclusteredJets,
947 std::vector<int>& matchedIndices,
952 std::vector<bool> matchedLocks(reclusteredJets.size(),
false);
954 for(
size_t j=0;
j<jets->size(); ++
j)
956 double matchedDR2 = 1e9;
959 for(
size_t rj=0; rj<reclusteredJets.size(); ++rj)
961 if( matchedLocks.at(rj) )
continue;
963 double tempDR2 =
Geom::deltaR2(
toJet(jets->at(
j))->rapidity(),
toJet(jets->at(
j))->
phi(), reclusteredJets.at(rj).rapidity(), reclusteredJets.at(rj).phi_std() );
964 if( tempDR2 < matchedDR2 )
966 matchedDR2 = tempDR2;
975 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"
976 <<
"This is not expected so please check that the jet algorithm and jet size match those used for the original " << type <<
"jet collection.";
979 matchedLocks.at(matchedIdx) =
true;
982 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.";
984 matchedIndices.push_back(matchedIdx);
989 template<
class IPTI,
class VTX>
992 std::vector<int>& matchedIndices)
994 std::vector<bool> jetLocks(
jets->size(),
false);
995 std::vector<int> jetIndices;
997 for(
size_t gj=0; gj<groomedJets->size(); ++gj)
999 double matchedDR2 = 1e9;
1000 int matchedIdx = -1;
1002 if( groomedJets->at(gj).pt()>0. )
1004 for(
size_t j=0;
j<
jets->size(); ++
j)
1006 if( jetLocks.at(
j) )
continue;
1008 double tempDR2 =
Geom::deltaR2(
jets->at(
j).rapidity(),
jets->at(
j).phi(), groomedJets->at(gj).rapidity(), groomedJets->at(gj).phi() );
1009 if( tempDR2 < matchedDR2 )
1011 matchedDR2 = tempDR2;
1021 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"
1022 <<
"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.";
1026 jetLocks.at(matchedIdx) =
true;
1028 jetIndices.push_back(matchedIdx);
1031 for(
size_t j=0;
j<
jets->size(); ++
j)
1033 std::vector<int>::iterator matchedIndex =
std::find( jetIndices.begin(), jetIndices.end(),
j );
1035 matchedIndices.push_back( matchedIndex != jetIndices.end() ?
std::distance(jetIndices.begin(),matchedIndex) : -1 );
1040 template<
class IPTI,
class VTX>
1044 std::vector<std::vector<int> >& matchedIndices)
1046 for(
size_t g=0;
g<groomedIndices.size(); ++
g)
1048 std::vector<int> subjetIndices;
1050 if( groomedIndices.at(
g)>=0 )
1052 for(
size_t s=0;
s<groomedJets->at(groomedIndices.at(
g)).numberOfDaughters(); ++
s)
1056 for(
size_t sj=0; sj<subjets->size(); ++sj)
1061 subjetIndices.push_back(sj);
1067 if( subjetIndices.size() == 0 )
1068 edm::LogError(
"SubjetMatchingFailed") <<
"Matching subjets to original fat jets failed. Please check that the groomed fat jet and subjet collections belong to each other.";
1070 matchedIndices.push_back(subjetIndices);
1073 matchedIndices.push_back(subjetIndices);
1078 template<
class IPTI,
class VTX>
1082 desc.
add<
double>(
"extSVDeltaRToJet",0.3);
1086 vertexReco.
add<
double>(
"primcut",1.8);
1087 vertexReco.
add<
double>(
"seccut",6.0);
1106 vertexCuts.
add<
double>(
"distSig3dMax",99999.9);
1107 vertexCuts.
add<
double>(
"fracPV",0.65);
1108 vertexCuts.
add<
double>(
"distVal2dMax",2.5);
1109 vertexCuts.
add<
bool>(
"useTrackWeights",
true);
1110 vertexCuts.
add<
double>(
"maxDeltaRToJetAxis",0.4);
1113 v0Filter.
add<
double>(
"k0sMassWindow",0.05);
1116 vertexCuts.
add<
double>(
"distSig2dMin",3.0);
1117 vertexCuts.
add<
unsigned int>(
"multiplicityMin",2);
1118 vertexCuts.
add<
double>(
"distVal2dMin",0.01);
1119 vertexCuts.
add<
double>(
"distSig2dMax",99999.9);
1120 vertexCuts.
add<
double>(
"distVal3dMax",99999.9);
1121 vertexCuts.
add<
double>(
"minimumTrackWeight",0.5);
1122 vertexCuts.
add<
double>(
"distVal3dMin",-99999.9);
1123 vertexCuts.
add<
double>(
"massMax",6.5);
1124 vertexCuts.
add<
double>(
"distSig3dMin",-99999.9);
1127 desc.
add<
bool>(
"useExternalSV",
false);
1128 desc.
add<
double>(
"minimumTrackWeight",0.5);
1129 desc.
add<
bool>(
"usePVError",
true);
1132 trackSelection.
add<
double>(
"b_pT",0.3684);
1133 trackSelection.
add<
double>(
"max_pT",500);
1134 trackSelection.
add<
bool>(
"useVariableJTA",
false);
1135 trackSelection.
add<
double>(
"maxDecayLen",99999.9);
1136 trackSelection.
add<
double>(
"sip3dValMin",-99999.9);
1137 trackSelection.
add<
double>(
"max_pT_dRcut",0.1);
1138 trackSelection.
add<
double>(
"a_pT",0.005263);
1139 trackSelection.
add<
unsigned int>(
"totalHitsMin",8);
1140 trackSelection.
add<
double>(
"jetDeltaRMax",0.3);
1141 trackSelection.
add<
double>(
"a_dR",-0.001053);
1142 trackSelection.
add<
double>(
"maxDistToAxis",0.2);
1143 trackSelection.
add<
double>(
"ptMin",1.0);
1145 trackSelection.
add<
unsigned int>(
"pixelHitsMin",2);
1146 trackSelection.
add<
double>(
"sip2dValMax",99999.9);
1147 trackSelection.
add<
double>(
"max_pT_trackPTcut",3);
1148 trackSelection.
add<
double>(
"sip2dValMin",-99999.9);
1149 trackSelection.
add<
double>(
"normChi2Max",99999.9);
1150 trackSelection.
add<
double>(
"sip3dValMax",99999.9);
1151 trackSelection.
add<
double>(
"sip3dSigMin",-99999.9);
1152 trackSelection.
add<
double>(
"min_pT",120);
1153 trackSelection.
add<
double>(
"min_pT_dRcut",0.5);
1154 trackSelection.
add<
double>(
"sip2dSigMax",99999.9);
1155 trackSelection.
add<
double>(
"sip3dSigMax",99999.9);
1156 trackSelection.
add<
double>(
"sip2dSigMin",-99999.9);
1157 trackSelection.
add<
double>(
"b_dR",0.6263);
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
boost::shared_ptr< fastjet::JetDefinition > JetDefPtr
reco::btag::SortCriteria getCriterium(const std::string &name)
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)
virtual void produce(edm::Event &event, const edm::EventSetup &es) override
const GlobalVector & direction
ClusterSequencePtr fjClusterSeq
virtual const Point & vertex() const
vertex position (overwritten by PF...)
boost::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::BeamSpot > token_BeamSpot
double y() const
y coordinate
Base class for all types of Jets.
CandidatePtr candidate() const
float totalChiSquared() const
reco::Vertex::Error convertError(const GlobalError &ge)
virtual Vector momentum() const
spatial momentum vector
Measurement1D dist3d() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
Measurement1D dist2d() const
virtual void setP4(const LorentzVector &p4)
set 4-momentum
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
const AlgebraicSymMatrix33 & matrix_new() const
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
edm::EDGetTokenT< std::vector< IPTI > > token_trackIPTagInfo
IPTI::input_container::value_type input_item
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
float degreesOfFreedom() const
const reco::Jet * toJet(const IPTI &j)
GlobalPoint position() const
Abs< T >::type abs(const T &t)
double z() const
y coordinate
ParameterDescriptionNode * addOptionalNode(ParameterDescriptionNode const &node, bool writeToCfi)
double deltaR2(const T1 &t1, const T2 &t2)
VertexSorting< SecondaryVertex > vertexSorting
static ConstraintType getConstraintType(const std::string &name)
~TemplatedSecondaryVertexProducer()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
Container::value_type value_type
float trackWeight(const reco::TransientTrack &track) const
virtual void setVertex(const Point &vertex)
set vertex
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)
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
TemplatedSecondaryVertex< VTX > SecondaryVertex
edm::ParameterSet vtxRecoPSet
edm::EDGetTokenT< edm::View< reco::Jet > > token_groomedFatJets
bool linearize(const GhostTrackPrediction &pred, bool initial=false, double lambda=0.)
XYZPointD XYZPoint
point in space with cartesian internal representation
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
SecondaryVertex operator()(const TransientVertex &sv) const
Error error() const
return SMatrix
TemplatedSecondaryVertexProducer< CandIPTagInfo, reco::VertexCompositePtrCandidate > CandSecondaryVertexProducer
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::vector< reco::btag::IndexedTrackData > TrackDataVector
const GlobalVector & direction
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
static int position[264][3]
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
volatile std::atomic< bool > shutdown_flag false
void setChi2AndNdof(double chi2, double ndof)
set chi2 and ndof
trackRef_iterator tracks_begin() const
first iterator over tracks
JetDefPtr fjJetDefinition
VertexState const & vertexState() const
const reco::Jet * toJet(const reco::Jet &j)
std::pair< unsigned int, TrackData > IndexedTrackData
Global3DVector GlobalVector
IPTI::input_container input_container
tuple trackSelector
Tracks selection.