CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWEcalRecHitProxyBuilder Class Reference

Inheritance diagram for FWEcalRecHitProxyBuilder:
FWDigitSetProxyBuilder FWProxyBuilderBase

List of all members.

Public Member Functions

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

Private Member Functions

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 FWEcalRecHitProxyBuilder (const FWEcalRecHitProxyBuilder &)
const FWEcalRecHitProxyBuilderoperator= (const FWEcalRecHitProxyBuilder &)

Private Attributes

bool m_plotEt

Detailed Description

Definition at line 18 of file FWEcalRecHitProxyBuilder.cc.


Constructor & Destructor Documentation

FWEcalRecHitProxyBuilder::FWEcalRecHitProxyBuilder ( ) [inline]

Definition at line 21 of file FWEcalRecHitProxyBuilder.cc.

virtual FWEcalRecHitProxyBuilder::~FWEcalRecHitProxyBuilder ( ) [inline, virtual]

Definition at line 22 of file FWEcalRecHitProxyBuilder.cc.

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

Member Function Documentation

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

Reimplemented from FWProxyBuilderBase.

Definition at line 96 of file FWEcalRecHitProxyBuilder.cc.

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

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

   const EcalRecHitCollection* collection = 0;
   iItem->get( collection );
   if (! collection)
      return;

   TEveBoxSet* boxSet = addBoxSetToProduct(product);
   std::vector<float> scaledCorners(24);
   int index = 0;
   for (std::vector<EcalRecHit>::const_iterator it = collection->begin() ; it != collection->end(); ++it)
   {
      const float* corners = item()->getGeom()->getCorners((*it).detid());
      if (corners == 0) 
         continue;

      Float_t scale = 10.0;
      bool reflect = false;
      if (EcalSubdetector( (*it).detid().subdetId() ) == EcalPreshower)
      {
         scale = 1000.0;        // FIXME: The scale should be taken form somewhere else
         reflect = corners[2] < 0;
      }

      if (m_plotEt)
         fireworks::energyTower3DCorners(corners, (*it).energy() * scale,  scaledCorners, reflect);
      else
         fireworks::energyTower3DCorners(corners, (*it).energy() * scale,  scaledCorners, reflect);

      addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index++).displayProperties());
   }
}
virtual bool FWEcalRecHitProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 24 of file FWEcalRecHitProxyBuilder.cc.

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

Reimplemented from FWProxyBuilderBase.

Definition at line 42 of file FWEcalRecHitProxyBuilder.cc.

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

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

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

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

         Float_t scale = 10.0;
         bool reflect = false;
         if (EcalSubdetector( (*it).detid().subdetId() ) == EcalPreshower)
         {
            scale = 1000.0;     // FIXME: The scale should be taken form somewhere else
            reflect = corners[2] < 0;
         }

         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::etTower3DCorners(corners, (*it).energy() * scale,  scaledCorners, reflect);
         else
            fireworks::energyTower3DCorners(corners, (*it).energy() * scale,  scaledCorners, reflect);

         memcpy(b->fVertices, &scaledCorners[0], sizeof(b->fVertices));

         /*
           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] );
         */
      }
      getBoxSet()->ElementChanged();
   }
}

Member Data Documentation

Definition at line 35 of file FWEcalRecHitProxyBuilder.cc.

Referenced by build(), and scaleProduct().