ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4PSMinKinEAtGeneration.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4PSMinKinEAtGeneration.cc
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
//
28
// G4PSMinKinEAtGeneration
29
#include "
G4PSMinKinEAtGeneration.hh
"
30
#include "
G4UnitsTable.hh
"
31
32
// (Description)
33
// This is a primitive scorer class for scoring minimum energy of
34
// newly produced particles in the geometry.
35
//
36
// Created: 2005-11-17 Tsukasa ASO, Akinori Kimura.
37
// 2010-07-22 Introduce Unit specification.
38
// 2011-09-09 Modify comment in PrintAll(). T.Aso
39
//
40
41
G4PSMinKinEAtGeneration::G4PSMinKinEAtGeneration
(
G4String
name
,
G4int
depth)
42
:
G4VPrimitiveScorer
(name,depth),HCID(-1),EvtMap(0)
43
{
44
SetUnit
(
"MeV"
);
45
}
46
47
G4PSMinKinEAtGeneration::G4PSMinKinEAtGeneration
(
G4String
name
,
48
const
G4String
& unit,
49
G4int
depth)
50
:
G4VPrimitiveScorer
(name,depth),HCID(-1),EvtMap(0)
51
{
52
SetUnit
(unit);
53
}
54
55
G4PSMinKinEAtGeneration::~G4PSMinKinEAtGeneration
()
56
{;}
57
58
G4bool
G4PSMinKinEAtGeneration::ProcessHits
(
G4Step
* aStep,
G4TouchableHistory
*)
59
{
60
// ===============
61
// First Step,
62
// Confirm this is a newly produced secondary.
63
//
64
//- check for newly produced particle. e.g. Step number is 1.
65
if
( aStep->
GetTrack
()->
GetCurrentStepNumber
() != 1)
return
FALSE
;
66
//- check for this is not a primary particle. e.g. ParentID != 0 .
67
if
( aStep->
GetTrack
()->
GetParentID
() == 0 )
return
FALSE
;
68
69
//===============================================
70
//- This is a newly produced secondary particle.
71
//===============================================
72
73
// ===============
74
// Second Step,
75
// Confirm this track has lower energy than previous one.
76
//
77
78
// -Kinetic energy of this particle at the starting point.
79
G4double
kinetic = aStep->
GetPreStepPoint
()->
GetKineticEnergy
();
80
81
// -Stored value in the current HitsMap.
82
G4int
index =
GetIndex
(aStep);
83
G4double
* mapValue= ((*EvtMap)[index]);
84
85
// -
86
// If mapValue exits (e.g not NULL ), compare it with
87
// current track's kinetic energy.
88
if
( mapValue && ( kinetic > *mapValue ) )
return
FALSE
;
89
90
// -
91
// Current Track is a newly produced secondary and has lower
92
// kinetic energy than previous one in this geometry.
93
//
94
EvtMap
->
set
(index, kinetic);
95
return
TRUE
;
96
}
97
98
void
G4PSMinKinEAtGeneration::Initialize
(
G4HCofThisEvent
* HCE)
99
{
100
EvtMap
=
new
G4THitsMap<G4double>
(
detector
->
GetName
(),
GetName
());
101
if
(
HCID
< 0) {
HCID
=
GetCollectionID
(0);}
102
HCE->
AddHitsCollection
(
HCID
, (
G4VHitsCollection
*)
EvtMap
);
103
}
104
105
void
G4PSMinKinEAtGeneration::EndOfEvent
(
G4HCofThisEvent
*)
106
{;}
107
108
void
G4PSMinKinEAtGeneration::clear
(){
109
EvtMap
->
clear
();
110
}
111
112
void
G4PSMinKinEAtGeneration::DrawAll
()
113
{;}
114
115
void
G4PSMinKinEAtGeneration::PrintAll
()
116
{
117
G4cout
<<
" PrimitiveScorer "
<<
GetName
() <<
G4endl
;
118
G4cout
<<
" Number of entries "
<<
EvtMap
->
entries
() <<
G4endl
;
119
std::map<G4int,G4double*>::iterator itr =
EvtMap
->
GetMap
()->begin();
120
for
(; itr !=
EvtMap
->
GetMap
()->end(); itr++) {
121
G4cout
<<
" copy no.: "
<< itr->first
122
<<
" energy: "
<< *(itr->second)/
GetUnitValue
()
123
<<
" ["
<<
GetUnit
()<<
"]"
124
<<
G4endl
;
125
}
126
}
127
128
void
G4PSMinKinEAtGeneration::SetUnit
(
const
G4String
& unit)
129
{
130
CheckAndSetUnit
(unit,
"Energy"
);
131
}
132
133
geant4
tree
geant4-10.6-release
source
digits_hits
scorer
src
G4PSMinKinEAtGeneration.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:12
using
1.8.2 with
ECCE GitHub integration