159 auto AVPFTauPV = std::make_unique<edm::AssociationVector<PFTauRefProd, std::vector<reco::VertexRef>>>(
PFTauRefProd(Tau));
160 auto VertexCollection_out = std::make_unique<VertexCollection>();
167 disc->discr_ = &(*discr);
188 for(
auto const&
disc : discriminators_) {
190 bool passedDisc =
true;
191 if (
disc->cutFormula_ )passedDisc = (
disc->cutFormula_->Eval((*
disc->discr_)[
tau]) > 0.5);
192 else passedDisc = ((*
disc->discr_)[
tau] >
disc->cut_);
193 if ( !passedDisc ){
passed =
false;
break;}
197 std::vector<reco::TrackBaseRef> SignalTracks;
203 const std::vector<edm::Ptr<reco::PFCandidate> >
cands = RefPFTau->signalPFChargedHadrCands();
205 if(iter->get()->trackRef().isNonnull()) SignalTracks.push_back(
reco::TrackBaseRef(iter->get()->trackRef()));
206 else if(iter->get()->gsfTrackRef().isNonnull()){SignalTracks.push_back(
reco::TrackBaseRef(((iter)->
get()->gsfTrackRef())));}
216 if(RefMuon->track().isNonnull()) SignalTracks.push_back(
reco::TrackBaseRef(RefMuon->track()));
225 if(RefElectron->track().isNonnull()) SignalTracks.push_back(
reco::TrackBaseRef(RefElectron->track()));
232 for(std::vector<reco::TrackBaseRef>::const_iterator vtxTrkRef=thePV.
tracks_begin();vtxTrkRef<thePV.
tracks_end();vtxTrkRef++){
234 for (
unsigned int sigTrk = 0; sigTrk < SignalTracks.size(); sigTrk++) {
235 if ( (*vtxTrkRef) == SignalTracks[sigTrk] ) {
239 if ( !matched ) nonTauTracks.push_back(**vtxTrkRef);
244 std::vector<reco::TransientTrack> transTracks;
245 for (reco::TrackCollection::iterator iter=nonTauTracks.begin(); iter!=nonTauTracks.end(); ++iter){
246 transTracks.push_back(transTrackBuilder->
build(*iter));
249 if ( transTracks.size() >= 2 ) {
254 transVtx = avf.
vertex(transTracks);
256 transVtx = avf.
vertex(transTracks, *beamSpot);
261 }
else FitOk =
false;
262 if ( FitOk ) thePV = transVtx;
265 VertexCollection_out->push_back(thePV);
266 AVPFTauPV->setValue(iPFTau, VRef);
269 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_
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
RefProd< PROD > getRefBeforePut()
bool RemoveElectronTracks_
std::unique_ptr< StringCutObjectSelector< reco::PFTau > > cut_
std::unique_ptr< tau::RecoTauVertexAssociator > vertexAssociator_
trackRef_iterator tracks_begin() const
first iterator over tracks
edm::EDGetTokenT< std::vector< reco::Electron > > ElectronToken_