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

Member Enumeration Documentation

◆ PID

Enumerator
NONE 
HADZERO 
PHOTON 
HADMINUS 
HADPLUS 
ELEMINUS 
ELEPLUS 
MUMINUS 
MUPLUS 

Definition at line 51 of file datatypes.h.

◆ PTYPE

Enumerator
HAD 
EM 
MU 

Definition at line 62 of file datatypes.h.

Constructor & Destructor Documentation

◆ ParticleID()

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

Definition at line 64 of file datatypes.h.

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

64 : bits(val) {}
ap_uint< 3 > bits
Definition: datatypes.h:50

Member Function Documentation

◆ charge()

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

Definition at line 80 of file datatypes.h.

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

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

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

◆ charged()

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

◆ chargeOrNull()

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

Definition at line 87 of file datatypes.h.

References bits.

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

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

◆ clear()

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

Definition at line 94 of file datatypes.h.

References bits.

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

94 { bits = 0; }
ap_uint< 3 > bits
Definition: datatypes.h:50

◆ intCharge()

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

Definition at line 92 of file datatypes.h.

References charge(), and charged().

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

92 { return charged() ? (charge() ? +1 : -1) : 0; }
bool charge() const
Definition: datatypes.h:80
bool charged() const
Definition: datatypes.h:90

◆ isChargedHadron()

bool l1ct::ParticleID::isChargedHadron ( ) 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:50

◆ isElectron()

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

◆ isMuon()

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

Definition at line 77 of file datatypes.h.

References bits.

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

◆ isPhoton()

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

Definition at line 71 of file datatypes.h.

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

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

◆ mkChHad()

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

Definition at line 96 of file datatypes.h.

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

◆ mkElectron()

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

Definition at line 97 of file datatypes.h.

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

◆ mkMuon()

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

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

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

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

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

◆ operator=()

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

Definition at line 65 of file datatypes.h.

References bits, and heppy_batch::val.

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

◆ operator==()

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

Definition at line 100 of file datatypes.h.

References bits, and trackingPlots::other.

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

◆ pdgId()

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

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

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

◆ rawId()

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

Definition at line 70 of file datatypes.h.

References bits.

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

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

Member Data Documentation

◆ bits

ap_uint<3> l1ct::ParticleID::bits