src
SimG4Core
Notification
src
TrackWithHistory.cc
Go to the documentation of this file.
1
#include "
SimG4Core/Notification/interface/TrackWithHistory.h
"
2
#include "
SimG4Core/Notification/interface/G4TrackToParticleID.h
"
3
#include "
SimG4Core/Notification/interface/TrackInformation.h
"
4
#include "
SimG4Core/Notification/interface/GenParticleInfo.h
"
5
6
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
7
8
#include "G4VProcess.hh"
9
#include "G4DynamicParticle.hh"
10
#include "G4PrimaryParticle.hh"
11
#include "G4ThreeVector.hh"
12
13
#include <iostream>
14
15
G4ThreadLocal G4Allocator<TrackWithHistory>*
fpTrackWithHistoryAllocator
=
nullptr
;
16
17
TrackWithHistory::TrackWithHistory
(
const
G4Track* g4trk,
int
pID) {
18
trackID_
= g4trk->GetTrackID();
19
pdgID_
=
G4TrackToParticleID::particleID
(g4trk);
20
parentID_
= pID;
21
auto
mom = g4trk->GetMomentum();
22
momentum_
=
math::XYZVectorD
(mom.x(), mom.y(), mom.z());
23
totalEnergy_
= g4trk->GetTotalEnergy();
24
auto
pos
= g4trk->GetPosition();
25
vertexPosition_
=
math::XYZVectorD
(
pos
.x(),
pos
.y(),
pos
.z());
26
time_
= g4trk->GetGlobalTime();
27
auto
p
= g4trk->GetCreatorProcess();
28
procType_
= (
nullptr
!=
p
) ?
p
->GetProcessSubType() : 0;
29
TrackInformation
* trkinfo =
static_cast<
TrackInformation
*
>
(g4trk->GetUserInformation());
30
storeTrack_
= trkinfo->
storeTrack
();
31
auto
vgprimary = g4trk->GetDynamicParticle()->GetPrimaryParticle();
32
if
(vgprimary !=
nullptr
) {
33
auto
priminfo =
static_cast<
GenParticleInfo
*
>
(vgprimary->GetUserInformation());
34
if
(
nullptr
!= priminfo) {
35
genParticleID_
= priminfo->id();
36
}
37
}
38
// V.I. weight is computed in the same way as before
39
// without usage of G4Track::GetWeight()
40
weight_
= 10000 *
genParticleID_
;
41
}
42
43
TrackWithHistory::TrackWithHistory
(
const
G4PrimaryParticle* ptr,
int
trackID,
const
math::XYZVectorD
&
pos
,
double
time
) {
44
trackID_
=
trackID
;
45
pdgID_
=
G4TrackToParticleID::particleID
(ptr,
trackID_
);
46
parentID_
=
trackID
;
47
auto
mom = ptr->GetMomentum();
48
momentum_
=
math::XYZVectorD
(mom.x(), mom.y(), mom.z());
49
totalEnergy_
= ptr->GetTotalEnergy();
50
vertexPosition_
=
math::XYZVectorD
(
pos
.x(),
pos
.y(),
pos
.z());
51
time_
=
time
;
52
storeTrack_
=
true
;
53
auto
priminfo =
static_cast<
GenParticleInfo
*
>
(ptr->GetUserInformation());
54
if
(
nullptr
!= priminfo) {
55
genParticleID_
= priminfo->id();
56
}
57
weight_
= 10000. *
genParticleID_
;
58
}
TrackInformation::storeTrack
bool storeTrack() const
Definition:
TrackInformation.h:17
fpTrackWithHistoryAllocator
G4ThreadLocal G4Allocator< TrackWithHistory > * fpTrackWithHistoryAllocator
Definition:
TrackWithHistory.cc:15
TrackWithHistory::parentID_
int parentID_
Definition:
TrackWithHistory.h:74
MessageLogger.h
TrackWithHistory::vertexPosition_
math::XYZVectorD vertexPosition_
Definition:
TrackWithHistory.h:83
TrackWithHistory::momentum_
math::XYZVectorD momentum_
Definition:
TrackWithHistory.h:82
TrackWithHistory::trackID_
int trackID_
Definition:
TrackWithHistory.h:72
TrackWithHistory::time_
double time_
Definition:
TrackWithHistory.h:80
TrackInformation.h
G4TrackToParticleID.h
TrackWithHistory::time
double time() const
Definition:
TrackWithHistory.h:41
hcalRecHitTable_cff.time
time
Definition:
hcalRecHitTable_cff.py:14
TrackWithHistory::pdgID_
int pdgID_
Definition:
TrackWithHistory.h:73
TrackWithHistory::weight_
double weight_
Definition:
TrackWithHistory.h:81
TrackWithHistory::storeTrack_
bool storeTrack_
Definition:
TrackWithHistory.h:88
math::XYZVectorD
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition:
Vector3D.h:8
GenParticleInfo.h
TrackWithHistory::genParticleID_
int genParticleID_
Definition:
TrackWithHistory.h:75
G4TrackToParticleID::particleID
static int particleID(const G4Track *)
Definition:
G4TrackToParticleID.cc:8
TrackWithHistory::TrackWithHistory
TrackWithHistory(const G4Track *g4track, int pID)
Definition:
TrackWithHistory.cc:17
pos
Definition:
PixelCalibBase.h:13
TrackWithHistory.h
TrackInformation
Definition:
TrackInformation.h:10
TrackWithHistory::trackID
int trackID() const
Definition:
TrackWithHistory.h:27
GenParticleInfo
Definition:
GenParticleInfo.h:6
TrackWithHistory::totalEnergy_
double totalEnergy_
Definition:
TrackWithHistory.h:79
TrackWithHistory::procType_
int procType_
Definition:
TrackWithHistory.h:78
AlCaHLTBitMon_ParallelJobs.p
def p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
Generated for CMSSW Reference Manual by
1.8.14