CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions

FWSiStripClusterProxyBuilder Class Reference

Inheritance diagram for FWSiStripClusterProxyBuilder:
FWProxyBuilderBase

List of all members.

Public Member Functions

virtual void clean ()
 FWSiStripClusterProxyBuilder (void)
 REGISTER_PROXYBUILDER_METHODS ()
virtual ~FWSiStripClusterProxyBuilder (void)

Protected Member Functions

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
virtual void localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)

Private Member Functions

 FWSiStripClusterProxyBuilder (const FWSiStripClusterProxyBuilder &)
const
FWSiStripClusterProxyBuilder
operator= (const FWSiStripClusterProxyBuilder &)

Detailed Description

Definition at line 18 of file FWSiStripClusterProxyBuilder.cc.


Constructor & Destructor Documentation

FWSiStripClusterProxyBuilder::FWSiStripClusterProxyBuilder ( void  ) [inline]

Definition at line 21 of file FWSiStripClusterProxyBuilder.cc.

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

Definition at line 22 of file FWSiStripClusterProxyBuilder.cc.

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

Member Function Documentation

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

Reimplemented from FWProxyBuilderBase.

Definition at line 56 of file FWSiStripClusterProxyBuilder.cc.

References edmNew::DetSetVector< T >::begin(), edm::contains(), FWProxyBuilderBase::createCompound(), edmNew::DetSetVector< T >::end(), fwLog, FWEventItem::get(), FWGeometry::getEveShape(), FWEventItem::getGeom(), FWGeometry::getParameters(), errorMatrix2Lands_multiChannel::id, FWProxyBuilderBase::increaseComponentTransparency(), FWProxyBuilderBase::item(), fwlog::kError, fwlog::kWarning, fireworks::localSiStrip(), FWGeometry::localToGlobal(), runtimedef::set(), and FWProxyBuilderBase::setupAddElement().

{
   const edmNew::DetSetVector<SiStripCluster>* clusters = 0;
   iItem->get( clusters );
   if( 0 == clusters ) return;
   int cnt = 0;

   for( edmNew::DetSetVector<SiStripCluster>::const_iterator set = clusters->begin(), setEnd = clusters->end();
        set != setEnd; ++set) {
      unsigned int id = set->detId();

      
      TEveGeoShape* shape = item()->getGeom()->getEveShape( id );
      if (shape) 
      {
         shape->SetMainTransparency( 75 );    
         shape->SetElementName( "Det" );
      }
      else      
      {
         fwLog( fwlog::kWarning ) 
            << "failed to get shape of SiStripCluster with detid: "
            << id << std::endl;
      }  

      for( edmNew::DetSet<SiStripCluster>::const_iterator ic = set->begin (), icEnd = set->end (); ic != icEnd; ++ic ) 
      {
         TEveCompound* itemHolder = 0;
         if (cnt < product->NumChildren())
         {
            TEveElement::List_i pit = product->BeginChildren();
            std::advance(pit, cnt);
            itemHolder = (TEveCompound*)*pit;
            itemHolder->SetRnrSelfChildren(true, true);
         }
         else {
            itemHolder = createCompound(); 
            setupAddElement( itemHolder, product );
         }

         // add common shape
         if (shape) 
         {
            setupAddElement( shape, itemHolder );
            increaseComponentTransparency( cnt, itemHolder, "Det", 60 );
         }

         // add line        
         if( ! item()->getGeom()->contains( id ))
         {
            fwLog( fwlog::kError )
               << "failed to geometry of SiStripCluster with detid: " 
               << id << std::endl;
            continue;
         }

         TEveStraightLineSet *lineSet = new TEveStraightLineSet( "strip" );
         setupAddElement( lineSet, itemHolder ); 
         float localTop[3] = { 0.0, 0.0, 0.0 };
         float localBottom[3] = { 0.0, 0.0, 0.0 };

         fireworks::localSiStrip( (*ic).firstStrip(), localTop, localBottom, iItem->getGeom()->getParameters( id ), id );

         float globalTop[3];
         float globalBottom[3];
         iItem->getGeom()->localToGlobal( id, localTop, globalTop, localBottom, globalBottom );
  
         lineSet->AddLine( globalTop[0], globalTop[1], globalTop[2],
                           globalBottom[0], globalBottom[1], globalBottom[2] ); 

         cnt++;
      }
   }
}
void FWSiStripClusterProxyBuilder::clean ( ) [virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 39 of file FWSiStripClusterProxyBuilder.cc.

References FWProxyBuilderBase::cleanLocal(), i, and FWProxyBuilderBase::m_products.

{
   // keep itemholders to restore configuration

   for (FWProxyBuilderBase::Product_it i = m_products.begin(); i != m_products.end(); ++i)
   {
      if ((*i)->m_elements)
      {
         TEveElement* elms = (*i)->m_elements;
         for (TEveElement::List_i it = elms->BeginChildren(); it != elms->EndChildren(); ++it)
            (*it)->DestroyElements();
      }
   }

   cleanLocal();
}
void FWSiStripClusterProxyBuilder::localModelChanges ( const FWModelId iId,
TEveElement *  iCompound,
FWViewType::EType  viewType,
const FWViewContext vc 
) [protected, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 131 of file FWSiStripClusterProxyBuilder.cc.

References FWProxyBuilderBase::increaseComponentTransparency(), and FWModelId::index().

{
  increaseComponentTransparency( iId.index(), iCompound, "Det", 60 );
}
const FWSiStripClusterProxyBuilder& FWSiStripClusterProxyBuilder::operator= ( const FWSiStripClusterProxyBuilder ) [private]
FWSiStripClusterProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )