CMS 3D CMS Logo

FastTimeGeometryLoader.cc
Go to the documentation of this file.
7 
8 //#define EDM_ML_DEBUG
9 
11 typedef std::vector<float> ParmVec;
12 
15 
17  // allocate geometry
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 << ":"
25 #endif
26  geom->allocateCorners(numberOfCells);
28 
29  // loop over modules
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 
72  const HepGeom::Transform3D& ht3d,
73  const DetId& detId,
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
mps_fire.i
i
Definition: mps_fire.py:355
CaloCellGeometry::CCGFloat
float CCGFloat
Definition: CaloCellGeometry.h:52
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
FastTimeGeometryLoader::build
FastTimeGeometry * build(const FastTimeTopology &)
Definition: FastTimeGeometryLoader.cc:16
cms::cuda::assert
assert(be >=bs)
DDAxes::x
PV3DBase::mag2
T mag2() const
Definition: PV3DBase.h:63
ForwardSubdetector.h
CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: FastTimeGeometryLoader.cc:10
DetId
Definition: DetId.h:17
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
FastTimeGeometryLoader::~FastTimeGeometryLoader
~FastTimeGeometryLoader()
Definition: FastTimeGeometryLoader.cc:14
ecaldqm::topology
const CaloTopology * topology(nullptr)
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 >
FastTimeGeometry::k_NumberOfShapes
Definition: FastTimeGeometry.h:39
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
FastTimeGeometry
Definition: FastTimeGeometry.h:24
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
FastTimeDDDConstants.h
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:15
FastTimeGeometryLoader.h
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
FastTimeGeometryLoader::buildGeom
void buildGeom(const ParmVec &, const HepGeom::Transform3D &, const DetId &, const FastTimeTopology &, FastTimeGeometry *)
Definition: FastTimeGeometryLoader.cc:71
CaloCellGeometry.h
type
type
Definition: HCALResponse.h:21
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
FastTimeGeometry::k_NumberOfParametersPerShape
Definition: FastTimeGeometry.h:38
ParmVec
std::vector< float > ParmVec
Definition: FastTimeGeometryLoader.cc:11