43 linkToPackedPF_(iConfig.getParameter<
bool>(
"linkToPackedPFCandidates")),
45 iConfig.getParameter<
edm::
InputTag>(
"packedPFCandidates"))),
46 linkToLostTracks_(iConfig.getParameter<
bool>(
"linkToLostTracks")),
48 iConfig.getParameter<
edm::
InputTag>(
"lostTracks"))),
49 dropPiZeroRefs_(iConfig.exists(
"dropPiZeroRefs") ? iConfig.getParameter<
bool>(
"dropPiZeroRefs") :
true),
50 dropTauChargedHadronRefs_(
51 iConfig.exists(
"dropTauChargedHadronRefs") ? iConfig.getParameter<
bool>(
"dropTauChargedHadronRefs") :
true),
52 dropPFSpecific_(iConfig.exists(
"dropPFSpecific") ? iConfig.getParameter<
bool>(
"dropPFSpecific") :
true),
53 modifyTau_(iConfig.getParameter<
bool>(
"modifyTaus")) {
56 tauModifier_ = std::make_unique<pat::ObjectModifier<pat::Tau>>(mod_config, consumesCollector());
58 produces<std::vector<pat::Tau>>();
66 tauModifier_->setEventContent(iSetup);
73 iEvent.getByToken(pf2pc_, pf2pc);
76 if (linkToLostTracks_)
77 iEvent.getByToken(trk2lost_, trk2lost);
79 auto out = std::make_unique<std::vector<pat::Tau>>();
83 tauModifier_->setEvent(
iEvent);
91 tauModifier_->modify(
tau);
95 tau.isolations_.clear();
96 tau.isoDeposits_.clear();
98 if (linkToPackedPF_) {
105 tau.setSignalChargedHadrCands(signalChHPtrs);
110 tau.setSignalNeutralHadrCands(signalNHPtrs);
115 tau.setSignalGammaCands(signalGammaPtrs);
120 tau.setIsolationChargedHadrCands(isolationChHPtrs);
125 tau.setIsolationNeutralHadrCands(isolationNHPtrs);
130 tau.setIsolationGammaCands(isolationGammaPtrs);
132 if (linkToLostTracks_ && !
tau.signalTracks().empty()) {
133 std::vector<reco::CandidatePtr> signalLostTracks;
134 for (
const auto &trkRef :
tau.signalTracks()) {
135 const auto &lostCandRef = (*trk2lost)[
edm::refToPtr(trkRef)];
136 if (lostCandRef.isNonnull())
139 tau.setSignalLostTracks(signalLostTracks);
142 if (dropPiZeroRefs_) {
143 tau.pfSpecific_[0].signalPiZeroCandidates_.clear();
144 tau.pfSpecific_[0].isolationPiZeroCandidates_.clear();
146 if (dropTauChargedHadronRefs_) {
147 tau.pfSpecific_[0].signalTauChargedHadronCandidates_.clear();
148 tau.pfSpecific_[0].isolationTauChargedHadronCandidates_.clear();
150 if (dropPFSpecific_) {
151 tau.pfSpecific_.clear();
T getParameter(std::string const &) const
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
const bool linkToLostTracks_
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
void push_back(Ptr< T > const &iPtr)
std::vector< pat::PackedCandidate > PackedCandidateCollection
~PATTauSlimmer() override
const edm::EDGetTokenT< edm::View< pat::Tau > > src_
const bool dropPFSpecific_
const bool dropPiZeroRefs_
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > trk2lost_
PATTauSlimmer(const edm::ParameterSet &iConfig)
#define DEFINE_FWK_MODULE(type)
Analysis-level tau class.
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
const bool dropTauChargedHadronRefs_
const bool linkToPackedPF_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::unique_ptr< pat::ObjectModifier< pat::Tau > > tauModifier_