CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Member Functions

 FWMuonDetailView ()
 
virtual ~FWMuonDetailView ()
 
- Public Member Functions inherited from FWDetailViewGL< reco::Muon >
 FWDetailViewGL ()
 
virtual void init (TEveWindowSlot *)
 
virtual void setBackgroundColor (Color_t)
 
TGLViewer * viewerGL () const
 
virtual ~FWDetailViewGL ()
 
- Public Member Functions inherited from FWDetailView< reco::Muon >
 FWDetailView ()
 
- Public Member Functions inherited from FWDetailViewBase
void build (const FWModelId &)
 
const fireworks::Contextcontext () const
 
const FWEventItemitem ()
 
void setItem (const FWEventItem *x)
 
virtual ~FWDetailViewBase ()
 

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
 

Additional Inherited Members

- Static Public Member Functions inherited from FWDetailView< reco::Muon >
static std::string classRegisterTypeName ()
 
static std::string classTypeName ()
 
- Static Public Member Functions inherited from FWDetailViewBase
static void drawCanvasBox (Double_t *pos, Color_t fillCol, Int_t fillType=0, bool bg=kTRUE)
 
static void drawCanvasDot (Float_t x, Float_t y, Float_t r, Color_t)
 
- Protected Member Functions inherited from FWDetailViewBase
 FWDetailViewBase (const std::type_info &)
 
- Protected Attributes inherited from FWDetailViewGL< reco::Muon >
TEveScene * m_eveScene
 
TEveViewer * m_eveViewer
 
TGCompositeFrame * m_guiFrame
 
TCanvas * m_infoCanvas
 

Detailed Description

Definition at line 19 of file FWMuonDetailView.h.

Constructor & Destructor Documentation

FWMuonDetailView::FWMuonDetailView ( )

Definition at line 33 of file FWMuonDetailView.cc.

33  :
34  m_data(0),
35  m_builder(0)
36 {
37 }
TEveCaloData * m_data
FWECALDetailViewBuilder * m_builder
FWMuonDetailView::~FWMuonDetailView ( )
virtual

Definition at line 39 of file FWMuonDetailView.cc.

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

40 {
41  m_eveViewer->GetGLViewer()->DeleteOverlayElements(TGLOverlayElement::kUser);
42  if (m_data) m_data->DecDenyDestroy();
43  delete m_builder;
44 }
TEveCaloData * m_data
FWECALDetailViewBuilder * 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::MuonEnergy::ecal_position, reco::LeafCandidate::eta(), reco::MuonEnergy::hcal_position, reco::Muon::isEnergyValid(), groupFilesInBlocks::lines, reco::LeafCandidate::phi(), funct::sin(), funct::tan(), reco::LeafCandidate::theta(), vdt::x, and detailsBasic3DVector::y.

Referenced by build().

147 {
148  // muon direction at vertex
149 
150  bool barrel = fabs(i->eta())<1.5;
151  if ( i->isEnergyValid() ) barrel = fabs(i->calEnergy().ecal_position.eta()) < 1.5;
152 
153  Double_t x(0), y(0);
154  Double_t delta(0.01);
155  TEveStraightLineSet *direction = new TEveStraightLineSet("Direction at vertex");
156  direction->SetPickable(kTRUE);
157  direction->SetTitle("Muon direction at vertex");
158  direction->SetPickable(kTRUE);
159  if (barrel) {
160  x = i->eta();
161  y = i->phi();
162  }else{
163  x = 310*fabs(tan(i->theta()))*cos(i->phi());
164  y = 310*fabs(tan(i->theta()))*sin(i->phi());
165  }
166  direction->AddLine(x-delta,y-delta,0,x+delta,y+delta,0);
167  direction->AddLine(x-delta,y+delta,0,x+delta,y-delta,0);
168  direction->SetLineColor(kYellow);
169  direction->SetDepthTest(kFALSE);
170  tList->AddElement(direction);
171 
172  if (! i->isEnergyValid() ) return;
173 
174  // ecal position
175  TEveStraightLineSet *ecalposition = new TEveStraightLineSet("ecal position");
176  ecalposition->SetPickable(kTRUE);
177  ecalposition->SetTitle("Muon position at ECAL surface");
178  if ( barrel ) {
179  x = i->calEnergy().ecal_position.eta();
180  y = i->calEnergy().ecal_position.phi();
181  } else {
182  x = i->calEnergy().ecal_position.x();
183  y = i->calEnergy().ecal_position.y();
184  }
185  ecalposition->AddLine(x-delta,y,0,x+delta,y,0);
186  ecalposition->AddLine(x,y-delta,0,x,y+delta,0);
187  ecalposition->AddLine(x,y,0-delta,x,y,0+delta);
188  ecalposition->SetLineColor(kRed);
189  ecalposition->SetLineWidth(2);
190  ecalposition->SetDepthTest(kFALSE);
191  tList->AddElement(ecalposition);
192 
193  // hcal position
194  TEveStraightLineSet *hcalposition = new TEveStraightLineSet("hcal position");
195  hcalposition->SetPickable(kTRUE);
196  hcalposition->SetTitle("Muon position at HCAL surface");
197  if ( barrel ) {
198  x = i->calEnergy().hcal_position.eta();
199  y = i->calEnergy().hcal_position.phi();
200  } else {
201  x = i->calEnergy().hcal_position.x();
202  y = i->calEnergy().hcal_position.y();
203  }
204  hcalposition->AddLine(x-delta,y,0,x+delta,y,0);
205  hcalposition->AddLine(x,y-delta,0,x,y+delta,0);
206  hcalposition->AddLine(x,y,0-delta,x,y,0+delta);
207  hcalposition->SetLineColor(kBlue);
208  hcalposition->SetLineWidth(2);
209  hcalposition->SetDepthTest(kFALSE);
210  tList->AddElement(hcalposition);
211 
212  // draw a line connecting the two positions
213  TEveStraightLineSet *lines = new TEveStraightLineSet("Muon trajectory in ECAL","Muon trajectory in ECAL");
214  lines->SetPickable(kTRUE);
215  if ( barrel ) {
216  lines->AddLine(i->calEnergy().ecal_position.eta(),
217  i->calEnergy().ecal_position.phi(),
218  0,
219  i->calEnergy().hcal_position.eta(),
220  i->calEnergy().hcal_position.phi(),
221  0);
222  } else {
223  lines->AddLine(i->calEnergy().ecal_position.x(),
224  i->calEnergy().ecal_position.y(),
225  0,
226  i->calEnergy().hcal_position.x(),
227  i->calEnergy().hcal_position.y(),
228  0);
229  }
230  lines->SetLineColor(kRed);
231  lines->SetDepthTest(kFALSE);
232  tList->AddElement(lines);
233 }
dbl * delta
Definition: mlp_gen.cc:36
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual double eta() const
momentum pseudorapidity
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
math::XYZPointF hcal_position
Definition: MuonEnergy.h:44
bool isEnergyValid() const
Definition: Muon.h:110
virtual double theta() const
momentum polar angle
MuonEnergy calEnergy() const
get energy deposition information
Definition: Muon.h:112
x
Definition: VDTMath.h:216
math::XYZPointF ecal_position
Trajectory position at the calorimeter.
Definition: MuonEnergy.h:43
virtual double phi() const
momentum azimuthal angle
void FWMuonDetailView::build ( const FWModelId id,
const reco::Muon iMuon 
)
privatevirtual

Implements FWDetailView< reco::Muon >.

Definition at line 49 of file FWMuonDetailView.cc.

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

50 {
51  if(0==iMuon) return;
52 
53  double eta = iMuon->eta();
54  double phi = iMuon->phi();
55  if ( iMuon->isEnergyValid() )
56  {
57  eta = iMuon->calEnergy().ecal_position.eta();
58  phi = iMuon->calEnergy().ecal_position.phi();
59  }
60 
61  m_builder = new FWECALDetailViewBuilder(id.item()->getEvent(), id.item()->getGeom(),
62  eta, phi, 10);
63 
65  if ( iMuon->isEnergyValid() ) {
66  std::vector<DetId> ids;
67  ids.push_back(iMuon->calEnergy().ecal_id);
68  m_builder->setColor(kYellow,ids);
69  }
70 
71  TEveCaloLego* lego = m_builder->build();
72  m_data = lego->GetData();
73  m_data->IncDenyDestroy();
74  m_eveScene->AddElement(lego);
75  addSceneInfo(iMuon, m_eveScene);
76 
77  // draw axis at the window corners
78  TEveCaloLegoOverlay* overlay = new TEveCaloLegoOverlay();
79  overlay->SetShowPlane(kFALSE);
80  overlay->SetShowPerspective(kFALSE);
81  overlay->SetCaloLego(lego);
82  overlay->SetShowScales(0); // temporary
83  viewerGL()->AddOverlayElement(overlay);
84 
85  // set event handler and flip camera to top view at beginning
86  viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
87  FWGLEventHandler* eh =
88  new FWGLEventHandler((TGWindow*)viewerGL()->GetGLWidget(), (TObject*)viewerGL(), lego);
89  viewerGL()->SetEventHandler(eh);
90 
91  viewerGL()->ResetCamerasAfterNextUpdate();
92  viewerGL()->UpdateScene(kFALSE);
93  gEve->Redraw3D();
94 
95  setTextInfo(id, iMuon);
96 }
TEveCaloData * m_data
TGLViewer * viewerGL() const
const FWEventItem * item()
T eta() const
virtual double eta() const
momentum pseudorapidity
void addSceneInfo(const reco::Muon *i, TEveElementList *tList)
FWECALDetailViewBuilder * m_builder
bool isEnergyValid() const
Definition: Muon.h:110
MuonEnergy calEnergy() const
get energy deposition information
Definition: Muon.h:112
void showSuperClusters(Color_t color1=kGreen+2, Color_t color2=kTeal)
virtual void setTextInfo(const FWModelId &, const reco::Muon *)
void setColor(Color_t color, const std::vector< DetId > &detIds)
DetId ecal_id
DetId of the central ECAL crystal.
Definition: MuonEnergy.h:47
math::XYZPointF ecal_position
Trajectory position at the calorimeter.
Definition: MuonEnergy.h:43
virtual double phi() const
momentum azimuthal angle
Definition: DDAxes.h:10
const FWMuonDetailView& FWMuonDetailView::operator= ( const FWMuonDetailView )
private
void FWMuonDetailView::setTextInfo ( const FWModelId id,
const reco::Muon muon 
)
privatevirtual

Implements FWDetailView< reco::Muon >.

Definition at line 99 of file FWMuonDetailView.cc.

References reco::Muon::calEnergy(), reco::LeafCandidate::charge(), reco::MuonEnergy::em, reco::MuonEnergy::emS25, reco::MuonEnergy::emS9, 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(), vdt::x, and detailsBasic3DVector::y.

Referenced by build().

100 {
101  m_infoCanvas->cd();
102  double y0 = 0.95;
103  double x0 = 0.02;
104 
105  TLatex* latex = new TLatex(x0, y0, "");
106  const double textsize(0.05);
107  latex->SetTextSize(2*textsize);
108 
109  float_t x = x0;
110  float y = y0;
111  float fontsize = latex->GetTextSize()*0.6;
112 
113  latex->DrawLatex(x, y, id.item()->modelName(id.index()).c_str() );
114  y -= fontsize;
115  latex->SetTextSize(textsize);
116  fontsize = latex->GetTextSize()*0.6;
117 
118  latex->DrawLatex(x, y, Form(" p_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
119  muon->pt(), muon->eta(), muon->phi()) );
120  y -= fontsize;
121  // summary
122  if (muon->charge() > 0)
123  latex->DrawLatex(x, y, " charge = +1");
124  else
125  latex->DrawLatex(x, y, " charge = -1");
126  y -= fontsize;
127 
128  if (muon->isEnergyValid() )
129  {
130  // delta phi/eta in
131  latex->DrawLatex(x, y, "ECAL energy in:");
132  y -= fontsize;
133  latex->DrawLatex(x, y, Form(" crossed crystalls = %.3f",
134  muon->calEnergy().em) );
135  y -= fontsize;
136  latex->DrawLatex(x, y, Form(" 3x3 crystall shape = %.3f",
137  muon->calEnergy().emS9) );
138  y -= fontsize;
139  latex->DrawLatex(x, y, Form(" 5x5 crystall shape = %.3f",
140  muon->calEnergy().emS25) );
141  }
142  m_builder->makeLegend(0.02, y);
143 }
double makeLegend(double x0=0.02, double y0=0.95, Color_t clustered1=kGreen+1, Color_t clustered2=kTeal, Color_t supercluster=kYellow)
const FWEventItem * item()
float emS9
energy deposited in 3x3 ECAL crystal shape around central crystal
Definition: MuonEnergy.h:18
virtual double eta() const
momentum pseudorapidity
float emS25
energy deposited in 5x5 ECAL crystal shape around central crystal
Definition: MuonEnergy.h:20
virtual int charge() const
electric charge
FWECALDetailViewBuilder * m_builder
bool isEnergyValid() const
Definition: Muon.h:110
MuonEnergy calEnergy() const
get energy deposition information
Definition: Muon.h:112
virtual double pt() const
transverse momentum
x
Definition: VDTMath.h:216
virtual double phi() const
momentum azimuthal angle

Member Data Documentation

FWECALDetailViewBuilder* FWMuonDetailView::m_builder
private

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().