CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions

FWCaloDataProxyBuilderBase Class Reference

#include <Fireworks/Calo/interface/FWCaloDataProxyBuilderBase.h>

Inheritance diagram for FWCaloDataProxyBuilderBase:
FWProxyBuilderBase FWCaloTowerProxyBuilderBase FWHFTowerProxyBuilderBase FWECalCaloTowerProxyBuilder FWHCalCaloTowerProxyBuilder FWHOCaloTowerProxyBuilder

List of all members.

Public Member Functions

 FWCaloDataProxyBuilderBase ()
virtual bool willHandleInteraction () const
virtual ~FWCaloDataProxyBuilderBase ()

Protected Member Functions

virtual bool assertCaloDataSlice ()=0
virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
virtual void fillCaloData ()=0
virtual void itemBeingDestroyed (const FWEventItem *)
virtual void setCaloData (const fireworks::Context &)=0

Protected Attributes

TEveCaloData * m_caloData
Int_t m_sliceIndex

Private Member Functions

void clearCaloDataSelection ()
 FWCaloDataProxyBuilderBase (const FWCaloDataProxyBuilderBase &)
virtual void modelChanges (const FWModelIds &, Product *)
const FWCaloDataProxyBuilderBaseoperator= (const FWCaloDataProxyBuilderBase &)

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 34 of file FWCaloDataProxyBuilderBase.h.


Constructor & Destructor Documentation

FWCaloDataProxyBuilderBase::FWCaloDataProxyBuilderBase ( )

Definition at line 45 of file FWCaloDataProxyBuilderBase.cc.

                                                       :
   m_caloData(0),
   m_sliceIndex(-1)
{
}
FWCaloDataProxyBuilderBase::~FWCaloDataProxyBuilderBase ( ) [virtual]

Definition at line 56 of file FWCaloDataProxyBuilderBase.cc.

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

Member Function Documentation

virtual bool FWCaloDataProxyBuilderBase::assertCaloDataSlice ( ) [protected, pure virtual]

Implemented in FWCaloTowerProxyBuilderBase, and FWHFTowerProxyBuilderBase.

Referenced by build().

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

Reimplemented from FWProxyBuilderBase.

Reimplemented in FWCaloTowerProxyBuilderBase, and FWHFTowerProxyBuilderBase.

Definition at line 77 of file FWCaloDataProxyBuilderBase.cc.

References assertCaloDataSlice(), FWEventItem::context(), fillCaloData(), FWProxyBuilderBase::item(), m_caloData, m_sliceIndex, and setCaloData().

{
   setCaloData(iItem->context());

   assertCaloDataSlice();
   fillCaloData();

   m_caloData->SetSliceColor(m_sliceIndex,item()->defaultDisplayProperties().color());
   m_caloData->SetSliceTransparency(m_sliceIndex,item()->defaultDisplayProperties().transparency());
   m_caloData->DataChanged();
   m_caloData->CellSelectionChanged();
}
void FWCaloDataProxyBuilderBase::clearCaloDataSelection ( ) [private]

Definition at line 136 of file FWCaloDataProxyBuilderBase.cc.

References m_caloData, m_sliceIndex, and swap().

Referenced by itemBeingDestroyed(), and modelChanges().

{
   //find all selected cell ids which are not from this FWEventItem and preserve only them
   // do this by moving them to the end of the list and then clearing only the end of the list
   // this avoids needing any additional memory

   TEveCaloData::vCellId_t& selected = m_caloData->GetCellsSelected();

   TEveCaloData::vCellId_t::iterator itEnd = selected.end();
   for(TEveCaloData::vCellId_t::iterator it = selected.begin();
       it != itEnd;
       ++it) {
      if(it->fSlice ==m_sliceIndex) {
         //we have found one we want to get rid of, so we swap it with the
         // one closest to the end which is not of this slice
         do {
            TEveCaloData::vCellId_t::iterator itLast = itEnd-1;
            itEnd = itLast;
         } while (itEnd != it && itEnd->fSlice==m_sliceIndex);
            
         if(itEnd != it) {
            std::swap(*it,*itEnd);
         } else {
            //shouldn't go on since advancing 'it' will put us past itEnd
            break;
         }
         //std::cout <<"keeping "<<it->fTower<<" "<<it->fSlice<<std::endl;
      }
   }
   selected.erase(itEnd,selected.end());


   // reset higlight
   m_caloData->GetCellsHighlighted().clear();
}
virtual void FWCaloDataProxyBuilderBase::fillCaloData ( ) [protected, pure virtual]
void FWCaloDataProxyBuilderBase::itemBeingDestroyed ( const FWEventItem iItem) [protected, virtual]
void FWCaloDataProxyBuilderBase::modelChanges ( const FWModelIds ,
Product p 
) [private, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 94 of file FWCaloDataProxyBuilderBase.cc.

References clearCaloDataSelection(), fillCaloData(), FWProxyBuilderBase::item(), m_caloData, and m_sliceIndex.

{
   if(m_caloData && item())
   {      
      clearCaloDataSelection();
      fillCaloData();    

      TEveCaloData::vCellId_t& selected = m_caloData->GetCellsSelected();
      if(!selected.empty()) {
         if(0==m_caloData->GetSelectedLevel()) {
            gEve->GetSelection()->AddElement(m_caloData);
         }
      } else {
         if(1==m_caloData->GetSelectedLevel()||2==m_caloData->GetSelectedLevel()) {
            gEve->GetSelection()->RemoveElement(m_caloData);
         }
      }   

      m_caloData->SetSliceColor(m_sliceIndex,item()->defaultDisplayProperties().color());
      m_caloData->SetSliceTransparency(m_sliceIndex,item()->defaultDisplayProperties().transparency());
      m_caloData->DataChanged();
      m_caloData->CellSelectionChanged();
   }
}
const FWCaloDataProxyBuilderBase& FWCaloDataProxyBuilderBase::operator= ( const FWCaloDataProxyBuilderBase ) [private]
virtual void FWCaloDataProxyBuilderBase::setCaloData ( const fireworks::Context ) [protected, pure virtual]

Implemented in FWCaloTowerProxyBuilderBase, and FWHFTowerProxyBuilderBase.

Referenced by build().

virtual bool FWCaloDataProxyBuilderBase::willHandleInteraction ( ) const [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 42 of file FWCaloDataProxyBuilderBase.h.

{ return true; }

Member Data Documentation

TEveCaloData* FWCaloDataProxyBuilderBase::m_caloData [protected]