CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWInteractionList Class Reference

#include <Fireworks/Core/interface/FWInteractionList.h>

List of all members.

Public Member Functions

void added (TEveElement *, unsigned int)
bool empty () const
 FWInteractionList (const FWEventItem *item)
const FWEventItemitem () const
void itemChanged ()
void modelChanges (const std::set< FWModelId > &)
virtual ~FWInteractionList ()

Private Member Functions

 FWInteractionList (const FWInteractionList &)
const FWInteractionListoperator= (const FWInteractionList &)

Private Attributes

std::vector< TEveCompound * > m_compounds
const FWEventItemm_item

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 33 of file FWInteractionList.h.


Constructor & Destructor Documentation

FWInteractionList::FWInteractionList ( const FWEventItem item)

Definition at line 37 of file FWInteractionList.cc.

   : m_item(item)
{}
FWInteractionList::~FWInteractionList ( ) [virtual]

Definition at line 46 of file FWInteractionList.cc.

References i, and m_compounds.

{
   for ( std::vector<TEveCompound*>::iterator i = m_compounds.begin(); i != m_compounds.end(); ++i)
   {
      // Interaction are created only in the standard use case, where user data is FWFromEveSelectorBase.
      // This is defined with return value of virtual function FWPRoxyBuilderBase::willHandleInteraction().

      if ((*i)->GetUserData())
         delete reinterpret_cast<FWFromEveSelectorBase*>((*i)->GetUserData());

      (*i)->RemoveElements();
      (*i)->DecDenyDestroy();
   }
}
FWInteractionList::FWInteractionList ( const FWInteractionList ) [private]

Member Function Documentation

void FWInteractionList::added ( TEveElement *  el,
unsigned int  idx 
)

This function is called from FWProxyBuilderBase::build() function (e.g. on next event). The PB build function creates TEveElement for each element of collection and calls this function to add the element to "master" element, which is a TEveCompound.

Definition at line 71 of file FWInteractionList.cc.

References trackerHits::c, FWDisplayProperties::color(), FWEventItem::defaultDisplayProperties(), FWEventItem::haveInterestingValue(), FWDisplayProperties::isVisible(), m_compounds, m_item, FWEventItem::modelInterestingValueAsString(), FWEventItem::modelName(), AlCaRecoCosmics_cfg::name, and FWDisplayProperties::transparency().

Referenced by FWProxyBuilderBase::build().

{

   // In the case a compound for the given index already exists, just add 
   // the TEveElement to it, otherwise create a new one.
   if (idx < m_compounds.size())
   {
      m_compounds[idx]->AddElement(el);
      return;
   }

   // Prepare name for the tooltip on mouseover in GL viewer.Value of
   // tooltip is TEveElement::fTitle
   std::string name = m_item->modelName(idx);
   if (m_item->haveInterestingValue())
      name += ", " + m_item->modelInterestingValueAsString(idx);

   TEveCompound* c = new TEveCompound(name.c_str(), name.c_str());
   c->EnableListElements(m_item->defaultDisplayProperties().isVisible());
   c->SetMainColor(m_item->defaultDisplayProperties().color());
   c->SetMainTransparency(m_item->defaultDisplayProperties().transparency());
   
   // Set flags to propagat attributes.
   c->CSCImplySelectAllChildren();
   c->CSCApplyMainColorToAllChildren();
   c->CSCApplyMainTransparencyToAllChildren();

   // TEveElement is auto-destroyed if is is not added to any parent. Alternative could 
   // be to use increase/decrease reference count.
   c->IncDenyDestroy();
   //  FWModelIdFromEveSelector is needed for interaction from Eve to Fireworks.
   //  FWEveViewManager gets ROOT signals with selected objects (TEveCompound)
   //  then cals doSelect() on the compound's user data.
   c->SetUserData(new FWModelIdFromEveSelector(FWModelId(m_item, idx)));
   // Order does not matter. What is added to TEveCompound is not concern of interaction list.
   // Interaction list operates ony with the compound.
   m_compounds.push_back(c);
   m_compounds.back()->AddElement(el); 
   // printf("%s[%d] FWInteractionList::added has childern %d\n",m_item->name().c_str(), idx,  m_compounds[idx]->NumChildren()); 
}
bool FWInteractionList::empty ( void  ) const [inline]

Definition at line 42 of file FWInteractionList.h.

References m_compounds.

{ return m_compounds.empty(); }
const FWEventItem* FWInteractionList::item ( ) const [inline]

Definition at line 41 of file FWInteractionList.h.

References m_item.

{ return m_item;}
void FWInteractionList::itemChanged ( )

This method is called from FWEveViewManager::itemChanged(), which is a callback of signal FWEventItem::itemChanged_.

Definition at line 149 of file FWInteractionList.cc.

References FWDisplayProperties::color(), FWEventItem::ModelInfo::displayProperties(), ExpressReco_HICollisions_FallBack::e, FWEventItem::haveInterestingValue(), i, info, FWDisplayProperties::isVisible(), m_compounds, m_item, FWEventItem::modelInfo(), FWEventItem::modelInterestingValueAsString(), FWEventItem::modelName(), AlCaRecoCosmics_cfg::name, L1TEmulatorMonitor_cff::p, FWEventItem::size(), and FWDisplayProperties::transparency().

{   for (size_t i = 0, e = m_item->size(); i < e; ++i)
   {
       // Assert for sizes is not necessary, becuse it is already in a 
      // proxy builder.
      TEveElement* comp = m_compounds[i];
      
      std::string name = m_item->modelName(i);
      if (m_item->haveInterestingValue())
         name += ", " + m_item->modelInterestingValueAsString(i);

      comp->SetElementTitle(name.c_str());

      const FWEventItem::ModelInfo& info = m_item->modelInfo(i);
      const FWDisplayProperties &p = info.displayProperties();

      if (p.isVisible() != comp->GetRnrSelf())
         comp->EnableListElements(p.isVisible(), p.isVisible());

      if (p.color() != comp->GetMainColor())
         comp->SetMainColor(p.color());

      if (p.transparency() != comp->GetMainTransparency())
         comp->SetMainTransparency(p.transparency());

   }
}
void FWInteractionList::modelChanges ( const std::set< FWModelId > &  iIds)

This method is called from FWEveViewManager::modelChanges(), which has modelChanges callback same as all other view maangers.

Definition at line 117 of file FWInteractionList.cc.

References FWDisplayProperties::color(), FWEventItem::ModelInfo::displayProperties(), info, FWEventItem::ModelInfo::isSelected(), FWDisplayProperties::isVisible(), m_compounds, m_item, FWEventItem::modelInfo(), L1TEmulatorMonitor_cff::p, FWEventItem::size(), and FWDisplayProperties::transparency().

{ 
   assert (m_compounds.size() >= m_item->size());

   for (std::set<FWModelId>::const_iterator it = iIds.begin(); it != iIds.end(); ++it)
   {
      const FWEventItem::ModelInfo& info = m_item->modelInfo(it->index());
      // std::cout <<" FWInteractionList::modelChanges  color "<< info.displayProperties().color()  << "(*it).index() " <<(*it).index() << "  " << m_item->name() <<std::endl;
      const FWDisplayProperties &p = info.displayProperties();
      TEveElement* comp = m_compounds[it->index()];
      comp->EnableListElements(p.isVisible(), p.isVisible());
      comp->SetMainColor(p.color());
      comp->SetMainTransparency(p.transparency());

      if (info.isSelected())
      {
         if (comp->GetSelectedLevel() != 1)
            gEve->GetSelection()->AddElement(comp);
      }
      else
      {
         if (comp->GetSelectedLevel() == 1)
            gEve->GetSelection()->RemoveElement(comp);
      }
   }
}
const FWInteractionList& FWInteractionList::operator= ( const FWInteractionList ) [private]

Member Data Documentation

std::vector<TEveCompound*> FWInteractionList::m_compounds [private]

Definition at line 60 of file FWInteractionList.h.

Referenced by added(), empty(), itemChanged(), modelChanges(), and ~FWInteractionList().

Definition at line 61 of file FWInteractionList.h.

Referenced by added(), item(), itemChanged(), and modelChanges().