10 #include <boost/iterator/transform_iterator.hpp>
51 #include "fastjet/JetDefinition.hh"
52 #include "fastjet/ClusterSequence.hh"
53 #include "fastjet/PseudoJet.hh"
59 typedef boost::shared_ptr<fastjet::JetDefinition>
JetDefPtr;
65 class VertexInfo :
public fastjet::PseudoJet::UserInfoBase{
67 VertexInfo(
const int vertexIndex) :
68 m_vertexIndex(vertexIndex) { }
70 inline const int vertexIndex()
const {
return m_vertexIndex; }
77 struct RefToBaseLess :
public std::binary_function<edm::RefToBase<T>,
83 return r1.
id() < r2.
id() ||
101 template <
class IPTI,
class VTX>
106 typedef std::vector<TemplatedSecondaryVertexTagInfo<IPTI,VTX> >
Product;
114 template<
class CONTAINER>
116 const std::vector<fastjet::PseudoJet>& matchedJets,
117 std::vector<int>& matchedIndices,
121 std::vector<int>& matchedIndices);
122 void matchSubjets(
const std::vector<int>& groomedIndices,
125 std::vector<std::vector<int> >& matchedIndices);
136 CONSTRAINT_PV_PRIMARIES_IN_FIT
172 public std::unary_function<const VTX&, SecondaryVertex> {
177 double minTrackWeight) :
178 pv(pv), direction(direction),
179 withPVError(withPVError),
180 minTrackWeight(minTrackWeight) {}
194 public std::unary_function<const SecondaryVertex&, bool> {
198 filter(filter), pv(pv), direction(direction) {}
201 {
return !
filter(
pv, sv, direction); }
208 template <
class IPTI,
class VTX>
213 return CONSTRAINT_NONE;
214 else if (name ==
"BeamSpot")
215 return CONSTRAINT_BEAMSPOT;
216 else if (name ==
"BeamSpot+PVPosition")
217 return CONSTRAINT_PV_BEAMSPOT_SIZE;
218 else if (name ==
"BeamSpotZ+PVErrorScaledXY")
219 return CONSTRAINT_PV_BS_Z_ERRORS_SCALED;
220 else if (name ==
"PVErrorScaled")
221 return CONSTRAINT_PV_ERROR_SCALED;
222 else if (name ==
"BeamSpot+PVTracksInFit")
223 return CONSTRAINT_PV_PRIMARIES_IN_FIT;
226 <<
"TemplatedSecondaryVertexProducer: ``constraint'' parameter "
227 "value \"" << name <<
"\" not understood."
234 if (name ==
"AlwaysWithGhostTrack")
236 else if (name ==
"SingleTracksWithGhostTrack")
238 else if (name ==
"RefitGhostTrackWithVertices")
242 <<
"TemplatedSecondaryVertexProducer: ``fitType'' "
243 "parameter value \"" << name <<
"\" for "
244 "GhostTrackVertexFinder settings not "
245 "understood." << std::endl;
248 template <
class IPTI,
class VTX>
251 sortCriterium(TrackSorting::
getCriterium(params.getParameter<std::
string>(
"trackSort"))),
253 constraint(getConstraintType(params.getParameter<std::
string>(
"constraint"))),
254 constraintScaling(1.0),
255 vtxRecoPSet(params.getParameter<edm::
ParameterSet>(
"vertexReco")),
256 useGhostTrack(vtxRecoPSet.getParameter<std::
string>(
"finder") ==
"gtvr"),
257 withPVError(params.getParameter<bool>(
"usePVError")),
258 minTrackWeight(params.getParameter<double>(
"minimumTrackWeight")),
259 vertexFilter(params.getParameter<edm::
ParameterSet>(
"vertexCuts")),
260 vertexSorting(params.getParameter<edm::
ParameterSet>(
"vertexSelection"))
297 throw cms::Exception(
"InvalidJetAlgorithm") <<
"Jet clustering algorithm is invalid: " <<
jetAlgorithm <<
", use CambridgeAachen | Kt | AntiKt" << std::endl;
307 template <
class IPTI,
class VTX>
312 template <
class IPTI,
class VTX>
319 typedef std::map<const Track *, TransientTrack> TransientTrackMap;
327 event.getByToken(token_trackIPTagInfo, trackIPTagInfos);
331 if(useExternalSV)
event.getByToken(token_extSVCollection,extSecVertex);
337 event.getByToken(token_fatJets, fatJetsHandle);
338 event.getByToken(token_groomedFatJets, groomedFatJetsHandle);
340 if( groomedFatJetsHandle->size() > fatJetsHandle->size() )
341 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.";
345 unsigned int bsCovSrc[7] = { 0, };
346 double sigmaZ = 0.0, beamWidth = 0.0;
348 case CONSTRAINT_PV_BEAMSPOT_SIZE:
349 event.getByToken(token_BeamSpot,beamSpot);
350 bsCovSrc[3] = bsCovSrc[4] = bsCovSrc[5] = bsCovSrc[6] = 1;
351 sigmaZ = beamSpot->sigmaZ();
352 beamWidth = beamSpot->BeamWidthX();
355 case CONSTRAINT_PV_BS_Z_ERRORS_SCALED:
356 event.getByToken(token_BeamSpot,beamSpot);
357 bsCovSrc[0] = bsCovSrc[1] = 2;
358 bsCovSrc[3] = bsCovSrc[4] = bsCovSrc[5] = 1;
359 sigmaZ = beamSpot->sigmaZ();
362 case CONSTRAINT_PV_ERROR_SCALED:
363 bsCovSrc[0] = bsCovSrc[1] = bsCovSrc[2] = 2;
366 case CONSTRAINT_BEAMSPOT:
367 case CONSTRAINT_PV_PRIMARIES_IN_FIT:
368 event.getByToken(token_BeamSpot,beamSpot);
376 std::vector<std::vector<int> > clusteredSVs(trackIPTagInfos->size(),std::vector<int>());
377 if( useExternalSV && useSVClustering && trackIPTagInfos->size()>0 )
380 std::vector<fastjet::PseudoJet> fjInputs;
386 std::vector<edm::Ptr<reco::Candidate> > constituents = it->getJetConstituents();
387 std::vector<edm::Ptr<reco::Candidate> >::const_iterator
m;
388 for( m = constituents.begin(); m != constituents.end(); ++
m )
391 if(constit->pt() == 0)
393 edm::LogWarning(
"NullTransverseMomentum") <<
"dropping input candidate with pt=0";
396 fjInputs.push_back(fastjet::PseudoJet(constit->px(),constit->py(),constit->pz(),constit->energy()));
402 for(
typename std::vector<IPTI>::const_iterator it = trackIPTagInfos->begin(); it != trackIPTagInfos->end(); ++it)
404 std::vector<edm::Ptr<reco::Candidate> > constituents = it->jet()->getJetConstituents();
405 std::vector<edm::Ptr<reco::Candidate> >::const_iterator
m;
406 for( m = constituents.begin(); m != constituents.end(); ++
m )
409 if(constit->pt() == 0)
411 edm::LogWarning(
"NullTransverseMomentum") <<
"dropping input candidate with pt=0";
414 fjInputs.push_back(fastjet::PseudoJet(constit->px(),constit->py(),constit->pz(),constit->energy()));
421 const reco::Vertex &
pv = *(trackIPTagInfos->front().primaryVertex());
424 fastjet::PseudoJet
p(dir.
x(),dir.
y(),dir.
z(),dir.
mag());
426 p = fastjet::PseudoJet(it->p4().px(),it->p4().py(),it->p4().pz(),it->p4().energy());
428 p.set_user_info(
new VertexInfo( it - extSecVertex->begin() ));
429 fjInputs.push_back(p);
433 fjClusterSeq =
ClusterSequencePtr(
new fastjet::ClusterSequence( fjInputs, *fjJetDefinition ) );
435 std::vector<fastjet::PseudoJet> inclusiveJets = fastjet::sorted_by_pt( fjClusterSeq->inclusive_jets(jetPtMin) );
439 if( inclusiveJets.size() < fatJetsHandle->size() )
440 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.";
443 std::vector<int> reclusteredIndices;
444 matchReclusteredJets<edm::View<reco::Jet> >(fatJetsHandle,inclusiveJets,reclusteredIndices,
"fat");
447 std::vector<int> groomedIndices;
448 matchGroomedJets(fatJetsHandle,groomedFatJetsHandle,groomedIndices);
451 std::vector<std::vector<int> > subjetIndices;
452 matchSubjets(groomedIndices,groomedFatJetsHandle,trackIPTagInfos,subjetIndices);
455 for(
size_t i=0;
i<fatJetsHandle->size(); ++
i)
457 if( reclusteredIndices.at(
i) < 0 )
continue;
459 if( fatJetsHandle->at(
i).pt() == 0 )
461 edm::LogWarning(
"NullTransverseMomentum") <<
"The original fat jet " <<
i <<
" has Pt=0. This is not expected so the jet will be skipped.";
465 if( subjetIndices.at(
i).size()==0 )
continue;
468 if( (
std::abs( inclusiveJets.at(reclusteredIndices.at(
i)).
pt() - fatJetsHandle->at(
i).pt() ) / fatJetsHandle->at(
i).pt() ) > relPtTolerance )
470 if( fatJetsHandle->at(
i).pt() < 10. )
471 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"
472 <<
"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"
473 <<
"Since the mismatch is at low Pt, it is ignored and only a warning is issued.\n"
474 <<
"\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.";
476 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"
477 <<
"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"
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.";
482 std::vector<fastjet::PseudoJet> constituents = inclusiveJets.at(reclusteredIndices.at(
i)).constituents();
484 std::vector<int> svIndices;
486 for(std::vector<fastjet::PseudoJet>::const_iterator it = constituents.begin(); it != constituents.end(); ++it)
488 if( !it->has_user_info() )
continue;
490 svIndices.push_back( it->user_info<VertexInfo>().vertexIndex() );
494 for(
size_t sv=0; sv<svIndices.size(); ++sv)
496 const reco::Vertex &
pv = *(trackIPTagInfos->front().primaryVertex());
497 const VTX &extSV = (*extSecVertex)[ svIndices.at(sv) ];
500 fastjet::PseudoJet
p(dir.
x(),dir.
y(),dir.
z(),dir.
mag());
502 p = fastjet::PseudoJet(extSV.p4().px(),extSV.p4().py(),extSV.p4().pz(),extSV.p4().energy());
504 std::vector<double> dR2toSubjets;
506 for(
size_t sj=0; sj<subjetIndices.at(
i).size(); ++sj)
507 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() ) );
510 int closestSubjetIdx = std::distance( dR2toSubjets.begin(), std::min_element(dR2toSubjets.begin(), dR2toSubjets.end()) );
512 clusteredSVs.at(subjetIndices.at(
i).at(closestSubjetIdx)).push_back( svIndices.at(sv) );
518 if( inclusiveJets.size() < trackIPTagInfos->size() )
519 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.";
522 std::vector<int> reclusteredIndices;
523 matchReclusteredJets<std::vector<IPTI> >(trackIPTagInfos,inclusiveJets,reclusteredIndices);
526 for(
size_t i=0;
i<trackIPTagInfos->size(); ++
i)
528 if( reclusteredIndices.at(
i) < 0 )
continue;
530 if( trackIPTagInfos->at(
i).jet()->pt() == 0 )
532 edm::LogWarning(
"NullTransverseMomentum") <<
"The original jet " <<
i <<
" has Pt=0. This is not expected so the jet will be skipped.";
537 if( (
std::abs( inclusiveJets.at(reclusteredIndices.at(
i)).
pt() - trackIPTagInfos->at(
i).jet()->pt() ) / trackIPTagInfos->at(
i).jet()->pt() ) > relPtTolerance )
539 if( trackIPTagInfos->at(
i).jet()->pt() < 10. )
540 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"
541 <<
"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"
542 <<
"Since the mismatch is at low Pt, it is ignored and only a warning is issued.\n"
543 <<
"\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.";
545 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"
546 <<
"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"
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.";
551 std::vector<fastjet::PseudoJet> constituents = inclusiveJets.at(reclusteredIndices.at(
i)).constituents();
554 for(std::vector<fastjet::PseudoJet>::const_iterator it = constituents.begin(); it != constituents.end(); ++it)
556 if( !it->has_user_info() )
continue;
558 clusteredSVs.at(
i).push_back( it->user_info<VertexInfo>().vertexIndex() );
565 std::auto_ptr<ConfigurableVertexReconstructor> vertexReco;
566 std::auto_ptr<GhostTrackVertexFinder> vertexRecoGT;
569 vtxRecoPSet.getParameter<
double>(
"maxFitChi2"),
570 vtxRecoPSet.getParameter<
double>(
"mergeThreshold"),
571 vtxRecoPSet.getParameter<
double>(
"primcut"),
572 vtxRecoPSet.getParameter<
double>(
"seccut"),
578 TransientTrackMap primariesMap;
582 std::auto_ptr<Product> tagInfos(
new Product);
584 for(
typename std::vector<IPTI>::const_iterator iterJets =
585 trackIPTagInfos->begin(); iterJets != trackIPTagInfos->end();
590 const Vertex &
pv = *iterJets->primaryVertex();
592 std::set<TransientTrack> primaries;
593 if (constraint == CONSTRAINT_PV_PRIMARIES_IN_FIT) {
596 TransientTrackMap::iterator pos =
597 primariesMap.lower_bound(
iter->get());
599 if (pos != primariesMap.end() &&
600 pos->first ==
iter->get())
601 primaries.insert(pos->second);
606 primariesMap.insert(pos,
607 std::make_pair(
iter->get(), track));
608 primaries.insert(track);
619 std::vector<std::size_t> indices =
620 iterJets->sortedIndexes(sortCriterium);
624 const std::vector<reco::btag::TrackIPData> &ipData =
625 iterJets->impactParameterData();
629 std::vector<TransientTrack> fitTracks;
630 std::vector<GhostTrackState> gtStates;
631 std::auto_ptr<GhostTrackPrediction> gtPred;
634 *iterJets->ghostTrack()));
636 for(
unsigned int i = 0;
i < indices.size();
i++) {
642 trackData.back().first = indices[
i];
649 trackData.back().second.svStatus =
654 TransientTrackMap::const_iterator pos =
657 if (pos != primariesMap.end()) {
658 primaries.erase(pos->second);
659 fitTrack = pos->second;
661 fitTrack = trackBuilder->build(trackRef);
662 fitTracks.push_back(fitTrack);
664 trackData.back().second.svStatus =
670 ipData[indices[
i]].closestToGhostTrack;
672 gtPred->lambda(pos));
673 gtState.
setWeight(ipData[indices[i]].ghostTrackWeight);
674 gtStates.push_back(gtState);
678 std::auto_ptr<GhostTrack> ghostTrack;
685 iterJets->ghostTrack()->px(),
686 iterJets->ghostTrack()->py(),
687 iterJets->ghostTrack()->pz()),
690 iterJets->ghostTrack()->chi2(),
691 iterJets->ghostTrack()->ndof()));
696 std::vector<VTX> extAssoCollection;
697 std::vector<TransientVertex> fittedSVs;
698 std::vector<SecondaryVertex> SVs;
701 case CONSTRAINT_NONE:
703 fittedSVs = vertexRecoGT->vertices(
706 fittedSVs = vertexReco->vertices(fitTracks);
709 case CONSTRAINT_BEAMSPOT:
711 fittedSVs = vertexRecoGT->vertices(
712 pv, *beamSpot, *ghostTrack);
714 fittedSVs = vertexReco->vertices(fitTracks,
718 case CONSTRAINT_PV_BEAMSPOT_SIZE:
719 case CONSTRAINT_PV_BS_Z_ERRORS_SCALED:
720 case CONSTRAINT_PV_ERROR_SCALED: {
722 for(
unsigned int i = 0;
i < 7;
i++) {
723 unsigned int covSrc = bsCovSrc[
i];
724 for(
unsigned int j = 0;
j < 7;
j++) {
726 if (!covSrc || bsCovSrc[
j] != covSrc)
728 else if (covSrc == 1)
729 v = beamSpot->covariance(
i,
j);
738 beamSpot.
isValid() ? beamSpot->dxdz() : 0.,
739 beamSpot.
isValid() ? beamSpot->dydz() : 0.,
743 fittedSVs = vertexRecoGT->vertices(
744 pv, bs, *ghostTrack);
746 fittedSVs = vertexReco->vertices(fitTracks, bs);
749 case CONSTRAINT_PV_PRIMARIES_IN_FIT: {
750 std::vector<TransientTrack> primaries_(
751 primaries.begin(), primaries.end());
753 fittedSVs = vertexRecoGT->vertices(
754 pv, *beamSpot, primaries_,
757 fittedSVs = vertexReco->vertices(
758 primaries_, fitTracks,
763 SVBuilder svBuilder(pv, jetDir, withPVError, minTrackWeight);
764 std::remove_copy_if(boost::make_transform_iterator(
765 fittedSVs.begin(), svBuilder),
766 boost::make_transform_iterator(
767 fittedSVs.end(), svBuilder),
768 std::back_inserter(SVs),
769 SVFilter(vertexFilter, pv, jetDir));
772 if( !useSVClustering ) {
773 for(
size_t iExtSv = 0; iExtSv < extSecVertex->size(); iExtSv++){
774 const VTX & extVertex = (*extSecVertex)[iExtSv];
777 extAssoCollection.push_back( extVertex );
782 size_t jetIdx = ( iterJets - trackIPTagInfos->begin() );
784 for(
size_t iExtSv = 0; iExtSv < clusteredSVs.at(jetIdx).size(); iExtSv++){
785 const VTX & extVertex = (*extSecVertex)[ clusteredSVs.at(jetIdx).at(iExtSv) ];
786 if( extVertex.p4().M() < 0.3 )
788 extAssoCollection.push_back( extVertex );
792 SVBuilder svBuilder(pv, jetDir, withPVError, minTrackWeight);
793 std::remove_copy_if(boost::make_transform_iterator( extAssoCollection.begin(), svBuilder),
794 boost::make_transform_iterator(extAssoCollection.end(), svBuilder),
795 std::back_inserter(SVs),
796 SVFilter(vertexFilter, pv, jetDir));
804 extAssoCollection.clear();
808 std::vector<unsigned int> vtxIndices = vertexSorting(SVs);
810 std::vector<typename TemplatedSecondaryVertexTagInfo<IPTI,VTX>::VertexData> svData;
812 svData.resize(vtxIndices.size());
813 for(
unsigned int idx = 0;
idx < vtxIndices.size();
idx++) {
816 svData[
idx].vertex = sv;
821 markUsedTracks(trackData,trackRefs,sv,
idx);
828 trackData, svData, SVs.size(),
830 iterJets - trackIPTagInfos->begin())));
841 if (sv.trackWeight(*
iter) < minTrackWeight)
844 typename input_container::const_iterator pos =
845 std::find(trackRefs.begin(), trackRefs.end(),
848 if (pos == trackRefs.end() ) {
851 <<
"Could not find track from secondary "
852 "vertex in original tracks."
855 unsigned int index = pos - trackRefs.begin();
856 trackData[
index].second.svStatus =
858 ((
unsigned int)btag::TrackData::trackAssociatedToVertex +
idx);
865 for(
typename input_container::const_iterator
iter = sv.daughterPtrVector().begin();
iter != sv.daughterPtrVector().end(); ++
iter)
867 typename input_container::const_iterator pos =
870 if (pos != trackRefs.end() )
872 unsigned int index = pos - trackRefs.begin();
873 trackData[
index].second.svStatus =
875 ((
unsigned int)btag::TrackData::trackAssociatedToVertex +
idx);
889 edm::LogError(
"UnexpectedInputs") <<
"Building from Candidates, should not happen!";
900 edm::LogError(
"UnexpectedInputs") <<
"Building from Tracks, should not happen!";
925 edm::LogError(
"DynamicCastingFailed") <<
"Casting of TransientTrack to CandidatePtrTransientTrack failed!";
932 vtxCompPtrCand.
setP4(p4);
939 template<
class IPTI,
class VTX>
940 template<
class CONTAINER>
942 const std::vector<fastjet::PseudoJet>& reclusteredJets,
943 std::vector<int>& matchedIndices,
948 std::vector<bool> matchedLocks(reclusteredJets.size(),
false);
950 for(
size_t j=0;
j<jets->size(); ++
j)
952 double matchedDR2 = 1e9;
955 for(
size_t rj=0; rj<reclusteredJets.size(); ++rj)
957 if( matchedLocks.at(rj) )
continue;
959 double tempDR2 =
Geom::deltaR2(
toJet(jets->at(
j))->rapidity(),
toJet(jets->at(
j))->
phi(), reclusteredJets.at(rj).rapidity(), reclusteredJets.at(rj).phi_std() );
960 if( tempDR2 < matchedDR2 )
962 matchedDR2 = tempDR2;
971 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"
972 <<
"This is not expected so please check that the jet algorithm and jet size match those used for the original " << type <<
"jet collection.";
975 matchedLocks.at(matchedIdx) =
true;
978 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.";
980 matchedIndices.push_back(matchedIdx);
985 template<
class IPTI,
class VTX>
988 std::vector<int>& matchedIndices)
990 std::vector<bool> jetLocks(
jets->size(),
false);
991 std::vector<int> jetIndices;
993 for(
size_t gj=0; gj<groomedJets->size(); ++gj)
995 double matchedDR2 = 1e9;
998 if( groomedJets->at(gj).pt()>0. )
1000 for(
size_t j=0;
j<
jets->size(); ++
j)
1002 if( jetLocks.at(
j) )
continue;
1004 double tempDR2 =
Geom::deltaR2(
jets->at(
j).rapidity(),
jets->at(
j).phi(), groomedJets->at(gj).rapidity(), groomedJets->at(gj).phi() );
1005 if( tempDR2 < matchedDR2 )
1007 matchedDR2 = tempDR2;
1017 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"
1018 <<
"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.";
1022 jetLocks.at(matchedIdx) =
true;
1024 jetIndices.push_back(matchedIdx);
1027 for(
size_t j=0;
j<
jets->size(); ++
j)
1029 std::vector<int>::iterator matchedIndex =
std::find( jetIndices.begin(), jetIndices.end(),
j );
1031 matchedIndices.push_back( matchedIndex != jetIndices.end() ? std::distance(jetIndices.begin(),matchedIndex) : -1 );
1036 template<
class IPTI,
class VTX>
1040 std::vector<std::vector<int> >& matchedIndices)
1042 for(
size_t g=0;
g<groomedIndices.size(); ++
g)
1044 std::vector<int> subjetIndices;
1046 if( groomedIndices.at(
g)>=0 )
1048 for(
size_t s=0;
s<groomedJets->at(groomedIndices.at(
g)).numberOfDaughters(); ++
s)
1052 for(
size_t sj=0; sj<subjets->size(); ++sj)
1057 subjetIndices.push_back(sj);
1063 if( subjetIndices.size() == 0 )
1064 edm::LogError(
"SubjetMatchingFailed") <<
"Matching subjets to original fat jets failed. Please check that the groomed fat jet and subjet collections belong to each other.";
1066 matchedIndices.push_back(subjetIndices);
1069 matchedIndices.push_back(subjetIndices);
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
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
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
double deltaR2(const T1 &t1, const T2 &t2)
VertexSorting< SecondaryVertex > vertexSorting
static ConstraintType getConstraintType(const std::string &name)
~TemplatedSecondaryVertexProducer()
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)
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.