50 #include <boost/foreach.hpp>
61 enum Alg{useInputPV=0, useFontPV};
97 std::auto_ptr<StringCutObjectSelector<reco::PFTau> >
cut_;
102 PFTauTag_(iConfig.getParameter<edm::
InputTag>(
"PFTauTag")),
103 PFTauToken_(consumes<std::vector<
reco::
PFTau> >(PFTauTag_)),
104 ElectronTag_(iConfig.getParameter<edm::
InputTag>(
"ElectronTag")),
105 ElectronToken_(consumes<std::vector<
reco::
Electron> >(ElectronTag_)),
106 MuonTag_(iConfig.getParameter<edm::
InputTag>(
"MuonTag")),
107 MuonToken_(consumes<std::vector<
reco::
Muon> >(MuonTag_)),
108 PVTag_(iConfig.getParameter<edm::
InputTag>(
"PVTag")),
110 beamSpotTag_(iConfig.getParameter<edm::
InputTag>(
"beamSpot")),
112 TrackCollectionTag_(iConfig.getParameter<edm::
InputTag>(
"TrackCollectionTag")),
114 Algorithm_(iConfig.getParameter<int>(
"Algorithm")),
115 qualityCutsPSet_(iConfig.getParameter<edm::
ParameterSet>(
"qualityCuts")),
116 useBeamSpot_(iConfig.getParameter<bool>(
"useBeamSpot")),
117 useSelectedTaus_(iConfig.getParameter<bool>(
"useSelectedTaus")),
118 RemoveMuonTracks_(iConfig.getParameter<bool>(
"RemoveMuonTracks")),
119 RemoveElectronTracks_(iConfig.getParameter<bool>(
"RemoveElectronTracks"))
135 produces<edm::AssociationVector<PFTauRefProd, std::vector<reco::VertexRef> > >();
136 produces<VertexCollection>(
"PFTauPrimaryVertices");
170 std::auto_ptr<VertexCollection> VertexCollection_out= std::auto_ptr<VertexCollection>(
new VertexCollection);
197 bool passedDisc =
true;
199 else passedDisc = ((*disc->
discr_)[tau] > disc->
cut_);
200 if ( !passedDisc ){passed =
false;
break;}
202 if (passed &&
cut_.get()){passed = (*cut_)(*tau);}
204 std::vector<reco::TrackBaseRef> SignalTracks;
210 const std::vector<edm::Ptr<reco::PFCandidate> > cands = RefPFTau->signalPFChargedHadrCands();
212 if(iter->get()->trackRef().isNonnull()) SignalTracks.push_back(
reco::TrackBaseRef(iter->get()->trackRef()));
213 else if(iter->get()->gsfTrackRef().isNonnull()){SignalTracks.push_back(
reco::TrackBaseRef(((iter)->
get()->gsfTrackRef())));}
254 for(std::vector<reco::TrackBaseRef>::const_iterator vtxTrkRef=thePV.
tracks_begin();vtxTrkRef<thePV.
tracks_end();vtxTrkRef++){
255 for (
unsigned int sigTrk = 0; sigTrk < SignalTracks.size(); sigTrk++) {
256 if((*vtxTrkRef)!=SignalTracks[sigTrk] ){
257 nonTauTracks.push_back(**vtxTrkRef);
264 std::vector<reco::TransientTrack> transTracks;
265 for (reco::TrackCollection::iterator iter=nonTauTracks.begin(); iter!=nonTauTracks.end(); ++iter){
266 transTracks.push_back(transTrackBuilder->build(*iter));
269 if ( transTracks.size() >= 3 ) {
274 transVtx = avf.
vertex(transTracks);
276 transVtx = avf.
vertex(transTracks, *beamSpot);
281 }
else FitOk =
false;
282 if ( FitOk ) thePV = transVtx;
285 VertexCollection_out->push_back(thePV);
286 AVPFTauPV->setValue(iPFTau, VRef);
289 iEvent.
put(VertexCollection_out,
"PFTauPrimaryVertices");
290 iEvent.
put(AVPFTauPV);
T getParameter(std::string const &) const
const reco::PFTauDiscriminator * discr_
DiscCutPairVec discriminators_
bool isNonnull() const
Checks for non-null.
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_
edm::EDGetTokenT< reco::PFTauDiscriminator > inputToken_
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
std::vector< Track > TrackCollection
collection of Tracks
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::RefProd< PFTauCollection > PFTauRefProd
references to PFTau collection
edm::EDGetTokenT< reco::VertexCollection > PVToken_
tuple PFTauPrimaryVertexProducer
void setWeightThreshold(float w)
edm::InputTag ElectronTag_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< std::vector< reco::Muon > > MuonToken_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::auto_ptr< tau::RecoTauVertexAssociator > vertexAssociator_
virtual CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const
edm::EDGetTokenT< reco::TrackCollection > TrackCollectionToken_
~PFTauPrimaryVertexProducer()
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
virtual void produce(edm::Event &, const edm::EventSetup &)
PFTauPrimaryVertexProducer(const edm::ParameterSet &iConfig)
edm::InputTag TrackCollectionTag_
edm::InputTag beamSpotTag_
trackRef_iterator tracks_begin() const
first iterator over tracks
edm::EDGetTokenT< std::vector< reco::Electron > > ElectronToken_