CaloGeometryLoader

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
#include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h"
#include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.h"
#include "DetectorDescription/Core/interface/DDFilteredView.h"

typedef CaloGeometryLoader<EcalPreshowerGeometry> EcalPGL;

template <>
void EcalPGL::fillGeom(EcalPreshowerGeometry* geom,
                       const EcalPGL::ParmVec& pv,
                       const HepGeom::Transform3D& tr,
                       const DetId& id,
                       const double& scale);
template <>
void EcalPGL::fillNamedParams(const DDFilteredView& /*fv*/, EcalPreshowerGeometry* /*geom*/);
template <>
void EcalPGL::fillNamedParams(const cms::DDFilteredView& /*fv*/, EcalPreshowerGeometry* /*geom*/);

#include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc"

template class CaloGeometryLoader<EcalPreshowerGeometry>;
typedef CaloCellGeometry::CCGFloat CCGFloat;
typedef CaloCellGeometry::Pt3D Pt3D;

template <>
void EcalPGL::fillGeom(EcalPreshowerGeometry* geom,
                       const EcalPGL::ParmVec& pv,
                       const HepGeom::Transform3D& tr,
                       const DetId& id,
                       const double& scale) {
  std::vector<CCGFloat> vv;
  vv.reserve(pv.size() + 1);
  for (unsigned int i(0); i != pv.size(); ++i) {
    vv.emplace_back(scale * pv[i]);
  }

  const Pt3D cor1(vv[0], vv[1], vv[2]);
  const Pt3D cor2(-vv[0], vv[1], vv[2]);
  const Pt3D cor3(vv[0], -vv[1], vv[2]);

  const CCGFloat z1(Pt3D(tr * cor1).z());
  const CCGFloat z2(Pt3D(tr * cor2).z());
  const CCGFloat z3(Pt3D(tr * cor3).z());

  const CCGFloat y1(Pt3D(tr * cor3).y());
  const CCGFloat x1(Pt3D(tr * cor3).x());

  const CCGFloat zdif(0.00001 > fabs(z1 - z2) ? (y1 > 0 ? +1.0 : -1.0) * (z1 - z3)
                                              : (x1 > 0 ? +1.0 : -1.0) * (z1 - z2));

  const CCGFloat tilt(asin(0.5 * zdif / (vv[1] > vv[0] ? vv[1] : vv[0])));

  vv.emplace_back(tilt);

  const CCGFloat* pP(CaloCellGeometry::getParmPtr(vv, geom->parMgr(), geom->parVecVec()));

  const Pt3D ctr(tr * Pt3D(0, 0, 0));

  const GlobalPoint refPoint(ctr.x(), ctr.y(), ctr.z());

  geom->newCell(refPoint, refPoint, refPoint, pP, id);
}

template <>
void EcalPGL::fillNamedParams(const DDFilteredView& /*fv*/, EcalPreshowerGeometry* /*geom*/) {
  // nothing yet for preshower
}

template <>
void EcalPGL::fillNamedParams(const cms::DDFilteredView& /*fv*/, EcalPreshowerGeometry* /*geom*/) {
  // nothing yet for preshower
}