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
#include "G4PrimaryParticle.hh"
5
6
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
7
8
int
G4TrackToParticleID::particleID
(
const
G4Track* g4trk) {
9
int
pdg
= g4trk->GetDefinition()->GetPDGEncoding();
10
if
(0 ==
pdg
) {
11
edm::LogWarning
(
"SimG4CoreNotification"
)
12
<<
"G4TrackToParticleID: unknown code 0 for trackId="
<< g4trk->GetTrackID();
13
pdg
= -99;
14
}
15
return
pdg
;
16
}
17
18
int
G4TrackToParticleID::particleID
(
const
G4PrimaryParticle* ptr,
const
int
id
) {
19
int
pdg
= ptr->GetPDGcode();
20
if
(0 ==
pdg
) {
21
edm::LogWarning
(
"SimG4CoreNotification"
) <<
"G4TrackToParticleID: unknown code 0 for trackId="
<<
id
;
22
pdg
= -99;
23
}
24
return
pdg
;
25
}
26
27
bool
G4TrackToParticleID::isGammaElectronPositron
(
int
pdgCode) {
28
int
pdg
=
std::abs
(pdgCode);
29
return
(
pdg
== 11 ||
pdg
== 22);
30
}
31
32
bool
G4TrackToParticleID::isGammaElectronPositron
(
const
G4Track* g4trk) {
33
int
pdg
=
std::abs
(g4trk->GetDefinition()->GetPDGEncoding());
34
return
(
pdg
== 11 ||
pdg
== 22);
35
}
36
37
bool
G4TrackToParticleID::isMuon
(
int
pdgCode) {
return
(
std::abs
(pdgCode) == 13); }
38
39
bool
G4TrackToParticleID::isMuon
(
const
G4Track* g4trk) {
40
return
(
std::abs
(g4trk->GetDefinition()->GetPDGEncoding()) == 13);
41
}
42
43
bool
G4TrackToParticleID::isStableHadron
(
int
pdgCode) {
44
// pi+-, p, pbar, n, nbar, KL, K+-, light ions and anti-ions
45
int
pdg
=
std::abs
(pdgCode);
46
return
(
pdg
== 211 ||
pdg
== 2212 ||
pdg
== 2112 ||
pdg
== 130 ||
pdg
== 321 ||
pdg
== 1000010020 ||
47
pdg
== 1000010030 ||
pdg
== 1000020030 ||
pdg
== 1000020040);
48
}
49
50
bool
G4TrackToParticleID::isStableHadronIon
(
const
G4Track* g4trk) {
51
// pi+-, p, pbar, n, nbar, KL, K+-, light ion and anti-ion, generic ion
52
int
pdg
=
std::abs
(g4trk->GetDefinition()->GetPDGEncoding());
53
return
(
pdg
== 211 ||
pdg
== 2212 ||
pdg
== 2112 ||
pdg
== 130 ||
pdg
== 321 ||
pdg
== 1000010020 ||
54
pdg
== 1000010030 ||
pdg
== 1000020030 ||
pdg
== 1000020040 || g4trk->GetDefinition()->IsGeneralIon());
55
}
G4TrackToParticleID::isMuon
static bool isMuon(int pdgCode)
Definition:
G4TrackToParticleID.cc:37
MessageLogger.h
dileptonTrigSettings_cff.pdg
pdg
Definition:
dileptonTrigSettings_cff.py:6
pdg
Definition:
pdg_functions.h:28
G4TrackToParticleID.h
G4TrackToParticleID::isStableHadron
static bool isStableHadron(int pdgCode)
Definition:
G4TrackToParticleID.cc:43
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
G4TrackToParticleID::particleID
static int particleID(const G4Track *)
Definition:
G4TrackToParticleID.cc:8
G4TrackToParticleID::isStableHadronIon
static bool isStableHadronIon(const G4Track *)
Definition:
G4TrackToParticleID.cc:50
EcalPhiSymFlatTableProducers_cfi.id
id
Definition:
EcalPhiSymFlatTableProducers_cfi.py:11
G4TrackToParticleID::isGammaElectronPositron
static bool isGammaElectronPositron(int pdgCode)
Definition:
G4TrackToParticleID.cc:27
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:128
Generated for CMSSW Reference Manual by
1.8.14