CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 {
17  jetSrc = iConfig.getParameter<InputTag>("JetSrc");
18  tauTrigger = iConfig.getParameter<InputTag>("L1TauTrigger");
19  mEt_Min = iConfig.getParameter<double>("EtMin");
20 
21  produces<CaloJetCollection>();
22 }
23 
25 
27 {
28 
29  using namespace edm;
30  using namespace std;
31  using namespace reco;
32  using namespace trigger;
33  using namespace l1extra;
34 
35  typedef std::vector<LeafCandidate> LeafCandidateCollection;
36 
37  auto_ptr<CaloJetCollection> tauL2jets(new CaloJetCollection);
38 
39  double deltaR = 1.0;
40  double matchingR = 0.5;
41  //Getting HLT jets to be matched
43  iEvent.getByLabel( jetSrc, tauJets );
44 
45 // std::cout <<"Size of input jet collection "<<tauJets->size()<<std::endl;
46 
48  iEvent.getByLabel(tauTrigger,l1TriggeredTaus);
49 
50 
51  tauCandRefVec.clear();
52  jetCandRefVec.clear();
53 
54  l1TriggeredTaus->getObjects( trigger::TriggerL1TauJet,tauCandRefVec);
55  l1TriggeredTaus->getObjects( trigger::TriggerL1CenJet,jetCandRefVec);
56  math::XYZPoint a(0.,0.,0.);
58 
59  for( unsigned int iL1Tau=0; iL1Tau <tauCandRefVec.size();iL1Tau++)
60  {
61  for(unsigned int iJet=0;iJet<tauJets->size();iJet++)
62  {
63  //Find the relative L2TauJets, to see if it has been reconstructed
64  const Candidate & myJet = (*tauJets)[iJet];
65  deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
66  if(deltaR < matchingR ) {
67  // LeafCandidate myLC(myJet);
68  CaloJet myCaloJet(myJet.p4(),a,f);
69  if(myJet.pt() > mEt_Min) {
70  // tauL2LC->push_back(myLC);
71  tauL2jets->push_back(myCaloJet);
72  }
73  break;
74  }
75  }
76  }
77 
78  for(unsigned int iL1Tau=0; iL1Tau <jetCandRefVec.size();iL1Tau++)
79  {
80  for(unsigned int iJet=0;iJet<tauJets->size();iJet++)
81  {
82  const Candidate & myJet = (*tauJets)[iJet];
83  //Find the relative L2TauJets, to see if it has been reconstructed
84  deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect());
85  if(deltaR < matchingR ) {
86  // LeafCandidate myLC(myJet);
87  CaloJet myCaloJet(myJet.p4(),a,f);
88  if(myJet.pt() > mEt_Min) {
89  //tauL2LC->push_back(myLC);
90  tauL2jets->push_back(myCaloJet);
91  }
92  break;
93  }
94  }
95  }
96 
97 
98 //std::cout <<"Size of L1HLT matched jets "<<tauL2jets->size()<<std::endl;
99 
100 iEvent.put(tauL2jets);
101 // iEvent.put(tauL2LC);
102 }
T getParameter(std::string const &) const
Jets made from CaloTowers.
Definition: CaloJet.h:30
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual float pt() const =0
transverse momentum
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
double f[11][100]
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
double a
Definition: hdecay.h:121
L1HLTJetsMatching(const edm::ParameterSet &)
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector