CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWCaloRecHitDigitSetProxyBuilder Class Reference

#include <FWCaloRecHitDigitSetProxyBuilder.h>

Inheritance diagram for FWCaloRecHitDigitSetProxyBuilder:
FWDigitSetProxyBuilder FWProxyBuilderBase FWCastorRecHitProxyBuilder FWEcalRecHitProxyBuilder FWHBHERecHitProxyBuilder FWHFRecHitProxyBuilder FWHORecHitProxyBuilder FWZDCRecHitProxyBuilder

List of all members.

Public Member Functions

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 FWCaloRecHitDigitSetProxyBuilder ()
virtual bool havePerViewProduct (FWViewType::EType) const
virtual void invertBox (bool x)
virtual float scaleFactor (const FWViewContext *vc)
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
virtual void setItem (const FWEventItem *iItem)
virtual void viewContextBoxScale (const float *corners, float scale, bool plotEt, std::vector< float > &scaledCorners, const CaloRecHit *)
virtual ~FWCaloRecHitDigitSetProxyBuilder (void)

Private Member Functions

 FWCaloRecHitDigitSetProxyBuilder (const FWCaloRecHitDigitSetProxyBuilder &)
const
FWCaloRecHitDigitSetProxyBuilder
operator= (const FWCaloRecHitDigitSetProxyBuilder &)

Private Attributes

bool m_ignoreGeoShapeSize
bool m_invertBox
TEveVector m_vector

Detailed Description

Definition at line 9 of file FWCaloRecHitDigitSetProxyBuilder.h.


Constructor & Destructor Documentation

FWCaloRecHitDigitSetProxyBuilder::FWCaloRecHitDigitSetProxyBuilder ( )

Definition at line 13 of file FWCaloRecHitDigitSetProxyBuilder.cc.

   : m_invertBox(false), m_ignoreGeoShapeSize(false) 
{} 
virtual FWCaloRecHitDigitSetProxyBuilder::~FWCaloRecHitDigitSetProxyBuilder ( void  ) [inline, virtual]

Definition at line 13 of file FWCaloRecHitDigitSetProxyBuilder.h.

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

Member Function Documentation

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

Reimplemented from FWProxyBuilderBase.

Definition at line 138 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References FWDigitSetProxyBuilder::addBox(), FWDigitSetProxyBuilder::addBoxSetToProduct(), FWProxyBuilderBase::context(), CaloRecHit::detid(), CaloRecHit::energy(), f, FWGeometry::getCorners(), FWViewContext::getEnergyScale(), fireworks::Context::getGeom(), FWViewEnergyScale::getPlotEt(), i, getHLTprescales::index, FWProxyBuilderBase::item(), m_vector, FWEventItem::modelData(), FWEventItem::modelInfo(), pileupReCalc_HLTpaths::scale, scaleFactor(), findQualityFiles::size, FWEventItem::size(), viewContextBoxScale(), and fireworks::Context::voteMaxEtAndEnergy().

{
   size_t size = iItem->size();
   if (!size) return;

   // m_ignoreGeoShapeSize = item()->getConfig()->value<bool>("IgnoreShapeSize");

   std::vector<float> scaledCorners(24);

   float scale = scaleFactor(vc);

   TEveBoxSet* boxSet = addBoxSetToProduct(product);
   boxSet->SetAntiFlick(kTRUE);
   for (int index = 0; index < static_cast<int>(size); ++index)
   {  
      const CaloRecHit* hit = (const CaloRecHit*)item()->modelData(index);

      const float* corners = context().getGeom()->getCorners(hit->detid());
      if (corners)
      {
         m_vector.Set(0.f, 0.f, 0.f);
         for( unsigned int i = 0; i < 24; i += 3 )
         {       
            m_vector[0] += corners[i];
            m_vector[1] += corners[i + 1];
            m_vector[2] += corners[i + 2];
         }
         m_vector.Normalize();
         context().voteMaxEtAndEnergy( m_vector.Perp() *hit->energy(), hit->energy());
         viewContextBoxScale( corners, hit->energy()*scale, vc->getEnergyScale()->getPlotEt(), scaledCorners, hit);
      }

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

Reimplemented from FWProxyBuilderBase.

Definition at line 17 of file FWCaloRecHitDigitSetProxyBuilder.h.

{ return true; }
virtual void FWCaloRecHitDigitSetProxyBuilder::invertBox ( bool  x) [inline, virtual]
const FWCaloRecHitDigitSetProxyBuilder& FWCaloRecHitDigitSetProxyBuilder::operator= ( const FWCaloRecHitDigitSetProxyBuilder ) [private]
float FWCaloRecHitDigitSetProxyBuilder::scaleFactor ( const FWViewContext vc) [virtual]

Reimplemented in FWCastorRecHitProxyBuilder.

Definition at line 101 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References FWViewContext::getEnergyScale(), and FWViewEnergyScale::getScaleFactor3D().

Referenced by build(), and scaleProduct().

{
   // printf("scale face %f \n", vc->getEnergyScale()->getScaleFactor3D());
     return vc->getEnergyScale()->getScaleFactor3D()/50;
}
void FWCaloRecHitDigitSetProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
) [virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 110 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References b, CaloRecHit::detid(), CaloRecHit::energy(), FWDigitSetProxyBuilder::BFreeBox_t::fVertices, FWGeometry::getCorners(), FWViewContext::getEnergyScale(), FWEventItem::getGeom(), FWViewEnergyScale::getPlotEt(), getHLTprescales::index, FWProxyBuilderBase::item(), FWEventItem::modelData(), pileupReCalc_HLTpaths::scale, scaleFactor(), findQualityFiles::size, FWEventItem::size(), and viewContextBoxScale().

{
   size_t size = item()->size();
   if (!size) return;


   std::vector<float> scaledCorners(24);
   float scale = scaleFactor(vc);

   assert(parent->NumChildren() == 1);
   TEveBoxSet* boxSet = static_cast<TEveBoxSet*>(*parent->BeginChildren());

   for (int index = 0; index < static_cast<int>(size); ++index)
   {
      const CaloRecHit* hit = (const CaloRecHit*)item()->modelData(index);
      const float* corners = item()->getGeom()->getCorners(hit->detid());
      if (corners == 0)  continue;

      FWDigitSetProxyBuilder::BFreeBox_t* b = (FWDigitSetProxyBuilder::BFreeBox_t*)boxSet->GetPlex()->Atom(index);

      viewContextBoxScale(corners, hit->energy()*scale, vc->getEnergyScale()->getPlotEt(), scaledCorners, hit);
      memcpy(b->fVertices, &scaledCorners[0], sizeof(b->fVertices));
   }
   boxSet->ElementChanged();
}
void FWCaloRecHitDigitSetProxyBuilder::setItem ( const FWEventItem iItem) [virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 19 of file FWCaloRecHitDigitSetProxyBuilder.cc.

{
   FWProxyBuilderBase::setItem(iItem);
   // if (iItem) iItem->getConfig()->assertParam( "IgnoreShapeSize", false);
}
void FWCaloRecHitDigitSetProxyBuilder::viewContextBoxScale ( const float *  corners,
float  scale,
bool  plotEt,
std::vector< float > &  scaledCorners,
const CaloRecHit  
) [virtual]

Reimplemented in FWEcalRecHitProxyBuilder.

Definition at line 26 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References f, i, invertBox(), m_ignoreGeoShapeSize, m_invertBox, m_vector, and pileupReCalc_HLTpaths::scale.

Referenced by build(), and scaleProduct().

{
   if ( m_ignoreGeoShapeSize)
   {
      // Same functionality as fireworks::energyTower3DCorners()

      for( int i = 0; i < 24; ++i )
         scaledCorners[i] = corners[i];

      // Coordinates of a front face scaled 
      if( m_invertBox )
      {
         // We know, that an ES rechit geometry in -Z needs correction. 
         // The back face is actually its front face.
         for( unsigned int i = 0; i < 12; i += 3 )
         {
            m_vector.Set( corners[i] - corners[i + 12], corners[i + 1] - corners[i + 13], corners[i + 2] - corners[i + 14] );
            m_vector.Normalize();
            m_vector *= scale;
            
            scaledCorners[i] = corners[i] + m_vector.fX;
            scaledCorners[i + 1] = corners[i + 1] + m_vector.fY;
            scaledCorners[i + 2] = corners[i + 2] + m_vector.fZ;
         }
      } 
      else
      {
         for( unsigned int i = 0; i < 12; i += 3 )
         {
            m_vector.Set( corners[i + 12] - corners[i], corners[i + 13] - corners[i + 1], corners[i + 14] - corners[i + 2] );
            m_vector.Normalize();
            m_vector *= scale;
            
            scaledCorners[i] = corners[i + 12];
            scaledCorners[i + 1] = corners[i + 13];
            scaledCorners[i + 2] = corners[i + 14];
            
            scaledCorners[i + 12] = corners[i + 12] + m_vector.fX;
            scaledCorners[i + 13] = corners[i + 13] + m_vector.fY;
            scaledCorners[i + 14] = corners[i + 14] + m_vector.fZ;
         }
      }
   }
   else {

      // Same functionality as fireworks::energyScaledBox3DCorners().

      m_vector.Set(0.f, 0.f, 0.f);
      for( unsigned int i = 0; i < 24; i += 3 )
      {  
         m_vector[0] += corners[i];
         m_vector[1] += corners[i + 1];
         m_vector[2] += corners[i + 2];
      }
      m_vector *= 1.f/8.f;

      if (plotEt)
      {
         scale *= m_vector.Perp()/m_vector.Mag();
      }

      // Coordinates for a scaled version of the original box
      for( unsigned int i = 0; i < 24; i += 3 )
      { 
         scaledCorners[i] = m_vector[0] + ( corners[i] - m_vector[0] ) * scale;
         scaledCorners[i + 1] = m_vector[1] + ( corners[i + 1] - m_vector[1] ) * scale;
         scaledCorners[i + 2] = m_vector[2] + ( corners[i + 2] - m_vector[2] ) * scale;
      }
      
      if( m_invertBox )
         fireworks::invertBox( scaledCorners );
   }
}

Member Data Documentation

Definition at line 31 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by viewContextBoxScale().

Definition at line 30 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by invertBox(), and viewContextBoxScale().

Definition at line 32 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by build(), and viewContextBoxScale().