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  l1GTCandsToken_(sumes.consumes<l1t::P2GTCandidateCollection>(conf.getParameter<edm::InputTag>("l1GTCandColl"))),
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  quality_(conf.getParameter<int>("quality")),
27  qualityIsMask_(conf.getParameter<bool>("qualityIsMask")),
28  applyQuality_(conf.getParameter<bool>("applyQuality")) {}
29 
31  const edm::EventSetup &es,
32  std::vector<TICLSeedingRegion> &result) {
33  auto l1GTCands = ev.getHandle(l1GTCandsToken_);
34  edm::ProductID l1gtcandsId = l1GTCands.id();
35 
36  for (size_t indx = 0; indx < (*l1GTCands).size(); indx++) {
37  const auto &l1GTCand = (*l1GTCands)[indx];
38  double offlinePt = l1GTCand.pt();
39  bool passQuality(false);
40 
41  if (applyQuality_) {
42  if (qualityIsMask_) {
43  passQuality = (l1GTCand.hwQualityFlags() & quality_);
44  } else {
45  passQuality = (l1GTCand.hwQualityFlags() == quality_);
46  }
47  } else {
48  passQuality = true;
49  }
50 
51  if ((offlinePt < minPt_) || (std::abs(l1GTCand.eta()) < minAbsEta_) || (std::abs(l1GTCand.eta()) > maxAbsEta_) ||
52  !passQuality) {
53  continue;
54  }
55 
56  int iSide = int(l1GTCand.eta() > 0);
57  result.emplace_back(GlobalPoint(l1GTCand.p4().X(), l1GTCand.p4().Y(), l1GTCand.p4().Z()),
58  GlobalVector(l1GTCand.px(), l1GTCand.py(), l1GTCand.pz()),
59  iSide,
60  indx,
61  l1gtcandsId);
62  }
63 
64  std::sort(result.begin(), result.end(), [](const TICLSeedingRegion &a, const TICLSeedingRegion &b) {
65  return a.directionAtOrigin.perp2() > b.directionAtOrigin.perp2();
66  });
67 }
68 
70  desc.add<edm::InputTag>("l1GTCandColl", edm::InputTag("L1TkPhotonsHGC", "EG"));
71  desc.add<double>("minPt", 10);
72  desc.add<double>("minAbsEta", 1.479);
73  desc.add<double>("maxAbsEta", 4.0);
74  desc.add<int>("quality", 5);
75  desc.add<bool>("qualityIsMask", false);
76  desc.add<bool>("applyQuality", false);
78 }
std::vector< P2GTCandidate > P2GTCandidateCollection
Definition: P2GTCandidate.h:16
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 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