CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWHBHERecHitProxyBuilder Class Reference

Inheritance diagram for FWHBHERecHitProxyBuilder:
FWDigitSetProxyBuilder FWProxyBuilderBase

List of all members.

Public Member Functions

 FWHBHERecHitProxyBuilder (void)
virtual bool havePerViewProduct (FWViewType::EType) const
 REGISTER_PROXYBUILDER_METHODS ()
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
virtual ~FWHBHERecHitProxyBuilder (void)

Private Member Functions

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 FWHBHERecHitProxyBuilder (const FWHBHERecHitProxyBuilder &)
const FWHBHERecHitProxyBuilderoperator= (const FWHBHERecHitProxyBuilder &)

Private Attributes

Float_t m_maxEnergy
bool m_plotEt

Detailed Description

Definition at line 12 of file FWHBHERecHitProxyBuilder.cc.


Constructor & Destructor Documentation

FWHBHERecHitProxyBuilder::FWHBHERecHitProxyBuilder ( void  ) [inline]

Definition at line 15 of file FWHBHERecHitProxyBuilder.cc.

      : m_maxEnergy( 0.85 ), m_plotEt(true)
    {}
virtual FWHBHERecHitProxyBuilder::~FWHBHERecHitProxyBuilder ( void  ) [inline, virtual]

Definition at line 19 of file FWHBHERecHitProxyBuilder.cc.

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

Member Function Documentation

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

Reimplemented from FWProxyBuilderBase.

Definition at line 84 of file FWHBHERecHitProxyBuilder.cc.

References FWDigitSetProxyBuilder::addBox(), FWDigitSetProxyBuilder::addBoxSetToProduct(), edm::SortedCollection< T, SORT >::begin(), runEdmFileComparison::collection, FWProxyBuilderBase::context(), edm::SortedCollection< T, SORT >::end(), fireworks::energyScaledBox3DCorners(), fireworks::etScaledBox3DCorners(), FWEventItem::get(), FWGeometry::getCorners(), FWViewContext::getEnergyScale(), fireworks::Context::getGeom(), FWViewEnergyScale::getPlotEt(), getHLTprescales::index, m_maxEnergy, m_plotEt, and FWEventItem::modelInfo().

{
   m_plotEt = vc->getEnergyScale()->getPlotEt();

   const HBHERecHitCollection* collection = 0;
   iItem->get( collection );

   if( 0 == collection )
   {
      return;
   }
   std::vector<HBHERecHit>::const_iterator it = collection->begin();
   std::vector<HBHERecHit>::const_iterator itEnd = collection->end();
   std::vector<float> scaledCorners(24);

   for( ; it != itEnd; ++it )
   {
      if(( *it ).energy() > m_maxEnergy )
         m_maxEnergy = ( *it ).energy();
   }

   TEveBoxSet* boxSet = addBoxSetToProduct(product);
   int index = 0;
   for (std::vector<HBHERecHit>::const_iterator it = collection->begin() ; it != collection->end(); ++it)
   {  
      const float* corners = context().getGeom()->getCorners((*it).detid());
      if (corners)
      {
         if (m_plotEt)
            fireworks::etScaledBox3DCorners(corners, (*it).energy(), m_maxEnergy, scaledCorners, true);
         else
            fireworks::energyScaledBox3DCorners(corners, (*it).energy() / m_maxEnergy, scaledCorners, true);
      }
      addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index++).displayProperties());
   }
}
virtual bool FWHBHERecHitProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 22 of file FWHBHERecHitProxyBuilder.cc.

{ return true; }
const FWHBHERecHitProxyBuilder& FWHBHERecHitProxyBuilder::operator= ( const FWHBHERecHitProxyBuilder ) [private]
FWHBHERecHitProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )
void FWHBHERecHitProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
) [virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 38 of file FWHBHERecHitProxyBuilder.cc.

References b, edm::SortedCollection< T, SORT >::begin(), runEdmFileComparison::collection, edm::SortedCollection< T, SORT >::end(), fireworks::energyScaledBox3DCorners(), fireworks::etScaledBox3DCorners(), FWDigitSetProxyBuilder::BFreeBox_t::fVertices, FWEventItem::get(), FWDigitSetProxyBuilder::getBoxSet(), FWGeometry::getCorners(), FWViewContext::getEnergyScale(), FWEventItem::getGeom(), FWViewEnergyScale::getPlotEt(), getHLTprescales::index, FWProxyBuilderBase::item(), m_maxEnergy, and m_plotEt.

{
   if (m_plotEt != vc->getEnergyScale()->getPlotEt() )
   {
      m_plotEt = !m_plotEt;

      const HBHERecHitCollection* collection = 0;
      item()->get( collection );
      if (! collection)
         return;

      int index = 0;
      std::vector<float> scaledCorners(24);
      for (std::vector<HBHERecHit>::const_iterator it = collection->begin() ; it != collection->end(); ++it, ++index)
      {
         const float* corners = item()->getGeom()->getCorners((*it).detid());
         if (corners == 0) 
            continue;
         FWDigitSetProxyBuilder::BFreeBox_t* b = (FWDigitSetProxyBuilder::BFreeBox_t*)getBoxSet()->GetPlex()->Atom(index);

         /*          
         printf("--------------------scale product \n");
         for (int i = 0; i < 8 ; ++i)
            printf("[%f %f %f ]\n",b->fVertices[i][0], b->fVertices[i][1],b->fVertices[i][2] );
         */

         if (m_plotEt)
            fireworks::etScaledBox3DCorners(corners, (*it).energy(),  m_maxEnergy, scaledCorners, true);
         else
            fireworks::energyScaledBox3DCorners(corners, (*it).energy() / m_maxEnergy, scaledCorners, true);
         
         /*
         printf("after \n");
         for (int i = 0; i < 8 ; ++i)
            printf("[%f %f %f ]\n",b->fVertices[i][0], b->fVertices[i][1],b->fVertices[i][2] );        
         */
         memcpy(b->fVertices, &scaledCorners[0], sizeof(b->fVertices));

      }
      getBoxSet()->ElementChanged();
   }
}

Member Data Documentation

Definition at line 30 of file FWHBHERecHitProxyBuilder.cc.

Referenced by build(), and scaleProduct().

Definition at line 31 of file FWHBHERecHitProxyBuilder.cc.

Referenced by build(), and scaleProduct().