CMS 3D CMS Logo

PFJetsTauOverlapRemoval.cc
Go to the documentation of this file.
2 #include "Math/GenVector/VectorUtil.h"
7 
8 //
9 // class declaration
10 //
12  : tauSrc_(consumes<trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<edm::InputTag>("TauSrc"))),
13  pfJetSrc_(consumes<reco::PFJetCollection>(iConfig.getParameter<edm::InputTag>("PFJetSrc"))),
14  matchingR2_(iConfig.getParameter<double>("Min_dR") * iConfig.getParameter<double>("Min_dR")) {
15  produces<reco::PFJetCollection>();
16 }
18 
20  std::unique_ptr<reco::PFJetCollection> cleanedPFJets(new reco::PFJetCollection);
21 
23  iEvent.getByToken(tauSrc_, tauJets);
24 
26  iEvent.getByToken(pfJetSrc_, PFJets);
27 
30 
31  if (PFJets->size() > 1) {
32  for (unsigned int iJet = 0; iJet < PFJets->size(); iJet++) {
33  bool isMatched = false;
34  const reco::PFJet& myPFJet = (*PFJets)[iJet];
35  for (unsigned int iTau = 0; iTau < taus.size(); iTau++) {
36  if (reco::deltaR2(taus[iTau]->p4(), myPFJet.p4()) < matchingR2_) {
37  isMatched = true;
38  break;
39  }
40  }
41  if (isMatched == false)
42  cleanedPFJets->push_back(myPFJet);
43  }
44  }
45  iEvent.put(std::move(cleanedPFJets));
46 }
47 
50  desc.add<edm::InputTag>("PFJetSrc", edm::InputTag("hltAK4PFJetsCorrected"))->setComment("Input collection of PFJets");
51  desc.add<edm::InputTag>("TauSrc", edm::InputTag("hltSinglePFTau20TrackPt1LooseChargedIsolationReg"))
52  ->setComment("Input collection of PFTaus that have passed ID and isolation requirements");
53  desc.add<double>("Min_dR", 0.5)->setComment("Minimum dR outside of which PFJets will be saved");
54  descriptions.setComment(
55  "This module produces a collection of PFJets that are cross-cleaned with respect to PFTaus passing a HLT "
56  "filter.");
57  descriptions.add("PFJetsTauOverlapRemoval", desc);
58 }
edm::StreamID
Definition: StreamID.h:30
Tau3MuMonitor_cff.taus
taus
Definition: Tau3MuMonitor_cff.py:7
edm
HLT enums.
Definition: AlignableModifier.h:19
trigger::TriggerTau
Definition: TriggerTypeDefs.h:80
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TriggerTypeDefs.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle< trigger::TriggerFilterObjectWithRefs >
PFJetsTauOverlapRemoval.h
trigger::TriggerRefsCollections::getObjects
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Definition: TriggerRefsCollections.h:590
EDMException.h
PFJetsTauOverlapRemoval::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: PFJetsTauOverlapRemoval.cc:19
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PFJetsTauOverlapRemoval::PFJetsTauOverlapRemoval
PFJetsTauOverlapRemoval(const edm::ParameterSet &)
Definition: PFJetsTauOverlapRemoval.cc:11
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
JetHTJetPlusHOFilter_cff.PFJets
PFJets
Definition: JetHTJetPlusHOFilter_cff.py:5
trackerHitRTTI::isMatched
bool isMatched(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:33
edm::ParameterSet
Definition: ParameterSet.h:47
PFJetsTauOverlapRemoval::pfJetSrc_
const edm::EDGetTokenT< reco::PFJetCollection > pfJetSrc_
Definition: PFJetsTauOverlapRemoval.h:23
deltaR.h
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
edm::ConfigurationDescriptions::setComment
void setComment(std::string const &value)
Definition: ConfigurationDescriptions.cc:48
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
p4
double p4[4]
Definition: TauolaWrapper.h:92
PFJetsTauOverlapRemoval::tauSrc_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tauSrc_
Definition: PFJetsTauOverlapRemoval.h:22
edm::EventSetup
Definition: EventSetup.h:58
PFJetsTauOverlapRemoval::~PFJetsTauOverlapRemoval
~PFJetsTauOverlapRemoval() override
Definition: PFJetsTauOverlapRemoval.cc:17
PFJetsTauOverlapRemoval::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PFJetsTauOverlapRemoval.cc:48
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
reco::PFJetCollection
std::vector< PFJet > PFJetCollection
collection of PFJet objects
Definition: PFJetCollection.h:14
PFJetsTauOverlapRemoval::matchingR2_
const double matchingR2_
Definition: PFJetsTauOverlapRemoval.h:24
PFTau.h
reco::PFJet
Jets made from PFObjects.
Definition: PFJet.h:20
trigger
Definition: HLTPrescaleTableCond.h:8
trigger::VRpftau
std::vector< reco::PFTauRef > VRpftau
Definition: TriggerRefsCollections.h:98
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15