CMS 3D CMS Logo

Public Member Functions | Private Member Functions

FWCSCRecHitProxyBuilder Class Reference

Inheritance diagram for FWCSCRecHitProxyBuilder:
FWSimpleProxyBuilderTemplate< CSCRecHit2D > FWSimpleProxyBuilder FWProxyBuilderBase

List of all members.

Public Member Functions

 FWCSCRecHitProxyBuilder (void)
 REGISTER_PROXYBUILDER_METHODS ()
virtual ~FWCSCRecHitProxyBuilder (void)

Private Member Functions

void build (const CSCRecHit2D &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *)
 FWCSCRecHitProxyBuilder (const FWCSCRecHitProxyBuilder &)
const FWCSCRecHitProxyBuilderoperator= (const FWCSCRecHitProxyBuilder &)

Detailed Description

Definition at line 19 of file FWCSCRecHitProxyBuilder.cc.


Constructor & Destructor Documentation

FWCSCRecHitProxyBuilder::FWCSCRecHitProxyBuilder ( void  ) [inline]

Definition at line 22 of file FWCSCRecHitProxyBuilder.cc.

{}
virtual FWCSCRecHitProxyBuilder::~FWCSCRecHitProxyBuilder ( void  ) [inline, virtual]

Definition at line 23 of file FWCSCRecHitProxyBuilder.cc.

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

Member Function Documentation

void FWCSCRecHitProxyBuilder::build ( const CSCRecHit2D iData,
unsigned int  iIndex,
TEveElement &  oItemHolder,
const FWViewContext  
) [private, virtual]

iIndex is the index where iData is found in the container from which it came iItemHolder is the object to which you add your own objects which inherit from TEveElement

Reimplemented from FWSimpleProxyBuilderTemplate< CSCRecHit2D >.

Definition at line 35 of file FWCSCRecHitProxyBuilder.cc.

References FWGeometry::contains(), CSCRecHit2D::cscDetId(), FWGeometry::find(), fwLog, relativeConstraints::geom, FWEventItem::getGeom(), FWProxyBuilderBase::item(), fwlog::kError, CSCRecHit2D::localPosition(), CSCRecHit2D::localPositionError(), FWGeometry::localToGlobal(), DetId::rawId(), FWProxyBuilderBase::setupAddElement(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

{       
  const FWGeometry *geom = item()->getGeom();
  unsigned int rawid = iData.cscDetId().rawId();
  
  if( ! geom->contains( rawid ))
  {
    fwLog( fwlog::kError ) << "failed to get geometry of CSC layer with detid: " 
                           << rawid <<std::endl;
    return;
  }
  FWGeometry::IdToInfoItr det = geom->find( rawid );

  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
  setupAddElement( recHitSet, &oItemHolder );

  TEvePointSet* pointSet = new TEvePointSet;
  setupAddElement( pointSet, &oItemHolder );
  
  float localPositionX = iData.localPosition().x();
  float localPositionY = iData.localPosition().y();
  
  float localPositionXX = sqrt( iData.localPositionError().xx());
  float localPositionYY = sqrt( iData.localPositionError().yy());
  
  float localU1Point[3] = 
    {
      localPositionX - localPositionXX, localPositionY, 0.0
    };
  
  float localU2Point[3] = 
    {
      localPositionX + localPositionXX, localPositionY, 0.0
    };
  
  float localV1Point[3] = 
    {
      localPositionX, localPositionY - localPositionYY, 0.0
    };
  
  float localV2Point[3] = 
    {
      localPositionX, localPositionY + localPositionYY, 0.0
    };

  float globalU1Point[3];
  float globalU2Point[3];
  float globalV1Point[3];
  float globalV2Point[3];

  geom->localToGlobal( *det, localU1Point, globalU1Point );
  geom->localToGlobal( *det, localU2Point, globalU2Point );
  geom->localToGlobal( *det, localV1Point, globalV1Point );
  geom->localToGlobal( *det, localV2Point, globalV2Point );

  pointSet->SetNextPoint( globalU1Point[0], globalU1Point[1], globalU1Point[2] ); 
  pointSet->SetNextPoint( globalU2Point[0], globalU2Point[1], globalU2Point[2] );
  pointSet->SetNextPoint( globalV1Point[0], globalV1Point[1], globalV1Point[2] );
  pointSet->SetNextPoint( globalV2Point[0], globalV2Point[1], globalV2Point[2] );
  
  recHitSet->AddLine( globalU1Point[0], globalU1Point[1], globalU1Point[2], 
                      globalU2Point[0], globalU2Point[1], globalU2Point[2] );
 
  recHitSet->AddLine( globalV1Point[0], globalV1Point[1], globalV1Point[2], 
                      globalV2Point[0], globalV2Point[1], globalV2Point[2] );
}
const FWCSCRecHitProxyBuilder& FWCSCRecHitProxyBuilder::operator= ( const FWCSCRecHitProxyBuilder ) [private]
FWCSCRecHitProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )