CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes
l1ct::ParticleID Struct Reference

#include <datatypes.h>

Public Types

enum  PID {
  NONE = 0, HADZERO = 0, PHOTON = 1, HADMINUS = 2,
  HADPLUS = 3, ELEMINUS = 4, ELEPLUS = 5, MUMINUS = 6,
  MUPLUS = 7
}
 
enum  PTYPE { HAD = 0, EM = 1, MU = 2 }
 

Public Member Functions

bool charge () const
 
bool charged () const
 
bool chargeOrNull () const
 
void clear ()
 
int intCharge () const
 
bool isChargedHadron () const
 
bool isElectron () const
 
bool isMuon () const
 
bool isPhoton () const
 
bool neutral () const
 
int oldId () const
 
ParticleIDoperator= (PID val)
 
bool operator== (const ParticleID &other) const
 
 ParticleID (PID val=NONE)
 
int pdgId () const
 
int rawId () const
 

Static Public Member Functions

static ParticleID mkChHad (bool charge)
 
static ParticleID mkElectron (bool charge)
 
static ParticleID mkMuon (bool charge)
 

Public Attributes

ap_uint< 3 > bits
 

Detailed Description

Definition at line 41 of file datatypes.h.

Member Enumeration Documentation

◆ PID

Enumerator
NONE 
HADZERO 
PHOTON 
HADMINUS 
HADPLUS 
ELEMINUS 
ELEPLUS 
MUMINUS 
MUPLUS 

Definition at line 43 of file datatypes.h.

◆ PTYPE

Enumerator
HAD 
EM 
MU 

Definition at line 54 of file datatypes.h.

Constructor & Destructor Documentation

◆ ParticleID()

l1ct::ParticleID::ParticleID ( PID  val = NONE)
inline

Definition at line 56 of file datatypes.h.

Referenced by mkChHad(), mkElectron(), and mkMuon().

56 : bits(val) {}
ap_uint< 3 > bits
Definition: datatypes.h:42

Member Function Documentation

◆ charge()

bool l1ct::ParticleID::charge ( ) const
inline

Definition at line 72 of file datatypes.h.

References cms::cuda::assert(), bits, and charged().

Referenced by intCharge(), mkChHad(), mkElectron(), and mkMuon().

72  {
73 #ifndef __SYNTHESIS__
74  assert(charged());
75 #endif
76  return bits[0]; /* 1 if positive, 0 if negative */
77  }
assert(be >=bs)
bool charged() const
Definition: datatypes.h:82
ap_uint< 3 > bits
Definition: datatypes.h:42

◆ charged()

bool l1ct::ParticleID::charged ( ) const
inline

◆ chargeOrNull()

bool l1ct::ParticleID::chargeOrNull ( ) const
inline

Definition at line 79 of file datatypes.h.

References bits.

Referenced by l1ct::PFChargedObj::hwVtxPhi().

79  { // doesn't throw on null id
80  return bits[0];
81  }
ap_uint< 3 > bits
Definition: datatypes.h:42

◆ clear()

void l1ct::ParticleID::clear ( void  )
inline

Definition at line 86 of file datatypes.h.

References bits.

Referenced by l1ct::PFChargedObj::clear(), l1ct::PuppiObj::clear(), and l1ct::PFNeutralObj::clear().

86 { bits = 0; }
ap_uint< 3 > bits
Definition: datatypes.h:42

◆ intCharge()

int l1ct::ParticleID::intCharge ( ) const
inline

Definition at line 84 of file datatypes.h.

References charge(), and charged().

Referenced by l1ct::PFCommonObj::intCharge(), and l1ct::PuppiObj::intCharge().

84 { return charged() ? (charge() ? +1 : -1) : 0; }
bool charge() const
Definition: datatypes.h:72
bool charged() const
Definition: datatypes.h:82

◆ isChargedHadron()

bool l1ct::ParticleID::isChargedHadron ( ) const
inline

Definition at line 71 of file datatypes.h.

References bits.

71 { return !bits[2] && bits[1]; }
ap_uint< 3 > bits
Definition: datatypes.h:42

◆ isElectron()

bool l1ct::ParticleID::isElectron ( ) const
inline

Definition at line 70 of file datatypes.h.

References bits.

70 { return bits[2] && !bits[1]; }
ap_uint< 3 > bits
Definition: datatypes.h:42

◆ isMuon()

bool l1ct::ParticleID::isMuon ( ) const
inline

Definition at line 69 of file datatypes.h.

References bits.

69 { return bits[2] && bits[1]; }
ap_uint< 3 > bits
Definition: datatypes.h:42

◆ isPhoton()

bool l1ct::ParticleID::isPhoton ( ) const
inline

Definition at line 63 of file datatypes.h.

References cms::cuda::assert(), bits, and neutral().

63  {
64 #ifndef __SYNTHESIS__
65  assert(neutral());
66 #endif
67  return bits[0];
68  }
assert(be >=bs)
ap_uint< 3 > bits
Definition: datatypes.h:42
bool neutral() const
Definition: datatypes.h:83

◆ mkChHad()

static ParticleID l1ct::ParticleID::mkChHad ( bool  charge)
inlinestatic

Definition at line 88 of file datatypes.h.

References charge(), HADMINUS, HADPLUS, and ParticleID().

◆ mkElectron()

static ParticleID l1ct::ParticleID::mkElectron ( bool  charge)
inlinestatic

Definition at line 89 of file datatypes.h.

References charge(), ELEMINUS, ELEPLUS, and ParticleID().

◆ mkMuon()

static ParticleID l1ct::ParticleID::mkMuon ( bool  charge)
inlinestatic

Definition at line 90 of file datatypes.h.

References charge(), MUMINUS, MUPLUS, and ParticleID().

◆ neutral()

bool l1ct::ParticleID::neutral ( ) const
inline

◆ oldId()

int l1ct::ParticleID::oldId ( ) const
inline

Definition at line 116 of file datatypes.h.

References bits, ELEMINUS, ELEPLUS, HADMINUS, HADPLUS, HADZERO, MUMINUS, MUPLUS, and PHOTON.

Referenced by l1ct::PFCommonObj::oldId(), and l1ct::PuppiObj::oldId().

116  {
117  //{ PID_Charged=0, PID_Neutral=1, PID_Photon=2, PID_Electron=3, PID_Muon=4 };
118  switch (bits.to_int()) {
119  case HADZERO:
120  return 1;
121  case PHOTON:
122  return 2;
123  case HADMINUS:
124  return 0;
125  case HADPLUS:
126  return 0;
127  case ELEMINUS:
128  return 3;
129  case ELEPLUS:
130  return 3;
131  case MUMINUS:
132  return 4;
133  case MUPLUS:
134  return 4;
135  }
136  return -1;
137  }
ap_uint< 3 > bits
Definition: datatypes.h:42

◆ operator=()

ParticleID& l1ct::ParticleID::operator= ( PID  val)
inline

Definition at line 57 of file datatypes.h.

References bits, and heppy_batch::val.

57  {
58  bits = val;
59  return *this;
60  }
ap_uint< 3 > bits
Definition: datatypes.h:42

◆ operator==()

bool l1ct::ParticleID::operator== ( const ParticleID other) const
inline

Definition at line 92 of file datatypes.h.

References bits, and trackingPlots::other.

92 { return bits == other.bits; }
ap_uint< 3 > bits
Definition: datatypes.h:42

◆ pdgId()

int l1ct::ParticleID::pdgId ( ) const
inline

Definition at line 94 of file datatypes.h.

References bits, ELEMINUS, ELEPLUS, HADMINUS, HADPLUS, HADZERO, MUMINUS, MUPLUS, and PHOTON.

Referenced by Particle.Particle::__str__(), l1ct::PFCommonObj::pdgId(), and l1ct::PuppiObj::pdgId().

94  {
95  switch (bits.to_int()) {
96  case HADZERO:
97  return 130;
98  case PHOTON:
99  return 22;
100  case HADMINUS:
101  return -211;
102  case HADPLUS:
103  return +211;
104  case ELEMINUS:
105  return +11;
106  case ELEPLUS:
107  return -11;
108  case MUMINUS:
109  return +13;
110  case MUPLUS:
111  return -13;
112  }
113  return 0;
114  }
ap_uint< 3 > bits
Definition: datatypes.h:42

◆ rawId()

int l1ct::ParticleID::rawId ( ) const
inline

Definition at line 62 of file datatypes.h.

References bits.

Referenced by l1ct::PFCommonObj::intId(), and l1ct::PuppiObj::intId().

62 { return bits.to_int(); }
ap_uint< 3 > bits
Definition: datatypes.h:42

Member Data Documentation

◆ bits

ap_uint<3> l1ct::ParticleID::bits