Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:58

0001 #include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h"
0002 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.h"
0003 #include "DetectorDescription/Core/interface/DDFilteredView.h"
0004 
0005 typedef CaloGeometryLoader<EcalPreshowerGeometry> EcalPGL;
0006 
0007 template <>
0008 void EcalPGL::fillGeom(EcalPreshowerGeometry* geom,
0009                        const EcalPGL::ParmVec& pv,
0010                        const HepGeom::Transform3D& tr,
0011                        const DetId& id,
0012                        const double& scale);
0013 template <>
0014 void EcalPGL::fillNamedParams(const DDFilteredView& /*fv*/, EcalPreshowerGeometry* /*geom*/);
0015 template <>
0016 void EcalPGL::fillNamedParams(const cms::DDFilteredView& /*fv*/, EcalPreshowerGeometry* /*geom*/);
0017 
0018 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc"
0019 
0020 template class CaloGeometryLoader<EcalPreshowerGeometry>;
0021 typedef CaloCellGeometry::CCGFloat CCGFloat;
0022 typedef CaloCellGeometry::Pt3D Pt3D;
0023 
0024 template <>
0025 void EcalPGL::fillGeom(EcalPreshowerGeometry* geom,
0026                        const EcalPGL::ParmVec& pv,
0027                        const HepGeom::Transform3D& tr,
0028                        const DetId& id,
0029                        const double& scale) {
0030   std::vector<CCGFloat> vv;
0031   vv.reserve(pv.size() + 1);
0032   for (unsigned int i(0); i != pv.size(); ++i) {
0033     vv.emplace_back(scale * pv[i]);
0034   }
0035 
0036   const Pt3D cor1(vv[0], vv[1], vv[2]);
0037   const Pt3D cor2(-vv[0], vv[1], vv[2]);
0038   const Pt3D cor3(vv[0], -vv[1], vv[2]);
0039 
0040   const CCGFloat z1(Pt3D(tr * cor1).z());
0041   const CCGFloat z2(Pt3D(tr * cor2).z());
0042   const CCGFloat z3(Pt3D(tr * cor3).z());
0043 
0044   const CCGFloat y1(Pt3D(tr * cor3).y());
0045   const CCGFloat x1(Pt3D(tr * cor3).x());
0046 
0047   const CCGFloat zdif(0.00001 > fabs(z1 - z2) ? (y1 > 0 ? +1.0 : -1.0) * (z1 - z3)
0048                                               : (x1 > 0 ? +1.0 : -1.0) * (z1 - z2));
0049 
0050   const CCGFloat tilt(asin(0.5 * zdif / (vv[1] > vv[0] ? vv[1] : vv[0])));
0051 
0052   vv.emplace_back(tilt);
0053 
0054   const CCGFloat* pP(CaloCellGeometry::getParmPtr(vv, geom->parMgr(), geom->parVecVec()));
0055 
0056   const Pt3D ctr(tr * Pt3D(0, 0, 0));
0057 
0058   const GlobalPoint refPoint(ctr.x(), ctr.y(), ctr.z());
0059 
0060   geom->newCell(refPoint, refPoint, refPoint, pP, id);
0061 }
0062 
0063 template <>
0064 void EcalPGL::fillNamedParams(const DDFilteredView& /*fv*/, EcalPreshowerGeometry* /*geom*/) {
0065   // nothing yet for preshower
0066 }
0067 
0068 template <>
0069 void EcalPGL::fillNamedParams(const cms::DDFilteredView& /*fv*/, EcalPreshowerGeometry* /*geom*/) {
0070   // nothing yet for preshower
0071 }