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)
float calculateEt (const TEveVector &centre, float E)
 FWPFEcalRecHitRPProxyBuilder (const FWPFEcalRecHitRPProxyBuilder &)
const
FWPFEcalRecHitRPProxyBuilder
operator= (const FWPFEcalRecHitRPProxyBuilder &)

Private Attributes

FWPFUtilsm_pfUtils
std::vector< FWPFRhoPhiRecHit * > m_towers

Detailed Description

Definition at line 34 of file FWPFEcalRecHitRPProxyBuilder.h.


Constructor & Destructor Documentation

FWPFEcalRecHitRPProxyBuilder::FWPFEcalRecHitRPProxyBuilder ( ) [inline]

Definition at line 40 of file FWPFEcalRecHitRPProxyBuilder.h.

References m_pfUtils.

{ m_pfUtils = new FWPFUtils(); }
virtual FWPFEcalRecHitRPProxyBuilder::~FWPFEcalRecHitRPProxyBuilder ( ) [inline, virtual]

Definition at line 41 of file FWPFEcalRecHitRPProxyBuilder.h.

References m_pfUtils.

{ delete m_pfUtils; }
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 63 of file FWPFEcalRecHitRPProxyBuilder.cc.

References calculateCentre(), calculateEt(), FWProxyBuilderBase::context(), funct::cos(), FWProxyBuilderBase::createCompound(), CaloRecHit::detid(), CaloRecHit::energy(), ExpressReco_HICollisions_FallBack::et, FWPFUtils::getCaloR1(), FWGeometry::getCorners(), FWEventItem::getGeom(), i, getHLTprescales::index, FWProxyBuilderBase::item(), m_pfUtils, m_towers, FWProxyBuilderTemplate< EcalRecHit >::modelData(), phi, funct::sin(), FWEventItem::size(), ExpressReco_HICollisions_FallBack::vertices, 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 );

      bool added = false;
      float E, et;
      float ecalR = m_pfUtils->getCaloR1();
      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 = 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;
}
float FWPFEcalRecHitRPProxyBuilder::calculateEt ( const TEveVector &  centre,
float  E 
) [private]

Definition at line 49 of file FWPFEcalRecHitRPProxyBuilder.cc.

References ExpressReco_HICollisions_FallBack::et.

Referenced by build().

{
   TEveVector vec = centre;
   float et;

   vec.Normalize();
   vec *= E;
   et = vec.Perp();

   return et;
}
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 46 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 37 of file FWPFEcalRecHitRPProxyBuilder.h.

{ return "simple#"; }

Member Data Documentation

Definition at line 61 of file FWPFEcalRecHitRPProxyBuilder.h.

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