CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Types | 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 void setItem (const FWEventItem *iItem)
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 Types

typedef std::vector
< fireworks::jetScaleMarker
Lines_t

Private Member Functions

 FWJetProxyBuilder (const FWJetProxyBuilder &)
const FWJetProxyBuilderoperator= (const FWJetProxyBuilder &)
TEveElementList * requestCommon ()
void setTextPos (fireworks::jetScaleMarker &s, const FWViewContext *vc, FWViewType::EType)

Private Attributes

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

Detailed Description

Definition at line 47 of file FWJetProxyBuilder.cc.


Member Typedef Documentation

typedef std::vector<fireworks::jetScaleMarker> FWJetProxyBuilder::Lines_t [private]

Definition at line 79 of file FWJetProxyBuilder.cc.


Constructor & Destructor Documentation

FWJetProxyBuilder::FWJetProxyBuilder ( )

Definition at line 94 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 101 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 125 of file FWJetProxyBuilder.cc.

References fireworks::Context::caloR1(), fireworks::Context::caloZ1(), fireworks::Context::caloZ2(), create_public_lumi_plots::color, FWDisplayProperties::color(), FWProxyBuilderBase::context(), funct::cos(), FWEventItem::defaultDisplayProperties(), reco::LeafCandidate::energy(), reco::LeafCandidate::et(), FWEventItem::getConfig(), FWViewContext::getEnergyScale(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactor3D(), FWViewType::isProjected(), FWProxyBuilderBase::item(), kJetLabelsRhoPhiOn(), kJetLabelsRhoZOn(), FWViewType::kRhoPhi, FWViewType::kRhoZ, m_lines, fireworks::scaleMarker::m_ls, M_PI, fireworks::jetScaleMarker::m_text, siStripFEDMonitor_P5_cff::Min, reco::LeafCandidate::phi(), phi, alignCSCRings::r, requestCommon(), setTextPos(), FWProxyBuilderBase::setupAddElement(), funct::sin(), findQualityFiles::size, funct::tan(), theta(), reco::LeafCandidate::theta(), FWDisplayProperties::transparency(), FWProxyBuilderConfiguration::value(), 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))
   {
      m_lines.push_back(fireworks::jetScaleMarker(new TEveScalableStraightLineSet("jetline"), iData.et(), iData.energy(), vc));
      fireworks::jetScaleMarker& markers =  m_lines.back();

      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);
         }

         markers.m_ls->SetScaleCenter( 0., (phi>0 ? r*fabs(sin(theta)) : -r*fabs(sin(theta))), r*cos(theta) );
         markers.m_ls->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;
         markers.m_ls->SetScaleCenter(ecalR*cos(phi), ecalR*sin(phi), 0);
         markers.m_ls->AddLine(ecalR*cos(phi), ecalR*sin(phi), 0, (ecalR+size)*cos(phi), (ecalR+size)*sin(phi), 0);
      }

      markers.m_ls->SetLineWidth(4);  
      markers.m_ls->SetLineColor(dp.color());
      FWViewEnergyScale* caloScale = vc->getEnergyScale();    
      markers.m_ls->SetScale(caloScale->getScaleFactor3D()*(caloScale->getPlotEt() ?  iData.et() : iData.energy()));

      if ((type == FWViewType::kRhoZ && item()->getConfig()->value<bool>(kJetLabelsRhoZOn))||
          (type == FWViewType::kRhoPhi && item()->getConfig()->value<bool>(kJetLabelsRhoPhiOn) ) )
      {
         markers.m_text = new FWEveText(Form("%.1f", vc->getEnergyScale()->getPlotEt() ? iData.et() : iData.energy()));
         markers.m_text->SetMainColor( item()->defaultDisplayProperties().color());         
         setTextPos(markers, vc, type);
      }


      markers.m_ls->SetMarkerColor(markers.m_ls->GetMainColor());
      setupAddElement( markers.m_ls, &oItemHolder );
      if (markers.m_text)  setupAddElement( markers.m_text, &oItemHolder , false);

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

Reimplemented from FWProxyBuilderBase.

Definition at line 212 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 53 of file FWJetProxyBuilder.cc.

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

Reimplemented from FWProxyBuilderBase.

Definition at line 54 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 198 of file FWJetProxyBuilder.cc.

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

{
   increaseComponentTransparency(iId.index(), iCompound, "TEveJetCone", 80);

   for (Lines_t::iterator i = m_lines.begin(); i!= m_lines.end(); ++ i)
   {
      TEveStraightLineSetProjected* projLineSet = (TEveStraightLineSetProjected*)(*(*i).m_ls->BeginProjecteds());
      if (projLineSet) projLineSet->UpdateProjection();
   }
}
const FWJetProxyBuilder& FWJetProxyBuilder::operator= ( const FWJetProxyBuilder ) [private]
FWJetProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )
TEveElementList * FWJetProxyBuilder::requestCommon ( ) [private]

Definition at line 107 of file FWJetProxyBuilder.cc.

References create_public_lumi_plots::color, 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 219 of file FWJetProxyBuilder.cc.

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

{ 
   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 );
         if ((*i).m_text) 
         {
            (*i).m_text->SetText(Form("%.1f", value));
            setTextPos(*i, vc, type);
         }
         TEveStraightLineSetProjected* projLineSet = (TEveStraightLineSetProjected*)(*(*i).m_ls->BeginProjecteds());
         projLineSet->UpdateProjection();
      }
   }
}
virtual void FWJetProxyBuilder::setItem ( const FWEventItem iItem) [inline, virtual]
void FWJetProxyBuilder::setTextPos ( fireworks::jetScaleMarker s,
const FWViewContext vc,
FWViewType::EType  type 
) [private]

Definition at line 240 of file FWJetProxyBuilder.cc.

References FWProxyBuilderBase::context(), FWEventItem::getConfig(), FWViewContext::getEnergyScale(), fireworks::Context::getMaxEnergyInEvent(), FWViewEnergyScale::getPlotEt(), FWProxyBuilderBase::item(), kJetOffset(), prof2calltree::l, fireworks::scaleMarker::m_energy, fireworks::scaleMarker::m_et, fireworks::scaleMarker::m_ls, FWEveText::m_offsetZ, fireworks::jetScaleMarker::m_text, FWEveTextProjected::UpdateProjection(), v, FWProxyBuilderConfiguration::value(), relativeConstraints::value, x, detailsBasic3DVector::y, and z.

Referenced by buildViewType(), and scaleProduct().

{   
   TEveChunkManager::iterator li( s.m_ls->GetLinePlex() );
   li.next();
   TEveStraightLineSet::Line_t &l = * ( TEveStraightLineSet::Line_t* ) li();
   TEveVector v(l.fV2[0] - l.fV1[0], l.fV2[1] - l.fV1[1],  l.fV2[2] - l.fV1[2] );
   v.Normalize();


   double off = item()->getConfig()->value<double>(kJetOffset) -1;
   float value = vc->getEnergyScale()->getPlotEt() ? s.m_et : s.m_energy;
   double trs = off * 130 * value/context().getMaxEnergyInEvent(vc->getEnergyScale()->getPlotEt());
   v *= trs;

   float x = l.fV1[0] + v[0];
   float y = l.fV1[1] + v[1];
   float z = l.fV1[2] + v[2];

   s.m_text->m_offsetZ =  value/context().getMaxEnergyInEvent(vc->getEnergyScale()->getPlotEt());
   s.m_text->RefMainTrans().SetPos(x, y, z);
   if ((s.m_text)->BeginProjecteds() != (s.m_text)->EndProjecteds()) {
      FWEveTextProjected* textProjected = (FWEveTextProjected*)(*(s.m_text)->BeginProjecteds());
      textProjected->UpdateProjection();
   }
   
}

Member Data Documentation

TEveElementList* FWJetProxyBuilder::m_common [private]

Definition at line 89 of file FWJetProxyBuilder.cc.

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