160 auto AVPFTauPV = std::make_unique<edm::AssociationVector<PFTauRefProd, std::vector<reco::VertexRef>>>(
PFTauRefProd(Tau));
161 auto VertexCollection_out = std::make_unique<VertexCollection>();
168 disc->discr_ = &(*discr);
191 bool passedDisc =
true;
192 if ( disc->cutFormula_ )passedDisc = (disc->cutFormula_->Eval((*disc->discr_)[
tau]) > 0.5);
193 else passedDisc = ((*disc->discr_)[
tau] > disc->cut_);
194 if ( !passedDisc ){
passed =
false;
break;}
198 std::vector<reco::TrackBaseRef> SignalTracks;
204 const std::vector<edm::Ptr<reco::PFCandidate> >
cands = RefPFTau->signalPFChargedHadrCands();
206 if(iter->get()->trackRef().isNonnull()) SignalTracks.push_back(
reco::TrackBaseRef(iter->get()->trackRef()));
207 else if(iter->get()->gsfTrackRef().isNonnull()){SignalTracks.push_back(
reco::TrackBaseRef(((iter)->
get()->gsfTrackRef())));}
217 if(RefMuon->track().isNonnull()) SignalTracks.push_back(
reco::TrackBaseRef(RefMuon->track()));
226 if(RefElectron->track().isNonnull()) SignalTracks.push_back(
reco::TrackBaseRef(RefElectron->track()));
233 for(std::vector<reco::TrackBaseRef>::const_iterator vtxTrkRef=thePV.
tracks_begin();vtxTrkRef<thePV.
tracks_end();vtxTrkRef++){
235 for (
unsigned int sigTrk = 0; sigTrk < SignalTracks.size(); sigTrk++) {
236 if ( (*vtxTrkRef) == SignalTracks[sigTrk] ) {
240 if ( !matched ) nonTauTracks.push_back(**vtxTrkRef);
245 std::vector<reco::TransientTrack> transTracks;
246 for (reco::TrackCollection::iterator iter=nonTauTracks.begin(); iter!=nonTauTracks.end(); ++iter){
247 transTracks.push_back(transTrackBuilder->
build(*iter));
250 if ( transTracks.size() >= 2 ) {
255 transVtx = avf.
vertex(transTracks);
257 transVtx = avf.
vertex(transTracks, *beamSpot);
262 }
else FitOk =
false;
263 if ( FitOk ) thePV = transVtx;
266 VertexCollection_out->push_back(thePV);
267 AVPFTauPV->setValue(iPFTau, VRef);
270 iEvent.
put(
std::move(VertexCollection_out),
"PFTauPrimaryVertices");
DiscCutPairVec discriminators_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
trackRef_iterator tracks_end() const
last iterator over tracks
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
std::vector< Track > TrackCollection
collection of Tracks
reco::TransientTrack build(const reco::Track *p) const
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const override
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::RefProd< PFTauCollection > PFTauRefProd
references to PFTau collection
edm::EDGetTokenT< reco::VertexCollection > PVToken_
void setWeightThreshold(float w)
edm::EDGetTokenT< std::vector< reco::Muon > > MuonToken_
std::auto_ptr< tau::RecoTauVertexAssociator > vertexAssociator_
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
RefProd< PROD > getRefBeforePut()
bool RemoveElectronTracks_
std::auto_ptr< StringCutObjectSelector< reco::PFTau > > cut_
trackRef_iterator tracks_begin() const
first iterator over tracks
edm::EDGetTokenT< std::vector< reco::Electron > > ElectronToken_