CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWMuonDetailView Class Reference

#include <FWMuonDetailView.h>

Inheritance diagram for FWMuonDetailView:
FWDetailViewGL< reco::Muon > FWDetailView< reco::Muon > FWDetailViewBase

List of all members.

Public Member Functions

 FWMuonDetailView ()
virtual ~FWMuonDetailView ()

Private Member Functions

void addSceneInfo (const reco::Muon *i, TEveElementList *tList)
virtual void build (const FWModelId &id, const reco::Muon *)
 FWMuonDetailView (const FWMuonDetailView &)
const FWMuonDetailViewoperator= (const FWMuonDetailView &)
virtual void setTextInfo (const FWModelId &, const reco::Muon *)

Private Attributes

FWECALDetailViewBuilderm_builder
TEveCaloData * m_data

Detailed Description

Definition at line 19 of file FWMuonDetailView.h.


Constructor & Destructor Documentation

FWMuonDetailView::FWMuonDetailView ( )

Definition at line 33 of file FWMuonDetailView.cc.

                                  :
   m_data(0),
   m_builder(0)
{ 
}
FWMuonDetailView::~FWMuonDetailView ( ) [virtual]

Definition at line 39 of file FWMuonDetailView.cc.

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

{
   m_eveViewer->GetGLViewer()->DeleteOverlayElements(TGLOverlayElement::kUser);
   if (m_data) m_data->DecDenyDestroy();
   delete m_builder;
}
FWMuonDetailView::FWMuonDetailView ( const FWMuonDetailView ) [private]

Member Function Documentation

void FWMuonDetailView::addSceneInfo ( const reco::Muon i,
TEveElementList *  tList 
) [private]

Definition at line 146 of file FWMuonDetailView.cc.

References Reference_intrackfit_cff::barrel, reco::Muon::calEnergy(), funct::cos(), delta, reco::LeafCandidate::eta(), reco::Muon::isEnergyValid(), groupFilesInBlocks::lines, reco::LeafCandidate::phi(), funct::sin(), funct::tan(), reco::LeafCandidate::theta(), x, and detailsBasic3DVector::y.

Referenced by build().

{
   // muon direction at vertex

   bool barrel = fabs(i->eta())<1.5;
   if ( i->isEnergyValid() ) barrel = fabs(i->calEnergy().ecal_position.eta()) < 1.5;

   Double_t x(0), y(0);
   Double_t delta(0.01);
   TEveStraightLineSet *direction = new TEveStraightLineSet("Direction at vertex");
   direction->SetPickable(kTRUE);
   direction->SetTitle("Muon direction at vertex");
   direction->SetPickable(kTRUE);
   if (barrel) {
     x = i->eta();
     y = i->phi();
   }else{
     x = 310*fabs(tan(i->theta()))*cos(i->phi());
     y = 310*fabs(tan(i->theta()))*sin(i->phi());
   }
   direction->AddLine(x-delta,y-delta,0,x+delta,y+delta,0);
   direction->AddLine(x-delta,y+delta,0,x+delta,y-delta,0);
   direction->SetLineColor(kYellow);
   direction->SetDepthTest(kFALSE);
   tList->AddElement(direction);

   if (! i->isEnergyValid() ) return;

   // ecal position
   TEveStraightLineSet *ecalposition = new TEveStraightLineSet("ecal position");
   ecalposition->SetPickable(kTRUE);
   ecalposition->SetTitle("Muon position at ECAL surface");
   if ( barrel ) {
      x = i->calEnergy().ecal_position.eta();
      y = i->calEnergy().ecal_position.phi();
   } else {
      x = i->calEnergy().ecal_position.x();
      y = i->calEnergy().ecal_position.y();
   }
   ecalposition->AddLine(x-delta,y,0,x+delta,y,0);
   ecalposition->AddLine(x,y-delta,0,x,y+delta,0);
   ecalposition->AddLine(x,y,0-delta,x,y,0+delta);
   ecalposition->SetLineColor(kRed);
   ecalposition->SetLineWidth(2);
   ecalposition->SetDepthTest(kFALSE);
   tList->AddElement(ecalposition);

   // hcal position
   TEveStraightLineSet *hcalposition = new TEveStraightLineSet("hcal position");
   hcalposition->SetPickable(kTRUE);
   hcalposition->SetTitle("Muon position at HCAL surface");
   if ( barrel ) {
      x = i->calEnergy().hcal_position.eta();
      y = i->calEnergy().hcal_position.phi();
   } else {
      x = i->calEnergy().hcal_position.x();
      y = i->calEnergy().hcal_position.y();
   }
   hcalposition->AddLine(x-delta,y,0,x+delta,y,0);
   hcalposition->AddLine(x,y-delta,0,x,y+delta,0);
   hcalposition->AddLine(x,y,0-delta,x,y,0+delta);
   hcalposition->SetLineColor(kBlue);
   hcalposition->SetLineWidth(2);
   hcalposition->SetDepthTest(kFALSE);
   tList->AddElement(hcalposition);

   // draw a line connecting the two positions
   TEveStraightLineSet *lines = new TEveStraightLineSet("Muon trajectory in ECAL","Muon trajectory in ECAL");
   lines->SetPickable(kTRUE);
   if ( barrel ) {
      lines->AddLine(i->calEnergy().ecal_position.eta(),
                     i->calEnergy().ecal_position.phi(),
                     0,
                     i->calEnergy().hcal_position.eta(),
                     i->calEnergy().hcal_position.phi(),
                     0);
   } else {
      lines->AddLine(i->calEnergy().ecal_position.x(),
                     i->calEnergy().ecal_position.y(),
                     0,
                     i->calEnergy().hcal_position.x(),
                     i->calEnergy().hcal_position.y(),
                     0);
   }
   lines->SetLineColor(kRed);
   lines->SetDepthTest(kFALSE);
   tList->AddElement(lines);
}
void FWMuonDetailView::build ( const FWModelId id,
const reco::Muon iMuon 
) [private, virtual]

Implements FWDetailView< reco::Muon >.

Definition at line 49 of file FWMuonDetailView.cc.

References addSceneInfo(), FWECALDetailViewBuilder::build(), reco::Muon::calEnergy(), eta, reco::LeafCandidate::eta(), reco::Muon::isEnergyValid(), FWDetailViewBase::item(), m_builder, m_data, FWDetailViewGL< reco::Muon >::m_eveScene, reco::LeafCandidate::phi(), phi, FWECALDetailViewBuilder::setColor(), setTextInfo(), FWECALDetailViewBuilder::showSuperClusters(), and FWDetailViewGL< reco::Muon >::viewerGL().

{
   if(0==iMuon) return;

   double eta = iMuon->eta();
   double phi = iMuon->phi();
   if ( iMuon->isEnergyValid() )
   {
      eta = iMuon->calEnergy().ecal_position.eta();
      phi = iMuon->calEnergy().ecal_position.phi();
   }

   m_builder = new FWECALDetailViewBuilder(id.item()->getEvent(), id.item()->getGeom(),
                                           eta, phi, 10);
 
   m_builder->showSuperClusters();
   if ( iMuon->isEnergyValid() ) {
      std::vector<DetId> ids;
      ids.push_back(iMuon->calEnergy().ecal_id);
      m_builder->setColor(kYellow,ids);
   }

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

   // draw axis at the window corners
   TEveCaloLegoOverlay* overlay = new TEveCaloLegoOverlay();
   overlay->SetShowPlane(kFALSE);
   overlay->SetShowPerspective(kFALSE);
   overlay->SetCaloLego(lego);
   overlay->SetShowScales(0); // 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()->ResetCamerasAfterNextUpdate();
   viewerGL()->UpdateScene(kFALSE);
   gEve->Redraw3D();

   setTextInfo(id, iMuon);
}
const FWMuonDetailView& FWMuonDetailView::operator= ( const FWMuonDetailView ) [private]
void FWMuonDetailView::setTextInfo ( const FWModelId id,
const reco::Muon muon 
) [private, virtual]

Implements FWDetailView< reco::Muon >.

Definition at line 99 of file FWMuonDetailView.cc.

References reco::Muon::calEnergy(), reco::LeafCandidate::charge(), reco::LeafCandidate::eta(), getHLTprescales::index, reco::Muon::isEnergyValid(), FWDetailViewBase::item(), m_builder, FWDetailViewGL< reco::Muon >::m_infoCanvas, FWECALDetailViewBuilder::makeLegend(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), x, and detailsBasic3DVector::y.

Referenced by build().

{
   m_infoCanvas->cd();
   double y0 = 0.95;
   double x0 = 0.02; 

   TLatex* latex = new TLatex(x0, y0, "");
   const double textsize(0.05);
   latex->SetTextSize(2*textsize);

   float_t x = x0;
   float   y = y0;
   float fontsize = latex->GetTextSize()*0.6;

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

   latex->DrawLatex(x, y, Form(" p_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
                               muon->pt(), muon->eta(), muon->phi()) );
   y -= fontsize;
   // summary
   if (muon->charge() > 0)
      latex->DrawLatex(x, y, " charge = +1");
   else
      latex->DrawLatex(x, y, " charge = -1");
   y -= fontsize;

   if (muon->isEnergyValid() )
   {
      // delta phi/eta in
      latex->DrawLatex(x, y, "ECAL energy in:");
      y -= fontsize;
      latex->DrawLatex(x, y,  Form(" crossed crystalls = %.3f",
                                   muon->calEnergy().em) );
      y -= fontsize;
      latex->DrawLatex(x, y,  Form(" 3x3 crystall shape = %.3f",
                                   muon->calEnergy().emS9) );
      y -= fontsize;
      latex->DrawLatex(x, y,  Form(" 5x5 crystall shape = %.3f",
                                   muon->calEnergy().emS25) );
   }
   m_builder->makeLegend(0.02, y);
}

Member Data Documentation

Definition at line 36 of file FWMuonDetailView.h.

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

TEveCaloData* FWMuonDetailView::m_data [private]

Definition at line 35 of file FWMuonDetailView.h.

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