CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
ParticleTowerProducer< T > Class Template Reference

#include <RecoHI/HiJetAlgos/plugins/ParticleTowerProducer.cc>

Inheritance diagram for ParticleTowerProducer< T >:
edm::stream::EDProducer<>

Public Member Functions

 ParticleTowerProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

int eta2ieta (double eta) const
 
double ieta2eta (int ieta) const
 
double iphi2phi (int iphi, int ieta) const
 
int phi2iphi (double phi, int ieta) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< typename edm::View< T > > src_
 
const bool useHF_
 

Static Private Attributes

static constexpr int ietaMax = 42
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

template<class T>
class ParticleTowerProducer< T >

Description: [one line class summary] Implementation: [Notes on implementation]

Definition at line 49 of file ParticleTowerProducer.cc.

Constructor & Destructor Documentation

◆ ParticleTowerProducer()

template<class T >
ParticleTowerProducer< T >::ParticleTowerProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 72 of file ParticleTowerProducer.cc.

73  : src_(consumes<typename edm::View<T> >(iConfig.getParameter<edm::InputTag>("src"))),
74  useHF_(iConfig.getParameter<bool>("useHF")) {
75  produces<CaloTowerCollection>();
76 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< typename edm::View< T > > src_

Member Function Documentation

◆ eta2ieta()

template<class T >
int ParticleTowerProducer< T >::eta2ieta ( double  eta) const
private

Definition at line 130 of file ParticleTowerProducer.cc.

References PVValHelper::eta, hi::etaedge, and hcalRecHitTable_cff::ieta.

130  {
131  // binary search in the array of towers eta edges
132 
133  int ieta = 1;
134  double xeta = fabs(eta);
135  while (xeta > hi::etaedge[ieta] && ieta < ietaMax - 1) {
136  ++ieta;
137  }
138 
139  if (eta < 0)
140  ieta = -ieta;
141  return ieta;
142 }
static constexpr int ietaMax
constexpr std::array< double, 42 > etaedge
Definition: HITowerHelper.h:5

◆ fillDescriptions()

template<class T >
void ParticleTowerProducer< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 194 of file ParticleTowerProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and pfElectronTranslator_cfi::PFCandidate.

194  {
196  desc.add<bool>("useHF", true);
197  if (typeid(T) == typeid(reco::PFCandidate)) {
198  desc.add<edm::InputTag>("src", edm::InputTag("particleFlow"));
199  descriptions.add("PFTowers", desc);
200  }
201  if (typeid(T) == typeid(pat::PackedCandidate)) {
202  desc.add<edm::InputTag>("src", edm::InputTag("packedPFCandidates"));
203  descriptions.add("PackedPFTowers", desc);
204  }
205 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)
long double T

◆ ieta2eta()

template<class T >
double ParticleTowerProducer< T >::ieta2eta ( int  ieta) const
private

Definition at line 182 of file ParticleTowerProducer.cc.

References PVValHelper::eta, hi::etaedge, hcalRecHitTable_cff::ieta, and Validation_hcalonly_cfi::sign.

182  {
183  int sign = 1;
184  if (ieta < 0) {
185  sign = -1;
186  ieta = -ieta;
187  }
188 
189  double eta = sign * (hi::etaedge[ieta] + hi::etaedge[ieta - 1]) / 2.;
190  return eta;
191 }
constexpr std::array< double, 42 > etaedge
Definition: HITowerHelper.h:5

◆ iphi2phi()

template<class T >
double ParticleTowerProducer< T >::iphi2phi ( int  iphi,
int  ieta 
) const
private

Definition at line 162 of file ParticleTowerProducer.cc.

References funct::abs(), hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, M_PI, dqmiodumpmetadata::n, nphi, and PVValHelper::phi.

162  {
163  double phi = 0;
164  int nphi = 72;
165 
166  int n = 1;
167  if (abs(ieta) > 20)
168  n = 2;
169  if (abs(ieta) >= 40)
170  n = 4;
171 
172  int myphi = (iphi - 1) / n + 1;
173 
174  phi = 2. * M_PI * (myphi - 0.5) / nphi * n;
175  while (phi > M_PI)
176  phi -= 2. * M_PI;
177 
178  return phi;
179 }
const int nphi
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI

◆ phi2iphi()

template<class T >
int ParticleTowerProducer< T >::phi2iphi ( double  phi,
int  ieta 
) const
private

Definition at line 145 of file ParticleTowerProducer.cc.

References funct::abs(), reco::ceil(), hcalRecHitTable_cff::ieta, createfilelist::int, hcalRecHitTable_cff::iphi, M_PI, angle0to2pi::make0To2pi(), dqmiodumpmetadata::n, nphi, and PVValHelper::phi.

145  {
147  int nphi = 72;
148  int n = 1;
149  if (abs(ieta) > 20)
150  n = 2;
151  if (abs(ieta) >= 40)
152  n = 4;
153 
154  int iphi = (int)std::ceil(phi / 2.0 / M_PI * nphi / n);
155 
156  iphi = n * (iphi - 1) + 1;
157 
158  return iphi;
159 }
const int nphi
constexpr int32_t ceil(float num)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67

◆ produce()

template<class T >
void ParticleTowerProducer< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 84 of file ParticleTowerProducer.cc.

References funct::abs(), SiStripBadComponentsDQMServiceTemplate_cfg::ep, EgHLTOffHistBins_cfi::et, PVValHelper::eta, hcalRecHitTable_cff::ieta, iEvent, PixelMapPlotter::inputs, hcalRecHitTable_cff::iphi, eostools::move(), point, dumpMFGeometry_cfg::prod, and l1tHGCalTowerProducer_cfi::tower.

84  {
85  using namespace edm;
86 
87  typedef std::pair<int, int> EtaPhi;
88  typedef std::map<EtaPhi, double> EtaPhiMap;
89  EtaPhiMap towers_;
90  towers_.clear();
91 
92  auto const& inputs = iEvent.get(src_);
93  for (auto const& particle : inputs) {
94  double eta = particle.eta();
95 
96  int ieta = eta2ieta(eta);
97  int iphi = phi2iphi(particle.phi(), ieta);
98 
99  if (!useHF_ && abs(ieta) > 29)
100  continue;
101 
102  EtaPhi ep(ieta, iphi);
103  towers_[ep] += particle.et();
104  }
105 
106  auto prod = std::make_unique<CaloTowerCollection>();
107  prod->reserve(towers_.size());
108  for (auto const& tower : towers_) {
109  EtaPhi ep = tower.first;
110  double et = tower.second;
111 
112  int ieta = ep.first;
113  int iphi = ep.second;
114 
115  CaloTowerDetId newTowerId(ieta, iphi); // totally dummy id
116 
117  // currently sets et = pt, mass to zero
118  // pt, eta, phi, mass
120  GlobalPoint point(p4.x(), p4.y(), p4.z());
121  prod->emplace_back(newTowerId, p4.e(), 0, 0, 0, 0, p4, point, point);
122  }
123 
124  iEvent.put(std::move(prod));
125 }
double iphi2phi(int iphi, int ieta) const
int eta2ieta(double eta) const
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< typename edm::View< T > > src_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HLT enums.
int phi2iphi(double phi, int ieta) const
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
double ieta2eta(int ieta) const
def move(src, dest)
Definition: eostools.py:511
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

Member Data Documentation

◆ ietaMax

template<class T >
constexpr int ParticleTowerProducer< T >::ietaMax = 42
staticprivate

Definition at line 66 of file ParticleTowerProducer.cc.

◆ src_

template<class T >
edm::EDGetTokenT<typename edm::View<T> > ParticleTowerProducer< T >::src_
private

Definition at line 62 of file ParticleTowerProducer.cc.

◆ useHF_

template<class T >
const bool ParticleTowerProducer< T >::useHF_
private

Definition at line 63 of file ParticleTowerProducer.cc.