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);
186 }
else fitOK =
false;
187 if ( fitOK ) thePV = transVtx;
190 vertexCollection_out->push_back(thePV);
191 avPFTauPV->setValue(iPFTau, vtxRef);
194 iEvent.
put(
std::move(vertexCollection_out),
"PFTauPrimaryVertices");
205 vpsd1.
add<
double>(
"selectionCut");
206 desc.
addVPSet(
"discriminators", vpsd1);
211 pset_signalQualityCuts.
add<
double>(
"maxDeltaZ", 0.4);
212 pset_signalQualityCuts.
add<
double>(
"minTrackPt", 0.5);
213 pset_signalQualityCuts.
add<
double>(
"minTrackVertexWeight", -1.0);
214 pset_signalQualityCuts.
add<
double>(
"maxTrackChi2", 100.0);
215 pset_signalQualityCuts.
add<
unsigned int>(
"minTrackPixelHits", 0);
216 pset_signalQualityCuts.
add<
double>(
"minGammaEt", 1.0);
217 pset_signalQualityCuts.
add<
unsigned int>(
"minTrackHits", 3);
218 pset_signalQualityCuts.
add<
double>(
"minNeutralHadronEt", 30.0);
219 pset_signalQualityCuts.
add<
double>(
"maxTransverseImpactParameter", 0.1);
220 pset_signalQualityCuts.
addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
223 pset_vxAssocQualityCuts.
add<
double>(
"minTrackPt", 0.5);
224 pset_vxAssocQualityCuts.add<
double>(
"minTrackVertexWeight", -1.0);
225 pset_vxAssocQualityCuts.add<
double>(
"maxTrackChi2", 100.0);
226 pset_vxAssocQualityCuts.add<
unsigned int>(
"minTrackPixelHits", 0);
227 pset_vxAssocQualityCuts.add<
double>(
"minGammaEt", 1.0);
228 pset_vxAssocQualityCuts.add<
unsigned int>(
"minTrackHits", 3);
229 pset_vxAssocQualityCuts.add<
double>(
"maxTransverseImpactParameter", 0.1);
230 pset_vxAssocQualityCuts.addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
233 pset_isolationQualityCuts.
add<
double>(
"maxDeltaZ", 0.2);
234 pset_isolationQualityCuts.add<
double>(
"minTrackPt", 1.0);
235 pset_isolationQualityCuts.add<
double>(
"minTrackVertexWeight", -1.0);
236 pset_isolationQualityCuts.add<
double>(
"maxTrackChi2", 100.0);
237 pset_isolationQualityCuts.add<
unsigned int>(
"minTrackPixelHits", 0);
238 pset_isolationQualityCuts.add<
double>(
"minGammaEt", 1.5);
239 pset_isolationQualityCuts.add<
unsigned int>(
"minTrackHits", 8);
240 pset_isolationQualityCuts.add<
double>(
"maxTransverseImpactParameter", 0.03);
241 pset_isolationQualityCuts.addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
247 pset_qualityCuts.
add<
std::string>(
"leadingTrkOrPFCandOption",
"leadPFCand");
248 pset_qualityCuts.add<
std::string>(
"pvFindingAlgo",
"closestInDeltaZ");
250 pset_qualityCuts.add<
bool>(
"vertexTrackFiltering",
false);
251 pset_qualityCuts.add<
bool>(
"recoverLeadingTrk",
false);
257 desc.
add<
int>(
"Algorithm", 0);
258 desc.
add<
bool>(
"RemoveElectronTracks",
false);
259 desc.
add<
bool>(
"RemoveMuonTracks",
false);
260 desc.
add<
bool>(
"useBeamSpot",
true);
261 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)
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_