CMS 3D CMS Logo

SeedingRegionByHF.cc
Go to the documentation of this file.
1 #include <algorithm>
2 #include <set>
3 #include <vector>
4 
5 #include "SeedingRegionByHF.h"
6 
7 using namespace ticl;
8 
10  : SeedingRegionAlgoBase(conf, sumes),
11  hfhits_token_(sumes.consumes<HFRecHitCollection>(conf.getParameter<edm::InputTag>("hits"))),
12  minAbsEta_(conf.getParameter<double>("minAbsEta")),
13  maxAbsEta_(conf.getParameter<double>("maxAbsEta")),
14  minEt_(conf.getParameter<double>("minEt")) {
16 }
17 
19 
21 
23  const edm::EventSetup &es,
24  std::vector<TICLSeedingRegion> &result) {
25  const auto &recHits = ev.get(hfhits_token_);
26 
27  for (const auto &erh : recHits) {
28  const HcalDetId &detid = (HcalDetId)erh.detid();
29  if (erh.energy() < minEt_)
30  continue;
31 
32  const GlobalPoint &globalPosition =
34  auto eta = globalPosition.eta();
35 
37  continue;
38 
39  int iSide = int(eta > 0);
40  int idx = 0;
41  edm::ProductID hfSeedId = edm::ProductID(detid.rawId());
42 
43  auto phi = globalPosition.phi();
44  double theta = 2 * atan(exp(eta));
45  result.emplace_back(
46  globalPosition, GlobalVector(GlobalVector::Polar(theta, phi, erh.energy())), iSide, idx, hfSeedId);
47  }
48 
49  // sorting seeding region by descending momentum
50  std::sort(result.begin(), result.end(), [](const TICLSeedingRegion &a, const TICLSeedingRegion &b) {
51  return a.directionAtOrigin.perp2() > b.directionAtOrigin.perp2();
52  });
53 }
54 
56  desc.add<edm::InputTag>("hits", edm::InputTag("hfreco"));
57  desc.add<int>("algo_verbosity", 0);
58  desc.add<double>("minAbsEta", 3.0);
59  desc.add<double>("maxAbsEta", 4.0);
60  desc.add<double>("minEt", 5);
62 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
SeedingRegionByHF(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
T eta() const
Definition: PV3DBase.h:73
void initialize(const edm::EventSetup &es) override
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geo_token_
void makeRegions(const edm::Event &ev, const edm::EventSetup &es, std::vector< TICLSeedingRegion > &result) override
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const CaloGeometry * geometry_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
double b
Definition: hdecay.h:120
HLT enums.
double a
Definition: hdecay.h:121
Definition: Common.h:10
edm::EDGetTokenT< HFRecHitCollection > hfhits_token_
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Geom::Theta< T > theta() const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
Global3DVector GlobalVector
Definition: GlobalVector.h:10