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 42 of file datatypes.h.

Member Enumeration Documentation

◆ PID

Enumerator
NONE 
HADZERO 
PHOTON 
HADMINUS 
HADPLUS 
ELEMINUS 
ELEPLUS 
MUMINUS 
MUPLUS 

Definition at line 44 of file datatypes.h.

◆ PTYPE

Enumerator
HAD 
EM 
MU 

Definition at line 55 of file datatypes.h.

Constructor & Destructor Documentation

◆ ParticleID()

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

Definition at line 57 of file datatypes.h.

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

57 : bits(val) {}
ap_uint< 3 > bits
Definition: datatypes.h:43

Member Function Documentation

◆ charge()

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

Definition at line 73 of file datatypes.h.

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

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

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

◆ charged()

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

◆ chargeOrNull()

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

Definition at line 80 of file datatypes.h.

References bits.

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

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

◆ clear()

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

Definition at line 87 of file datatypes.h.

References bits.

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

87 { bits = 0; }
ap_uint< 3 > bits
Definition: datatypes.h:43

◆ intCharge()

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

Definition at line 85 of file datatypes.h.

References charge(), and charged().

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

85 { return charged() ? (charge() ? +1 : -1) : 0; }
bool charge() const
Definition: datatypes.h:73
bool charged() const
Definition: datatypes.h:83

◆ isChargedHadron()

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

Definition at line 72 of file datatypes.h.

References bits.

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

◆ isElectron()

bool l1ct::ParticleID::isElectron ( ) 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:43

◆ isMuon()

bool l1ct::ParticleID::isMuon ( ) 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:43

◆ isPhoton()

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

Definition at line 64 of file datatypes.h.

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

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

◆ mkChHad()

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

Definition at line 89 of file datatypes.h.

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

◆ mkElectron()

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

Definition at line 90 of file datatypes.h.

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

◆ mkMuon()

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

Definition at line 91 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 117 of file datatypes.h.

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

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

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

◆ operator=()

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

Definition at line 58 of file datatypes.h.

References bits, and heppy_batch::val.

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

◆ operator==()

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

Definition at line 93 of file datatypes.h.

References bits, and trackingPlots::other.

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

◆ pdgId()

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

Definition at line 95 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().

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

◆ rawId()

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

Definition at line 63 of file datatypes.h.

References bits.

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

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

Member Data Documentation

◆ bits

ap_uint<3> l1ct::ParticleID::bits