CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWCaloTowerDetailView.cc
Go to the documentation of this file.
1 #include "TLatex.h"
2 #include "TEveCalo.h"
3 #include "TEveScene.h"
4 #include "TGLViewer.h"
5 #include "TCanvas.h"
6 #include "TEveCaloLegoOverlay.h"
7 
9 
15 
16 //
17 // constructors and destructor
18 //
20  m_data(0),
21  m_builder(0)
22 {
23 }
24 
26 {
27 }
28 
29 //
30 // member functions
31 //
32 void FWCaloTowerDetailView::build(const FWModelId &id, const CaloTower* iTower)
33 {
34  if(!iTower) return;
35 
36  // build ECAL objects
37  m_builder = new FWECALDetailViewBuilder(id.item()->getEvent(), id.item()->getGeom(),
38  iTower->eta(), iTower->phi(), 25);
40 
41  TEveCaloLego* lego = m_builder->build();
42  m_data = lego->GetData();
43  m_data->IncDenyDestroy();
44  m_eveScene->AddElement(lego);
45 
46  // draw axis at the window corners
47  TEveCaloLegoOverlay* overlay = new TEveCaloLegoOverlay();
48  overlay->SetShowPlane(kFALSE);
49  overlay->SetShowPerspective(kFALSE);
50  overlay->SetCaloLego(lego);
51  overlay->SetShowScales(1); // temporary
52  viewerGL()->AddOverlayElement(overlay);
53 
54  // set event handler and flip camera to top view at beginning
55  viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
56  FWGLEventHandler* eh =
57  new FWGLEventHandler((TGWindow*)viewerGL()->GetGLWidget(), (TObject*)viewerGL(), lego);
58  viewerGL()->SetEventHandler(eh);
59  viewerGL()->UpdateScene();
60  viewerGL()->CurrentCamera().Reset();
61 
62  viewerGL()->RequestDraw(TGLRnrCtx::kLODHigh);
63 
64  setTextInfo(id, iTower);
65 
66 }
67 
68 void
70 {
71  m_infoCanvas->cd();
72  float_t x = 0.02;
73  float y = 0.97;
74  TLatex* latex = new TLatex(x, y, "");
75  const double textsize(0.05);
76  latex->SetTextSize(textsize);
77 
78  float h = latex->GetTextSize()*0.6;
79  latex->DrawLatex(x, y, "ECAL hit detail view centered on tower:" );
80  y -= h;
81  latex->DrawLatex(x, y, Form(" %s",id.item()->modelName(id.index()).c_str()) );
82  y -= h;
83  latex->DrawLatex(x, y, Form(" E_{T}(em) = %.1f GeV, E_{T}(had) = %.1f GeV",
84  tower->emEt(), tower->hadEt()) );
85  y -= h;
86  latex->DrawLatex(x, y, Form(" #eta = %0.2f, #varphi = %0.2f",
87  tower->eta(), tower->phi()) );
88  y -= h;
89  m_builder->makeLegend(x, y);
90 }
91 
FWECALDetailViewBuilder * m_builder
TGLViewer * viewerGL() const
double makeLegend(double x0=0.02, double y0=0.95, Color_t clustered1=kGreen+1, Color_t clustered2=kTeal, Color_t supercluster=kYellow)
double hadEt() const
Definition: CaloTower.h:100
const FWEventItem * item()
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
virtual void build(const FWModelId &id, const CaloTower *)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
void showSuperClusters(Color_t color1=kGreen+2, Color_t color2=kTeal)
#define REGISTER_FWDETAILVIEW(_classname_, _name_)
Definition: DDAxes.h:10
double emEt() const
Definition: CaloTower.h:99
virtual void setTextInfo(const FWModelId &, const CaloTower *)