Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-05 11:11:45

0001 #include "Geometry/CaloGeometry/interface/CaloGenericDetId.h"
0002 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0003 #include "Geometry/ForwardGeometry/interface/ZdcGeometry.h"
0004 #include "Geometry/ForwardGeometry/interface/IdealZDCTrapezoid.h"
0005 #include "Geometry/ForwardGeometry/interface/ZdcHardcodeGeometryData.h"
0006 #include <algorithm>
0007 
0008 typedef CaloCellGeometry::CCGFloat CCGFloat;
0009 typedef CaloCellGeometry::Pt3D Pt3D;
0010 typedef CaloCellGeometry::Pt3DVec Pt3DVec;
0011 
0012 ZdcGeometry::ZdcGeometry()
0013     : theTopology(new ZdcTopology),
0014       lastReqDet_(DetId::Detector(0)),
0015       lastReqSubdet_(0),
0016       m_ownsTopology(true),
0017       m_cellVec(k_NumberOfCellsForCorners) {}
0018 
0019 ZdcGeometry::ZdcGeometry(const ZdcTopology* topology)
0020     : theTopology(topology),
0021       lastReqDet_(DetId::Detector(0)),
0022       lastReqSubdet_(0),
0023       m_ownsTopology(false),
0024       m_cellVec(k_NumberOfCellsForCorners) {}
0025 
0026 ZdcGeometry::~ZdcGeometry() {
0027   if (m_ownsTopology)
0028     delete theTopology;
0029 }
0030 /*
0031 DetId ZdcGeometry::getClosestCell(const GlobalPoint& r) const
0032 {
0033    DetId returnId ( 0 ) ;
0034    const std::vector<DetId>& detIds ( getValidDetIds() ) ;
0035    for( std::vector<DetId>::const_iterator it ( detIds.begin() ) ;
0036     it != detIds.end(); ++it )
0037    {
0038       auto cell = ( getGeometry( *it ) ) ;
0039       if( 0 != cell &&
0040       cell->inside( r ) )
0041       {
0042      returnId = *it ;
0043      break ;
0044       }
0045    }
0046    return returnId ;
0047 }
0048 */
0049 unsigned int ZdcGeometry::alignmentTransformIndexLocal(const DetId& id) {
0050   const CaloGenericDetId gid(id);
0051 
0052   assert(gid.isZDC());
0053 
0054   return (0 > HcalZDCDetId(id).zside() ? 0 : 1);
0055 }
0056 
0057 unsigned int ZdcGeometry::alignmentTransformIndexGlobal(const DetId& /*id*/) { return (unsigned int)DetId::Calo - 1; }
0058 
0059 void ZdcGeometry::localCorners(Pt3DVec& lc, const CCGFloat* pv, unsigned int /*i*/, Pt3D& ref) {
0060   IdealZDCTrapezoid::localCorners(lc, pv, ref);
0061 }
0062 
0063 void ZdcGeometry::newCell(const GlobalPoint& f1,
0064                           const GlobalPoint& /*f2*/,
0065                           const GlobalPoint& /*f3*/,
0066                           const CCGFloat* parm,
0067                           const DetId& detId) {
0068   const CaloGenericDetId cgid(detId);
0069 
0070   assert(cgid.isZDC());
0071 
0072   const unsigned int di(cgid.denseIndex());
0073 
0074   m_cellVec[di] = IdealZDCTrapezoid(f1, cornersMgr(), parm);
0075   addValidID(detId);
0076 }
0077 
0078 const CaloCellGeometry* ZdcGeometry::getGeometryRawPtr(uint32_t index) const {
0079   // Modify the RawPtr class
0080   const CaloCellGeometry* cell(&m_cellVec[index]);
0081   return (m_cellVec.size() < index || nullptr == cell->param() ? nullptr : cell);
0082 }