CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWRecoGeometryESProducer Class Reference

#include <FWRecoGeometryESProducer.h>

Inheritance diagram for FWRecoGeometryESProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

 FWRecoGeometryESProducer (const edm::ParameterSet &)
boost::shared_ptr< FWRecoGeometryproduce (const FWRecoGeometryRecord &)
virtual ~FWRecoGeometryESProducer (void)

Private Member Functions

void addCaloGeometry (void)
void addCSCGeometry (void)
void addDTGeometry (void)
void addPixelBarrelGeometry (void)
void addPixelForwardGeometry (void)
void addRPCGeometry (void)
void addTECGeometry (void)
void addTIBGeometry (void)
void addTIDGeometry (void)
void addTOBGeometry (void)
void fillPoints (unsigned int id, std::vector< GlobalPoint >::const_iterator begin, std::vector< GlobalPoint >::const_iterator end)
void fillShapeAndPlacement (unsigned int id, const GeomDet *det)
 FWRecoGeometryESProducer (const FWRecoGeometryESProducer &)
unsigned int insert_id (unsigned int id)
const FWRecoGeometryESProduceroperator= (const FWRecoGeometryESProducer &)

Private Attributes

edm::ESHandle< CaloGeometrym_caloGeom
unsigned int m_current
boost::shared_ptr< FWRecoGeometrym_fwGeometry
edm::ESHandle
< GlobalTrackingGeometry
m_geomRecord
const TrackerGeometrym_trackerGeom

Detailed Description

Definition at line 22 of file FWRecoGeometryESProducer.h.


Constructor & Destructor Documentation

FWRecoGeometryESProducer::FWRecoGeometryESProducer ( const edm::ParameterSet )

Definition at line 64 of file FWRecoGeometryESProducer.cc.

References edm::ESProducer::setWhatProduced().

  : m_current( -1 )
{
  setWhatProduced( this );
}
FWRecoGeometryESProducer::~FWRecoGeometryESProducer ( void  ) [virtual]

Definition at line 70 of file FWRecoGeometryESProducer.cc.

{}
FWRecoGeometryESProducer::FWRecoGeometryESProducer ( const FWRecoGeometryESProducer ) [private]

Member Function Documentation

void FWRecoGeometryESProducer::addCaloGeometry ( void  ) [private]

Definition at line 361 of file FWRecoGeometryESProducer.cc.

References end, fillPoints(), insert_id(), and m_caloGeom.

Referenced by produce().

{
  std::vector<DetId> vid = m_caloGeom->getValidDetIds(); // Calo
  for( std::vector<DetId>::const_iterator it = vid.begin(),
                                         end = vid.end();
       it != end; ++it )
  {
    const CaloCellGeometry::CornersVec& cor( m_caloGeom->getGeometry( *it )->getCorners());
    unsigned int id = insert_id( it->rawId());
    fillPoints( id, cor.begin(), cor.end());
  }
}
void FWRecoGeometryESProducer::addCSCGeometry ( void  ) [private]

Definition at line 106 of file FWRecoGeometryESProducer.cc.

References RadialStripTopology::angularWidth(), RadialStripTopology::centreToIntersection(), CSCGeometry::chambers(), cond::rpcobimon::current, end, fillShapeAndPlacement(), GeomDet::geographicalId(), CSCLayer::geometry(), insert_id(), CSCChamber::layers(), m_fwGeometry, m_geomRecord, DetId::Muon, RadialStripTopology::phiOfOneEdge(), OffsetRadialStripTopology::stripOffset(), CSCLayerGeometry::topology(), CSCWireTopology::wireAngle(), CSCWireTopology::wireSpacing(), CSCLayerGeometry::wireTopology(), RadialStripTopology::yAxisOrientation(), and RadialStripTopology::yCentreOfStripPlane().

Referenced by produce().

{
  DetId detId( DetId::Muon, 2 ); 
  const CSCGeometry* cscGeometry = (const CSCGeometry*) m_geomRecord->slaveGeometry( detId );
  for( std::vector<CSCChamber*>::const_iterator it = cscGeometry->chambers().begin(),
                                               end = cscGeometry->chambers().end(); 
       it != end; ++it )
  {
    const CSCChamber *chamber = *it;
    
    if( chamber )
    {
      unsigned int rawid = chamber->geographicalId();
      unsigned int current =  insert_id( rawid );
      fillShapeAndPlacement( current, chamber );
      //
      // CSC layers geometry
      //
      for( std::vector< const CSCLayer* >::const_iterator lit = chamber->layers().begin(),
                                                         lend = chamber->layers().end(); 
           lit != lend; ++lit )
      {
        const CSCLayer* layer = *lit;
    
        if( layer )
        {
          unsigned int rawid = layer->geographicalId();
          unsigned int current = insert_id( rawid );
          fillShapeAndPlacement( current, layer );

          const CSCStripTopology* stripTopology = layer->geometry()->topology();
          m_fwGeometry->idToName[current].topology[0] = stripTopology->yAxisOrientation();
          m_fwGeometry->idToName[current].topology[1] = stripTopology->centreToIntersection();
          m_fwGeometry->idToName[current].topology[2] = stripTopology->yCentreOfStripPlane();
          m_fwGeometry->idToName[current].topology[3] = stripTopology->phiOfOneEdge();
          m_fwGeometry->idToName[current].topology[4] = stripTopology->stripOffset();
          m_fwGeometry->idToName[current].topology[5] = stripTopology->angularWidth();

          const CSCWireTopology* wireTopology = layer->geometry()->wireTopology();
          m_fwGeometry->idToName[current].topology[6] = wireTopology->wireSpacing();
          m_fwGeometry->idToName[current].topology[7] = wireTopology->wireAngle();
        }
      }
    }
  }
}
void FWRecoGeometryESProducer::addDTGeometry ( void  ) [private]

Definition at line 154 of file FWRecoGeometryESProducer.cc.

References BoundSurface::bounds(), DTTopology::cellHeight(), DTTopology::cellLenght(), DTTopology::cellWidth(), DTGeometry::chambers(), DTTopology::channels(), cond::rpcobimon::current, end, fillShapeAndPlacement(), DTTopology::firstChannel(), GeomDet::geographicalId(), DTLayer::id(), insert_id(), DTTopology::lastChannel(), DTGeometry::layers(), Bounds::length(), m_fwGeometry, m_geomRecord, DetId::Muon, DetId::rawId(), DTLayer::specificTopology(), GeomDet::surface(), Bounds::thickness(), and Bounds::width().

Referenced by produce().

{
  DetId detId( DetId::Muon, 1 );
  const DTGeometry* dtGeometry = (const DTGeometry*) m_geomRecord->slaveGeometry( detId );

  //
  // DT chambers geometry
  //
  for( std::vector<DTChamber *>::const_iterator it = dtGeometry->chambers().begin(),
                                               end = dtGeometry->chambers().end(); 
       it != end; ++it )
  {
    const DTChamber *chamber = *it;
    
    if( chamber )
    {
      unsigned int rawid = chamber->geographicalId().rawId();
      unsigned int current = insert_id( rawid );
      fillShapeAndPlacement( current, chamber );
    }
  }

  // Fill in DT layer parameters
  for( std::vector<DTLayer*>::const_iterator it = dtGeometry->layers().begin(),
                                            end = dtGeometry->layers().end(); 
       it != end; ++it )
  {
    const DTLayer* layer = *it;
     
    if( layer )
    {
      unsigned int rawid = layer->id().rawId();
      unsigned int current = insert_id( rawid );
      fillShapeAndPlacement( current, layer );

      const DTTopology& topo = layer->specificTopology();
      const BoundPlane& surf = layer->surface();
      // Topology W/H/L:
      m_fwGeometry->idToName[current].topology[0] = topo.cellWidth();
      m_fwGeometry->idToName[current].topology[1] = topo.cellHeight();
      m_fwGeometry->idToName[current].topology[2] = topo.cellLenght();
      m_fwGeometry->idToName[current].topology[3] = topo.firstChannel();
      m_fwGeometry->idToName[current].topology[4] = topo.lastChannel();
      m_fwGeometry->idToName[current].topology[5] = topo.channels();

      // Bounds W/H/L:
      m_fwGeometry->idToName[current].topology[6] = surf.bounds().width();
      m_fwGeometry->idToName[current].topology[7] = surf.bounds().thickness();
      m_fwGeometry->idToName[current].topology[8] = surf.bounds().length();
    }
  }  
}
void FWRecoGeometryESProducer::addPixelBarrelGeometry ( void  ) [private]

Definition at line 235 of file FWRecoGeometryESProducer.cc.

References ADD_PIXEL_TOPOLOGY, cond::rpcobimon::current, cond::rpcobgas::detid, TrackerGeometry::detsPXB(), end, fillShapeAndPlacement(), GeomDet::geographicalId(), TrackerGeometry::idToDetUnit(), insert_id(), m_trackerGeom, and DetId::rawId().

Referenced by produce().

{
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsPXB().begin(),
                                                    end = m_trackerGeom->detsPXB().end();
       it != end; ++it)
  {
    const GeomDet *det = *it;

    if( det )
    {     
      DetId detid = det->geographicalId();
      unsigned int rawid = detid.rawId();
      unsigned int current = insert_id( rawid );
      fillShapeAndPlacement( current, det );

      ADD_PIXEL_TOPOLOGY( current, m_trackerGeom->idToDetUnit( detid ));
    }
  }
}
void FWRecoGeometryESProducer::addPixelForwardGeometry ( void  ) [private]

Definition at line 256 of file FWRecoGeometryESProducer.cc.

References ADD_PIXEL_TOPOLOGY, cond::rpcobimon::current, cond::rpcobgas::detid, TrackerGeometry::detsPXF(), end, fillShapeAndPlacement(), GeomDet::geographicalId(), TrackerGeometry::idToDetUnit(), insert_id(), m_trackerGeom, and DetId::rawId().

Referenced by produce().

{
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsPXF().begin(),
                                                    end = m_trackerGeom->detsPXF().end();
       it != end; ++it )
  {
    const GeomDet *det = *it;

    if( det )
    {     
      DetId detid = det->geographicalId();
      unsigned int rawid = detid.rawId();
      unsigned int current = insert_id( rawid );
      fillShapeAndPlacement( current, det );
    
      ADD_PIXEL_TOPOLOGY( current, m_trackerGeom->idToDetUnit( detid ));
    }
  }
}
void FWRecoGeometryESProducer::addRPCGeometry ( void  ) [private]

Definition at line 208 of file FWRecoGeometryESProducer.cc.

References cond::rpcobimon::current, end, fillShapeAndPlacement(), GeomDet::geographicalId(), insert_id(), m_fwGeometry, m_geomRecord, DetId::Muon, StripTopology::nstrips(), StripTopology::pitch(), DetId::rawId(), RPCGeometry::rolls(), RPCRoll::specificTopology(), and StripTopology::stripLength().

Referenced by produce().

{
  //
  // RPC rolls geometry
  //
  DetId detId( DetId::Muon, 3 );
  const RPCGeometry* rpcGeom = (const RPCGeometry*) m_geomRecord->slaveGeometry( detId );
  for( std::vector<RPCRoll *>::const_iterator it = rpcGeom->rolls().begin(),
                                             end = rpcGeom->rolls().end(); 
       it != end; ++it )
  {
    RPCRoll* roll = (*it);
    if( roll )
    {
      unsigned int rawid = roll->geographicalId().rawId();
      unsigned int current = insert_id( rawid );
      fillShapeAndPlacement( current, roll );

      const StripTopology& topo = roll->specificTopology();
      m_fwGeometry->idToName[current].topology[0] = topo.nstrips();
      m_fwGeometry->idToName[current].topology[1] = topo.stripLength();
      m_fwGeometry->idToName[current].topology[2] = topo.pitch();
    }
  }
}
void FWRecoGeometryESProducer::addTECGeometry ( void  ) [private]

Definition at line 340 of file FWRecoGeometryESProducer.cc.

References ADD_SISTRIP_TOPOLOGY, cond::rpcobimon::current, cond::rpcobgas::detid, TrackerGeometry::detsTEC(), end, fillShapeAndPlacement(), GeomDet::geographicalId(), TrackerGeometry::idToDet(), insert_id(), m_trackerGeom, and DetId::rawId().

Referenced by produce().

{
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTEC().begin(),
                                                    end = m_trackerGeom->detsTEC().end();
       it != end; ++it )
  {
    const GeomDet *det = *it;

    if( det )
    {     
      DetId detid = det->geographicalId();
      unsigned int rawid = detid.rawId();
      unsigned int current = insert_id( rawid );
      fillShapeAndPlacement( current, det );

      ADD_SISTRIP_TOPOLOGY( current, m_trackerGeom->idToDet( detid ));
    }
  }
}
void FWRecoGeometryESProducer::addTIBGeometry ( void  ) [private]

Definition at line 277 of file FWRecoGeometryESProducer.cc.

References ADD_SISTRIP_TOPOLOGY, cond::rpcobimon::current, cond::rpcobgas::detid, TrackerGeometry::detsTIB(), end, fillShapeAndPlacement(), GeomDet::geographicalId(), TrackerGeometry::idToDet(), insert_id(), m_trackerGeom, and DetId::rawId().

Referenced by produce().

{
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTIB().begin(),
                                                    end = m_trackerGeom->detsTIB().end();
       it != end; ++it )
  {
    const GeomDet *det = *it;

    if( det )
    {     
      DetId detid = det->geographicalId();
      unsigned int rawid = detid.rawId();
      unsigned int current = insert_id( rawid );
      fillShapeAndPlacement( current, det );

      ADD_SISTRIP_TOPOLOGY( current, m_trackerGeom->idToDet( detid ));
    }
  }
}
void FWRecoGeometryESProducer::addTIDGeometry ( void  ) [private]

Definition at line 319 of file FWRecoGeometryESProducer.cc.

References ADD_SISTRIP_TOPOLOGY, cond::rpcobimon::current, cond::rpcobgas::detid, TrackerGeometry::detsTID(), end, fillShapeAndPlacement(), GeomDet::geographicalId(), TrackerGeometry::idToDet(), insert_id(), m_trackerGeom, and DetId::rawId().

Referenced by produce().

{
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTID().begin(),
                                                    end = m_trackerGeom->detsTID().end();
       it != end; ++it)
  {
    const GeomDet *det = *it;

    if( det )
    {     
      DetId detid = det->geographicalId();
      unsigned int rawid = detid.rawId();
      unsigned int current = insert_id( rawid );
      fillShapeAndPlacement( current, det );

      ADD_SISTRIP_TOPOLOGY( current, m_trackerGeom->idToDet( detid ));
    }
  }
}
void FWRecoGeometryESProducer::addTOBGeometry ( void  ) [private]

Definition at line 298 of file FWRecoGeometryESProducer.cc.

References ADD_SISTRIP_TOPOLOGY, cond::rpcobimon::current, cond::rpcobgas::detid, TrackerGeometry::detsTOB(), end, fillShapeAndPlacement(), GeomDet::geographicalId(), TrackerGeometry::idToDet(), insert_id(), m_trackerGeom, and DetId::rawId().

Referenced by produce().

{
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTOB().begin(),
                                                    end = m_trackerGeom->detsTOB().end();
       it != end; ++it )
  {
    const GeomDet *det = *it;

    if( det )
    {     
      DetId detid = det->geographicalId();
      unsigned int rawid = detid.rawId();
      unsigned int current = insert_id( rawid );
      fillShapeAndPlacement( current, det );

      ADD_SISTRIP_TOPOLOGY( current, m_trackerGeom->idToDet( detid ));
    }
  }
}
void FWRecoGeometryESProducer::fillPoints ( unsigned int  id,
std::vector< GlobalPoint >::const_iterator  begin,
std::vector< GlobalPoint >::const_iterator  end 
) [private]

Definition at line 385 of file FWRecoGeometryESProducer.cc.

References end, i, getHLTprescales::index, and m_fwGeometry.

Referenced by addCaloGeometry().

{
  unsigned int index( 0 );
  for( std::vector<GlobalPoint>::const_iterator i = begin; i != end; ++i )
  {
    assert( index < 23 );
    m_fwGeometry->idToName[id].points[index] = i->x();
    m_fwGeometry->idToName[id].points[++index] = i->y();
    m_fwGeometry->idToName[id].points[++index] = i->z();
    ++index;
  }
}
void FWRecoGeometryESProducer::fillShapeAndPlacement ( unsigned int  id,
const GeomDet det 
) [private]

Shape of GeomDet

Definition at line 401 of file FWRecoGeometryESProducer.cc.

References b, m_fwGeometry, pos, GloballyPositioned< T >::position(), GloballyPositioned< T >::rotation(), GeomDet::surface(), PV3DBase< T, PVType, FrameType >::x(), TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), PV3DBase< T, PVType, FrameType >::z(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().

Referenced by addCSCGeometry(), addDTGeometry(), addPixelBarrelGeometry(), addPixelForwardGeometry(), addRPCGeometry(), addTECGeometry(), addTIBGeometry(), addTIDGeometry(), and addTOBGeometry().

{
  // Trapezoidal
  const Bounds *b = &((det->surface ()).bounds ());
  if( const TrapezoidalPlaneBounds *b2 = dynamic_cast<const TrapezoidalPlaneBounds *> (b))
  {
    std::vector< float > par = b2->parameters ();
    
    // These parameters are half-lengths, as in CMSIM/GEANT3
    m_fwGeometry->idToName[id].shape[0] = 1;
    m_fwGeometry->idToName[id].shape[1] = par [0]; // hBottomEdge
    m_fwGeometry->idToName[id].shape[2] = par [1]; // hTopEdge
    m_fwGeometry->idToName[id].shape[3] = par [2]; // thickness
    m_fwGeometry->idToName[id].shape[4] = par [3]; // apothem
  }
  if( const RectangularPlaneBounds *b2 = dynamic_cast<const RectangularPlaneBounds *> (b))
  {
    // Rectangular
    m_fwGeometry->idToName[id].shape[0] = 2;
    m_fwGeometry->idToName[id].shape[1] = b2->width() * 0.5; // half width
    m_fwGeometry->idToName[id].shape[2] = b2->length() * 0.5; // half length
    m_fwGeometry->idToName[id].shape[3] = b2->thickness() * 0.5; // half thickness
  }

  // Position of the DetUnit's center
  GlobalPoint pos = det->surface().position();
  m_fwGeometry->idToName[id].translation[0] = pos.x();
  m_fwGeometry->idToName[id].translation[1] = pos.y();
  m_fwGeometry->idToName[id].translation[2] = pos.z();

  // Add the coeff of the rotation matrix
  // with a projection on the basis vectors
  TkRotation<float> detRot = det->surface().rotation();
  m_fwGeometry->idToName[id].matrix[0] = detRot.xx();
  m_fwGeometry->idToName[id].matrix[1] = detRot.yx();
  m_fwGeometry->idToName[id].matrix[2] = detRot.zx();
  m_fwGeometry->idToName[id].matrix[3] = detRot.xy();
  m_fwGeometry->idToName[id].matrix[4] = detRot.yy();
  m_fwGeometry->idToName[id].matrix[5] = detRot.zy();
  m_fwGeometry->idToName[id].matrix[6] = detRot.xz();
  m_fwGeometry->idToName[id].matrix[7] = detRot.yz();
  m_fwGeometry->idToName[id].matrix[8] = detRot.zz();
}
unsigned int FWRecoGeometryESProducer::insert_id ( unsigned int  id) [private]
const FWRecoGeometryESProducer& FWRecoGeometryESProducer::operator= ( const FWRecoGeometryESProducer ) [private]
boost::shared_ptr< FWRecoGeometry > FWRecoGeometryESProducer::produce ( const FWRecoGeometryRecord record)

Member Data Documentation

Definition at line 50 of file FWRecoGeometryESProducer.h.

Referenced by addCaloGeometry(), and produce().

unsigned int FWRecoGeometryESProducer::m_current [private]

Definition at line 54 of file FWRecoGeometryESProducer.h.

Referenced by insert_id(), and produce().

Definition at line 49 of file FWRecoGeometryESProducer.h.

Referenced by addCSCGeometry(), addDTGeometry(), addRPCGeometry(), and produce().