CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

FWJetProxyBuilder Class Reference

Inheritance diagram for FWJetProxyBuilder:
FWSimpleProxyBuilderTemplate< reco::Jet > FWSimpleProxyBuilder FWProxyBuilderBase

List of all members.

Public Member Functions

virtual void cleanLocal ()
 FWJetProxyBuilder ()
virtual bool havePerViewProduct (FWViewType::EType) const
virtual bool haveSingleProduct () const
 REGISTER_PROXYBUILDER_METHODS ()
virtual ~FWJetProxyBuilder ()

Protected Member Functions

virtual void buildViewType (const reco::Jet &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *)
virtual void localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)

Private Member Functions

 FWJetProxyBuilder (const FWJetProxyBuilder &)
const FWJetProxyBuilderoperator= (const FWJetProxyBuilder &)
TEveElementList * requestCommon ()

Private Attributes

TEveElementList * m_common
std::vector
< fireworks::scaleMarker
m_lines

Detailed Description

Definition at line 28 of file FWJetProxyBuilder.cc.


Constructor & Destructor Documentation

FWJetProxyBuilder::FWJetProxyBuilder ( )

Definition at line 60 of file FWJetProxyBuilder.cc.

References m_common.

                                    :
   m_common(0)
{
   m_common = new TEveElementList( "common electron scene" );
   m_common->IncDenyDestroy();
}
FWJetProxyBuilder::~FWJetProxyBuilder ( ) [virtual]

Definition at line 67 of file FWJetProxyBuilder.cc.

References m_common.

{
   m_common->DecDenyDestroy();
}
FWJetProxyBuilder::FWJetProxyBuilder ( const FWJetProxyBuilder ) [private]

Member Function Documentation

void FWJetProxyBuilder::buildViewType ( const reco::Jet iData,
unsigned int  iIndex,
TEveElement &  oItemHolder,
FWViewType::EType  type,
const FWViewContext vc 
) [protected, virtual]

Reimplemented from FWSimpleProxyBuilderTemplate< reco::Jet >.

Definition at line 91 of file FWJetProxyBuilder.cc.

References fireworks::Context::caloR1(), fireworks::Context::caloZ1(), fireworks::Context::caloZ2(), FWDisplayProperties::color(), FWProxyBuilderBase::context(), funct::cos(), FWEventItem::defaultDisplayProperties(), reco::LeafCandidate::energy(), reco::LeafCandidate::et(), FWViewContext::getEnergyScale(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactor3D(), FWViewType::isProjected(), FWProxyBuilderBase::item(), FWViewType::kRhoZ, m_lines, M_PI, siStripFEDMonitor_P5_cff::Min, reco::LeafCandidate::phi(), phi, csvReporter::r, requestCommon(), FWProxyBuilderBase::setupAddElement(), funct::sin(), findQualityFiles::size, funct::tan(), theta(), reco::LeafCandidate::theta(), FWDisplayProperties::transparency(), and fireworks::Context::voteMaxEtAndEnergy().

{
   // add cone from shared pool
   TEveElementList*    cones = requestCommon();
   TEveElement::List_i coneIt = cones->BeginChildren();
   std::advance(coneIt, iIndex);

   const FWDisplayProperties &dp = item()->defaultDisplayProperties();
   setupAddElement( *coneIt, &oItemHolder );
   (*coneIt)->SetMainTransparency(TMath::Min(100, 80 + dp.transparency() / 5)); 

   // scale markers in projected views
   if (FWViewType::isProjected(type))
   {
      TEveScalableStraightLineSet* marker =new TEveScalableStraightLineSet("jet lineset");
      float size = 1.f; // values are saved in scale
      double theta = iData.theta();
      double phi = iData.phi();

      if ( type == FWViewType::kRhoZ )
      {  
         static const float_t offr = 4;
         float r_ecal = context().caloR1() + offr;
         float z_ecal = context().caloZ1() + offr/tan(context().caloTransAngle());

         double r(0);
         if ( theta < context().caloTransAngle() || M_PI-theta < context().caloTransAngle())
         {
            z_ecal = context().caloZ2() + offr/tan(context().caloTransAngle());
            r = z_ecal/fabs(cos(theta));
         }
         else
         {
            r = r_ecal/sin(theta);
         }

         marker->SetScaleCenter( 0., (phi>0 ? r*fabs(sin(theta)) : -r*fabs(sin(theta))), r*cos(theta) );
         marker->AddLine( 0., (phi>0 ? r*fabs(sin(theta)) : -r*fabs(sin(theta))), r*cos(theta),
                          0., (phi>0 ? (r+size)*fabs(sin(theta)) : -(r+size)*fabs(sin(theta))), (r+size)*cos(theta) );
      }
      else
      {
         float ecalR = context().caloR1() + 4;
         marker->SetScaleCenter(ecalR*cos(phi), ecalR*sin(phi), 0);
         marker->AddLine(ecalR*cos(phi), ecalR*sin(phi), 0, (ecalR+size)*cos(phi), (ecalR+size)*sin(phi), 0);
      }

      marker->SetLineWidth(4);  

      marker->SetLineColor(dp.color());

      FWViewEnergyScale* caloScale = vc->getEnergyScale();    
      marker->SetScale(caloScale->getScaleFactor3D()*(caloScale->getPlotEt() ?  iData.et() : iData.energy()));
      setupAddElement( marker, &oItemHolder );
      m_lines.push_back(fireworks::scaleMarker(marker, iData.et(), iData.energy(), vc));

      context().voteMaxEtAndEnergy(iData.et(), iData.energy());
   }
}
void FWJetProxyBuilder::cleanLocal ( ) [virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 159 of file FWJetProxyBuilder.cc.

References m_common, and m_lines.

{
   m_lines.clear();
   m_common->DestroyElements();
}
virtual bool FWJetProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 34 of file FWJetProxyBuilder.cc.

{ return true; }
virtual bool FWJetProxyBuilder::haveSingleProduct ( void  ) const [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 35 of file FWJetProxyBuilder.cc.

{ return false; } // different view types
void FWJetProxyBuilder::localModelChanges ( const FWModelId iId,
TEveElement *  iCompound,
FWViewType::EType  viewType,
const FWViewContext vc 
) [protected, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 152 of file FWJetProxyBuilder.cc.

References FWProxyBuilderBase::increaseComponentTransparency(), and FWModelId::index().

{
   increaseComponentTransparency(iId.index(), iCompound, "TEveJetCone", 80);
}
const FWJetProxyBuilder& FWJetProxyBuilder::operator= ( const FWJetProxyBuilder ) [private]
FWJetProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )
TEveElementList * FWJetProxyBuilder::requestCommon ( ) [private]

Definition at line 73 of file FWJetProxyBuilder.cc.

References FWProxyBuilderBase::context(), funct::false, i, FWProxyBuilderBase::item(), m_common, fireworks::makeEveJetCone(), FWSimpleProxyBuilderTemplate< reco::Jet >::modelData(), and FWEventItem::size().

Referenced by buildViewType().

{
   if( m_common->HasChildren() == false )
   {
      for (int i = 0; i < static_cast<int>(item()->size()); ++i)
      {
         TEveJetCone* cone = fireworks::makeEveJetCone(modelData(i), context());

         m_common->AddElement(cone);
         cone->SetFillColor(item()->defaultDisplayProperties().color());
         cone->SetLineColor(item()->defaultDisplayProperties().color());

      }
   }
   return m_common;
}
void FWJetProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
) [protected, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 166 of file FWJetProxyBuilder.cc.

References FWViewContext::getEnergyScale(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactor3D(), i, m_lines, and relativeConstraints::value.

{ 
   typedef std::vector<fireworks::scaleMarker> Lines_t;  
   for (Lines_t::iterator i = m_lines.begin(); i!= m_lines.end(); ++ i)
   {
      if (vc == (*i).m_vc)
      { 
         float value = vc->getEnergyScale()->getPlotEt() ? (*i).m_et : (*i).m_energy;      
         (*i).m_ls->SetScale(vc->getEnergyScale()->getScaleFactor3D() *value);
         TEveProjected* proj = *(*i).m_ls->BeginProjecteds();
         proj->UpdateProjection();
      }
   }
}

Member Data Documentation

TEveElementList* FWJetProxyBuilder::m_common [private]

Definition at line 56 of file FWJetProxyBuilder.cc.

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