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

Member Enumeration Documentation

◆ PID

Enumerator
NONE 
HADZERO 
PHOTON 
HADMINUS 
HADPLUS 
ELEMINUS 
ELEPLUS 
MUMINUS 
MUPLUS 

Definition at line 52 of file datatypes.h.

◆ PTYPE

Enumerator
HAD 
EM 
MU 

Definition at line 63 of file datatypes.h.

Constructor & Destructor Documentation

◆ ParticleID()

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

Definition at line 65 of file datatypes.h.

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

65 : bits(val) {}
ap_uint< 3 > bits
Definition: datatypes.h:51

Member Function Documentation

◆ charge()

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

Definition at line 81 of file datatypes.h.

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

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

81  {
82 #ifndef __SYNTHESIS__
83  assert(charged());
84 #endif
85  return bits[0]; /* 1 if positive, 0 if negative */
86  }
assert(be >=bs)
bool charged() const
Definition: datatypes.h:91
ap_uint< 3 > bits
Definition: datatypes.h:51

◆ charged()

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

◆ chargeOrNull()

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

Definition at line 88 of file datatypes.h.

References bits.

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

88  { // doesn't throw on null id
89  return bits[0];
90  }
ap_uint< 3 > bits
Definition: datatypes.h:51

◆ clear()

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

Definition at line 95 of file datatypes.h.

References bits.

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

95 { bits = 0; }
ap_uint< 3 > bits
Definition: datatypes.h:51

◆ intCharge()

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

Definition at line 93 of file datatypes.h.

References charge(), and charged().

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

93 { return charged() ? (charge() ? +1 : -1) : 0; }
bool charge() const
Definition: datatypes.h:81
bool charged() const
Definition: datatypes.h:91

◆ isChargedHadron()

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

Definition at line 80 of file datatypes.h.

References bits.

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

◆ isElectron()

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

Definition at line 79 of file datatypes.h.

References bits.

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

◆ isMuon()

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

Definition at line 78 of file datatypes.h.

References bits.

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

◆ isPhoton()

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

Definition at line 72 of file datatypes.h.

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

72  {
73 #ifndef __SYNTHESIS__
74  assert(neutral());
75 #endif
76  return bits[0];
77  }
assert(be >=bs)
ap_uint< 3 > bits
Definition: datatypes.h:51
bool neutral() const
Definition: datatypes.h:92

◆ mkChHad()

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

Definition at line 97 of file datatypes.h.

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

◆ mkElectron()

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

Definition at line 98 of file datatypes.h.

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

◆ mkMuon()

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

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

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

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

125  {
126  //{ PID_Charged=0, PID_Neutral=1, PID_Photon=2, PID_Electron=3, PID_Muon=4 };
127  switch (bits.to_int()) {
128  case HADZERO:
129  return 1;
130  case PHOTON:
131  return 2;
132  case HADMINUS:
133  return 0;
134  case HADPLUS:
135  return 0;
136  case ELEMINUS:
137  return 3;
138  case ELEPLUS:
139  return 3;
140  case MUMINUS:
141  return 4;
142  case MUPLUS:
143  return 4;
144  }
145  return -1;
146  }
ap_uint< 3 > bits
Definition: datatypes.h:51

◆ operator=()

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

Definition at line 66 of file datatypes.h.

References bits, and heppy_batch::val.

66  {
67  bits = val;
68  return *this;
69  }
ap_uint< 3 > bits
Definition: datatypes.h:51

◆ operator==()

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

Definition at line 101 of file datatypes.h.

References bits, and trackingPlots::other.

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

◆ pdgId()

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

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

103  {
104  switch (bits.to_int()) {
105  case HADZERO:
106  return 130;
107  case PHOTON:
108  return 22;
109  case HADMINUS:
110  return -211;
111  case HADPLUS:
112  return +211;
113  case ELEMINUS:
114  return +11;
115  case ELEPLUS:
116  return -11;
117  case MUMINUS:
118  return +13;
119  case MUPLUS:
120  return -13;
121  }
122  return 0;
123  }
ap_uint< 3 > bits
Definition: datatypes.h:51

◆ rawId()

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

Definition at line 71 of file datatypes.h.

References bits.

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

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

Member Data Documentation

◆ bits

ap_uint<3> l1ct::ParticleID::bits