CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
ParticleTowerProducer Class Reference

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

Inheritance diagram for ParticleTowerProducer:
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< reco::PFCandidateCollectionsrc_
 
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

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

Definition at line 47 of file ParticleTowerProducer.cc.

Constructor & Destructor Documentation

◆ ParticleTowerProducer()

ParticleTowerProducer::ParticleTowerProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 69 of file ParticleTowerProducer.cc.

70  : src_(consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("src"))),
71  useHF_(iConfig.getParameter<bool>("useHF")) {
72  produces<CaloTowerCollection>();
73 }

Member Function Documentation

◆ eta2ieta()

int ParticleTowerProducer::eta2ieta ( double  eta) const
private

Definition at line 125 of file ParticleTowerProducer.cc.

125  {
126  // binary search in the array of towers eta edges
127 
128  int ieta = 1;
129  double xeta = fabs(eta);
130  while (xeta > hi::etaedge[ieta] && ieta < ietaMax - 1) {
131  ++ieta;
132  }
133 
134  if (eta < 0)
135  ieta = -ieta;
136  return ieta;
137 }

References PVValHelper::eta, hi::etaedge, LEDCalibrationChannels::ieta, and ietaMax.

Referenced by produce().

◆ fillDescriptions()

void ParticleTowerProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 185 of file ParticleTowerProducer.cc.

185  {
186  // particleTowerProducer
188  desc.add<edm::InputTag>("src", edm::InputTag("particleFlow"));
189  desc.add<bool>("useHF", true);
190  descriptions.add("particleTowerProducer", desc);
191 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

◆ ieta2eta()

double ParticleTowerProducer::ieta2eta ( int  ieta) const
private

Definition at line 174 of file ParticleTowerProducer.cc.

174  {
175  int sign = 1;
176  if (ieta < 0) {
177  sign = -1;
178  ieta = -ieta;
179  }
180 
181  double eta = sign * (hi::etaedge[ieta] + hi::etaedge[ieta - 1]) / 2.;
182  return eta;
183 }

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

Referenced by produce().

◆ iphi2phi()

double ParticleTowerProducer::iphi2phi ( int  iphi,
int  ieta 
) const
private

Definition at line 155 of file ParticleTowerProducer.cc.

155  {
156  double phi = 0;
157  int nphi = 72;
158 
159  int n = 1;
160  if (abs(ieta) > 20)
161  n = 2;
162  if (abs(ieta) >= 40)
163  n = 4;
164 
165  int myphi = (iphi - 1) / n + 1;
166 
167  phi = 2. * M_PI * (myphi - 0.5) / nphi * n;
168  while (phi > M_PI)
169  phi -= 2. * M_PI;
170 
171  return phi;
172 }

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

Referenced by produce().

◆ phi2iphi()

int ParticleTowerProducer::phi2iphi ( double  phi,
int  ieta 
) const
private

Definition at line 139 of file ParticleTowerProducer.cc.

139  {
141  int nphi = 72;
142  int n = 1;
143  if (abs(ieta) > 20)
144  n = 2;
145  if (abs(ieta) >= 40)
146  n = 4;
147 
148  int iphi = (int)std::ceil(phi / 2.0 / M_PI * nphi / n);
149 
150  iphi = n * (iphi - 1) + 1;
151 
152  return iphi;
153 }

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

Referenced by produce().

◆ produce()

void ParticleTowerProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 80 of file ParticleTowerProducer.cc.

80  {
81  using namespace edm;
82 
83  typedef std::pair<int, int> EtaPhi;
84  typedef std::map<EtaPhi, double> EtaPhiMap;
85  EtaPhiMap towers_;
86  towers_.clear();
87 
88  auto const& inputs = iEvent.get(src_);
89  for (auto const& particle : inputs) {
90  double eta = particle.eta();
91 
92  int ieta = eta2ieta(eta);
93  int iphi = phi2iphi(particle.phi(), ieta);
94 
95  if (!useHF_ && abs(ieta) > 29)
96  continue;
97 
98  EtaPhi ep(ieta, iphi);
99  towers_[ep] += particle.et();
100  }
101 
102  auto prod = std::make_unique<CaloTowerCollection>();
103  prod->reserve(towers_.size());
104  for (auto const& tower : towers_) {
105  EtaPhi ep = tower.first;
106  double et = tower.second;
107 
108  int ieta = ep.first;
109  int iphi = ep.second;
110 
111  CaloTowerDetId newTowerId(ieta, iphi); // totally dummy id
112 
113  // currently sets et = pt, mass to zero
114  // pt, eta, phi, mass
116  GlobalPoint point(p4.x(), p4.y(), p4.z());
117  prod->emplace_back(newTowerId, p4.e(), 0, 0, 0, 0, p4, point, point);
118  }
119 
120  iEvent.put(std::move(prod));
121 }

References funct::abs(), SiStripBadComponentsDQMServiceTemplate_cfg::ep, EgHLTOffHistBins_cfi::et, PVValHelper::eta, eta2ieta(), LEDCalibrationChannels::ieta, ieta2eta(), iEvent, PixelMapPlotter::inputs, LEDCalibrationChannels::iphi, iphi2phi(), eostools::move(), p4, phi2iphi(), point, dumpMFGeometry_cfg::prod, src_, hgcalTowerProducer_cfi::tower, and useHF_.

Member Data Documentation

◆ ietaMax

constexpr int ParticleTowerProducer::ietaMax = 42
staticconstexprprivate

Definition at line 64 of file ParticleTowerProducer.cc.

Referenced by eta2ieta().

◆ src_

edm::EDGetTokenT<reco::PFCandidateCollection> ParticleTowerProducer::src_
private

Definition at line 60 of file ParticleTowerProducer.cc.

Referenced by produce().

◆ useHF_

const bool ParticleTowerProducer::useHF_
private

Definition at line 61 of file ParticleTowerProducer.cc.

Referenced by produce().

dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
ParticleTowerProducer::eta2ieta
int eta2ieta(double eta) const
Definition: ParticleTowerProducer.cc:125
edm
HLT enums.
Definition: AlignableModifier.h:19
ParticleTowerProducer::iphi2phi
double iphi2phi(int iphi, int ieta) const
Definition: ParticleTowerProducer.cc:155
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
ParticleTowerProducer::ietaMax
static constexpr int ietaMax
Definition: ParticleTowerProducer.cc:64
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
ParticleTowerProducer::src_
edm::EDGetTokenT< reco::PFCandidateCollection > src_
Definition: ParticleTowerProducer.cc:60
nphi
const int nphi
Definition: CMTRawAnalyzer.h:424
reco::ceil
constexpr int32_t ceil(float num)
Definition: constexpr_cmath.h:7
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PVValHelper::eta
Definition: PVValidationHelpers.h:70
hi::etaedge
constexpr std::array< double, 42 > etaedge
Definition: HITowerHelper.h:5
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
reco::Particle::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
Point3DBase< float, GlobalTag >
ParticleTowerProducer::useHF_
const bool useHF_
Definition: ParticleTowerProducer.cc:61
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
ParticleTowerProducer::ieta2eta
double ieta2eta(int ieta) const
Definition: ParticleTowerProducer.cc:174
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
angle0to2pi::make0To2pi
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
DDAxes::phi
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParticleTowerProducer::phi2iphi
int phi2iphi(double phi, int ieta) const
Definition: ParticleTowerProducer.cc:139
point
*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
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::InputTag
Definition: InputTag.h:15
CaloTowerDetId
Definition: CaloTowerDetId.h:12