File indexing completed on 2024-04-06 12:27:46
0001 #ifndef RecoTauTag_RecoTau_PFTauPrimaryVertexProducerBase_H_
0002 #define RecoTauTag_RecoTau_PFTauPrimaryVertexProducerBase_H_
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/Framework/interface/Frameworkfwd.h"
0017 #include "FWCore/Framework/interface/stream/EDProducer.h"
0018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0019 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0020
0021 #include "DataFormats/TauReco/interface/PFTau.h"
0022 #include "DataFormats/TauReco/interface/PFTauFwd.h"
0023 #include "DataFormats/MuonReco/interface/Muon.h"
0024 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0025 #include "DataFormats/EgammaCandidates/interface/Electron.h"
0026 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
0027 #include "DataFormats/VertexReco/interface/Vertex.h"
0028 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0029 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0030 #include "DataFormats/TrackReco/interface/Track.h"
0031 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0032
0033 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
0034 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
0035
0036 #include "DataFormats/TauReco/interface/PFTauDiscriminator.h"
0037 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0038 #include "RecoTauTag/RecoTau/interface/RecoTauVertexAssociator.h"
0039 #include "RecoTauTag/RecoTau/interface/RecoTauQualityCuts.h"
0040
0041 #include <TFormula.h>
0042
0043 class PFTauPrimaryVertexProducerBase : public edm::stream::EDProducer<> {
0044 public:
0045 enum Alg { useInputPV = 0, useFrontPV };
0046
0047 struct DiscCutPair {
0048 DiscCutPair() : discr_(nullptr), cutFormula_(nullptr) {}
0049 ~DiscCutPair() { delete cutFormula_; }
0050 const reco::PFTauDiscriminator* discr_;
0051 edm::EDGetTokenT<reco::PFTauDiscriminator> inputToken_;
0052 double cut_;
0053 TFormula* cutFormula_;
0054 };
0055 typedef std::vector<DiscCutPair*> DiscCutPairVec;
0056
0057 explicit PFTauPrimaryVertexProducerBase(const edm::ParameterSet& iConfig);
0058 ~PFTauPrimaryVertexProducerBase() override;
0059 void produce(edm::Event&, const edm::EventSetup&) override;
0060
0061 static edm::ParameterSetDescription getDescriptionsBase();
0062
0063
0064 virtual void beginEvent(const edm::Event&, const edm::EventSetup&) {}
0065
0066 protected:
0067
0068 virtual void nonTauTracksInPV(const reco::VertexRef&,
0069 const std::vector<edm::Ptr<reco::TrackBase> >&,
0070 std::vector<const reco::Track*>&) = 0;
0071
0072 private:
0073 edm::EDGetTokenT<std::vector<reco::PFTau> > pftauToken_;
0074 edm::EDGetTokenT<edm::View<reco::Electron> > electronToken_;
0075 edm::EDGetTokenT<edm::View<reco::Muon> > muonToken_;
0076 edm::EDGetTokenT<reco::VertexCollection> pvToken_;
0077 edm::EDGetTokenT<reco::BeamSpot> beamSpotToken_;
0078 edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> transTrackBuilderToken_;
0079 int algorithm_;
0080 edm::ParameterSet qualityCutsPSet_;
0081 bool useBeamSpot_;
0082 bool useSelectedTaus_;
0083 bool removeMuonTracks_;
0084 bool removeElectronTracks_;
0085 DiscCutPairVec discriminators_;
0086 std::unique_ptr<StringCutObjectSelector<reco::PFTau> > cut_;
0087 std::unique_ptr<reco::tau::RecoTauVertexAssociator> vertexAssociator_;
0088 };
0089
0090 #endif