21 pftauToken_(consumes<
std::vector<
reco::
PFTau> >(iConfig.getParameter<
edm::InputTag>(
"PFTauTag"))),
23 muonToken_(consumes<
edm::
View<
reco::
Muon> >(iConfig.getParameter<
edm::InputTag>(
"MuonTag"))),
25 beamSpotToken_(consumes<
reco::
BeamSpot>(iConfig.getParameter<
edm::InputTag>(
"beamSpot"))),
26 algorithm_(iConfig.getParameter<
int>(
"Algorithm")),
27 qualityCutsPSet_(iConfig.getParameter<
edm::
ParameterSet>(
"qualityCuts")),
28 useBeamSpot_(iConfig.getParameter<
bool>(
"useBeamSpot")),
29 useSelectedTaus_(iConfig.getParameter<
bool>(
"useSelectedTaus")),
30 removeMuonTracks_(iConfig.getParameter<
bool>(
"RemoveMuonTracks")),
31 removeElectronTracks_(iConfig.getParameter<
bool>(
"RemoveElectronTracks"))
36 for(
auto const&
pset : discriminators) {
41 else newCut->
cut_ =
pset.getParameter<
double>(
"selectionCut");
47 produces<edm::AssociationVector<reco::PFTauRefProd, std::vector<reco::VertexRef> > >();
48 produces<reco::VertexCollection>(
"PFTauPrimaryVertices");
64 if (pCand && pCand->hasTrackDetails()) {
96 auto avPFTauPV = std::make_unique<edm::AssociationVector<reco::PFTauRefProd, std::vector<reco::VertexRef>>>(
reco::PFTauRefProd(pfTaus));
97 auto vertexCollection_out = std::make_unique<reco::VertexCollection>();
104 disc->discr_ = &(*discr);
126 for(
auto const&
disc : discriminators_) {
128 bool passedDisc =
true;
129 if (
disc->cutFormula_ )passedDisc = (
disc->cutFormula_->Eval((*
disc->discr_)[tau]) > 0.5);
130 else passedDisc = ((*
disc->discr_)[tau] >
disc->cut_);
131 if ( !passedDisc ){passed =
false;
break;}
133 if (passed &&
cut_.get()){passed = (*cut_)(*tau);}
135 std::vector<edm::Ptr<reco::TrackBase> > signalTracks;
141 for(
const auto&
pfcand : pfTauRef->signalChargedHadrCands()) {
142 if(
pfcand.isNull())
continue;
144 if(trackPtr.
isNonnull()) signalTracks.push_back(trackPtr);
151 for(
const auto&
muon: *muons){
159 for(
const auto&
electron: *electrons){
167 std::vector<const reco::Track*> nonTauTracks;
173 std::vector<reco::TransientTrack> transTracks;
174 for(
const auto track: nonTauTracks){
175 transTracks.push_back(transTrackBuilder->
build(*
track));
178 if ( transTracks.size() >= 2 ) {
182 transVtx = avf.
vertex(transTracks);
184 transVtx = avf.
vertex(transTracks, *beamSpot);
190 if (!std::isfinite(transVtx.
position().
z()))
193 }
else fitOK =
false;
194 if ( fitOK ) thePV = transVtx;
197 vertexCollection_out->push_back(thePV);
198 avPFTauPV->setValue(iPFTau, vtxRef);
201 iEvent.
put(
std::move(vertexCollection_out),
"PFTauPrimaryVertices");
212 vpsd1.
add<
double>(
"selectionCut");
213 desc.
addVPSet(
"discriminators", vpsd1);
218 pset_signalQualityCuts.
add<
double>(
"maxDeltaZ", 0.4);
219 pset_signalQualityCuts.
add<
double>(
"minTrackPt", 0.5);
220 pset_signalQualityCuts.
add<
double>(
"minTrackVertexWeight", -1.0);
221 pset_signalQualityCuts.
add<
double>(
"maxTrackChi2", 100.0);
222 pset_signalQualityCuts.
add<
unsigned int>(
"minTrackPixelHits", 0);
223 pset_signalQualityCuts.
add<
double>(
"minGammaEt", 1.0);
224 pset_signalQualityCuts.
add<
unsigned int>(
"minTrackHits", 3);
225 pset_signalQualityCuts.
add<
double>(
"minNeutralHadronEt", 30.0);
226 pset_signalQualityCuts.
add<
double>(
"maxTransverseImpactParameter", 0.1);
227 pset_signalQualityCuts.
addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
230 pset_vxAssocQualityCuts.
add<
double>(
"minTrackPt", 0.5);
231 pset_vxAssocQualityCuts.add<
double>(
"minTrackVertexWeight", -1.0);
232 pset_vxAssocQualityCuts.add<
double>(
"maxTrackChi2", 100.0);
233 pset_vxAssocQualityCuts.add<
unsigned int>(
"minTrackPixelHits", 0);
234 pset_vxAssocQualityCuts.add<
double>(
"minGammaEt", 1.0);
235 pset_vxAssocQualityCuts.add<
unsigned int>(
"minTrackHits", 3);
236 pset_vxAssocQualityCuts.add<
double>(
"maxTransverseImpactParameter", 0.1);
237 pset_vxAssocQualityCuts.addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
240 pset_isolationQualityCuts.
add<
double>(
"maxDeltaZ", 0.2);
241 pset_isolationQualityCuts.add<
double>(
"minTrackPt", 1.0);
242 pset_isolationQualityCuts.add<
double>(
"minTrackVertexWeight", -1.0);
243 pset_isolationQualityCuts.add<
double>(
"maxTrackChi2", 100.0);
244 pset_isolationQualityCuts.add<
unsigned int>(
"minTrackPixelHits", 0);
245 pset_isolationQualityCuts.add<
double>(
"minGammaEt", 1.5);
246 pset_isolationQualityCuts.add<
unsigned int>(
"minTrackHits", 8);
247 pset_isolationQualityCuts.add<
double>(
"maxTransverseImpactParameter", 0.03);
248 pset_isolationQualityCuts.addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
254 pset_qualityCuts.
add<
std::string>(
"leadingTrkOrPFCandOption",
"leadPFCand");
255 pset_qualityCuts.add<
std::string>(
"pvFindingAlgo",
"closestInDeltaZ");
257 pset_qualityCuts.add<
bool>(
"vertexTrackFiltering",
false);
258 pset_qualityCuts.add<
bool>(
"recoverLeadingTrk",
false);
264 desc.
add<
int>(
"Algorithm", 0);
265 desc.
add<
bool>(
"RemoveElectronTracks",
false);
266 desc.
add<
bool>(
"RemoveMuonTracks",
false);
267 desc.
add<
bool>(
"useBeamSpot",
true);
268 desc.
add<
bool>(
"useSelectedTaus",
false);
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
bool isNonnull() const
Checks for non-null.
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void nonTauTracksInPV(const reco::VertexRef &, const std::vector< edm::Ptr< reco::TrackBase > > &, std::vector< const reco::Track * > &)=0
edm::EDGetTokenT< reco::VertexCollection > pvToken_
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
~PFTauPrimaryVertexProducerBase() override
edm::RefProd< PFTauCollection > PFTauRefProd
references to PFTau collection
virtual void beginEvent(const edm::Event &, const edm::EventSetup &)
reco::TrackRef trackRef() const
void setWeightThreshold(float w)
GlobalPoint position() const
edm::EDGetTokenT< std::vector< reco::PFTau > > pftauToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
RefProd< PROD > getRefBeforePut()
bool isNonnull() const
Checks for non-null.
bool removeElectronTracks_
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
std::unique_ptr< reco::tau::RecoTauVertexAssociator > vertexAssociator_
PFTauPrimaryVertexProducerBase(const edm::ParameterSet &iConfig)
static edm::ParameterSetDescription getDescriptionsBase()
Particle reconstructed by the particle flow algorithm.
DiscCutPairVec discriminators_
reco::GsfTrackRef gsfTrackRef() 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_