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

Member Enumeration Documentation

◆ PID

Enumerator
NONE 
HADZERO 
PHOTON 
HADMINUS 
HADPLUS 
ELEMINUS 
ELEPLUS 
MUMINUS 
MUPLUS 

Definition at line 47 of file datatypes.h.

◆ PTYPE

Enumerator
HAD 
EM 
MU 

Definition at line 58 of file datatypes.h.

Constructor & Destructor Documentation

◆ ParticleID()

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

Definition at line 60 of file datatypes.h.

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

60 : bits(val) {}
ap_uint< 3 > bits
Definition: datatypes.h:46

Member Function Documentation

◆ charge()

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

Definition at line 76 of file datatypes.h.

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

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

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

◆ charged()

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

◆ chargeOrNull()

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

Definition at line 83 of file datatypes.h.

References bits.

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

83  { // doesn't throw on null id
84  return bits[0];
85  }
ap_uint< 3 > bits
Definition: datatypes.h:46

◆ clear()

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

Definition at line 90 of file datatypes.h.

References bits.

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

90 { bits = 0; }
ap_uint< 3 > bits
Definition: datatypes.h:46

◆ intCharge()

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

Definition at line 88 of file datatypes.h.

References charge(), and charged().

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

88 { return charged() ? (charge() ? +1 : -1) : 0; }
bool charge() const
Definition: datatypes.h:76
bool charged() const
Definition: datatypes.h:86

◆ isChargedHadron()

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

Definition at line 75 of file datatypes.h.

References bits.

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

◆ isElectron()

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

Definition at line 74 of file datatypes.h.

References bits.

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

◆ isMuon()

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

Definition at line 73 of file datatypes.h.

References bits.

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

◆ isPhoton()

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

Definition at line 67 of file datatypes.h.

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

67  {
68 #ifndef __SYNTHESIS__
69  assert(neutral());
70 #endif
71  return bits[0];
72  }
assert(be >=bs)
ap_uint< 3 > bits
Definition: datatypes.h:46
bool neutral() const
Definition: datatypes.h:87

◆ mkChHad()

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

Definition at line 92 of file datatypes.h.

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

◆ mkElectron()

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

Definition at line 93 of file datatypes.h.

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

◆ mkMuon()

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

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

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

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

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

◆ operator=()

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

Definition at line 61 of file datatypes.h.

References bits, and heppy_batch::val.

61  {
62  bits = val;
63  return *this;
64  }
ap_uint< 3 > bits
Definition: datatypes.h:46

◆ operator==()

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

Definition at line 96 of file datatypes.h.

References bits, and trackingPlots::other.

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

◆ pdgId()

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

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

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

◆ rawId()

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

Definition at line 66 of file datatypes.h.

References bits.

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

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

Member Data Documentation

◆ bits

ap_uint<3> l1ct::ParticleID::bits