CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
GlobalVector directionAtOrigin
static void fillPSetDescription(edm::ParameterSetDescription &desc)
SeedingRegionByHF(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Geom::Theta< T > theta() const
void initialize(const edm::EventSetup &es) override
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
T perp2() const
Definition: PV3DBase.h:68
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geo_token_
tuple result
Definition: mps_fire.py:311
bool getData(T &iHolder) const
Definition: EventSetup.h:122
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
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const CaloGeometry * geometry_
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.
double b
Definition: hdecay.h:118
T eta() const
Definition: PV3DBase.h:73
double a
Definition: hdecay.h:119
edm::EDGetTokenT< HFRecHitCollection > hfhits_token_
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Global3DVector GlobalVector
Definition: GlobalVector.h:10