src
SimG4Core
Notification
src
G4TrackToParticleID.cc
Go to the documentation of this file.
1
#include "
SimG4Core/Notification/interface/G4TrackToParticleID.h
"
2
3
#include "G4Track.hh"
4
5
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
6
7
int
G4TrackToParticleID::particleID
(
const
G4Track* g4trk) {
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
}
16
17
bool
G4TrackToParticleID::isGammaElectronPositron
(
int
pdgCode) {
18
int
pdg
=
std::abs
(pdgCode);
19
return
(
pdg
== 11 ||
pdg
== 22);
20
}
21
22
bool
G4TrackToParticleID::isGammaElectronPositron
(
const
G4Track* g4trk) {
23
int
pdg
=
std::abs
(g4trk->GetDefinition()->GetPDGEncoding());
24
return
(
pdg
== 11 ||
pdg
== 22);
25
}
26
27
bool
G4TrackToParticleID::isMuon
(
int
pdgCode) {
return
(
std::abs
(pdgCode) == 13); }
28
29
bool
G4TrackToParticleID::isMuon
(
const
G4Track* g4trk) {
30
return
(
std::abs
(g4trk->GetDefinition()->GetPDGEncoding()) == 13);
31
}
32
33
bool
G4TrackToParticleID::isStableHadron
(
int
pdgCode) {
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
}
39
40
bool
G4TrackToParticleID::isStableHadronIon
(
const
G4Track* g4trk) {
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
}
G4TrackToParticleID::isMuon
static bool isMuon(int pdgCode)
Definition:
G4TrackToParticleID.cc:27
MessageLogger.h
pdg
Definition:
pdg_functions.h:28
G4TrackToParticleID.h
G4TrackToParticleID::isStableHadron
static bool isStableHadron(int pdgCode)
Definition:
G4TrackToParticleID.cc:33
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
G4TrackToParticleID::particleID
static int particleID(const G4Track *)
Definition:
G4TrackToParticleID.cc:7
G4TrackToParticleID::isStableHadronIon
static bool isStableHadronIon(const G4Track *)
Definition:
G4TrackToParticleID.cc:40
G4TrackToParticleID::isGammaElectronPositron
static bool isGammaElectronPositron(int pdgCode)
Definition:
G4TrackToParticleID.cc:17
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
Generated for CMSSW Reference Manual by
1.8.14