CMS 3D CMS Logo

HLTJetL1TMatchProducer.cc
Go to the documentation of this file.
1 #include <string>
2 
7 
12 
13 template <typename T>
15  jetsInput_ = iConfig.template getParameter<edm::InputTag>("jetsInput");
16  L1Jets_ = iConfig.template getParameter<edm::InputTag>("L1Jets");
17  DeltaR_ = iConfig.template getParameter<double>("DeltaR");
18 
19  typedef std::vector<T> TCollection;
20  m_theJetToken = consumes<TCollection>(jetsInput_);
21  m_theL1JetToken = consumes<l1t::JetBxCollection>(L1Jets_);
22  produces<TCollection>();
23 }
24 
25 template <typename T>
27 
28 template <typename T>
30 
31 template <typename T>
34  desc.add<edm::InputTag>("jetsInput", edm::InputTag("hltAntiKT5PFJets"));
35  desc.add<edm::InputTag>("L1Jets", edm::InputTag("hltCaloStage2Digis"));
36  desc.add<double>("DeltaR", 0.5);
37  descriptions.add(defaultModuleLabel<HLTJetL1TMatchProducer<T>>(), desc);
38 }
39 
40 template <typename T>
42  typedef std::vector<T> TCollection;
43 
45  iEvent.getByToken(m_theJetToken, jets);
46 
47  std::unique_ptr<TCollection> result(new TCollection);
48 
50  iEvent.getByToken(m_theL1JetToken, l1Jets);
51  bool trigger_bx_only = true; // selection of BX not implemented
52 
53  if (l1Jets.isValid()) {
54  typename TCollection::const_iterator jet_iter;
55  for (jet_iter = jets->begin(); jet_iter != jets->end(); ++jet_iter) {
56  bool isMatched = false;
57  for (int ibx = l1Jets->getFirstBX(); ibx <= l1Jets->getLastBX(); ++ibx) {
58  if (trigger_bx_only && (ibx != 0))
59  continue;
60  for (auto it = l1Jets->begin(ibx); it != l1Jets->end(ibx); it++) {
61  if (it->et() == 0)
62  continue; // if you don't care about L1T candidates with zero ET.
63  const double deltaeta = jet_iter->eta() - it->eta();
64  const double deltaphi = deltaPhi(jet_iter->phi(), it->phi());
65  if (sqrt(deltaeta * deltaeta + deltaphi * deltaphi) < DeltaR_)
66  isMatched = true;
67  //cout << "bx: " << ibx << " et: " << it->et() << " eta: " << it->eta() << " phi: " << it->phi() << "\n";
68  }
69  }
70  if (isMatched == true)
71  result->push_back(*jet_iter);
72  } // jet_iter
73  } else {
74  edm::LogWarning("MissingProduct") << "L1Upgrade l1Jets bx collection not found." << std::endl;
75  }
76 
77  iEvent.put(std::move(result));
78 }
defaultModuleLabel.h
ConfigurationDescriptions.h
HLTJetL1TMatchProducer.h
Handle.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
ESHandle.h
HLTJetL1TMatchProducer::beginJob
virtual void beginJob()
Definition: HLTJetL1TMatchProducer.cc:26
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLTJetL1TMatchProducer
Definition: HLTJetL1TMatchProducer.h:21
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
HLTJetL1TMatchProducer::~HLTJetL1TMatchProducer
~HLTJetL1TMatchProducer() override
BXVector::getFirstBX
int getFirstBX() const
HLTJetL1TMatchProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: HLTJetL1TMatchProducer.cc:41
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HLTJetL1TMatchProducer::HLTJetL1TMatchProducer
HLTJetL1TMatchProducer(const edm::ParameterSet &)
Definition: HLTJetL1TMatchProducer.cc:14
ParameterSetDescription.h
BXVector::begin
const_iterator begin(int bx) const
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::LogWarning
Definition: MessageLogger.h:141
trackerHitRTTI::isMatched
bool isMatched(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:32
BXVector::end
const_iterator end(int bx) const
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
defaultModuleLabel
std::string defaultModuleLabel()
Definition: defaultModuleLabel.h:16
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLTJetL1TMatchProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTJetL1TMatchProducer.cc:32
mps_fire.result
result
Definition: mps_fire.py:303
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
BXVector::getLastBX
int getLastBX() const
edm::InputTag
Definition: InputTag.h:15
deltaPhi.h