Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
athena
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
Container 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
Fernando Torales Acosta
athena
Commits
5d42e138
Commit
5d42e138
authored
3 years ago
by
Chao Peng
Browse files
Options
Downloads
Patches
Plain Diff
add skeleton for trapezoid segmentation
parent
79c190c7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TrapezoidSegmentation.cpp
+107
-0
107 additions, 0 deletions
src/TrapezoidSegmentation.cpp
with
107 additions
and
0 deletions
src/TrapezoidSegmentation.cpp
0 → 100644
+
107
−
0
View file @
5d42e138
// Trapezoid Segmentation for GlueX type barrel calorimeter
// Author: M. Zurek, C. Peng (ANL)
// Date: 06/25/2021
#include
"DD4hep/Factories.h"
#include
"DD4hep/detail/SegmentationsInterna.h"
#include
"DDSegmentation/Segmentation.h"
using
namespace
dd4hep
::
DDSegmentation
;
namespace
athena
::
seg
{
class
TrapezoidGrid
:
public
Segmentation
{
public:
// Default constructor used by derived classes passing the encoding string
TrapezoidGrid
(
const
std
::
string
&
cellEncoding
=
""
)
:
Segmentation
(
cellEncoding
)
{
// define type and description
_type
=
"TrapezoidGrid"
;
_description
=
"Trapezoid segmentation in the local YZ-plane"
;
registerParameters
();
}
// Default constructor used by derived classes passing an existing decoder
TrapezoidGrid
(
const
BitFieldCoder
*
decoder
)
:
Segmentation
(
decoder
)
{
// define type and description
_type
=
"TrapezoidGrid"
;
_description
=
"Trapezoid segmentation in the local YZ-plane"
;
registerParameters
();
}
// Destructor
virtual
~
TrapezoidGrid
()
{}
void
registerParameters
()
{
// @TODO: register all necessary parameters
// mandatory
registerParameter
(
"grid_size_y"
,
"Cell size in Y"
,
_gridSizeY
,
1.
,
SegmentationParameter
::
LengthUnit
);
// optional
registerIdentifier
(
"identifier_y"
,
"Cell ID identifier for Y"
,
_yId
,
"y"
);
}
// override
virtual
Vector3D
position
(
const
CellID
&
cellID
)
const
{
// @TODO
/* PolarGridRPhi
Vector3D cellPosition;
double R = binToPosition(_decoder->get(cID,_rId), _gridSizeR, _offsetR);
double phi = binToPosition(_decoder->get(cID,_phiId), _gridSizePhi, _offsetPhi);
cellPosition.X = R * cos(phi);
cellPosition.Y = R * sin(phi);
return cellPosition;
*/
return
Vector3D
();
}
// override
virtual
CellID
cellID
(
const
Vector3D
&
localPosition
,
const
Vector3D
&
globalPosition
,
const
VolumeID
&
volumeID
)
const
{
// @TODO
/*
PolarGridRPhi
double
phi
=
atan2
(
localPosition
.
Y
,
localPosition
.
X
);
double
R
=
sqrt
(
localPosition
.
X
*
localPosition
.
X
+
localPosition
.
Y
*
localPosition
.
Y
);
CellID
cID
=
vID
;
_decoder
->
set
(
cID
,
_rId
,
positionToBin
(
R
,
_gridSizeR
,
_offsetR
));
_decoder
->
set
(
cID
,
_phiId
,
positionToBin
(
phi
,
_gridSizePhi
,
_offsetPhi
));
*/
return
volumeID
;
}
// override
virtual
std
::
vector
<
double
>
cellDimensions
(
const
CellID
&
cellID
)
const
{
// @TODO
/* PolarGridRPhi
const double rPhiSize = binToPosition(_decoder->get(cID,_rId), _gridSizeR, _offsetR)*_gridSizePhi;
return {_gridSizeR, rPhiSize};
*/
return
std
::
vector
<
double
>
{
0.
,
0.
,
0.
};
}
// public methods to get member value
double
gridSizeY
()
const
{
return
_gridSizeY
;
}
const
std
::
string
&
fieldNameY
()
const
{
return
_yId
;
}
// public methods to set member value
void
setGridSizeY
(
double
cellSize
)
{
_gridSizeY
=
cellSize
;
}
void
setFieldNameY
(
const
std
::
string
&
fieldName
)
{
_yId
=
fieldName
;
}
protected
:
// @TODO: add parameters accordingly
double
_gridSizeY
;
std
::
string
_yId
;
};
// class TrapezoidGrid
}
// namespace athena::seg
DECLARE_SEGMENTATION
(
TrapezoidGrid
,
new
dd4hep
::
SegmentationWrapper
<
athena
::
seg
::
TrapezoidGrid
>
)
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