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.
13 
16 
17 #include<typeinfo>
18 #include<string>
19 
20 template<typename T>
22 {
23  jetsInput_ = iConfig.template getParameter<edm::InputTag>("jetsInput");
24  L1TauJets_ = iConfig.template getParameter<edm::InputTag>("L1TauJets");
25  L1CenJets_ = iConfig.template getParameter<edm::InputTag>("L1CenJets");
26  L1ForJets_ = iConfig.template getParameter<edm::InputTag>("L1ForJets");
27  DeltaR_ = iConfig.template getParameter<double>("DeltaR");
28 
29  typedef std::vector<T> TCollection;
30  produces<TCollection> ();
31 
32 }
33 
34 template<typename T>
36 {
37 
38 }
39 
40 template<typename T>
42 {
43 
44 }
45 
46 template<typename T>
49  desc.add<edm::InputTag>("jetsInput",edm::InputTag("hltAntiKT5PFJets"));
50  desc.add<edm::InputTag>("L1TauJets",edm::InputTag("hltL1extraParticles","Tau"));
51  desc.add<edm::InputTag>("L1CenJets",edm::InputTag("hltL1extraParticles","Central"));
52  desc.add<edm::InputTag>("L1ForJets",edm::InputTag("hltL1extraParticles","Forward"));
53  desc.add<double>("DeltaR",0.5);
54  descriptions.add(std::string("hlt")+std::string(typeid(HLTJetL1MatchProducer<T>).name()),desc);
55 }
56 
57 template<typename T>
59 {
60 
61  typedef std::vector<T> TCollection;
62 
64  iEvent.getByLabel(jetsInput_, jets);
65 
66  std::auto_ptr<TCollection> result (new TCollection);
67 
68 
70  iEvent.getByLabel(L1TauJets_,l1TauJets);
71 
73  iEvent.getByLabel(L1CenJets_,l1CenJets);
74 
76  iEvent.getByLabel(L1ForJets_,l1ForJets);
77 
78  typename TCollection::const_iterator jet_iter;
79  for (jet_iter = jets->begin(); jet_iter != jets->end(); ++jet_iter) {
80 
81  bool isMatched=false;
82 
83  //std::cout << "FL: l1TauJets.size = " << l1TauJets->size() << std::endl;
84  for (unsigned int jetc=0;jetc<l1TauJets->size();++jetc)
85  {
86  const double deltaeta=jet_iter->eta()-(*l1TauJets)[jetc].eta();
87  const double deltaphi=deltaPhi(jet_iter->phi(),(*l1TauJets)[jetc].phi());
88  //std::cout << "FL: sqrt(2) = " << sqrt(2) << std::endl;
89  if (sqrt(deltaeta*deltaeta+deltaphi*deltaphi) < DeltaR_) isMatched=true;
90  }
91 
92  for (unsigned int jetc=0;jetc<l1CenJets->size();++jetc)
93  {
94  const double deltaeta=jet_iter->eta()-(*l1CenJets)[jetc].eta();
95  const double deltaphi=deltaPhi(jet_iter->phi(),(*l1CenJets)[jetc].phi());
96  if (sqrt(deltaeta*deltaeta+deltaphi*deltaphi) < DeltaR_) isMatched=true;
97  }
98 
99  for (unsigned int jetc=0;jetc<l1ForJets->size();++jetc)
100  {
101  const double deltaeta=jet_iter->eta()-(*l1ForJets)[jetc].eta();
102  const double deltaphi=deltaPhi(jet_iter->phi(),(*l1ForJets)[jetc].phi());
103  if (sqrt(deltaeta*deltaeta+deltaphi*deltaphi) < DeltaR_) isMatched=true;
104  }
105 
106 
107  if (isMatched==true) result->push_back(*jet_iter);
108 
109  } // jet_iter
110 
111  iEvent.put( result);
112 
113 }
114 
115 
virtual void produce(edm::Event &, const edm::EventSetup &)
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:94
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)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
void add(std::string const &label, ParameterSetDescription const &psetDescription)