CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1HLTJetsMatching.cc
Go to the documentation of this file.
2 #include "Math/GenVector/VectorUtil.h"
7 //
8 // class decleration
9 //
10 using namespace reco;
11 using namespace std;
12 using namespace edm;
13 using namespace l1extra;
14 
16  jetSrc = consumes<edm::View<reco::Candidate> >(iConfig.getParameter<InputTag>("JetSrc"));
17  tauTrigger = consumes<trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<InputTag>("L1TauTrigger"));
18  mEt_Min = iConfig.getParameter<double>("EtMin");
19 
20  produces<CaloJetCollection>();
21 }
22 
24 
26  using namespace edm;
27  using namespace std;
28  using namespace reco;
29  using namespace trigger;
30  using namespace l1extra;
31 
32  typedef std::vector<LeafCandidate> LeafCandidateCollection;
33 
34  unique_ptr<CaloJetCollection> tauL2jets(new CaloJetCollection);
35 
36  double deltaR = 1.0;
37  double matchingR = 0.5;
38  //Getting HLT jets to be matched
40  iEvent.getByToken(jetSrc, tauJets);
41 
42  // std::cout <<"Size of input jet collection "<<tauJets->size()<<std::endl;
43 
45  iEvent.getByToken(tauTrigger, l1TriggeredTaus);
46 
47  tauCandRefVec.clear();
48  jetCandRefVec.clear();
49 
50  l1TriggeredTaus->getObjects(trigger::TriggerL1TauJet, tauCandRefVec);
51  l1TriggeredTaus->getObjects(trigger::TriggerL1CenJet, jetCandRefVec);
52  math::XYZPoint a(0., 0., 0.);
54 
55  for (unsigned int iL1Tau = 0; iL1Tau < tauCandRefVec.size(); iL1Tau++) {
56  for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) {
57  //Find the relative L2TauJets, to see if it has been reconstructed
58  const Candidate& myJet = (*tauJets)[iJet];
59  deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
60  if (deltaR < matchingR) {
61  // LeafCandidate myLC(myJet);
62  CaloJet myCaloJet(myJet.p4(), a, f);
63  if (myJet.pt() > mEt_Min) {
64  // tauL2LC->push_back(myLC);
65  tauL2jets->push_back(myCaloJet);
66  }
67  break;
68  }
69  }
70  }
71 
72  for (unsigned int iL1Tau = 0; iL1Tau < jetCandRefVec.size(); iL1Tau++) {
73  for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) {
74  const Candidate& myJet = (*tauJets)[iJet];
75  //Find the relative L2TauJets, to see if it has been reconstructed
76  deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect());
77  if (deltaR < matchingR) {
78  // LeafCandidate myLC(myJet);
79  CaloJet myCaloJet(myJet.p4(), a, f);
80  if (myJet.pt() > mEt_Min) {
81  //tauL2LC->push_back(myLC);
82  tauL2jets->push_back(myCaloJet);
83  }
84  break;
85  }
86  }
87  }
88 
89  //std::cout <<"Size of L1HLT matched jets "<<tauL2jets->size()<<std::endl;
90 
91  iEvent.put(std::move(tauL2jets));
92  // iEvent.put(std::move(tauL2LC));
93 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
Jets made from CaloTowers.
Definition: CaloJet.h:27
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
virtual double pt() const =0
transverse momentum
void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
~L1HLTJetsMatching() override
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double a
Definition: hdecay.h:119
L1HLTJetsMatching(const edm::ParameterSet &)
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector