CMS 3D CMS Logo

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 = consumes<edm::View<reco::Candidate> >(iConfig.getParameter<InputTag>("JetSrc") );
18  tauTrigger = consumes<trigger::TriggerFilterObjectWithRefs>(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  unique_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.getByToken( jetSrc, tauJets );
44 
45  // std::cout <<"Size of input jet collection "<<tauJets->size()<<std::endl;
46 
48  iEvent.getByToken(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(std::move(tauL2jets));
101  // iEvent.put(std::move(tauL2LC));
102 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Jets made from CaloTowers.
Definition: CaloJet.h:29
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:230
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
~L1HLTJetsMatching() override
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
double f[11][100]
virtual double pt() const =0
transverse momentum
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
fixed size matrix
HLT enums.
double a
Definition: hdecay.h:121
L1HLTJetsMatching(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:510
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects