Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CEPCSW
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
maxt@ihep.ac.cn
CEPCSW
Commits
28fdb293
Commit
28fdb293
authored
1 year ago
by
FU Chengdong
Browse files
Options
Downloads
Patches
Plain Diff
import parameterized spatial resolution model
parent
7edab5ff
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
Digitisers/SimpleDigi/src/PlanarDigiAlg.cpp
+60
-24
60 additions, 24 deletions
Digitisers/SimpleDigi/src/PlanarDigiAlg.cpp
Digitisers/SimpleDigi/src/PlanarDigiAlg.h
+3
-0
3 additions, 0 deletions
Digitisers/SimpleDigi/src/PlanarDigiAlg.h
with
63 additions
and
24 deletions
Digitisers/SimpleDigi/src/PlanarDigiAlg.cpp
+
60
−
24
View file @
28fdb293
...
...
@@ -54,13 +54,20 @@ PlanarDigiAlg::PlanarDigiAlg(const std::string& name, ISvcLocator* svcLoc)
StatusCode
PlanarDigiAlg
::
initialize
()
{
if
(
_parameterize
)
{
if
(
_parU
.
size
()
!=
10
||
_parV
.
size
()
!=
10
)
{
fatal
()
<<
"parameters number must be 10! now "
<<
_parU
.
size
()
<<
" for U and "
<<
_parV
.
size
()
<<
" for V"
<<
endmsg
;
return
StatusCode
::
FAILURE
;
}
}
else
{
if
(
_resU
.
size
()
!=
_resV
.
size
())
{
fatal
()
<<
"Inconsistent number of resolutions given for U and V coordinate: "
<<
"ResolutionU :"
<<
_resU
.
size
()
<<
" != ResolutionV : "
<<
_resV
.
size
()
<<
endmsg
;
if
(
_resU
.
size
()
!=
_resV
.
size
()
)
{
fatal
()
<<
"Inconsistent number of resolutions given for U and V coordinate: "
<<
"ResolutionU :"
<<
_resU
.
size
()
<<
" != ResolutionV : "
<<
_resV
.
size
()
<<
endmsg
;
return
StatusCode
::
FAILURE
;
return
StatusCode
::
FAILURE
;
}
}
// get the GEAR manager
...
...
@@ -167,6 +174,7 @@ StatusCode PlanarDigiAlg::execute()
int
i
=
0
;
for
(
auto
SimTHit
:
*
STHcol
)
{
if
(
SimTHit
.
getEDep
()
<=
_eThreshold
)
continue
;
debug
()
<<
"MCParticle id "
<<
SimTHit
.
getMCParticle
().
id
()
<<
endmsg
;
const
int
celId
=
SimTHit
.
getCellID
()
;
...
...
@@ -206,28 +214,60 @@ StatusCode PlanarDigiAlg::execute()
// << endmsg;
// continue;
// }
if
(
(
_resU
.
size
()
>
1
&&
layer
>
_resU
.
size
()
-
1
)
||
(
_resV
.
size
()
>
1
&&
layer
>
_resV
.
size
()
-
1
)
)
{
fatal
()
<<
"layer exceeds resolution vector, please check input parameters ResolutionU and ResolutionV"
<<
endmsg
;
return
StatusCode
::
FAILURE
;
}
gear
::
MeasurementSurface
const
*
ms
=
_GEAR
->
getMeasurementSurfaceStore
().
GetMeasurementSurface
(
encoder
.
lowWord
()
);
gear
::
CartesianCoordinateSystem
*
cartesian
=
dynamic_cast
<
gear
::
CartesianCoordinateSystem
*
>
(
ms
->
getCoordinateSystem
()
)
;
CLHEP
::
Hep3Vector
uVec
=
cartesian
->
getLocalXAxis
()
;
CLHEP
::
Hep3Vector
vVec
=
cartesian
->
getLocalYAxis
();
float
resU
=
(
_resU
.
size
()
>
1
?
_resU
.
value
().
at
(
layer
)
:
_resU
.
value
().
at
(
0
)
)
;
float
resV
=
(
_resV
.
size
()
>
1
?
_resV
.
value
().
at
(
layer
)
:
_resV
.
value
().
at
(
0
)
)
;
float
u_direction
[
2
]
;
u_direction
[
0
]
=
uVec
.
theta
();
u_direction
[
1
]
=
uVec
.
phi
();
float
v_direction
[
2
]
;
v_direction
[
0
]
=
vVec
.
theta
();
v_direction
[
1
]
=
vVec
.
phi
();
debug
()
<<
" U[0] = "
<<
u_direction
[
0
]
<<
" U[1] = "
<<
u_direction
[
1
]
<<
" V[0] = "
<<
v_direction
[
0
]
<<
" V[1] = "
<<
v_direction
[
1
]
<<
endmsg
;
float
resU
(
0
),
resV
(
0
);
if
(
!
_parameterize
)
{
if
(
(
_resU
.
size
()
>
1
&&
layer
>
_resU
.
size
()
-
1
)
||
(
_resV
.
size
()
>
1
&&
layer
>
_resV
.
size
()
-
1
)
)
{
fatal
()
<<
"layer exceeds resolution vector, please check input parameters ResolutionU and ResolutionV"
<<
endmsg
;
return
StatusCode
::
FAILURE
;
}
resU
=
(
_resU
.
size
()
>
1
?
_resU
.
value
().
at
(
layer
)
:
_resU
.
value
().
at
(
0
)
)
;
resV
=
(
_resV
.
size
()
>
1
?
_resV
.
value
().
at
(
layer
)
:
_resV
.
value
().
at
(
0
)
)
;
}
else
{
// Riccardo's parameterized model
auto
mom
=
SimTHit
.
getMomentum
();
CLHEP
::
Hep3Vector
momVec
(
mom
[
0
],
mom
[
1
],
mom
[
2
]);
const
double
alpha
=
uVec
.
azimAngle
(
momVec
,
vVec
);
const
double
cotanAlpha
=
1.
/
tan
(
alpha
);
// TODO: title angle (PI/2), magnetic field (3)
const
double
tanLorentzAngle
=
(
side
==
0
)
?
0.
:
0.053
*
3
*
cos
(
M_PI
/
2.
);
const
double
x
=
fabs
(
-
cotanAlpha
-
tanLorentzAngle
);
resU
=
_parU
[
0
]
+
_parU
[
1
]
*
x
+
_parU
[
2
]
*
exp
(
-
_parU
[
9
]
*
x
)
*
cos
(
_parU
[
3
]
*
x
+
_parU
[
4
])
+
_parU
[
5
]
*
exp
(
-
0.5
*
pow
(((
x
-
_parU
[
6
])
/
_parU
[
7
]),
2
))
+
_parU
[
8
]
*
pow
(
x
,
0.5
);
const
double
beta
=
vVec
.
azimAngle
(
momVec
,
uVec
);
const
double
cotanBeta
=
1.
/
tan
(
beta
);
const
double
y
=
fabs
(
-
cotanBeta
);
resV
=
_parV
[
0
]
+
_parV
[
1
]
*
y
+
_parV
[
2
]
*
exp
(
-
_parV
[
9
]
*
y
)
*
cos
(
_parV
[
3
]
*
y
+
_parV
[
4
])
+
_parV
[
5
]
*
exp
(
-
0.5
*
pow
(((
y
-
_parV
[
6
])
/
_parV
[
7
]),
2
))
+
_parV
[
8
]
*
pow
(
y
,
0.5
);
}
debug
()
<<
" --- will smear hit with resU = "
<<
resU
<<
" and resV = "
<<
resV
<<
endmsg
;
auto
&
pos
=
SimTHit
.
getPosition
()
;
//edm4hep::Vector3d smearedPos;
//GearSurfaces::MeasurementSurface* ms = _GEAR->getMeasurementSurfaceStore().GetMeasurementSurface( SimTHit->getCellID0() );
gear
::
MeasurementSurface
const
*
ms
=
_GEAR
->
getMeasurementSurfaceStore
().
GetMeasurementSurface
(
encoder
.
lowWord
()
);;
CLHEP
::
Hep3Vector
globalPoint
(
pos
[
0
],
pos
[
1
],
pos
[
2
]);
CLHEP
::
Hep3Vector
localPoint
=
ms
->
getCoordinateSystem
()
->
getLocalPoint
(
globalPoint
);
CLHEP
::
Hep3Vector
localPointSmeared
=
localPoint
;
debug
()
<<
std
::
setprecision
(
8
)
<<
"Position of hit before smearing global: ( "
<<
pos
[
0
]
<<
" "
<<
pos
[
1
]
<<
" "
<<
pos
[
2
]
<<
" ) "
<<
"local: ( "
<<
localPoint
.
x
()
<<
" "
<<
localPoint
.
y
()
<<
" "
<<
localPoint
.
z
()
<<
" )"
<<
endmsg
;
...
...
@@ -260,7 +300,6 @@ StatusCode PlanarDigiAlg::execute()
//check if hit is in boundaries
if
(
ms
->
isLocalInBoundary
(
localPointSmeared
)
&&
fabs
(
dx
)
<=
_maxPull
*
resU
&&
fabs
(
dy
)
<=
_maxPull
*
resV
)
{
//if ( ms->isLocalInBoundary( localPointSmeared ) ) {
accept_hit
=
true
;
break
;
}
...
...
@@ -285,10 +324,6 @@ StatusCode PlanarDigiAlg::execute()
<<
localPointSmeared
.
x
()
<<
" "
<<
localPointSmeared
.
y
()
<<
" "
<<
localPointSmeared
.
z
()
<<
" )"
<<
endmsg
;
//smearedPos[0] = globalPointSmeared.x();
//smearedPos[1] = globalPointSmeared.y();
//smearedPos[2] = globalPointSmeared.z();
//make the TrackerHitPlaneImpl
auto
trkHit
=
trkhitVec
->
create
();
...
...
@@ -296,7 +331,7 @@ StatusCode PlanarDigiAlg::execute()
edm4hep
::
Vector3d
smearedPos
(
globalPointSmeared
.
x
(),
globalPointSmeared
.
y
(),
globalPointSmeared
.
z
());
trkHit
.
setPosition
(
smearedPos
)
;
/*
gear::CartesianCoordinateSystem* cartesian = dynamic_cast< gear::CartesianCoordinateSystem* >( ms->getCoordinateSystem() );
CLHEP::Hep3Vector uVec = cartesian->getLocalXAxis();
CLHEP::Hep3Vector vVec = cartesian->getLocalYAxis();
...
...
@@ -312,6 +347,7 @@ StatusCode PlanarDigiAlg::execute()
debug() << " U[0] = "<< u_direction[0] << " U[1] = "<< u_direction[1]
<< " V[0] = "<< v_direction[0] << " V[1] = "<< v_direction[1]
<< endmsg ;
*/
// fucd: next TODO: cov[0] = resU*reU, cov[2] = resV*resV, cov[5] = 0
if
(
_usePlanarTag
){
std
::
array
<
float
,
6
>
cov
;
...
...
This diff is collapsed.
Click to expand it.
Digitisers/SimpleDigi/src/PlanarDigiAlg.h
+
3
−
0
View file @
28fdb293
...
...
@@ -84,6 +84,9 @@ protected:
Gaudi
::
Property
<
bool
>
_usePlanarTag
{
this
,
"UsePlanarTag"
,
true
};
Gaudi
::
Property
<
float
>
_eThreshold
{
this
,
"EnergyThreshold"
,
0
};
Gaudi
::
Property
<
float
>
_maxPull
{
this
,
"PullCutToRetry"
,
1000.
};
Gaudi
::
Property
<
bool
>
_parameterize
{
this
,
"ParameterizeResolution"
,
false
};
Gaudi
::
Property
<
FloatVec
>
_parU
{
this
,
"ParametersU"
,
{
0
}
};
Gaudi
::
Property
<
FloatVec
>
_parV
{
this
,
"ParametersV"
,
{
0
}
};
// Input collections
DataHandle
<
edm4hep
::
EventHeaderCollection
>
_headerCol
{
"EventHeaderCol"
,
Gaudi
::
DataHandle
::
Reader
,
this
};
...
...
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