CMS 3D CMS Logo

List of all members | Static Public Member Functions
G4TrackToParticleID Class Reference

#include <G4TrackToParticleID.h>

Static Public Member Functions

static bool isGammaElectronPositron (const G4Track *)
 
static bool isGammaElectronPositron (int pdgCode)
 
static bool isMuon (const G4Track *)
 
static bool isMuon (int pdgCode)
 
static bool isStableHadron (int pdgCode)
 
static bool isStableHadronIon (const G4Track *)
 
static int particleID (const G4Track *)
 

Detailed Description

Definition at line 6 of file G4TrackToParticleID.h.

Member Function Documentation

◆ isGammaElectronPositron() [1/2]

bool G4TrackToParticleID::isGammaElectronPositron ( const G4Track *  g4trk)
static

Definition at line 22 of file G4TrackToParticleID.cc.

22  {
23  int pdg = std::abs(g4trk->GetDefinition()->GetPDGEncoding());
24  return (pdg == 11 || pdg == 22);
25 }

References funct::abs().

◆ isGammaElectronPositron() [2/2]

bool G4TrackToParticleID::isGammaElectronPositron ( int  pdgCode)
static

◆ isMuon() [1/2]

bool G4TrackToParticleID::isMuon ( const G4Track *  g4trk)
static

Definition at line 29 of file G4TrackToParticleID.cc.

29  {
30  return (std::abs(g4trk->GetDefinition()->GetPDGEncoding()) == 13);
31 }

References funct::abs().

◆ isMuon() [2/2]

bool G4TrackToParticleID::isMuon ( int  pdgCode)
static

Definition at line 27 of file G4TrackToParticleID.cc.

27 { return (std::abs(pdgCode) == 13); }

References funct::abs().

Referenced by HCalSD::getEnergyDeposit(), and HCalSD::getFromLibrary().

◆ isStableHadron()

bool G4TrackToParticleID::isStableHadron ( int  pdgCode)
static

Definition at line 33 of file G4TrackToParticleID.cc.

33  {
34  // pi+-, p, pbar, n, nbar, KL, K+-, light ions and anti-ions
35  int pdg = std::abs(pdgCode);
36  return (pdg == 211 || pdg == 2212 || pdg == 2112 || pdg == 130 || pdg == 321 || pdg == 1000010020 ||
37  pdg == 1000010030 || pdg == 1000020030 || pdg == 1000020040);
38 }

References funct::abs().

Referenced by HFShowerLibrary::fillHits().

◆ isStableHadronIon()

bool G4TrackToParticleID::isStableHadronIon ( const G4Track *  g4trk)
static

Definition at line 40 of file G4TrackToParticleID.cc.

40  {
41  // pi+-, p, pbar, n, nbar, KL, K+-, light ion and anti-ion, generic ion
42  int pdg = std::abs(g4trk->GetDefinition()->GetPDGEncoding());
43  return (pdg == 211 || pdg == 2212 || pdg == 2112 || pdg == 130 || pdg == 321 || pdg == 1000010020 ||
44  pdg == 1000010030 || pdg == 1000020030 || pdg == 1000020040 || g4trk->GetDefinition()->IsGeneralIon());
45 }

References funct::abs().

Referenced by CastorSD::getEnergyDeposit(), CastorSD::getFromLibrary(), HCalSD::getFromLibrary(), ZdcShowerLibrary::getHits(), and CastorShowerLibrary::getShowerHits().

◆ particleID()

int G4TrackToParticleID::particleID ( const G4Track *  g4trk)
static

Definition at line 7 of file G4TrackToParticleID.cc.

7  {
8  int particleID_ = g4trk->GetDefinition()->GetPDGEncoding();
9  if (0 == particleID_) {
10  edm::LogWarning("SimG4CoreNotification")
11  << "G4TrackToParticleID: unknown code 0 for track Id = " << g4trk->GetTrackID();
12  particleID_ = -99;
13  }
14  return particleID_;
15 }

Referenced by TkAccumulatingSensitiveDetector::createHit(), MuonSensitiveDetector::createHit(), and TrackWithHistory::TrackWithHistory().

edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
pdg
Definition: pdg_functions.h:28
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22