CMS 3D CMS Logo

PFTauL1TJetsMatching.cc
Go to the documentation of this file.
2 #include "Math/GenVector/VectorUtil.h"
7 
8 //
9 // class declaration
10 //
12  tauSrc_ ( consumes<reco::PFTauCollection>(iConfig.getParameter<edm::InputTag>("TauSrc" ) ) ),
13  L1JetSrc_ ( consumes<trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<edm::InputTag>("L1JetSrc") ) ),
14  matchingR2_ ( iConfig.getParameter<double>("MatchingdR")*iConfig.getParameter<double>("MatchingdR") ),
15  minTauPt_ (iConfig.getParameter<double>("MinTauPt") ),
16  minL1TPt_ (iConfig.getParameter<double>("MinL1TPt") )
17 {
18  produces<reco::PFTauCollection>();
19 }
21 
23 {
24  std::unique_ptr<reco::PFTauCollection> L1TmatchedPFTau(new reco::PFTauCollection);
25 
27  iEvent.getByToken(tauSrc_, taus);
28 
30  iEvent.getByToken(L1JetSrc_,L1Jets);
31 
32  l1t::JetVectorRef jetCandRefVec;
33  L1Jets->getObjects(trigger::TriggerL1Jet,jetCandRefVec);
34 
35  /* Loop over taus that must pass a certain minTauPt_ cut */
36  /* then loop over L1T jets that must pass minL1TPt_ */
37  /* and check whether they match, if yes -> include the taus in */
38  /* the new L1T matched PFTau collection */
39 
40  for(unsigned int iTau = 0; iTau < taus->size(); iTau++){
41  bool isMatched = false;
42  if ((*taus)[iTau].pt() > minTauPt_){
43  for (unsigned int iJet = 0; iJet < jetCandRefVec.size(); iJet++) {
44  if (jetCandRefVec[iJet]->pt() > minL1TPt_){
45 
46  if(reco::deltaR2((*taus)[iTau].p4(), jetCandRefVec[iJet]->p4()) < matchingR2_){
47  isMatched = true;
48  break;
49  }
50  }
51  }
52  }
53  if(isMatched) L1TmatchedPFTau->push_back((*taus)[iTau]);
54  }
55  iEvent.put(std::move(L1TmatchedPFTau));
56 }
57 
59 {
61  desc.add<edm::InputTag>("L1JetSrc", edm::InputTag("hltL1VBFDiJetOR"))->setComment("Input filter objects passing L1 seed" );
62  desc.add<edm::InputTag>("TauSrc", edm::InputTag("hltSelectedPFTausTrackFindingLooseChargedIsolationAgainstMuon"))->setComment("Input collection of PFTaus");
63  desc.add<double> ("MatchingdR",0.5)->setComment("Maximum dR for matching between PFTaus and L1 filter jets");
64  desc.add<double> ("MinTauPt",20.0)->setComment("PFTaus above this pt will be considered");
65  desc.add<double> ("MinL1TPt",115.0)->setComment("L1T Objects above this pt will be considered");
66  descriptions.setComment("This module produces a collection of PFTaus matched to the leading jet passing the L1 seed filter.");
67  descriptions.add ("PFTauL1TJetsMatching",desc);
68 }
void setComment(std::string const &value)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::vector< JetRef > JetVectorRef
Definition: Jet.h:15
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > L1JetSrc_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:230
double p4[4]
Definition: TauolaWrapper.h:92
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
bool isMatched(TrackingRecHit const &hit)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void setComment(std::string const &value)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
void add(std::string const &label, ParameterSetDescription const &psetDescription)
PFTauL1TJetsMatching(const edm::ParameterSet &)
const edm::EDGetTokenT< reco::PFTauCollection > tauSrc_
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:510