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 >
virtual void build (const FWModelId &iID, const void *iData)
 
 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 18 of file FWMuonDetailView.h.

Constructor & Destructor Documentation

FWMuonDetailView::FWMuonDetailView ( )

Definition at line 32 of file FWMuonDetailView.cc.

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

Definition at line 38 of file FWMuonDetailView.cc.

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

39 {
40  m_eveViewer->GetGLViewer()->DeleteOverlayElements(TGLOverlayElement::kUser);
41  if (m_data) m_data->DecDenyDestroy();
42  delete m_builder;
43 }
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 145 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(), x, and y.

Referenced by build().

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

References addSceneInfo(), FWECALDetailViewBuilder::build(), reco::Muon::calEnergy(), reco::MuonEnergy::ecal_id, reco::MuonEnergy::ecal_position, eta, reco::LeafCandidate::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().

49 {
50  if(0==iMuon) return;
51 
52  double eta = iMuon->eta();
53  double phi = iMuon->phi();
54  if ( iMuon->isEnergyValid() )
55  {
56  eta = iMuon->calEnergy().ecal_position.eta();
57  phi = iMuon->calEnergy().ecal_position.phi();
58  }
59 
60  m_builder = new FWECALDetailViewBuilder(id.item()->getEvent(), id.item()->getGeom(),
61  eta, phi, 10);
62 
64  if ( iMuon->isEnergyValid() ) {
65  std::vector<DetId> ids;
66  ids.push_back(iMuon->calEnergy().ecal_id);
67  m_builder->setColor(kYellow,ids);
68  }
69 
70  TEveCaloLego* lego = m_builder->build();
71  m_data = lego->GetData();
72  m_data->IncDenyDestroy();
73  m_eveScene->AddElement(lego);
74  addSceneInfo(iMuon, m_eveScene);
75 
76  // draw axis at the window corners
77  TEveCaloLegoOverlay* overlay = new TEveCaloLegoOverlay();
78  overlay->SetShowPlane(kFALSE);
79  overlay->SetShowPerspective(kFALSE);
80  overlay->SetCaloLego(lego);
81  overlay->SetShowScales(0); // temporary
82  viewerGL()->AddOverlayElement(overlay);
83 
84  // set event handler and flip camera to top view at beginning
85  viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
86  FWGLEventHandler* eh =
87  new FWGLEventHandler((TGWindow*)viewerGL()->GetGLWidget(), (TObject*)viewerGL(), lego);
88  viewerGL()->SetEventHandler(eh);
89 
90  viewerGL()->ResetCamerasAfterNextUpdate();
91  viewerGL()->UpdateScene(kFALSE);
92  gEve->Redraw3D();
93 
94  setTextInfo(id, iMuon);
95 }
TEveCaloData * m_data
TGLViewer * viewerGL() const
const FWEventItem * item()
virtual double eta() const
momentum pseudorapidity
void addSceneInfo(const reco::Muon *i, TEveElementList *tList)
FWECALDetailViewBuilder * m_builder
bool isEnergyValid() const
Definition: Muon.h:109
MuonEnergy calEnergy() const
get energy deposition information
Definition: Muon.h:111
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
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 98 of file FWMuonDetailView.cc.

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

Referenced by build().

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

Member Data Documentation

FWECALDetailViewBuilder* FWMuonDetailView::m_builder
private

Definition at line 35 of file FWMuonDetailView.h.

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

TEveCaloData* FWMuonDetailView::m_data
private

Definition at line 34 of file FWMuonDetailView.h.

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