CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWPhotonDetailView Class Reference

#include <FWPhotonDetailView.h>

Inheritance diagram for FWPhotonDetailView:
FWDetailViewGL< reco::Photon > FWDetailView< reco::Photon > FWDetailViewBase

List of all members.

Public Member Functions

virtual void build (const FWModelId &id, const reco::Photon *)
 FWPhotonDetailView ()
virtual void setTextInfo (const FWModelId &id, const reco::Photon *)
virtual ~FWPhotonDetailView ()

Private Member Functions

void addSceneInfo (const reco::Photon *, TEveElementList *)
 FWPhotonDetailView (const FWPhotonDetailView &)
const FWPhotonDetailViewoperator= (const FWPhotonDetailView &)

Private Attributes

FWECALDetailViewBuilderm_builder
TEveCaloData * m_data

Detailed Description

Definition at line 24 of file FWPhotonDetailView.h.


Constructor & Destructor Documentation

FWPhotonDetailView::FWPhotonDetailView ( )

Definition at line 27 of file FWPhotonDetailView.cc.

                                      :
m_builder(0)
{
}
FWPhotonDetailView::~FWPhotonDetailView ( ) [virtual]

Definition at line 32 of file FWPhotonDetailView.cc.

References m_builder, m_data, and FWDetailViewGL< reco::Photon >::m_eveViewer.

{
   m_eveViewer->GetGLViewer()->DeleteOverlayElements(TGLOverlayElement::kUser);

   if (m_data) m_data->DecDenyDestroy();
   delete m_builder;
}
FWPhotonDetailView::FWPhotonDetailView ( const FWPhotonDetailView ) [private]

Member Function Documentation

void FWPhotonDetailView::addSceneInfo ( const reco::Photon i,
TEveElementList *  tList 
) [private]

Definition at line 110 of file FWPhotonDetailView.cc.

References reco::Photon::caloPosition(), EcalBarrel, EcalEndcap, reco::Photon::superCluster(), ExpressReco_HICollisions_FallBack::x, ExpressReco_HICollisions_FallBack::y, and z.

Referenced by build().

{
   unsigned int subdetId(0);
   if ( !i->superCluster()->seed()->hitsAndFractions().empty() )
      subdetId = i->superCluster()->seed()->hitsAndFractions().front().first.subdetId();

   // points for centroids
   Double_t x(0), y(0), z(0);
   TEvePointSet *scposition = new TEvePointSet("sc position");
   scposition->SetPickable(kTRUE);
   scposition->SetTitle("Super cluster centroid");
   if (subdetId == EcalBarrel) {
      x = i->caloPosition().eta();
      y = i->caloPosition().phi();
   } else if (subdetId == EcalEndcap) {
      x = i->caloPosition().x();
      y = i->caloPosition().y();
   }
   scposition->SetNextPoint(x,y,z);
   scposition->SetMarkerSize(1);
   scposition->SetMarkerStyle(4);
   scposition->SetMarkerColor(kBlue);
   tList->AddElement(scposition);

   // points for seed position
   TEvePointSet *seedposition = new TEvePointSet("seed position");
   seedposition->SetTitle("Seed cluster centroid");
   seedposition->SetPickable(kTRUE);
   if (subdetId == EcalBarrel) {
      x  = i->superCluster()->seed()->position().eta();
      y  = i->superCluster()->seed()->position().phi();
      seedposition->SetMarkerSize(0.01);
   } else if (subdetId == EcalEndcap) {
      x  = i->superCluster()->seed()->position().x();
      y  = i->superCluster()->seed()->position().y();
      seedposition->SetMarkerSize(1);
   }
   seedposition->SetNextPoint(x, y, z);
   seedposition->SetMarkerStyle(2);
   seedposition->SetMarkerColor(kRed);
   tList->AddElement(seedposition);
}
void FWPhotonDetailView::build ( const FWModelId id,
const reco::Photon iPhoton 
) [virtual]

Implements FWDetailView< reco::Photon >.

Definition at line 43 of file FWPhotonDetailView.cc.

References addSceneInfo(), FWECALDetailViewBuilder::build(), reco::Photon::caloPosition(), edm::Ref< C, T, F >::isAvailable(), FWDetailViewBase::item(), m_builder, m_data, FWDetailViewGL< reco::Photon >::m_eveScene, setTextInfo(), FWECALDetailViewBuilder::showSuperCluster(), FWECALDetailViewBuilder::showSuperClusters(), reco::Photon::superCluster(), and FWDetailViewGL< reco::Photon >::viewerGL().

{
   if(!iPhoton) return;

   // build ECAL objects
   m_builder = new FWECALDetailViewBuilder(id.item()->getEvent(), id.item()->getGeom(),
                                   iPhoton->caloPosition().eta(), iPhoton->caloPosition().phi(), 25);
   m_builder->showSuperClusters();

   if ( iPhoton->superCluster().isAvailable() )
      m_builder->showSuperCluster(*(iPhoton->superCluster()), kYellow);

   TEveCaloLego* lego = m_builder->build();
   m_data = lego->GetData();
   m_data->IncDenyDestroy();
   m_eveScene->AddElement(lego);

   // add Photon specific details
   if( iPhoton->superCluster().isAvailable() ) 
      addSceneInfo(iPhoton, m_eveScene);

   // draw axis at the window corners
   TEveCaloLegoOverlay* overlay = new TEveCaloLegoOverlay();
   overlay->SetShowPlane(kFALSE);
   overlay->SetShowPerspective(kFALSE);
   overlay->SetCaloLego(lego);
   overlay->SetShowScales(1); // temporary
   viewerGL()->AddOverlayElement(overlay);

   // set event handler and flip camera to top view at beginning
   viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
   FWGLEventHandler* eh =
      new FWGLEventHandler((TGWindow*)viewerGL()->GetGLWidget(), (TObject*)viewerGL(), lego);
   viewerGL()->SetEventHandler(eh);
   viewerGL()->UpdateScene();
   viewerGL()->CurrentCamera().Reset();

   viewerGL()->RequestDraw(TGLRnrCtx::kLODHigh);

   setTextInfo(id, iPhoton);
}
const FWPhotonDetailView& FWPhotonDetailView::operator= ( const FWPhotonDetailView ) [private]
void FWPhotonDetailView::setTextInfo ( const FWModelId id,
const reco::Photon photon 
) [virtual]

Implements FWDetailView< reco::Photon >.

Definition at line 88 of file FWPhotonDetailView.cc.

References reco::LeafCandidate::et(), reco::LeafCandidate::eta(), h, getHLTprescales::index, FWDetailViewBase::item(), m_builder, FWDetailViewGL< reco::Photon >::m_infoCanvas, FWECALDetailViewBuilder::makeLegend(), reco::LeafCandidate::phi(), ExpressReco_HICollisions_FallBack::x, and ExpressReco_HICollisions_FallBack::y.

Referenced by build().

{
   m_infoCanvas->cd();
   float_t x = 0.02;
   float y = 0.97;
   TLatex* latex = new TLatex(x, y, "");
   const double textsize(0.05);
   latex->SetTextSize(2*textsize);

   float h = latex->GetTextSize()*0.6;
   latex->DrawLatex(x, y, id.item()->modelName(id.index()).c_str() );
   y -= h;

   latex->DrawLatex(x, y, Form(" E_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
                               photon->et(), photon->eta(), photon->phi()) );
   y -= h;
   m_builder->makeLegend(x, y);
}

Member Data Documentation

Definition at line 40 of file FWPhotonDetailView.h.

Referenced by build(), setTextInfo(), and ~FWPhotonDetailView().

TEveCaloData* FWPhotonDetailView::m_data [private]

Definition at line 39 of file FWPhotonDetailView.h.

Referenced by build(), and ~FWPhotonDetailView().