Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:37

0001 #include "Geometry/CaloGeometry/interface/TruncatedPyramid.h"
0002 
0003 #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h"
0004 
0005 #include "Geometry/EcalTestBeam/test/ee/CaloGeometryLoaderTest.h"
0006 #include "Geometry/EcalTestBeam/test/ee/CaloGeometryLoaderTest.icc"
0007 
0008 template class CaloGeometryLoaderTest<EcalEndcapGeometry>;
0009 
0010 #include "DetectorDescription/Core/interface/DDFilteredView.h"
0011 
0012 #include <iostream>
0013 #include <vector>
0014 
0015 using namespace std;
0016 
0017 typedef CaloGeometryLoaderTest<EcalEndcapGeometry> EcalEGL;
0018 
0019 template <>
0020 void EcalEGL::fillGeom(EcalEndcapGeometry* geom,
0021                        const EcalEGL::ParmVec& vv,
0022                        const HepGeom::Transform3D& tr,
0023                        const DetId& id) {
0024   std::vector<CCGFloat> pv;
0025   pv.reserve(vv.size());
0026   for (unsigned int i(0); i != vv.size(); ++i) {
0027     const double factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : k_ScaleFromDDDtoGeant);
0028     pv.push_back(factor * vv[i]);
0029   }
0030 
0031   //   CaloCellGeometry::CornersVec corners ( geom->cornersMgr() ) ;
0032   //   corners.resize() ;
0033 
0034   std::vector<GlobalPoint> corners(8);
0035 
0036   TruncatedPyramid::createCorners(pv, tr, corners);
0037   const CCGFloat* parmPtr(CaloCellGeometry::getParmPtr(pv, geom->parMgr(), geom->parVecVec()));
0038 
0039   const GlobalPoint front(0.25 * (corners[0].x() + corners[1].x() + corners[2].x() + corners[3].x()),
0040                           0.25 * (corners[0].y() + corners[1].y() + corners[2].y() + corners[3].y()),
0041                           0.25 * (corners[0].z() + corners[1].z() + corners[2].z() + corners[3].z()));
0042 
0043   const GlobalPoint back(0.25 * (corners[4].x() + corners[5].x() + corners[6].x() + corners[7].x()),
0044                          0.25 * (corners[4].y() + corners[5].y() + corners[6].y() + corners[7].y()),
0045                          0.25 * (corners[4].z() + corners[5].z() + corners[6].z() + corners[7].z()));
0046 
0047   geom->newCell(front, back, corners[0], parmPtr, id);
0048 }
0049 
0050 template <>
0051 void EcalEGL::fillNamedParams(DDFilteredView fv, EcalEndcapGeometry* geom) {
0052   bool doSubDets = fv.firstChild();
0053   while (doSubDets) {
0054     DDsvalues_type sv(fv.mergedSpecifics());
0055 
0056     //ncrys
0057     DDValue valNcrys("ncrys");
0058     if (DDfetch(&sv, valNcrys)) {
0059       const vector<double>& fvec = valNcrys.doubles();
0060 
0061       // this parameter can only appear once
0062       assert(fvec.size() == 1);
0063       geom->setNumberOfCrystalPerModule((int)fvec[0]);
0064     } else
0065       continue;
0066 
0067     //nmods
0068     DDValue valNmods("nmods");
0069     if (DDfetch(&sv, valNmods)) {
0070       const vector<double>& fmvec = valNmods.doubles();
0071 
0072       // there can only be one such value
0073       assert(fmvec.size() == 1);
0074       geom->setNumberOfModules((int)fmvec[0]);
0075     }
0076 
0077     break;
0078 
0079     doSubDets = fv.nextSibling();  // go to next layer
0080   }
0081 }