Geometry
HGCalGeometry
src
FastTimeGeometryLoader.cc
Go to the documentation of this file.
1
#include "
Geometry/HGCalGeometry/interface/FastTimeGeometryLoader.h
"
2
#include "
Geometry/HGCalGeometry/interface/FastTimeGeometry.h
"
3
#include "
Geometry/CaloGeometry/interface/CaloCellGeometry.h
"
4
#include "
Geometry/CaloGeometry/interface/FlatTrd.h
"
5
#include "
Geometry/HGCalCommonData/interface/FastTimeDDDConstants.h
"
6
#include "
DataFormats/ForwardDetId/interface/ForwardSubdetector.h
"
7
8
//#define EDM_ML_DEBUG
9
10
typedef
CaloCellGeometry::CCGFloat
CCGFloat
;
11
typedef
std::vector<float>
ParmVec
;
12
13
FastTimeGeometryLoader::FastTimeGeometryLoader
() {}
14
FastTimeGeometryLoader::~FastTimeGeometryLoader
() {}
15
16
FastTimeGeometry
*
FastTimeGeometryLoader::build
(
const
FastTimeTopology
& topology) {
17
// allocate geometry
18
FastTimeGeometry
*
geom
=
new
FastTimeGeometry
(topology);
19
unsigned
int
numberOfCells = topology.
totalGeomModules
();
// both sides
20
int
detType = topology.
detectorType
();
21
#ifdef EDM_ML_DEBUG
22
std::cout
<<
"Number of Cells "
<< numberOfCells <<
" for type "
<< detType <<
" of sub-detector "
23
<< topology.
subDetector
() <<
" Shape parameters "
<<
FastTimeGeometry::k_NumberOfShapes
<<
":"
24
<<
FastTimeGeometry::k_NumberOfParametersPerShape
<< std::endl;
25
#endif
26
geom
->allocateCorners(numberOfCells);
27
geom
->allocatePar(
FastTimeGeometry::k_NumberOfShapes
,
FastTimeGeometry::k_NumberOfParametersPerShape
);
28
29
// loop over modules
30
ParmVec
params
(
FastTimeGeometry::k_NumberOfParametersPerShape
, 0);
31
unsigned
int
counter
(0);
32
#ifdef EDM_ML_DEBUG
33
std::cout
<<
"FastTimeGeometryLoader with # of transformation matrices "
<< numberOfCells << std::endl;
34
#endif
35
for
(
unsigned
itr = 0; itr < numberOfCells; ++itr) {
36
int
zside
= (itr == 0) ? 1 : -1;
37
#ifdef EDM_ML_DEBUG
38
std::cout
<<
"FastTimeGeometryLoader:: Z:Layer:Type "
<<
zside
<<
":"
<< detType << std::endl;
39
#endif
40
double
zv
=
zside
* (topology.
dddConstants
().
getZPos
(detType));
41
const
CLHEP::HepRep3x3
rotation
=
42
(
zside
> 0) ? CLHEP::HepRep3x3(1, 0, 0, 0, 1, 0, 0, 0, 1) : CLHEP::HepRep3x3(-1, 0, 0, 0, 1, 0, 0, 0, -1);
43
const
CLHEP::HepRotation hr(
rotation
);
44
const
CLHEP::Hep3Vector h3v(0, 0,
zv
);
45
const
HepGeom::Transform3D ht3d(hr, h3v);
46
DetId
detId = (
DetId
)(
FastTimeDetId
(detType, 0, 0,
zside
));
47
#ifdef EDM_ML_DEBUG
48
std::cout
<<
"FastTimeGeometryLoader:: transf "
<< ht3d.getTranslation() <<
" and "
<< ht3d.getRotation();
49
#endif
50
params
[0] = topology.
dddConstants
().
getZHalf
(detType);
51
params
[1] =
params
[2] = 0;
52
params
[3] =
params
[7] = topology.
dddConstants
().
getRin
(detType);
53
params
[4] =
params
[8] = topology.
dddConstants
().
getRout
(detType);
54
params
[5] =
params
[9] = topology.
dddConstants
().
getRout
(detType);
55
params
[6] =
params
[10] = 0;
56
params
[11] =
zside
;
57
buildGeom
(
params
, ht3d, detId, topology,
geom
);
58
counter
++;
59
}
60
61
geom
->sortDetIds();
62
63
if
(
counter
!= numberOfCells) {
64
std::cerr
<<
"inconsistent # of cells: expected "
<< numberOfCells <<
" , inited "
<<
counter
<< std::endl;
65
assert
(
counter
== numberOfCells);
66
}
67
68
return
geom
;
69
}
70
71
void
FastTimeGeometryLoader::buildGeom
(
const
ParmVec
&
params
,
72
const
HepGeom::Transform3D& ht3d,
73
const
DetId
& detId,
74
const
FastTimeTopology
& topology,
75
FastTimeGeometry
*
geom
) {
76
#ifdef EDM_ML_DEBUG
77
std::cout
<<
"Volume Parameters"
;
78
for
(
unsigned
int
i
= 0;
i
< 12; ++
i
)
79
std::cout
<<
" : "
<<
params
[
i
];
80
std::cout
<< std::endl;
81
#endif
82
FastTimeDetId
id
=
FastTimeDetId
(detId);
83
std::vector<GlobalPoint> corners = topology.
dddConstants
().
getCorners
(
id
.
type
(), 1, 1,
id
.
zside
());
84
85
FlatTrd::createCorners
(
params
, ht3d, corners);
86
87
const
CCGFloat
* parmPtr(
CaloCellGeometry::getParmPtr
(
params
,
geom
->parMgr(),
geom
->parVecVec()));
88
89
GlobalPoint
front(0.25 * (corners[0].
x
() + corners[1].
x
() + corners[2].
x
() + corners[3].
x
()),
90
0.25 * (corners[0].
y
() + corners[1].
y
() + corners[2].
y
() + corners[3].
y
()),
91
0.25 * (corners[0].
z
() + corners[1].
z
() + corners[2].
z
() + corners[3].
z
()));
92
93
GlobalPoint
back(0.25 * (corners[4].
x
() + corners[5].
x
() + corners[6].
x
() + corners[7].
x
()),
94
0.25 * (corners[4].
y
() + corners[5].
y
() + corners[6].
y
() + corners[7].
y
()),
95
0.25 * (corners[4].
z
() + corners[5].
z
() + corners[6].
z
() + corners[7].
z
()));
96
97
if
(front.
mag2
() > back.
mag2
()) {
// front should always point to the center, so swap front and back
98
std::swap
(front, back);
99
std::swap_ranges(corners.begin(), corners.begin() + 4, corners.begin() + 4);
100
}
101
102
geom
->newCell(front, back, corners[0], parmPtr, detId);
103
}
FlatTrd::createCorners
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition:
FlatTrd.cc:133
counter
Definition:
counter.py:1
DDAxes::y
FastTimeDDDConstants::getRout
double getRout(int type) const
Definition:
FastTimeDDDConstants.cc:134
mps_fire.i
i
Definition:
mps_fire.py:428
CaloCellGeometry::CCGFloat
float CCGFloat
Definition:
CaloCellGeometry.h:52
FastTimeGeometry::k_NumberOfParametersPerShape
Definition:
FastTimeGeometry.h:38
CalibrationSummaryClient_cfi.params
params
Definition:
CalibrationSummaryClient_cfi.py:14
ecaldqm::zside
int zside(DetId const &)
Definition:
EcalDQMCommonUtils.cc:189
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
FastTimeTopology::subDetector
ForwardSubdetector subDetector() const
Definition:
FastTimeTopology.h:96
FastTimeGeometryLoader::build
FastTimeGeometry * build(const FastTimeTopology &)
Definition:
FastTimeGeometryLoader.cc:16
cms::cuda::assert
assert(be >=bs)
gpuVertexFinder::zv
float *__restrict__ zv
Definition:
gpuFitVertices.h:26
DDAxes::x
PV3DBase::mag2
T mag2() const
Definition:
PV3DBase.h:63
FastTimeDDDConstants::getZPos
double getZPos(int type) const
Definition:
FastTimeDDDConstants.cc:154
ForwardSubdetector.h
FastTimeTopology::dddConstants
const FastTimeDDDConstants & dddConstants() const
Definition:
FastTimeTopology.h:82
CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition:
FastTimeGeometryLoader.cc:10
DetId
Definition:
DetId.h:17
FastTimeDDDConstants::getRin
double getRin(int type) const
Definition:
FastTimeDDDConstants.cc:124
FastTimeTopology::detectorType
int detectorType() const
Definition:
FastTimeTopology.h:97
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition:
DataFrameContainer.h:209
FastTimeGeometryLoader::~FastTimeGeometryLoader
~FastTimeGeometryLoader()
Definition:
FastTimeGeometryLoader.cc:14
FastTimeGeometryLoader::CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition:
FastTimeGeometryLoader.h:10
DDAxes::z
FastTimeGeometryLoader::ParmVec
std::vector< float > ParmVec
Definition:
FastTimeGeometryLoader.h:11
FastTimeGeometryLoader::FastTimeGeometryLoader
FastTimeGeometryLoader()
Definition:
FastTimeGeometryLoader.cc:13
relativeConstraints.geom
geom
Definition:
relativeConstraints.py:72
Point3DBase< float, GlobalTag >
FastTimeTopology::totalGeomModules
unsigned int totalGeomModules() const
Definition:
FastTimeTopology.h:79
idealTransformation.rotation
dictionary rotation
Definition:
idealTransformation.py:1
FastTimeGeometry
Definition:
FastTimeGeometry.h:24
FastTimeGeometry::k_NumberOfShapes
Definition:
FastTimeGeometry.h:39
gainCalibHelper::gainCalibPI::type
type
Definition:
SiPixelGainCalibHelper.h:40
FastTimeDDDConstants.h
counter
static std::atomic< unsigned int > counter
Definition:
SharedResourceNames.cc:18
FastTimeGeometryLoader.h
FastTimeGeometryLoader::buildGeom
void buildGeom(const ParmVec &, const HepGeom::Transform3D &, const DetId &, const FastTimeTopology &, FastTimeGeometry *)
Definition:
FastTimeGeometryLoader.cc:71
CaloCellGeometry.h
FastTimeTopology
Definition:
FastTimeTopology.h:11
FastTimeDetId
Definition:
FastTimeDetId.h:8
CaloCellGeometry::getParmPtr
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
Definition:
CaloCellGeometry.cc:117
FlatTrd.h
FastTimeGeometry.h
FastTimeDDDConstants::getZHalf
double getZHalf(int type) const
Definition:
FastTimeDDDConstants.cc:144
FastTimeDDDConstants::getCorners
std::vector< GlobalPoint > getCorners(int type, int izeta, int iphi, int zside) const
Definition:
FastTimeDDDConstants.cc:80
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition:
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
ParmVec
std::vector< float > ParmVec
Definition:
FastTimeGeometryLoader.cc:11
Generated for CMSSW Reference Manual by
1.8.16