CMS 3D CMS Logo

L1THLTTauMatching.cc
Go to the documentation of this file.
2 #include "Math/GenVector/VectorUtil.h"
7 
8 //
9 // class decleration
10 //
11 using namespace reco;
12 using namespace std;
13 using namespace edm;
14 using namespace trigger;
15 
17  : jetSrc(consumes<PFTauCollection>(iConfig.getParameter<InputTag>("JetSrc"))),
18  tauTrigger(consumes<trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<InputTag>("L1TauTrigger"))),
19  mEt_Min(iConfig.getParameter<double>("EtMin")),
20  reduceTauContent(iConfig.getParameter<bool>("ReduceTauContent")),
21  keepOriginalVertex(iConfig.getParameter<bool>("KeepOriginalVertex")) {
22  produces<PFTauCollection>();
23 }
25 
27  unique_ptr<PFTauCollection> tauL2jets(new PFTauCollection);
28 
29  double deltaR = 1.0;
30  double matchingR = 0.5;
31 
32  // Getting HLT jets to be matched
34  iEvent.getByToken(jetSrc, tauJets);
35 
37  iEvent.getByToken(tauTrigger, l1TriggeredTaus);
38 
39  l1t::TauVectorRef tauCandRefVec;
40  l1TriggeredTaus->getObjects(trigger::TriggerL1Tau, tauCandRefVec);
41 
42  math::XYZPoint a(0., 0., 0.);
43 
44  for (unsigned int iL1Tau = 0; iL1Tau < tauCandRefVec.size(); iL1Tau++) {
45  for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) {
46  // Find the relative L2TauJets, to see if it has been reconstructed
47  const PFTau& myJet = (*tauJets)[iJet];
48  deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
49  if (deltaR < matchingR) {
50  if (myJet.leadChargedHadrCand().isNonnull()) {
51  a = myJet.leadChargedHadrCand()->vertex();
52  }
53 
54  auto myPFTau =
55  reduceTauContent ? PFTau(std::numeric_limits<int>::quiet_NaN(), myJet.p4(), myJet.vertex()) : PFTau(myJet);
56 
57  if (!keepOriginalVertex) {
58  myPFTau.setVertex(a);
59  }
60 
61  if (myPFTau.pt() > mEt_Min) {
62  tauL2jets->push_back(myJet);
63  }
64  break;
65  }
66  }
67  }
68 
69  iEvent.put(std::move(tauL2jets));
70 }
71 
74  desc.add<edm::InputTag>("L1TauTrigger", edm::InputTag("hltL1sDoubleIsoTau40er"))
75  ->setComment("Name of trigger filter");
76  desc.add<edm::InputTag>("JetSrc", edm::InputTag("hltSelectedPFTausTrackPt1MediumIsolationReg"))
77  ->setComment("Input collection of PFTaus");
78  desc.add<double>("EtMin", 0.0)->setComment("Minimal pT of PFTau to match");
79  desc.add<bool>("ReduceTauContent", true)->setComment("Should produce taus with reduced content (Only p4 and vertex)");
80  desc.add<bool>("KeepOriginalVertex", false)
81  ->setComment("Should use original vertex instead of setting the vertex to that of the leading charged hadron");
82  descriptions.setComment("This module produces collection of PFTaus matched to L1 Taus / Jets passing a HLT filter.");
83  descriptions.add("L1THLTTauMatching", desc);
84 }
85 
const edm::EDGetTokenT< reco::PFTauCollection > jetSrc
~L1THLTTauMatching() override
L1THLTTauMatching(const edm::ParameterSet &)
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
const CandidatePtr & leadChargedHadrCand() const
Definition: PFTau.cc:63
const Point & vertex() const override
vertex position (overwritten by PF...)
const LorentzVector & p4() const final
four-momentum Lorentz vector
const bool keepOriginalVertex
int iEvent
Definition: GenABIO.cc:224
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tauTrigger
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
std::vector< TauRef > TauVectorRef
Definition: Tau.h:14
virtual const Point & vertex() const =0
vertex position
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const double mEt_Min
void setComment(std::string const &value)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const bool reduceTauContent
fixed size matrix
HLT enums.
double a
Definition: hdecay.h:119
def move(src, dest)
Definition: eostools.py:511