Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nptool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
np
nptool
Commits
cd365b12
Commit
cd365b12
authored
3 weeks ago
by
flavigny
Browse files
Options
Downloads
Patches
Plain Diff
* Add new method to fill DSSSD Scorers (Rectangle only for the momen)
Please enter the commit message for your changes. Lines starting
parent
caeeaa40
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NPSimulation/Scorers/DSSDScorers.cc
+153
-34
153 additions, 34 deletions
NPSimulation/Scorers/DSSDScorers.cc
NPSimulation/Scorers/DSSDScorers.hh
+2
-0
2 additions, 0 deletions
NPSimulation/Scorers/DSSDScorers.hh
with
155 additions
and
34 deletions
NPSimulation/Scorers/DSSDScorers.cc
+
153
−
34
View file @
cd365b12
...
@@ -155,7 +155,7 @@ PS_Rectangle::PS_Rectangle(G4String name, G4int Level, G4double StripPlaneLength
...
@@ -155,7 +155,7 @@ PS_Rectangle::PS_Rectangle(G4String name, G4int Level, G4double StripPlaneLength
m_StripPlaneWidth
=
StripPlaneWidth
;
m_StripPlaneWidth
=
StripPlaneWidth
;
m_NumberOfStripLength
=
NumberOfStripLength
;
m_NumberOfStripLength
=
NumberOfStripLength
;
m_NumberOfStripWidth
=
NumberOfStripWidth
;
m_NumberOfStripWidth
=
NumberOfStripWidth
;
m_StripPitchLength
=
m_StripPlaneLength
/
m_NumberOfStripLength
;
m_StripPitchLength
=
m_StripPlaneLength
/
m_NumberOfStripLength
;
m_StripPitchWidth
=
m_StripPlaneWidth
/
m_NumberOfStripWidth
;
m_StripPitchWidth
=
m_StripPlaneWidth
/
m_NumberOfStripWidth
;
m_Level
=
Level
;
m_Level
=
Level
;
if
(
axis
==
"xy"
)
if
(
axis
==
"xy"
)
...
@@ -170,60 +170,179 @@ PS_Rectangle::PS_Rectangle(G4String name, G4int Level, G4double StripPlaneLength
...
@@ -170,60 +170,179 @@ PS_Rectangle::PS_Rectangle(G4String name, G4int Level, G4double StripPlaneLength
PS_Rectangle
::~
PS_Rectangle
()
{}
PS_Rectangle
::~
PS_Rectangle
()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool
PS_Rectangle
::
ProcessHits
(
G4Step
*
aStep
,
G4TouchableHistory
*
)
{
G4bool
PS_Rectangle
::
ProcessHits
New
(
G4Step
*
aStep
)
{
// contain Energy Time, DetNbr, StripFront and StripBack
// contain Energy Time, DetNbr, StripFront and StripBack
t_Energy
=
aStep
->
GetTotalEnergyDeposit
();
t_Energy
=
aStep
->
GetTotalEnergyDeposit
();
t_Time
=
aStep
->
GetPreStepPoint
()
->
GetGlobalTime
();
t_Time
=
aStep
->
GetPreStepPoint
()
->
GetGlobalTime
();
t_DetectorNumber
=
aStep
->
GetPreStepPoint
()
->
GetTouchableHandle
()
->
GetCopyNumber
(
m_Level
);
t_DetectorNumber
=
aStep
->
GetPreStepPoint
()
->
GetTouchableHandle
()
->
GetCopyNumber
(
m_Level
);
t_Position
=
aStep
->
GetPreStepPoint
()
->
GetPosition
();
// Transform Pre/Post-StepPoint position from world coordinate system to local coordinate system of the volume
t_Position
=
aStep
->
GetPreStepPoint
()
->
GetPosition
();
t_Position
=
t_Position
=
aStep
->
GetPreStepPoint
()
->
GetTouchableHandle
()
->
GetHistory
()
->
GetTopTransform
().
TransformPoint
(
t_Position
);
aStep
->
GetPreStepPoint
()
->
GetTouchableHandle
()
->
GetHistory
()
->
GetTopTransform
().
TransformPoint
(
t_Position
);
post_Position
=
aStep
->
GetPostStepPoint
()
->
GetPosition
();
post_Position
=
aStep
->
GetPostStepPoint
()
->
GetTouchableHandle
()
->
GetHistory
()
->
GetTopTransform
().
TransformPoint
(
post_Position
);
double
Win
=
0
,
Wout
=
0
;
double
Wstart
=
0
,
Wend
=
0
;
double
Lin
=
0
,
Lout
=
0
;
double
Lstart
=
0
,
Lend
=
0
;
if
(
m_Axis
==
ps_xy
)
{
if
(
m_Axis
==
ps_xy
)
{
Lin
=
t_Position
.
x
()
+
m_StripPlaneLength
/
2.
;
t_StripLengthNumber
=
(
int
)((
t_Position
.
x
()
+
m_StripPlaneLength
/
2.
)
/
m_StripPitchLength
)
+
1
;
Lout
=
post_Position
.
x
()
+
m_StripPlaneLength
/
2.
;
t_StripWidthNumber
=
(
int
)((
t_Position
.
y
()
+
m_StripPlaneWidth
/
2.
)
/
m_StripPitchWidth
)
+
1
;
Win
=
t_Position
.
y
()
+
m_StripPlaneWidth
/
2.
;
}
Wout
=
post_Position
.
y
()
+
m_StripPlaneWidth
/
2.
;
}
else
if
(
m_Axis
==
ps_yz
)
{
else
if
(
m_Axis
==
ps_yz
)
{
t_StripLengthNumber
=
(
int
)((
t_Position
.
y
()
+
m_StripPlaneLength
/
2.
)
/
m_StripPitchLength
)
+
1
;
Lin
=
t_Position
.
y
()
+
m_StripPlaneLength
/
2.
;
t_StripWidthNumber
=
(
int
)((
t_Position
.
z
()
+
m_StripPlaneWidth
/
2.
)
/
m_StripPitchWidth
)
+
1
;
Lout
=
post_Position
.
y
()
+
m_StripPlaneLength
/
2.
;
Win
=
t_Position
.
z
()
+
m_StripPlaneWidth
/
2.
;
Wout
=
post_Position
.
z
()
+
m_StripPlaneWidth
/
2.
;
}
}
else
if
(
m_Axis
==
ps_xz
)
{
else
if
(
m_Axis
==
ps_xz
)
{
t_StripLengthNumber
=
(
int
)((
t_Position
.
x
()
+
m_StripPlaneLength
/
2.
)
/
m_StripPitchLength
)
+
1
;
Lin
=
t_Position
.
x
()
+
m_StripPlaneLength
/
2.
;
t_StripWidthNumber
=
(
int
)((
t_Position
.
z
()
+
m_StripPlaneWidth
/
2.
)
/
m_StripPitchWidth
)
+
1
;
Lout
=
post_Position
.
x
()
+
m_StripPlaneLength
/
2.
;
Win
=
t_Position
.
z
()
+
m_StripPlaneWidth
/
2.
;
Wout
=
post_Position
.
z
()
+
m_StripPlaneWidth
/
2.
;
}
}
// Rare case where particle is close to edge of silicon plan
if
(
t_StripLengthNumber
>
m_NumberOfStripLength
)
t_StripLengthNumber
=
m_NumberOfStripLength
;
if
(
t_StripWidthNumber
>
m_NumberOfStripWidth
)
t_StripWidthNumber
=
m_NumberOfStripWidth
;
if
(
Win
<
Wout
)
{
Wstart
=
Win
;
Wend
=
Wout
;
}
else
{
Wstart
=
Wout
;
Wend
=
Win
;
}
if
(
Lin
<
Lout
)
{
Lstart
=
Lin
;
Lend
=
Lout
;
}
else
{
Lstart
=
Lout
;
Lend
=
Lin
;
}
// Check if the particle has interact before, if yes, add up the energies.
// Width
// cout << "--------Width--------" << endl;
// cout << "totalE:\t" << t_Energy << endl;
int
Nstart
=
(
int
)(
Wstart
/
m_StripPitchWidth
);
int
Nend
=
(
int
)(
Wend
/
m_StripPitchWidth
);
vector
<
DSSDData
>::
iterator
it
;
vector
<
DSSDData
>::
iterator
it
;
// Length
double
dW
=
0
;
it
=
m_HitLength
.
find
(
DSSDData
::
CalculateIndex
(
t_StripLengthNumber
,
t_DetectorNumber
));
for
(
int
i
=
Nstart
;
i
<=
Nend
;
i
++
)
{
if
(
i
==
Nstart
)
if
(
it
!=
m_HitLength
.
end
())
{
dW
=
(
Nstart
+
1
)
*
m_StripPitchWidth
-
Wstart
;
it
->
Add
(
t_Energy
);
else
if
(
i
==
Nend
)
dW
=
Wend
-
Nend
*
m_StripPitchWidth
;
else
dW
=
m_StripPitchWidth
;
t_StripWidthNumber
=
i
+
1
;
// Rare case where particle is close to edge of silicon plan
if
(
t_StripWidthNumber
>
m_NumberOfStripWidth
)
t_StripWidthNumber
=
m_NumberOfStripWidth
;
it
=
m_HitWidth
.
find
(
DSSDData
::
CalculateIndex
(
t_StripWidthNumber
,
t_DetectorNumber
));
if
(
it
!=
m_HitWidth
.
end
())
{
it
->
Add
(
t_Energy
*
dW
/
(
Wend
-
Wstart
));
}
else
{
m_HitWidth
.
Set
(
t_Energy
*
dW
/
(
Wend
-
Wstart
),
t_Time
,
t_StripWidthNumber
,
t_DetectorNumber
);
}
}
}
else
{
// Length
m_HitLength
.
Set
(
t_Energy
,
t_Time
,
t_StripLengthNumber
,
t_DetectorNumber
);
// cout << "--------Length--------" << endl;
// cout << "totalE:\t" << t_Energy << endl;
Nstart
=
(
int
)(
Lstart
/
m_StripPitchLength
);
Nend
=
(
int
)(
Lend
/
m_StripPitchLength
);
double
dL
=
0
;
for
(
int
i
=
Nstart
;
i
<=
Nend
;
i
++
)
{
if
(
i
==
Nstart
)
dL
=
(
Nstart
+
1
)
*
m_StripPitchLength
-
Lstart
;
else
if
(
i
==
Nend
)
dL
=
Lend
-
Nend
*
m_StripPitchLength
;
else
dL
=
m_StripPitchLength
;
t_StripLengthNumber
=
i
+
1
;
// Rare case where particle is close to edge of silicon plan
if
(
t_StripLengthNumber
>
m_NumberOfStripLength
)
t_StripLengthNumber
=
m_NumberOfStripLength
;
it
=
m_HitLength
.
find
(
DSSDData
::
CalculateIndex
(
t_StripLengthNumber
,
t_DetectorNumber
));
if
(
it
!=
m_HitLength
.
end
())
{
it
->
Add
(
t_Energy
*
dL
/
(
Lend
-
Lstart
));
}
else
{
m_HitLength
.
Set
(
t_Energy
*
dL
/
(
Lend
-
Lstart
),
t_Time
,
t_StripLengthNumber
,
t_DetectorNumber
);
}
}
}
it
=
m_HitWidth
.
find
(
DSSDData
::
CalculateIndex
(
t_StripWidthNumber
,
t_DetectorNumber
));
return
TRUE
;
}
if
(
it
!=
m_HitWidth
.
end
())
{
G4bool
PS_Rectangle
::
ProcessHits
(
G4Step
*
aStep
,
G4TouchableHistory
*
)
{
it
->
Add
(
t_Energy
);
bool
UseNewMethod
=
false
;
if
(
UseNewMethod
)
{
ProcessHitsNew
(
aStep
);
}
}
else
else
{
{
t_Energy
=
aStep
->
GetTotalEnergyDeposit
();
m_HitWidth
.
Set
(
t_Energy
,
t_Time
,
t_StripWidthNumber
,
t_DetectorNumber
);
t_Time
=
aStep
->
GetPreStepPoint
()
->
GetGlobalTime
();
t_DetectorNumber
=
aStep
->
GetPreStepPoint
()
->
GetTouchableHandle
()
->
GetCopyNumber
(
m_Level
);
t_Position
=
aStep
->
GetPreStepPoint
()
->
GetPosition
();
// Transform PreStepPoint position from world coordinate system to local coordinate system of the volume
t_Position
=
aStep
->
GetPreStepPoint
()
->
GetTouchableHandle
()
->
GetHistory
()
->
GetTopTransform
().
TransformPoint
(
t_Position
);
if
(
m_Axis
==
ps_xy
)
{
t_StripLengthNumber
=
(
int
)((
t_Position
.
x
()
+
m_StripPlaneLength
/
2.
)
/
m_StripPitchLength
)
+
1
;
t_StripWidthNumber
=
(
int
)((
t_Position
.
y
()
+
m_StripPlaneWidth
/
2.
)
/
m_StripPitchWidth
)
+
1
;
}
else
if
(
m_Axis
==
ps_yz
)
{
t_StripLengthNumber
=
(
int
)((
t_Position
.
y
()
+
m_StripPlaneLength
/
2.
)
/
m_StripPitchLength
)
+
1
;
t_StripWidthNumber
=
(
int
)((
t_Position
.
z
()
+
m_StripPlaneWidth
/
2.
)
/
m_StripPitchWidth
)
+
1
;
}
else
if
(
m_Axis
==
ps_xz
)
{
t_StripLengthNumber
=
(
int
)((
t_Position
.
x
()
+
m_StripPlaneLength
/
2.
)
/
m_StripPitchLength
)
+
1
;
t_StripWidthNumber
=
(
int
)((
t_Position
.
z
()
+
m_StripPlaneWidth
/
2.
)
/
m_StripPitchWidth
)
+
1
;
}
// Rare case where particle is close to edge of silicon plan
if
(
t_StripLengthNumber
>
m_NumberOfStripLength
)
t_StripLengthNumber
=
m_NumberOfStripLength
;
if
(
t_StripWidthNumber
>
m_NumberOfStripWidth
)
t_StripWidthNumber
=
m_NumberOfStripWidth
;
// Check if the particle has interact before, if yes, add up the energies.
vector
<
DSSDData
>::
iterator
it
;
// Length
it
=
m_HitLength
.
find
(
DSSDData
::
CalculateIndex
(
t_StripLengthNumber
,
t_DetectorNumber
));
if
(
it
!=
m_HitLength
.
end
())
{
it
->
Add
(
t_Energy
);
}
else
{
m_HitLength
.
Set
(
t_Energy
,
t_Time
,
t_StripLengthNumber
,
t_DetectorNumber
);
}
it
=
m_HitWidth
.
find
(
DSSDData
::
CalculateIndex
(
t_StripWidthNumber
,
t_DetectorNumber
));
if
(
it
!=
m_HitWidth
.
end
())
{
it
->
Add
(
t_Energy
);
}
else
{
m_HitWidth
.
Set
(
t_Energy
,
t_Time
,
t_StripWidthNumber
,
t_DetectorNumber
);
}
//}
return
TRUE
;
}
}
//}
return
TRUE
;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
...
...
This diff is collapsed.
Click to expand it.
NPSimulation/Scorers/DSSDScorers.hh
+
2
−
0
View file @
cd365b12
...
@@ -176,6 +176,7 @@ namespace DSSDScorers {
...
@@ -176,6 +176,7 @@ namespace DSSDScorers {
protected
:
// with description
protected
:
// with description
G4bool
ProcessHits
(
G4Step
*
,
G4TouchableHistory
*
);
G4bool
ProcessHits
(
G4Step
*
,
G4TouchableHistory
*
);
G4bool
ProcessHitsNew
(
G4Step
*
);
public
:
public
:
void
Initialize
(
G4HCofThisEvent
*
);
void
Initialize
(
G4HCofThisEvent
*
);
...
@@ -200,6 +201,7 @@ namespace DSSDScorers {
...
@@ -200,6 +201,7 @@ namespace DSSDScorers {
private
:
// Needed for intermediate calculation (avoid multiple instantiation in Processing Hit)
private
:
// Needed for intermediate calculation (avoid multiple instantiation in Processing Hit)
G4ThreeVector
t_Position
;
G4ThreeVector
t_Position
;
G4ThreeVector
post_Position
;
double
t_Energy
;
double
t_Energy
;
double
t_Time
;
double
t_Time
;
unsigned
int
t_DetectorNumber
;
unsigned
int
t_DetectorNumber
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment