CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

FWPFEcalRecHitRPProxyBuilder Class Reference

#include <FWPFEcalRecHitRPProxyBuilder.h>

Inheritance diagram for FWPFEcalRecHitRPProxyBuilder:
FWProxyBuilderTemplate< EcalRecHit > FWProxyBuilderBase

List of all members.

Public Member Functions

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
virtual void cleanLocal ()
 FWPFEcalRecHitRPProxyBuilder ()
virtual bool havePerViewProduct (FWViewType::EType) const
 REGISTER_PROXYBUILDER_METHODS ()
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
virtual ~FWPFEcalRecHitRPProxyBuilder ()

Static Public Member Functions

static std::string typeOfBuilder ()
 Used by the plugin system to determine how the proxy uses the data from FWEventItem.

Private Member Functions

TEveVector calculateCentre (const float *corners)
 FWPFEcalRecHitRPProxyBuilder (const FWPFEcalRecHitRPProxyBuilder &)
const
FWPFEcalRecHitRPProxyBuilder
operator= (const FWPFEcalRecHitRPProxyBuilder &)

Private Attributes

std::vector< FWPFRhoPhiRecHit * > m_towers

Detailed Description

Definition at line 35 of file FWPFEcalRecHitRPProxyBuilder.h.


Constructor & Destructor Documentation

FWPFEcalRecHitRPProxyBuilder::FWPFEcalRecHitRPProxyBuilder ( ) [inline]

Definition at line 41 of file FWPFEcalRecHitRPProxyBuilder.h.

{}
virtual FWPFEcalRecHitRPProxyBuilder::~FWPFEcalRecHitRPProxyBuilder ( ) [inline, virtual]

Definition at line 42 of file FWPFEcalRecHitRPProxyBuilder.h.

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

Member Function Documentation

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

Reimplemented from FWProxyBuilderBase.

Definition at line 49 of file FWPFEcalRecHitRPProxyBuilder.cc.

References calculateCentre(), FWPFMaths::calculateEt(), FWPFUtils::caloR1(), FWProxyBuilderBase::context(), funct::cos(), FWProxyBuilderBase::createCompound(), CaloRecHit::detid(), FWEventItem::ModelInfo::displayProperties(), CaloRecHit::energy(), FWGeometry::getCorners(), FWEventItem::getGeom(), i, getHLTprescales::index, info, FWDisplayProperties::isVisible(), FWProxyBuilderBase::item(), m_towers, FWProxyBuilderTemplate< EcalRecHit >::modelData(), FWEventItem::modelInfo(), phi, funct::sin(), FWEventItem::size(), and fireworks::Context::voteMaxEtAndEnergy().

{
   m_towers.clear(); // Bug fix required for when multiple RhoPhiPF views are active
   for( unsigned int index = 0; index < static_cast<unsigned int>( iItem->size() ); ++index )
   {
      TEveCompound *itemHolder = createCompound();
      product->AddElement( itemHolder );
      const FWEventItem::ModelInfo &info = item()->modelInfo( index );

      if( info.displayProperties().isVisible() )
      {
         bool added = false;
         float E, et;
         float ecalR = FWPFUtils::caloR1();
         Double_t lPhi, rPhi;
         const EcalRecHit &iData = modelData( index );
         const float *vertices = item()->getGeom()->getCorners( iData.detid() );

         TEveVector centre = calculateCentre( vertices );
         TEveVector lVec = TEveVector( vertices[0], vertices[1], 0 );   // Bottom left corner of tower
         TEveVector rVec = TEveVector( vertices[9], vertices[10], 0 );  // Bottom right corner of tower
         
         lPhi = lVec.Phi();
         rPhi = rVec.Phi();
         E = iData.energy();
         et = FWPFMaths::calculateEt( centre, E );

         for( unsigned int i = 0; i < m_towers.size(); i++ )
         {   // Small range to catch rounding inaccuracies etc.
            Double_t phi = m_towers[i]->getlPhi();
            if( ( lPhi == phi ) || ( ( lPhi < phi + 0.0005 ) && ( lPhi > phi - 0.0005 ) ) )
            {
               m_towers[i]->addChild( this, itemHolder, vc, E, et );
               context().voteMaxEtAndEnergy( et, E );
               added = true;
               break;
            }
         }
      
         if( !added )
         {
            rVec.fX = ecalR * cos( rPhi ); rVec.fY = ecalR * sin( rPhi );
            lVec.fX = ecalR * cos( lPhi ); lVec.fY = ecalR * sin( lPhi );
            std::vector<TEveVector> bCorners(2);
            bCorners[0] = lVec;
            bCorners[1] = rVec;

            FWPFRhoPhiRecHit *rh = new FWPFRhoPhiRecHit( this, itemHolder, vc, E, et, lPhi, rPhi, bCorners );
            context().voteMaxEtAndEnergy(et, E);
            m_towers.push_back( rh );
         }
      }
   }
}
TEveVector FWPFEcalRecHitRPProxyBuilder::calculateCentre ( const float *  corners) [private]

Definition at line 30 of file FWPFEcalRecHitRPProxyBuilder.cc.

References i, and j.

Referenced by build().

{
   TEveVector centre;
   
   for( unsigned int i = 0; i < 8; i++ )
   {
      int j = i * 3;
      centre.fX += vertices[j];
      centre.fY += vertices[j+1];            // Total x,y,z values
      centre.fZ += vertices[j+2];
   }

   centre *= 1.0f / 8.0f;                  // Actually calculate the centre point

   return centre;
}
void FWPFEcalRecHitRPProxyBuilder::cleanLocal ( ) [virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 19 of file FWPFEcalRecHitRPProxyBuilder.cc.

References i, and m_towers.

{
   typedef std::vector<FWPFRhoPhiRecHit*> rpRecHits;
   for( rpRecHits::iterator i = m_towers.begin(); i != m_towers.end(); ++i )
      (*i)->clean();

   m_towers.clear();
}
virtual bool FWPFEcalRecHitRPProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 47 of file FWPFEcalRecHitRPProxyBuilder.h.

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

Reimplemented from FWProxyBuilderBase.

Definition at line 5 of file FWPFEcalRecHitRPProxyBuilder.cc.

References i, getHLTprescales::index, and m_towers.

{
   typedef std::vector<FWPFRhoPhiRecHit*> rpRecHits;
   unsigned int index = 0;
   
   for( rpRecHits::iterator i = m_towers.begin(); i != m_towers.end(); ++i )
   {
      m_towers[index]->updateScale( vc );
      index++;
   }
}
static std::string FWPFEcalRecHitRPProxyBuilder::typeOfBuilder ( ) [inline, static]

Used by the plugin system to determine how the proxy uses the data from FWEventItem.

Reimplemented from FWProxyBuilderBase.

Definition at line 38 of file FWPFEcalRecHitRPProxyBuilder.h.

{ return "simple#"; }

Member Data Documentation

Definition at line 61 of file FWPFEcalRecHitRPProxyBuilder.h.

Referenced by build(), cleanLocal(), and scaleProduct().