24 algorithm_(iConfig.getParameter<
int>(
"Algorithm")),
25 qualityCutsPSet_(iConfig.getParameter<
edm::
ParameterSet>(
"qualityCuts")),
26 useBeamSpot_(iConfig.getParameter<
bool>(
"useBeamSpot")),
27 useSelectedTaus_(iConfig.getParameter<
bool>(
"useSelectedTaus")),
28 removeMuonTracks_(iConfig.getParameter<
bool>(
"RemoveMuonTracks")),
29 removeElectronTracks_(iConfig.getParameter<
bool>(
"RemoveElectronTracks")) {
32 iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"discriminators");
41 newCut->
cut_ =
pset.getParameter<
double>(
"selectionCut");
48 produces<edm::AssociationVector<reco::PFTauRefProd, std::vector<reco::VertexRef>>>();
49 produces<reco::VertexCollection>(
"PFTauPrimaryVertices");
101 auto avPFTauPV = std::make_unique<edm::AssociationVector<reco::PFTauRefProd, std::vector<reco::VertexRef>>>(
103 auto vertexCollection_out = std::make_unique<reco::VertexCollection>();
110 disc->discr_ = &(*discr);
133 bool passedDisc =
true;
134 if (
disc->cutFormula_)
135 passedDisc = (
disc->cutFormula_->Eval((*
disc->discr_)[
tau]) > 0.5);
153 for (
const auto&
pfcand : pfTauRef->signalChargedHadrCands()) {
164 if (
muons.isValid()) {
166 if (
muon.track().isNonnull())
177 if (
electron.gsfTrack().isNonnull())
184 std::vector<const reco::Track*> nonTauTracks;
190 std::vector<reco::TransientTrack> transTracks;
191 transTracks.reserve(nonTauTracks.size());
192 for (
const auto track : nonTauTracks) {
193 transTracks.push_back(transTrackBuilder.build(*
track));
196 if (transTracks.size() >= 2) {
200 transVtx = avf.
vertex(transTracks);
208 if (!std::isfinite(transVtx.
position().
z()))
217 vertexCollection_out->push_back(thePV);
218 avPFTauPV->setValue(iPFTau, vtxRef);
232 vpsd1.
add<
double>(
"selectionCut");
233 desc.addVPSet(
"discriminators", vpsd1);
241 desc.add<
int>(
"Algorithm", 0);
242 desc.add<
bool>(
"RemoveElectronTracks",
false);
243 desc.add<
bool>(
"RemoveMuonTracks",
false);
244 desc.add<
bool>(
"useBeamSpot",
true);
245 desc.add<
bool>(
"useSelectedTaus",
false);
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
reco::GsfTrackRef gsfTrackRef() const
T getParameter(std::string const &) const
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
GlobalPoint position() const
static void fillDescriptions(edm::ParameterSetDescription &descriptions)
Declare all parameters read from python config file.
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::EDGetTokenT< reco::VertexCollection > pvToken_
bool isNonnull() const
Checks for non-null.
std::vector< Vertex > VertexCollection
collection of Vertex objects
~PFTauPrimaryVertexProducerBase() override
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const override
std::vector< Vertex > VertexCollection
edm::RefProd< PFTauCollection > PFTauRefProd
references to PFTau collection
virtual void beginEvent(const edm::Event &, const edm::EventSetup &)
void setWeightThreshold(float w)
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transTrackBuilderToken_
bool isNonnull() const
Checks for non-null.
edm::EDGetTokenT< std::vector< reco::PFTau > > pftauToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer
bool removeElectronTracks_
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
std::unique_ptr< reco::tau::RecoTauVertexAssociator > vertexAssociator_
virtual void nonTauTracksInPV(const reco::VertexRef &, const std::vector< edm::Ptr< reco::TrackBase > > &, std::vector< const reco::Track *> &)=0
PFTauPrimaryVertexProducerBase(const edm::ParameterSet &iConfig)
static edm::ParameterSetDescription getDescriptionsBase()
Particle reconstructed by the particle flow algorithm.
DiscCutPairVec discriminators_
reco::TrackRef trackRef() const
void produce(edm::Event &, const edm::EventSetup &) override
std::unique_ptr< StringCutObjectSelector< reco::PFTau > > cut_
edm::ParameterSet qualityCutsPSet_
edm::EDGetTokenT< reco::PFTauDiscriminator > inputToken_
edm::EDGetTokenT< edm::View< reco::Electron > > electronToken_
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.