50 #include <boost/foreach.hpp> 61 enum Alg{useInputPV=0, useFontPV};
95 std::auto_ptr<StringCutObjectSelector<reco::PFTau> >
cut_;
100 PFTauTag_(iConfig.getParameter<
edm::
InputTag>(
"PFTauTag")),
101 PFTauToken_(consumes<
std::vector<
reco::
PFTau> >(PFTauTag_)),
102 ElectronTag_(iConfig.getParameter<
edm::
InputTag>(
"ElectronTag")),
104 MuonTag_(iConfig.getParameter<
edm::
InputTag>(
"MuonTag")),
105 MuonToken_(consumes<
std::vector<
reco::
Muon> >(MuonTag_)),
106 PVTag_(iConfig.getParameter<
edm::
InputTag>(
"PVTag")),
108 beamSpotTag_(iConfig.getParameter<
edm::
InputTag>(
"beamSpot")),
110 Algorithm_(iConfig.getParameter<
int>(
"Algorithm")),
111 qualityCutsPSet_(iConfig.getParameter<
edm::
ParameterSet>(
"qualityCuts")),
112 useBeamSpot_(iConfig.getParameter<
bool>(
"useBeamSpot")),
113 useSelectedTaus_(iConfig.getParameter<
bool>(
"useSelectedTaus")),
114 RemoveMuonTracks_(iConfig.getParameter<
bool>(
"RemoveMuonTracks")),
115 RemoveElectronTracks_(iConfig.getParameter<
bool>(
"RemoveElectronTracks"))
131 produces<edm::AssociationVector<PFTauRefProd, std::vector<reco::VertexRef> > >();
132 produces<VertexCollection>(
"PFTauPrimaryVertices");
160 auto AVPFTauPV = std::make_unique<edm::AssociationVector<PFTauRefProd, std::vector<reco::VertexRef>>>(
PFTauRefProd(Tau));
161 auto VertexCollection_out = std::make_unique<VertexCollection>();
191 bool passedDisc =
true;
193 else passedDisc = ((*disc->
discr_)[tau] > disc->
cut_);
194 if ( !passedDisc ){passed =
false;
break;}
196 if (passed &&
cut_.get()){passed = (*cut_)(*tau);}
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())));}
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");
void produce(edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
const reco::PFTauDiscriminator * discr_
DiscCutPairVec discriminators_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
~PFTauPrimaryVertexProducer() override
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
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::ParameterSet qualityCutsPSet_
PFTauPrimaryVertexProducer
edm::EDGetTokenT< reco::PFTauDiscriminator > inputToken_
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
std::vector< Track > TrackCollection
collection of Tracks
reco::TransientTrack build(const reco::Track *p) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
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::InputTag ElectronTag_
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_
std::vector< DiscCutPair * > DiscCutPairVec
PFTauPrimaryVertexProducer(const edm::ParameterSet &iConfig)
edm::InputTag beamSpotTag_
trackRef_iterator tracks_begin() const
first iterator over tracks
edm::EDGetTokenT< std::vector< reco::Electron > > ElectronToken_