CMS 3D CMS Logo

SeedingRegionByL1.cc
Go to the documentation of this file.
1 /*
2  Author: Swagata Mukherjee
3 
4  Date: Feb 2021
5 
6  TICL is currently seeded by tracks, or just globally.
7  Here, adding option to seed TICL by L1 e/gamma objects (L1 TkEm).
8  This is expected to be useful for CPU timing at the HLT.
9 */
10 
11 #include "SeedingRegionByL1.h"
12 
13 #include <algorithm>
14 #include <set>
15 #include <vector>
16 
18 
20  : SeedingRegionAlgoBase(conf, sumes),
21  l1TkEmsToken_(sumes.consumes<std::vector<l1t::TkEm>>(conf.getParameter<edm::InputTag>("l1TkEmColl"))),
22  algoVerbosity_(conf.getParameter<int>("algo_verbosity")),
23  minPt_(conf.getParameter<double>("minPt")),
24  minAbsEta_(conf.getParameter<double>("minAbsEta")),
25  maxAbsEta_(conf.getParameter<double>("maxAbsEta")),
26  endcapScalings_(conf.getParameter<std::vector<double>>("endcapScalings")),
27  quality_(conf.getParameter<int>("quality")),
28  qualityIsMask_(conf.getParameter<bool>("qualityIsMask")),
29  applyQuality_(conf.getParameter<bool>("applyQuality")) {}
30 
32  const edm::EventSetup &es,
33  std::vector<TICLSeedingRegion> &result) {
34  auto l1TrkEms = ev.getHandle(l1TkEmsToken_);
35  edm::ProductID l1tkemsId = l1TrkEms.id();
36 
37  for (size_t indx = 0; indx < (*l1TrkEms).size(); indx++) {
38  const auto &l1TrkEm = (*l1TrkEms)[indx];
39  double offlinePt = this->tkEmOfflineEt(l1TrkEm.pt());
40  bool passQuality(false);
41 
42  if (applyQuality_) {
43  if (qualityIsMask_) {
44  passQuality = (l1TrkEm.hwQual() & quality_);
45  } else {
46  passQuality = (l1TrkEm.hwQual() == quality_);
47  }
48  } else {
49  passQuality = true;
50  }
51 
52  if ((offlinePt < minPt_) || (std::abs(l1TrkEm.eta()) < minAbsEta_) || (std::abs(l1TrkEm.eta()) > maxAbsEta_) ||
53  !passQuality) {
54  continue;
55  }
56 
57  int iSide = int(l1TrkEm.eta() > 0);
58  result.emplace_back(GlobalPoint(l1TrkEm.p4().X(), l1TrkEm.p4().Y(), l1TrkEm.p4().Z()),
59  GlobalVector(l1TrkEm.px(), l1TrkEm.py(), l1TrkEm.pz()),
60  iSide,
61  indx,
62  l1tkemsId);
63  }
64 
65  std::sort(result.begin(), result.end(), [](const TICLSeedingRegion &a, const TICLSeedingRegion &b) {
66  return a.directionAtOrigin.perp2() > b.directionAtOrigin.perp2();
67  });
68 }
69 
71  return (endcapScalings_.at(0) + et * endcapScalings_.at(1) + et * et * endcapScalings_.at(2));
72 }
73 
75  desc.add<edm::InputTag>("l1TkEmColl", edm::InputTag("L1TkPhotonsHGC", "EG"));
76  desc.add<double>("minPt", 10);
77  desc.add<double>("minAbsEta", 1.479);
78  desc.add<double>("maxAbsEta", 4.0);
79  desc.add<std::vector<double>>("endcapScalings", {3.17445, 1.13219, 0.0});
80  desc.add<int>("quality", 5);
81  desc.add<bool>("qualityIsMask", false);
82  desc.add<bool>("applyQuality", false);
84 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
static void fillPSetDescription(edm::ParameterSetDescription &desc)
delete x;
Definition: CaloConfig.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
SeedingRegionByL1(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
ProductIndex id() const
Definition: ProductID.h:35
void makeRegions(const edm::Event &ev, const edm::EventSetup &es, std::vector< TICLSeedingRegion > &result) override
double tkEmOfflineEt(double et) const
double b
Definition: hdecay.h:120
HLT enums.
double a
Definition: hdecay.h:121
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Global3DVector GlobalVector
Definition: GlobalVector.h:10