CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions
FastTimeGeometryLoader Class Reference

#include <FastTimeGeometryLoader.h>

Public Types

typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< float > ParmVec
 

Public Member Functions

FastTimeGeometrybuild (const FastTimeTopology &)
 
 FastTimeGeometryLoader ()
 
 ~FastTimeGeometryLoader ()
 

Private Member Functions

void buildGeom (const ParmVec &, const HepGeom::Transform3D &, const DetId &, const FastTimeTopology &, FastTimeGeometry *)
 

Detailed Description

Definition at line 8 of file FastTimeGeometryLoader.h.

Member Typedef Documentation

◆ CCGFloat

Definition at line 10 of file FastTimeGeometryLoader.h.

◆ ParmVec

typedef std::vector<float> FastTimeGeometryLoader::ParmVec

Definition at line 11 of file FastTimeGeometryLoader.h.

Constructor & Destructor Documentation

◆ FastTimeGeometryLoader()

FastTimeGeometryLoader::FastTimeGeometryLoader ( )

Definition at line 16 of file FastTimeGeometryLoader.cc.

16 {}

◆ ~FastTimeGeometryLoader()

FastTimeGeometryLoader::~FastTimeGeometryLoader ( )

Definition at line 17 of file FastTimeGeometryLoader.cc.

17 {}

Member Function Documentation

◆ build()

FastTimeGeometry * FastTimeGeometryLoader::build ( const FastTimeTopology topology)

Definition at line 19 of file FastTimeGeometryLoader.cc.

References cms::cuda::assert(), buildGeom(), counter, FastTimeTopology::dddConstants(), FastTimeTopology::detectorType(), relativeConstraints::geom, FastTimeDDDConstants::getRin(), FastTimeDDDConstants::getRout(), FastTimeDDDConstants::getZHalf(), FastTimeDDDConstants::getZPos(), FastTimeGeometry::k_NumberOfParametersPerShape, FastTimeGeometry::k_NumberOfShapes, submitPVValidationJobs::params, idealTransformation::rotation, FastTimeTopology::subDetector(), FastTimeTopology::totalGeomModules(), ecaldqm::zside(), and gpuVertexFinder::zv.

Referenced by FastTimeGeometryESProducer::produce().

19  {
20  // allocate geometry
21  FastTimeGeometry* geom = new FastTimeGeometry(topology);
22  unsigned int numberOfCells = topology.totalGeomModules(); // both sides
23  int detType = topology.detectorType();
24 #ifdef EDM_ML_DEBUG
25  edm::LogVerbatim("FastTimeGeom") << "Number of Cells " << numberOfCells << " for type " << detType
26  << " of sub-detector " << topology.subDetector() << " Shape parameters "
29 #endif
30  geom->allocateCorners(numberOfCells);
32 
33  // loop over modules
35  unsigned int counter(0);
36 #ifdef EDM_ML_DEBUG
37  edm::LogVerbatim("FastTimeGeom") << "FastTimeGeometryLoader with # of transformation matrices " << numberOfCells;
38 #endif
39  for (unsigned itr = 0; itr < numberOfCells; ++itr) {
40  int zside = (itr == 0) ? 1 : -1;
41 #ifdef EDM_ML_DEBUG
42  edm::LogVerbatim("FastTimeGeom") << "FastTimeGeometryLoader:: Z:Layer:Type " << zside << ":" << detType;
43 #endif
44  double zv = zside * (topology.dddConstants().getZPos(detType));
45  const CLHEP::HepRep3x3 rotation =
46  (zside > 0) ? CLHEP::HepRep3x3(1, 0, 0, 0, 1, 0, 0, 0, 1) : CLHEP::HepRep3x3(-1, 0, 0, 0, 1, 0, 0, 0, -1);
47  const CLHEP::HepRotation hr(rotation);
48  const CLHEP::Hep3Vector h3v(0, 0, zv);
49  const HepGeom::Transform3D ht3d(hr, h3v);
50  DetId detId = (DetId)(FastTimeDetId(detType, 0, 0, zside));
51 #ifdef EDM_ML_DEBUG
52  edm::LogVerbatim("FastTimeGeom") << "FastTimeGeometryLoader:: transf " << ht3d.getTranslation() << " and "
53  << ht3d.getRotation();
54 #endif
55  params[0] = topology.dddConstants().getZHalf(detType);
56  params[1] = params[2] = 0;
57  params[3] = params[7] = topology.dddConstants().getRin(detType);
58  params[4] = params[8] = topology.dddConstants().getRout(detType);
59  params[5] = params[9] = topology.dddConstants().getRout(detType);
60  params[6] = params[10] = 0;
61  params[11] = zside;
62  buildGeom(params, ht3d, detId, topology, geom);
63  counter++;
64  }
65 
66  geom->sortDetIds();
67 
68  if (counter != numberOfCells) {
69  edm::LogWarning("FastTimeGeom") << "inconsistent # of cells: expected " << numberOfCells << " , inited " << counter;
70  assert(counter == numberOfCells);
71  }
72 
73  return geom;
74 }
Log< level::Info, true > LogVerbatim
double getRin(int type) const
double getZHalf(int type) const
int detectorType() const
unsigned int totalGeomModules() const
float *__restrict__ zv
std::vector< float > ParmVec
int zside(DetId const &)
assert(be >=bs)
void buildGeom(const ParmVec &, const HepGeom::Transform3D &, const DetId &, const FastTimeTopology &, FastTimeGeometry *)
double getRout(int type) const
ForwardSubdetector subDetector() const
const FastTimeDDDConstants & dddConstants() const
Definition: DetId.h:17
double getZPos(int type) const
static std::atomic< unsigned int > counter
Log< level::Warning, false > LogWarning

◆ buildGeom()

void FastTimeGeometryLoader::buildGeom ( const ParmVec params,
const HepGeom::Transform3D &  ht3d,
const DetId detId,
const FastTimeTopology topology,
FastTimeGeometry geom 
)
private

Definition at line 76 of file FastTimeGeometryLoader.cc.

References FlatTrd::createCorners(), FastTimeTopology::dddConstants(), relativeConstraints::geom, FastTimeDDDConstants::getCorners(), CaloCellGeometry::getParmPtr(), mps_fire::i, PV3DBase< T, PVType, FrameType >::mag2(), submitPVValidationJobs::params, std::swap(), x, y, z, and ecaldqm::zside().

Referenced by build().

80  {
81 #ifdef EDM_ML_DEBUG
82  std::ostringstream st1;
83  st1 << "Volume Parameters";
84  for (unsigned int i = 0; i < 12; ++i)
85  st1 << " : " << params[i];
86  edm::LogVerbatim("FastTimeGeom") << st1.str();
87 #endif
88  FastTimeDetId id = FastTimeDetId(detId);
89  std::vector<GlobalPoint> corners = topology.dddConstants().getCorners(id.type(), 1, 1, id.zside());
90 
91  FlatTrd::createCorners(params, ht3d, corners);
92 
93  const CCGFloat* parmPtr(CaloCellGeometry::getParmPtr(params, geom->parMgr(), geom->parVecVec()));
94 
95  GlobalPoint front(0.25 * (corners[0].x() + corners[1].x() + corners[2].x() + corners[3].x()),
96  0.25 * (corners[0].y() + corners[1].y() + corners[2].y() + corners[3].y()),
97  0.25 * (corners[0].z() + corners[1].z() + corners[2].z() + corners[3].z()));
98 
99  GlobalPoint back(0.25 * (corners[4].x() + corners[5].x() + corners[6].x() + corners[7].x()),
100  0.25 * (corners[4].y() + corners[5].y() + corners[6].y() + corners[7].y()),
101  0.25 * (corners[4].z() + corners[5].z() + corners[6].z() + corners[7].z()));
102 
103  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
104  std::swap(front, back);
105  std::swap_ranges(corners.begin(), corners.begin() + 4, corners.begin() + 4);
106  }
107 
108  geom->newCell(front, back, corners[0], parmPtr, detId);
109 }
Log< level::Info, true > LogVerbatim
int zside(DetId const &)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
CaloCellGeometry::CCGFloat CCGFloat
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
const FastTimeDDDConstants & dddConstants() const
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition: FlatTrd.cc:133
std::vector< GlobalPoint > getCorners(int type, int izeta, int iphi, int zside) const