CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWMETProxyBuilder Class Reference

Inheritance diagram for FWMETProxyBuilder:
FWSimpleProxyBuilderTemplate< reco::MET > FWSimpleProxyBuilder FWProxyBuilderBase

List of all members.

Public Member Functions

virtual void cleanLocal ()
 FWMETProxyBuilder ()
virtual bool havePerViewProduct (FWViewType::EType) const
virtual bool haveSingleProduct () const
 REGISTER_PROXYBUILDER_METHODS ()
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
virtual ~FWMETProxyBuilder ()

Private Member Functions

virtual void buildViewType (const reco::MET &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *)
 FWMETProxyBuilder (const FWMETProxyBuilder &)
const FWMETProxyBuilderoperator= (const FWMETProxyBuilder &)

Private Attributes

std::vector
< fireworks::scaleMarker
m_lines

Detailed Description

Definition at line 37 of file FWMETProxyBuilder.cc.


Constructor & Destructor Documentation

FWMETProxyBuilder::FWMETProxyBuilder ( ) [inline]

Definition at line 40 of file FWMETProxyBuilder.cc.

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

Definition at line 41 of file FWMETProxyBuilder.cc.

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

Member Function Documentation

void FWMETProxyBuilder::buildViewType ( const reco::MET iData,
unsigned int  iIndex,
TEveElement &  oItemHolder,
FWViewType::EType  type,
const FWViewContext vc 
) [private, virtual]

Reimplemented from FWSimpleProxyBuilderTemplate< reco::MET >.

Definition at line 89 of file FWMETProxyBuilder.cc.

References fireworks::addRhoZEnergyProjection(), fireworks::Context::caloR1(), fireworks::Context::caloTransEta(), fireworks::Context::caloZ1(), FWProxyBuilderBase::context(), funct::cos(), reco::LeafCandidate::energy(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), FWViewContext::getEnergyScale(), fireworks::getShape(), FWViewType::kRhoZ, m_lines, M_PI, reco::LeafCandidate::phi(), phi, FWProxyBuilderBase::setupAddElement(), funct::sin(), findQualityFiles::size, theta(), reco::LeafCandidate::theta(), and fireworks::Context::voteMaxEtAndEnergy().

{
   using namespace  TMath;
   double phi  = met.phi();
   double theta = met.theta();
   double size = 1.f;

   FWViewEnergyScale* caloScale = vc->getEnergyScale();   
        
   TEveScalableStraightLineSet* marker = new TEveScalableStraightLineSet( "MET marker" );
   marker->SetLineWidth( 2 );

   
  
   if ( type == FWViewType::kRhoZ ) 
   {
      // body 
      double r0;
      if (TMath::Abs(met.eta()) < context().caloTransEta())
      {
         r0  = context().caloR1()/sin(theta);
      }
      else
      {
         r0  = context().caloZ1()/fabs(cos(theta));
      }
      marker->SetScaleCenter( 0., Sign(r0*sin(theta), phi), r0*cos(theta) );
      double r1 = r0 + 1;
      marker->AddLine( 0., Sign(r0*sin(theta), phi), r0*cos(theta),
                       0., Sign(r1*sin(theta), phi), r1*cos(theta) );

      // arrow pointer
      double r2 = r1 - 0.1;
      double dy = 0.05*size;
      marker->AddLine( 0., Sign(r2*sin(theta) + dy*cos(theta), phi), r2*cos(theta) -dy*sin(theta),
                       0., Sign(r1*sin(theta), phi), r1*cos(theta) );
      dy = -dy;
      marker->AddLine( 0., Sign(r2*sin(theta) + dy*cos(theta), phi), r2*cos(theta) -dy*sin(theta),
                       0., Sign(r1*sin(theta), phi), r1*cos(theta) );

      // segment  
      fireworks::addRhoZEnergyProjection( this, &oItemHolder, context().caloR1() -1, context().caloZ1() -1,
                                          theta - 0.04, theta + 0.04,
                                          phi );
   }
   else
   { 
      // body
      double r0 = context().caloR1();
      double r1 = r0 + 1;
      marker->SetScaleCenter( r0*cos(phi), r0*sin(phi), 0 );
      marker->AddLine( r0*cos(phi), r0*sin(phi), 0,
                       r1*cos(phi), r1*sin(phi), 0);
       
      // arrow pointer, xy  rotate offset point ..
      double r2 = r1 - 0.1;
      double dy = 0.05*size;

      marker->AddLine( r2*cos(phi) -dy*sin(phi), r2*sin(phi) + dy*cos(phi), 0,
                       r1*cos(phi), r1*sin(phi), 0);
      dy = -dy;
      marker->AddLine( r2*cos(phi) -dy*sin(phi), r2*sin(phi) + dy*cos(phi), 0,
                       r1*cos(phi), r1*sin(phi), 0);

      // segment
      double min_phi = phi-M_PI/36/2;
      double max_phi = phi+M_PI/36/2;
      TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
      TEveGeoShape *element = fireworks::getShape( "spread", new TGeoTubeSeg( r0 - 2, r0, 1, min_phi*180/M_PI, max_phi*180/M_PI ), 0 );
      element->SetPickable( kTRUE );
      setupAddElement( element, &oItemHolder );
   }

   marker->SetScale(caloScale->getScaleFactor3D()*(caloScale->getPlotEt() ? met.et() : met.energy()));
   setupAddElement( marker, &oItemHolder );

   // printf("add line %s  %f %f .... eta %f theta %f\n", item()->name().c_str(), met.et(), met.energy(), met.eta(), met.theta());
   m_lines.push_back(fireworks::scaleMarker(marker, met.et(), met.energy(), vc));  // register for scales

   context().voteMaxEtAndEnergy(met.et(), met.energy());
}
virtual void FWMETProxyBuilder::cleanLocal ( ) [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 49 of file FWMETProxyBuilder.cc.

References m_lines.

{ m_lines.clear(); }
virtual bool FWMETProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 45 of file FWMETProxyBuilder.cc.

{ return true; } // used energy scaling
virtual bool FWMETProxyBuilder::haveSingleProduct ( void  ) const [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 43 of file FWMETProxyBuilder.cc.

{ return false; } // use buildViewType instead of buildView
const FWMETProxyBuilder& FWMETProxyBuilder::operator= ( const FWMETProxyBuilder ) [private]
FWMETProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )
void FWMETProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
) [virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 64 of file FWMETProxyBuilder.cc.

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

{
   typedef std::vector<fireworks::scaleMarker> Lines_t;
   FWViewEnergyScale* caloScale = vc->getEnergyScale();  

   //   printf("MET %s %p -> %f\n",  item()->name().c_str(),  vc, caloScale->getScaleFactor3D() );
   for (Lines_t::iterator i = m_lines.begin(); i!= m_lines.end(); ++ i)
   {
      if ( vc == (*i).m_vc )
      { 
         // printf("lineset %s  %p val %f ...%f\n", item()->name().c_str(), (*i).m_ls , (*i).m_et, caloScale->getScaleFactor3D()*(*i).m_et);
         float value = caloScale->getPlotEt() ? (*i).m_et : (*i).m_energy;      

         (*i).m_ls->SetScale(caloScale->getScaleFactor3D()*value);

         TEveProjectable *pable = static_cast<TEveProjectable*>((*i).m_ls);
         for (TEveProjectable::ProjList_i j = pable->BeginProjecteds(); j != pable->EndProjecteds(); ++j)
         {
            (*j)->UpdateProjection();
         }
      }
   }
}

Member Data Documentation

Definition at line 60 of file FWMETProxyBuilder.cc.

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