CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes
l1tpf_impl::Region Struct Reference

#include <Region.h>

Inheritance diagram for l1tpf_impl::Region:
l1tpf_impl::InputRegion

Public Types

enum  InputType {
  calo_type = 0, emcalo_type = 1, track_type = 2, l1mu_type = 3,
  n_input_types = 4
}
 
enum  OutputType {
  any_type = 0, charged_type = 1, neutral_type = 2, electron_type = 3,
  pfmuon_type = 4, charged_hadron_type = 5, neutral_hadron_type = 6, photon_type = 7,
  n_output_types = 8
}
 

Public Member Functions

bool contains (float eta, float phi) const
 
bool fiducial (float eta, float phi) const
 
bool fiducialLocal (float localEta, float localPhi) const
 
float globalAbsEta (float localEta) const
 
float globalEta (float localEta) const
 
float globalPhi (float localPhi) const
 
void inputSort ()
 
float localEta (float globalEta) const
 
float localPhi (float globalPhi) const
 
unsigned int nInput (InputType type) const
 
unsigned int nOutput (OutputType type, bool puppi, bool fiducial=true) const
 
 Region (float etamin, float etamax, float phicenter, float phiwidth, float etaextra, float phiextra, bool useRelativeCoordinates, unsigned int ncalomax, unsigned int nemcalomax, unsigned int ntrackmax, unsigned int nmuonmax, unsigned int npfmax, unsigned int npuppimax)
 
float regionAbsEta () const
 
void zero ()
 
- Public Member Functions inherited from l1tpf_impl::InputRegion
 InputRegion ()
 
 InputRegion (float etacenter, float etamin, float etamax, float phicenter, float phihalfwidth, float etaextra, float phiextra)
 

Static Public Member Functions

static const char * inputTypeName (int inputType)
 
static const char * outputTypeName (int outputType)
 

Public Attributes

unsigned int caloOverflow
 
unsigned int emcaloOverflow
 
unsigned int muonOverflow
 
const unsigned int ncaloMax
 
const unsigned int nemcaloMax
 
const unsigned int nmuonMax
 
const unsigned int npfMax
 
const unsigned int npuppiMax
 
const unsigned int ntrackMax
 
std::vector< PFParticlepf
 
unsigned int pfOverflow
 
std::vector< PFParticlepuppi
 
unsigned int puppiOverflow
 
const bool relativeCoordinates
 
unsigned int trackOverflow
 
- Public Attributes inherited from l1tpf_impl::InputRegion
std::vector< CaloClustercalo
 
std::vector< CaloClusteremcalo
 
float etaCenter
 
float etaExtra
 
float etaMax
 
float etaMin
 
std::vector< Muonmuon
 
float phiCenter
 
float phiExtra
 
float phiHalfWidth
 
std::vector< PropagatedTracktrack
 

Detailed Description

Definition at line 8 of file Region.h.

Member Enumeration Documentation

Enumerator
calo_type 
emcalo_type 
track_type 
l1mu_type 
n_input_types 

Definition at line 45 of file Region.h.

Enumerator
any_type 
charged_type 
neutral_type 
electron_type 
pfmuon_type 
charged_hadron_type 
neutral_hadron_type 
photon_type 
n_output_types 

Definition at line 48 of file Region.h.

Constructor & Destructor Documentation

l1tpf_impl::Region::Region ( float  etamin,
float  etamax,
float  phicenter,
float  phiwidth,
float  etaextra,
float  phiextra,
bool  useRelativeCoordinates,
unsigned int  ncalomax,
unsigned int  nemcalomax,
unsigned int  ntrackmax,
unsigned int  nmuonmax,
unsigned int  npfmax,
unsigned int  npuppimax 
)
inline

Definition at line 15 of file Region.h.

28  : InputRegion(0.5 * (etamin + etamax), etamin, etamax, phicenter, 0.5 * phiwidth, etaextra, phiextra),
29  pf(),
30  puppi(),
31  caloOverflow(),
33  trackOverflow(),
34  muonOverflow(),
35  pfOverflow(),
36  puppiOverflow(),
37  relativeCoordinates(useRelativeCoordinates),
38  ncaloMax(ncalomax),
39  nemcaloMax(nemcalomax),
40  ntrackMax(ntrackmax),
41  nmuonMax(nmuonmax),
42  npfMax(npfmax),
43  npuppiMax(npuppimax) {}
const unsigned int ncaloMax
Definition: Region.h:14
const unsigned int nemcaloMax
Definition: Region.h:14
const bool relativeCoordinates
Definition: Region.h:13
unsigned int caloOverflow
Definition: Region.h:11
unsigned int muonOverflow
Definition: Region.h:11
unsigned int pfOverflow
Definition: Region.h:11
const unsigned int ntrackMax
Definition: Region.h:14
unsigned int puppiOverflow
Definition: Region.h:11
std::vector< PFParticle > puppi
Definition: Region.h:10
std::vector< PFParticle > pf
Definition: Region.h:9
unsigned int emcaloOverflow
Definition: Region.h:11
const unsigned int npuppiMax
Definition: Region.h:14
unsigned int trackOverflow
Definition: Region.h:11
const unsigned int npfMax
Definition: Region.h:14
const unsigned int nmuonMax
Definition: Region.h:14

Member Function Documentation

bool l1tpf_impl::Region::contains ( float  eta,
float  phi 
) const
inline
bool l1tpf_impl::Region::fiducial ( float  eta,
float  phi 
) const
inline
bool l1tpf_impl::Region::fiducialLocal ( float  localEta,
float  localPhi 
) const
inline

Definition at line 76 of file Region.h.

References srCondWrite_cfg::deltaPhi, l1tpf_impl::InputRegion::etaCenter, l1tpf_impl::InputRegion::etaMax, l1tpf_impl::InputRegion::etaMin, validate-o2o-wbm::f, l1tpf_impl::InputRegion::phiCenter, l1tpf_impl::InputRegion::phiHalfWidth, and relativeCoordinates.

Referenced by l1tpf_impl::PFAlgo2HGC::runPF(), l1tpf_impl::PFAlgo3::runPF(), and l1tpf_impl::BitwisePFAlgo::runPF().

76  {
77  if (relativeCoordinates) {
78  float dphi = deltaPhi(0.f, localPhi);
79  return (etaMin < localEta + etaCenter && localEta + etaCenter <= etaMax && -phiHalfWidth < dphi &&
80  dphi <= phiHalfWidth);
81  }
82  float dphi = deltaPhi(phiCenter, localPhi);
83  return (etaMin < localEta && localEta <= etaMax && -phiHalfWidth < dphi && dphi <= phiHalfWidth);
84  }
const bool relativeCoordinates
Definition: Region.h:13
float localPhi(float globalPhi) const
Definition: Region.h:90
float localEta(float globalEta) const
Definition: Region.h:89
float l1tpf_impl::Region::globalAbsEta ( float  localEta) const
inline
float l1tpf_impl::Region::globalEta ( float  localEta) const
inline

Definition at line 87 of file Region.h.

References l1tpf_impl::InputRegion::etaCenter, localEta(), and relativeCoordinates.

Referenced by localEta().

const bool relativeCoordinates
Definition: Region.h:13
float localEta(float globalEta) const
Definition: Region.h:89
float l1tpf_impl::Region::globalPhi ( float  localPhi) const
inline

Definition at line 88 of file Region.h.

References localPhi(), l1tpf_impl::InputRegion::phiCenter, and relativeCoordinates.

Referenced by localPhi().

const bool relativeCoordinates
Definition: Region.h:13
float localPhi(float globalPhi) const
Definition: Region.h:90
void l1tpf_impl::Region::inputSort ( )

Definition at line 113 of file Region.cc.

References HLT_FULL_cff::muon, and HLT_FULL_cff::track.

Referenced by l1tpf_impl::PFAlgoBase::initRegion().

113  {
114  std::sort(calo.begin(), calo.end());
115  std::sort(emcalo.begin(), emcalo.end());
116  std::sort(track.begin(), track.end());
117  std::sort(muon.begin(), muon.end());
118  if (ncaloMax > 0 && calo.size() > ncaloMax) {
119  caloOverflow = calo.size() - ncaloMax;
120  calo.resize(ncaloMax);
121  }
122  if (nemcaloMax > 0 && emcalo.size() > nemcaloMax) {
123  emcaloOverflow = emcalo.size() - nemcaloMax;
124  emcalo.resize(nemcaloMax);
125  }
126  if (ntrackMax > 0 && track.size() > ntrackMax) {
127  trackOverflow = track.size() - ntrackMax;
128  track.resize(ntrackMax);
129  }
130 }
const unsigned int ncaloMax
Definition: Region.h:14
const unsigned int nemcaloMax
Definition: Region.h:14
unsigned int caloOverflow
Definition: Region.h:11
const unsigned int ntrackMax
Definition: Region.h:14
std::vector< CaloCluster > calo
std::vector< Muon > muon
unsigned int emcaloOverflow
Definition: Region.h:11
std::vector< PropagatedTrack > track
std::vector< CaloCluster > emcalo
unsigned int trackOverflow
Definition: Region.h:11
const char * l1tpf_impl::Region::inputTypeName ( int  inputType)
static

Definition at line 6 of file Region.cc.

References calo_type, emcalo_type, Exception, l1mu_type, n_input_types, and track_type.

Referenced by L1TPFProducer::L1TPFProducer(), and L1TPFProducer::produce().

6  {
7  switch (InputType(type)) {
8  case calo_type:
9  return "Calo";
10  case emcalo_type:
11  return "EmCalo";
12  case track_type:
13  return "TK";
14  case l1mu_type:
15  return "Mu";
16  case n_input_types:
17  throw cms::Exception(
18  "LogicError", "n_input_types is not a type to be used, but only a compile-time const for iterating on types");
19  }
20  return "NO_SUCH_INPUT_TYPE";
21 }
float l1tpf_impl::Region::localEta ( float  globalEta) const
inline

Definition at line 89 of file Region.h.

References l1tpf_impl::InputRegion::etaCenter, globalEta(), and relativeCoordinates.

Referenced by globalEta().

const bool relativeCoordinates
Definition: Region.h:13
float globalEta(float localEta) const
Definition: Region.h:87
float l1tpf_impl::Region::localPhi ( float  globalPhi) const
inline

Definition at line 90 of file Region.h.

References srCondWrite_cfg::deltaPhi, globalPhi(), l1tpf_impl::InputRegion::phiCenter, and relativeCoordinates.

Referenced by globalPhi().

const bool relativeCoordinates
Definition: Region.h:13
float globalPhi(float localPhi) const
Definition: Region.h:88
unsigned int l1tpf_impl::Region::nInput ( InputType  type) const

Definition at line 48 of file Region.cc.

References Exception, HLT_FULL_cff::muon, and HLT_FULL_cff::track.

48  {
49  switch (type) {
50  case calo_type:
51  return calo.size();
52  case emcalo_type:
53  return emcalo.size();
54  case track_type:
55  return track.size();
56  case l1mu_type:
57  return muon.size();
58  case n_input_types:
59  throw cms::Exception(
60  "LogicError", "n_input_types is not a type to be used, but only a compile-time const for iterating on types");
61  }
62  return 9999;
63 }
std::vector< CaloCluster > calo
std::vector< Muon > muon
std::vector< PropagatedTrack > track
std::vector< CaloCluster > emcalo
unsigned int l1tpf_impl::Region::nOutput ( OutputType  type,
bool  puppi,
bool  fiducial = true 
) const

Definition at line 65 of file Region.cc.

References l1t::PFCandidate::ChargedHadron, l1t::PFCandidate::Electron, Exception, l1t::PFCandidate::Muon, l1t::PFCandidate::NeutralHadron, AlCaHLTBitMon_ParallelJobs::p, l1t::PFCandidate::Photon, Puppi_cff::puppi, and runTheMatrix::ret.

Referenced by l1tpf_impl::BitwisePFAlgo::runPF().

65  {
66  unsigned int ret = 0;
67  for (const auto &p : (usePuppi ? puppi : pf)) {
68  if (p.hwPt <= 0)
69  continue;
70  if (fiducial && !fiducialLocal(p.floatEta(), p.floatPhi()))
71  continue;
72  switch (type) {
73  case any_type:
74  ret++;
75  break;
76  case charged_type:
77  if (p.intCharge() != 0)
78  ret++;
79  break;
80  case neutral_type:
81  if (p.intCharge() == 0)
82  ret++;
83  break;
84  case electron_type:
85  if (p.hwId == l1t::PFCandidate::Electron)
86  ret++;
87  break;
88  case pfmuon_type:
89  if (p.hwId == l1t::PFCandidate::Muon)
90  ret++;
91  break;
94  ret++;
95  break;
98  ret++;
99  break;
100  case photon_type:
101  if (p.hwId == l1t::PFCandidate::Photon)
102  ret++;
103  break;
104  case n_output_types:
105  throw cms::Exception(
106  "LogicError",
107  "n_output_types is not a type to be used, but only a compile-time const for iterating on types");
108  }
109  }
110  return ret;
111 }
tuple ret
prodAgent to be discontinued
bool fiducial(float eta, float phi) const
Definition: Region.h:71
std::vector< PFParticle > puppi
Definition: Region.h:10
std::vector< PFParticle > pf
Definition: Region.h:9
bool fiducialLocal(float localEta, float localPhi) const
Definition: Region.h:76
const char * l1tpf_impl::Region::outputTypeName ( int  outputType)
static

Definition at line 22 of file Region.cc.

References Exception.

Referenced by L1TPFProducer::L1TPFProducer(), and L1TPFProducer::produce().

22  {
23  switch (OutputType(type)) {
24  case any_type:
25  return "";
26  case charged_type:
27  return "Charged";
28  case neutral_type:
29  return "Neutral";
30  case electron_type:
31  return "Electron";
32  case pfmuon_type:
33  return "Muon";
35  return "ChargedHadron";
37  return "NeutralHadron";
38  case photon_type:
39  return "Photon";
40  case n_output_types:
41  throw cms::Exception(
42  "LogicError",
43  "n_output_types is not a type to be used, but only a compile-time const for iterating on types");
44  }
45  return "NO_SUCH_OUTPUT_TYPE";
46 }
float l1tpf_impl::Region::regionAbsEta ( ) const
inline

Definition at line 85 of file Region.h.

References funct::abs(), and l1tpf_impl::InputRegion::etaCenter.

85 { return std::abs(etaCenter); }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void l1tpf_impl::Region::zero ( )
inline

Definition at line 92 of file Region.h.

References l1tpf_impl::InputRegion::calo, caloOverflow, l1tpf_impl::InputRegion::emcalo, emcaloOverflow, l1tpf_impl::InputRegion::muon, muonOverflow, pf, pfOverflow, puppi, puppiOverflow, l1tpf_impl::InputRegion::track, and trackOverflow.

92  {
93  calo.clear();
94  emcalo.clear();
95  track.clear();
96  muon.clear();
97  pf.clear();
98  puppi.clear();
99  caloOverflow = 0;
100  emcaloOverflow = 0;
101  trackOverflow = 0;
102  muonOverflow = 0;
103  pfOverflow = 0;
104  puppiOverflow = 0;
105  }
unsigned int caloOverflow
Definition: Region.h:11
unsigned int muonOverflow
Definition: Region.h:11
unsigned int pfOverflow
Definition: Region.h:11
std::vector< CaloCluster > calo
std::vector< Muon > muon
unsigned int puppiOverflow
Definition: Region.h:11
std::vector< PFParticle > puppi
Definition: Region.h:10
std::vector< PFParticle > pf
Definition: Region.h:9
unsigned int emcaloOverflow
Definition: Region.h:11
std::vector< PropagatedTrack > track
std::vector< CaloCluster > emcalo
unsigned int trackOverflow
Definition: Region.h:11

Member Data Documentation

unsigned int l1tpf_impl::Region::caloOverflow

Definition at line 11 of file Region.h.

Referenced by zero().

unsigned int l1tpf_impl::Region::emcaloOverflow

Definition at line 11 of file Region.h.

Referenced by zero().

unsigned int l1tpf_impl::Region::muonOverflow

Definition at line 11 of file Region.h.

Referenced by zero().

const unsigned int l1tpf_impl::Region::ncaloMax

Definition at line 14 of file Region.h.

const unsigned int l1tpf_impl::Region::nemcaloMax

Definition at line 14 of file Region.h.

const unsigned int l1tpf_impl::Region::nmuonMax

Definition at line 14 of file Region.h.

const unsigned int l1tpf_impl::Region::npfMax

Definition at line 14 of file Region.h.

const unsigned int l1tpf_impl::Region::npuppiMax

Definition at line 14 of file Region.h.

const unsigned int l1tpf_impl::Region::ntrackMax

Definition at line 14 of file Region.h.

std::vector<PFParticle> l1tpf_impl::Region::pf
unsigned int l1tpf_impl::Region::pfOverflow

Definition at line 11 of file Region.h.

Referenced by zero().

std::vector<PFParticle> l1tpf_impl::Region::puppi
unsigned int l1tpf_impl::Region::puppiOverflow

Definition at line 11 of file Region.h.

Referenced by zero().

const bool l1tpf_impl::Region::relativeCoordinates
unsigned int l1tpf_impl::Region::trackOverflow

Definition at line 11 of file Region.h.

Referenced by zero().