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
Li Zhihao
CEPCSW
Commits
3d95f26d
Commit
3d95f26d
authored
4 years ago
by
myliu@ihep.ac.cn
Browse files
Options
Downloads
Patches
Plain Diff
The id of the layer of the out chamber starts from 0
parent
86db28b5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Detector/DetSegmentation/include/DetSegmentation/GridDriftChamber.h
+38
-20
38 additions, 20 deletions
...etSegmentation/include/DetSegmentation/GridDriftChamber.h
Detector/DetSegmentation/src/GridDriftChamber.cpp
+9
-5
9 additions, 5 deletions
Detector/DetSegmentation/src/GridDriftChamber.cpp
with
47 additions
and
25 deletions
Detector/DetSegmentation/include/DetSegmentation/GridDriftChamber.h
+
38
−
20
View file @
3d95f26d
...
@@ -30,6 +30,20 @@ typedef struct Layer
...
@@ -30,6 +30,20 @@ typedef struct Layer
}
}
}
LAYER
;
}
LAYER
;
typedef
struct
CID
{
int
chamberID
;
int
layerID
;
// CID(){}
CID
(
int
i
,
int
j
)
:
chamberID
(
i
),
layerID
(
j
){}
// the operator < defines the operation used in map
friend
bool
operator
<
(
const
CID
&
c1
,
const
CID
&
c2
);
}
vID
;
inline
bool
operator
<
(
const
struct
CID
&
c1
,
const
struct
CID
&
c2
)
{
return
c1
.
chamberID
<
c2
.
chamberID
||
(
c1
.
chamberID
==
c2
.
chamberID
&&
c1
.
layerID
<
c2
.
layerID
);
}
namespace
dd4hep
{
namespace
dd4hep
{
namespace
DDSegmentation
{
namespace
DDSegmentation
{
class
GridDriftChamber
:
public
Segmentation
{
class
GridDriftChamber
:
public
Segmentation
{
...
@@ -74,13 +88,15 @@ public:
...
@@ -74,13 +88,15 @@ public:
return
hit_phi
;
return
hit_phi
;
}
}
inline
void
setGeomParams
(
int
layer
,
double
layerphi
,
double
R
,
double
eps
,
double
offset
)
{
inline
void
setGeomParams
(
int
chamberID
,
int
layerID
,
double
layerphi
,
double
R
,
double
eps
,
double
offset
)
{
layer_params
.
insert
(
std
::
pair
<
int
,
LAYER
>
(
layer
,
LAYER
(
layerphi
,
R
,
eps
,
offset
)));
layer_params
.
insert
(
std
::
pair
<
vID
,
LAYER
>
(
vID
(
chamberID
,
layerID
),
LAYER
(
layerphi
,
R
,
eps
,
offset
)));
}
}
inline
void
setWiresInLayer
(
int
layer
,
int
numWires
)
inline
void
setWiresInLayer
(
int
chamber
,
int
layer
,
int
numWires
)
{
{
updateParams
(
layer
);
updateParams
(
chamber
,
layer
);
for
(
int
i
=
0
;
i
<
numWires
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numWires
;
++
i
)
{
auto
phi_start
=
_currentLayerphi
*
(
i
+
0.5
)
+
m_offset
;
auto
phi_start
=
_currentLayerphi
*
(
i
+
0.5
)
+
m_offset
;
...
@@ -106,31 +122,33 @@ public:
...
@@ -106,31 +122,33 @@ public:
// return w;
// return w;
// }
// }
void
updateParams
(
int
layer
)
const
{
void
updateParams
(
int
chamber
,
int
layer
)
const
{
auto
it_end
=
layer_params
.
cend
();
auto
it_end
=
layer_params
.
cend
();
--
it_end
;
--
it_end
;
double
l
ayer
p
hi
=
it_end
->
second
.
layerphi
;
double
L
ayer
P
hi
=
it_end
->
second
.
layerphi
;
double
r
adius
=
it_end
->
second
.
R
;
double
R
adius
=
it_end
->
second
.
R
;
double
e
ps
=
it_end
->
second
.
eps
;
double
E
ps
=
it_end
->
second
.
eps
;
double
o
ffset
=
it_end
->
second
.
offset
;
double
O
ffset
=
it_end
->
second
.
offset
;
auto
map_it
=
layer_params
.
find
(
layer
);
CID
v1
(
chamber
,
layer
);
auto
map_it
=
layer_params
.
find
(
v1
);
if
(
map_it
!=
layer_params
.
cend
())
{
if
(
map_it
!=
layer_params
.
cend
())
{
layerphi
=
map_it
->
second
.
layerphi
;
LayerPhi
=
map_it
->
second
.
layerphi
;
radius
=
map_it
->
second
.
R
;
Radius
=
map_it
->
second
.
R
;
eps
=
map_it
->
second
.
eps
;
Eps
=
map_it
->
second
.
eps
;
offset
=
map_it
->
second
.
offset
;
Offset
=
map_it
->
second
.
offset
;
}
}
else
{
std
::
cout
<<
" Sorry, pair with key "
<<
layer
<<
" not in map"
<<
std
::
endl
;
}
_currentLayerphi
=
layerphi
;
_currentRadius
=
radius
;
_currentLayerphi
=
LayerPhi
;
m_epsilon
=
eps
;
_currentRadius
=
Radius
;
m_offset
=
offset
;
m_epsilon
=
Eps
;
m_offset
=
Offset
;
}
}
protected
:
protected
:
double
phi
(
const
CellID
&
cID
)
const
;
double
phi
(
const
CellID
&
cID
)
const
;
std
::
map
<
int
,
LAYER
>
layer_params
;
// <layer, {layerphi, R, eps, offset}>
std
::
map
<
vID
,
LAYER
>
layer_params
;
// <
{chamberID,
layer
ID}
, {layerphi, R, eps, offset}>
std
::
map
<
int
,
std
::
vector
<
std
::
pair
<
TVector3
,
TVector3
>
>>
m_wiresPositions
;
// < layer, vec<WireMidpoint, WireDirection> >
std
::
map
<
int
,
std
::
vector
<
std
::
pair
<
TVector3
,
TVector3
>
>>
m_wiresPositions
;
// < layer, vec<WireMidpoint, WireDirection> >
inline
TVector3
returnWirePosition
(
double
angle
,
int
sign
)
const
{
inline
TVector3
returnWirePosition
(
double
angle
,
int
sign
)
const
{
...
...
This diff is collapsed.
Click to expand it.
Detector/DetSegmentation/src/GridDriftChamber.cpp
+
9
−
5
View file @
3d95f26d
...
@@ -54,6 +54,8 @@ CellID GridDriftChamber::cellID(const Vector3D& /*localPosition*/, const Vector3
...
@@ -54,6 +54,8 @@ CellID GridDriftChamber::cellID(const Vector3D& /*localPosition*/, const Vector3
CellID
cID
=
vID
;
CellID
cID
=
vID
;
int
chamberID
=
_decoder
->
get
(
cID
,
"chamber"
);
double
posx
=
globalPosition
.
X
;
double
posx
=
globalPosition
.
X
;
double
posy
=
globalPosition
.
Y
;
double
posy
=
globalPosition
.
Y
;
double
radius
=
sqrt
(
posx
*
posx
+
posy
*
posy
);
double
radius
=
sqrt
(
posx
*
posx
+
posy
*
posy
);
...
@@ -64,18 +66,19 @@ CellID GridDriftChamber::cellID(const Vector3D& /*localPosition*/, const Vector3
...
@@ -64,18 +66,19 @@ CellID GridDriftChamber::cellID(const Vector3D& /*localPosition*/, const Vector3
if
(
radius
<=
m_DC_inner_rend
&&
radius
>=
m_DC_inner_rbegin
)
{
if
(
radius
<=
m_DC_inner_rend
&&
radius
>=
m_DC_inner_rbegin
)
{
layerid
=
floor
((
radius
-
m_DC_inner_rbegin
)
/
DC_layerdelta
);
layerid
=
floor
((
radius
-
m_DC_inner_rbegin
)
/
DC_layerdelta
);
}
else
if
(
radius
<=
m_DC_outer_rend
&&
radius
>=
m_DC_outer_rbegin
)
{
}
else
if
(
radius
<=
m_DC_outer_rend
&&
radius
>=
m_DC_outer_rbegin
)
{
layerid
=
floor
((
radius
-
m_DC_outer_rbegin
)
/
DC_layerdelta
)
+
m_DC_inner_layer_number
;
layerid
=
floor
((
radius
-
m_DC_outer_rbegin
)
/
DC_layerdelta
);
}
else
if
(
radius
>=
(
m_DC_inner_rmin
-
m_safe_distance
)
&&
radius
<
m_DC_inner_rbegin
)
{
}
else
if
(
radius
>=
(
m_DC_inner_rmin
-
m_safe_distance
)
&&
radius
<
m_DC_inner_rbegin
)
{
layerid
=
0
;
layerid
=
0
;
}
else
if
(
radius
>
m_DC_inner_rend
&&
radius
<=
(
m_DC_inner_rmax
+
m_safe_distance
))
{
}
else
if
(
radius
>
m_DC_inner_rend
&&
radius
<=
(
m_DC_inner_rmax
+
m_safe_distance
))
{
layerid
=
m_DC_inner_layer_number
-
1
;
layerid
=
m_DC_inner_layer_number
-
1
;
}
else
if
(
radius
>=
(
m_DC_outer_rmin
-
m_safe_distance
)
&&
radius
<
m_DC_outer_rbegin
)
{
}
else
if
(
radius
>=
(
m_DC_outer_rmin
-
m_safe_distance
)
&&
radius
<
m_DC_outer_rbegin
)
{
layerid
=
m_DC_inner_layer_number
;
layerid
=
0
;
}
else
if
(
radius
>
m_DC_outer_rend
&&
radius
<=
(
m_DC_outer_rmax
+
m_safe_distance
))
{
}
else
if
(
radius
>
m_DC_outer_rend
&&
radius
<=
(
m_DC_outer_rmax
+
m_safe_distance
))
{
layerid
=
m_DC_inner_layer_number
+
m_DC_outer_layer_number
-
1
;
layerid
=
m_DC_outer_layer_number
-
1
;
}
}
updateParams
(
layerid
);
updateParams
(
chamberID
,
layerid
);
double
phi_hit
=
phiFromXY
(
globalPosition
);
double
phi_hit
=
phiFromXY
(
globalPosition
);
double
offsetphi
=
m_offset
;
double
offsetphi
=
m_offset
;
...
@@ -103,8 +106,9 @@ double GridDriftChamber::phi(const CellID& cID) const {
...
@@ -103,8 +106,9 @@ double GridDriftChamber::phi(const CellID& cID) const {
void
GridDriftChamber
::
cellposition
(
const
CellID
&
cID
,
TVector3
&
Wstart
,
void
GridDriftChamber
::
cellposition
(
const
CellID
&
cID
,
TVector3
&
Wstart
,
TVector3
&
Wend
)
const
{
TVector3
&
Wend
)
const
{
auto
chamberIndex
=
_decoder
->
get
(
cID
,
"chamber"
);
auto
layerIndex
=
_decoder
->
get
(
cID
,
"layer"
);
auto
layerIndex
=
_decoder
->
get
(
cID
,
"layer"
);
updateParams
(
layerIndex
);
updateParams
(
chamberIndex
,
layerIndex
);
double
phi_start
=
phi
(
cID
);
double
phi_start
=
phi
(
cID
);
double
phi_mid
=
phi_start
+
_currentLayerphi
/
2.
;
double
phi_mid
=
phi_start
+
_currentLayerphi
/
2.
;
...
...
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