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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

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

Definition at line 48 of file ParticleTowerProducer.cc.

Constructor & Destructor Documentation

◆ ParticleTowerProducer()

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

Definition at line 70 of file ParticleTowerProducer.cc.

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

Member Function Documentation

◆ eta2ieta()

int ParticleTowerProducer::eta2ieta ( double  eta) const
private

Definition at line 126 of file ParticleTowerProducer.cc.

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

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

Referenced by produce().

◆ fillDescriptions()

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

Definition at line 186 of file ParticleTowerProducer.cc.

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

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

◆ ieta2eta()

double ParticleTowerProducer::ieta2eta ( int  ieta) const
private

Definition at line 175 of file ParticleTowerProducer.cc.

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

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 156 of file ParticleTowerProducer.cc.

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

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 140 of file ParticleTowerProducer.cc.

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

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 81 of file ParticleTowerProducer.cc.

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

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 65 of file ParticleTowerProducer.cc.

Referenced by eta2ieta().

◆ src_

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

Definition at line 61 of file ParticleTowerProducer.cc.

Referenced by produce().

◆ useHF_

const bool ParticleTowerProducer::useHF_
private

Definition at line 62 of file ParticleTowerProducer.cc.

Referenced by produce().

dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
ParticleTowerProducer::eta2ieta
int eta2ieta(double eta) const
Definition: ParticleTowerProducer.cc:126
edm
HLT enums.
Definition: AlignableModifier.h:19
ParticleTowerProducer::iphi2phi
double iphi2phi(int iphi, int ieta) const
Definition: ParticleTowerProducer.cc:156
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
ParticleTowerProducer::ietaMax
static constexpr int ietaMax
Definition: ParticleTowerProducer.cc:65
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:61
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:69
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:62
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
ParticleTowerProducer::ieta2eta
double ieta2eta(int ieta) const
Definition: ParticleTowerProducer.cc:175
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:140
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