CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTJetL1MatchProducer.cc
Go to the documentation of this file.
5 
8 
9 #include<typeinfo>
10 #include<string>
11 
12 template<typename T>
14 {
15  jetsInput_ = iConfig.template getParameter<edm::InputTag>("jetsInput");
16  L1TauJets_ = iConfig.template getParameter<edm::InputTag>("L1TauJets");
17  L1CenJets_ = iConfig.template getParameter<edm::InputTag>("L1CenJets");
18  L1ForJets_ = iConfig.template getParameter<edm::InputTag>("L1ForJets");
19  DeltaR_ = iConfig.template getParameter<double>("DeltaR");
20 
21  typedef std::vector<T> TCollection;
22  m_theJetToken = consumes<TCollection>(jetsInput_);
23  m_theL1TauJetToken = consumes<l1extra::L1JetParticleCollection>(L1TauJets_);
24  m_theL1CenJetToken = consumes<l1extra::L1JetParticleCollection>(L1CenJets_);
25  m_theL1ForJetToken = consumes<l1extra::L1JetParticleCollection>(L1ForJets_);
26  produces<TCollection> ();
27 
28 }
29 
30 template<typename T>
32 {
33 
34 }
35 
36 template<typename T>
38 {
39 
40 }
41 
42 template<typename T>
45  desc.add<edm::InputTag>("jetsInput",edm::InputTag("hltAntiKT5PFJets"));
46  desc.add<edm::InputTag>("L1TauJets",edm::InputTag("hltL1extraParticles","Tau"));
47  desc.add<edm::InputTag>("L1CenJets",edm::InputTag("hltL1extraParticles","Central"));
48  desc.add<edm::InputTag>("L1ForJets",edm::InputTag("hltL1extraParticles","Forward"));
49  desc.add<double>("DeltaR",0.5);
50  descriptions.add(std::string("hlt")+std::string(typeid(HLTJetL1MatchProducer<T>).name()),desc);
51 }
52 
53 template<typename T>
55 {
56 
57  typedef std::vector<T> TCollection;
58 
60  iEvent.getByToken(m_theJetToken, jets);
61 
62  std::auto_ptr<TCollection> result (new TCollection);
63 
64 
66  iEvent.getByToken(m_theL1TauJetToken,l1TauJets);
67 
69  iEvent.getByToken(m_theL1CenJetToken,l1CenJets);
70 
72  iEvent.getByToken(m_theL1ForJetToken,l1ForJets);
73 
74  typename TCollection::const_iterator jet_iter;
75  for (jet_iter = jets->begin(); jet_iter != jets->end(); ++jet_iter) {
76 
77  bool isMatched=false;
78 
79  //std::cout << "FL: l1TauJets.size = " << l1TauJets->size() << std::endl;
80  for (unsigned int jetc=0;jetc<l1TauJets->size();++jetc)
81  {
82  const double deltaeta=jet_iter->eta()-(*l1TauJets)[jetc].eta();
83  const double deltaphi=deltaPhi(jet_iter->phi(),(*l1TauJets)[jetc].phi());
84  //std::cout << "FL: sqrt(2) = " << sqrt(2) << std::endl;
85  if (sqrt(deltaeta*deltaeta+deltaphi*deltaphi) < DeltaR_) isMatched=true;
86  }
87 
88  for (unsigned int jetc=0;jetc<l1CenJets->size();++jetc)
89  {
90  const double deltaeta=jet_iter->eta()-(*l1CenJets)[jetc].eta();
91  const double deltaphi=deltaPhi(jet_iter->phi(),(*l1CenJets)[jetc].phi());
92  if (sqrt(deltaeta*deltaeta+deltaphi*deltaphi) < DeltaR_) isMatched=true;
93  }
94 
95  for (unsigned int jetc=0;jetc<l1ForJets->size();++jetc)
96  {
97  const double deltaeta=jet_iter->eta()-(*l1ForJets)[jetc].eta();
98  const double deltaphi=deltaPhi(jet_iter->phi(),(*l1ForJets)[jetc].phi());
99  if (sqrt(deltaeta*deltaeta+deltaphi*deltaphi) < DeltaR_) isMatched=true;
100  }
101 
102 
103  if (isMatched==true) result->push_back(*jet_iter);
104 
105  } // jet_iter
106 
107  iEvent.put( result);
108 
109 }
110 
111 
virtual void produce(edm::Event &, const edm::EventSetup &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
T sqrt(T t)
Definition: SSEVec.h:48
vector< PseudoJet > jets
HLTJetL1MatchProducer(const edm::ParameterSet &)
tuple result
Definition: query.py:137
bool isMatched(TrackingRecHit const &hit)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)