CMS 3D CMS Logo

Public Member Functions | Private Member Functions

FWRPCDigiProxyBuilder Class Reference

Inheritance diagram for FWRPCDigiProxyBuilder:
FWProxyBuilderBase

List of all members.

Public Member Functions

 FWRPCDigiProxyBuilder ()
 REGISTER_PROXYBUILDER_METHODS ()
virtual ~FWRPCDigiProxyBuilder ()

Private Member Functions

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 FWRPCDigiProxyBuilder (const FWRPCDigiProxyBuilder &)
const FWRPCDigiProxyBuilderoperator= (const FWRPCDigiProxyBuilder &)

Detailed Description

Definition at line 25 of file FWRPCDigiProxyBuilder.cc.


Constructor & Destructor Documentation

FWRPCDigiProxyBuilder::FWRPCDigiProxyBuilder ( ) [inline]

Definition at line 28 of file FWRPCDigiProxyBuilder.cc.

{}
virtual FWRPCDigiProxyBuilder::~FWRPCDigiProxyBuilder ( ) [inline, virtual]

Definition at line 29 of file FWRPCDigiProxyBuilder.cc.

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

Member Function Documentation

void FWRPCDigiProxyBuilder::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext  
) [private, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 40 of file FWRPCDigiProxyBuilder.cc.

References FWGeometry::contains(), FWProxyBuilderBase::createCompound(), fwLog, relativeConstraints::geom, FWEventItem::get(), FWEventItem::getGeom(), FWGeometry::getParameters(), fwlog::kWarning, FWGeometry::localToGlobal(), evf::evtn::offset(), Parameters::parameters, FWProxyBuilderBase::setupAddElement(), and strip().

{
  const RPCDigiCollection* digis = 0;
 
  iItem->get(digis);

  if ( ! digis ) 
  {
    fwLog(fwlog::kWarning)<<"Failed to get RPCDigis"<<std::endl;
    return;
  }
  const FWGeometry *geom = iItem->getGeom();

  for ( RPCDigiCollection::DigiRangeIterator dri = digis->begin(), driEnd = digis->end();
        dri != driEnd; ++dri )
  {
    unsigned int rawid = (*dri).first.rawId();
    const RPCDigiCollection::Range& range = (*dri).second;

    if( ! geom->contains( rawid ))
    {
      fwLog( fwlog::kWarning ) << "Failed to get geometry of RPC roll with detid: "
                               << rawid << std::endl;
      
      TEveCompound* compound = createCompound();
      setupAddElement( compound, product );
      
      continue;
    }
    
    const float* parameters = geom->getParameters( rawid );
    float nStrips = parameters[0];
    float halfStripLength = parameters[1]*0.5;
    float pitch = parameters[2];
    float offset = -0.5*nStrips*pitch;
    
    for( RPCDigiCollection::const_iterator dit = range.first;
         dit != range.second; ++dit )
    {
      TEveStraightLineSet* stripDigiSet = new TEveStraightLineSet;
      stripDigiSet->SetLineWidth(3);
      setupAddElement( stripDigiSet, product );

      int strip = (*dit).strip();
      float centreOfStrip = (strip-0.5)*pitch + offset;

      float localPointTop[3] =
      {
        centreOfStrip, halfStripLength, 0.0
      };

      float localPointBottom[3] = 
      {
        centreOfStrip, -halfStripLength, 0.0
      };

      float globalPointTop[3];
      float globalPointBottom[3];

      geom->localToGlobal( rawid, localPointTop, globalPointTop, localPointBottom, globalPointBottom );

      stripDigiSet->AddLine(globalPointTop[0], globalPointTop[1], globalPointTop[2],
                            globalPointBottom[0], globalPointBottom[1], globalPointBottom[2]);
    }
  }
}
const FWRPCDigiProxyBuilder& FWRPCDigiProxyBuilder::operator= ( const FWRPCDigiProxyBuilder ) [private]
FWRPCDigiProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )