CMS 3D CMS Logo

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 ()
 
 ~FWMuonDetailView () override
 
- Public Member Functions inherited from FWDetailViewGL< reco::Muon >
 FWDetailViewGL ()
 
void init (TEveWindowSlot *) override
 
void setBackgroundColor (Color_t) override
 
TGLViewer * viewerGL () const
 
 ~FWDetailViewGL () override
 
- Public Member Functions inherited from FWDetailView< reco::Muon >
void build (const FWModelId &iID, const void *iData) override
 
 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)
 
void build (const FWModelId &id, const reco::Muon *) override
 
 FWMuonDetailView (const FWMuonDetailView &)=delete
 
const FWMuonDetailViewoperator= (const FWMuonDetailView &)=delete
 
void setTextInfo (const FWModelId &, const reco::Muon *) override
 

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() [1/2]

FWMuonDetailView::FWMuonDetailView ( )

Definition at line 32 of file FWMuonDetailView.cc.

32 : m_data(nullptr), m_builder(nullptr) {}

◆ ~FWMuonDetailView()

FWMuonDetailView::~FWMuonDetailView ( )
override

Definition at line 34 of file FWMuonDetailView.cc.

34  {
35  m_eveViewer->GetGLViewer()->DeleteOverlayElements(TGLOverlayElement::kUser);
36  if (m_data)
37  m_data->DecDenyDestroy();
38  delete m_builder;
39 }

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

◆ FWMuonDetailView() [2/2]

FWMuonDetailView::FWMuonDetailView ( const FWMuonDetailView )
privatedelete

Member Function Documentation

◆ addSceneInfo()

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

Definition at line 131 of file FWMuonDetailView.cc.

131  {
132  // muon direction at vertex
133 
134  bool barrel = fabs(i->eta()) < 1.5;
135  if (i->isEnergyValid())
136  barrel = fabs(i->calEnergy().ecal_position.eta()) < 1.5;
137 
138  Double_t x(0), y(0);
139  Double_t delta(0.01);
140  TEveStraightLineSet* direction = new TEveStraightLineSet("Direction at vertex");
141  direction->SetPickable(kTRUE);
142  direction->SetTitle("Muon direction at vertex");
143  direction->SetPickable(kTRUE);
144  if (barrel) {
145  x = i->eta();
146  y = i->phi();
147  } else {
148  x = 310 * fabs(tan(i->theta())) * cos(i->phi());
149  y = 310 * fabs(tan(i->theta())) * sin(i->phi());
150  }
151  direction->AddLine(x - delta, y - delta, 0, x + delta, y + delta, 0);
152  direction->AddLine(x - delta, y + delta, 0, x + delta, y - delta, 0);
153  direction->SetLineColor(kYellow);
154  direction->SetDepthTest(kFALSE);
155  tList->AddElement(direction);
156 
157  if (!i->isEnergyValid())
158  return;
159 
160  // ecal position
161  TEveStraightLineSet* ecalposition = new TEveStraightLineSet("ecal position");
162  ecalposition->SetPickable(kTRUE);
163  ecalposition->SetTitle("Muon position at ECAL surface");
164  if (barrel) {
165  x = i->calEnergy().ecal_position.eta();
166  y = i->calEnergy().ecal_position.phi();
167  } else {
168  x = i->calEnergy().ecal_position.x();
169  y = i->calEnergy().ecal_position.y();
170  }
171  ecalposition->AddLine(x - delta, y, 0, x + delta, y, 0);
172  ecalposition->AddLine(x, y - delta, 0, x, y + delta, 0);
173  ecalposition->AddLine(x, y, 0 - delta, x, y, 0 + delta);
174  ecalposition->SetLineColor(kRed);
175  ecalposition->SetLineWidth(2);
176  ecalposition->SetDepthTest(kFALSE);
177  tList->AddElement(ecalposition);
178 
179  // hcal position
180  TEveStraightLineSet* hcalposition = new TEveStraightLineSet("hcal position");
181  hcalposition->SetPickable(kTRUE);
182  hcalposition->SetTitle("Muon position at HCAL surface");
183  if (barrel) {
184  x = i->calEnergy().hcal_position.eta();
185  y = i->calEnergy().hcal_position.phi();
186  } else {
187  x = i->calEnergy().hcal_position.x();
188  y = i->calEnergy().hcal_position.y();
189  }
190  hcalposition->AddLine(x - delta, y, 0, x + delta, y, 0);
191  hcalposition->AddLine(x, y - delta, 0, x, y + delta, 0);
192  hcalposition->AddLine(x, y, 0 - delta, x, y, 0 + delta);
193  hcalposition->SetLineColor(kBlue);
194  hcalposition->SetLineWidth(2);
195  hcalposition->SetDepthTest(kFALSE);
196  tList->AddElement(hcalposition);
197 
198  // draw a line connecting the two positions
199  TEveStraightLineSet* lines = new TEveStraightLineSet("Muon trajectory in ECAL", "Muon trajectory in ECAL");
200  lines->SetPickable(kTRUE);
201  if (barrel) {
202  lines->AddLine(i->calEnergy().ecal_position.eta(),
203  i->calEnergy().ecal_position.phi(),
204  0,
205  i->calEnergy().hcal_position.eta(),
206  i->calEnergy().hcal_position.phi(),
207  0);
208  } else {
209  lines->AddLine(i->calEnergy().ecal_position.x(),
210  i->calEnergy().ecal_position.y(),
211  0,
212  i->calEnergy().hcal_position.x(),
213  i->calEnergy().hcal_position.y(),
214  0);
215  }
216  lines->SetLineColor(kRed);
217  lines->SetDepthTest(kFALSE);
218  tList->AddElement(lines);
219 }

References Reference_intrackfit_cff::barrel, funct::cos(), dumpMFGeometry_cfg::delta, mps_fire::i, groupFilesInBlocks::lines, funct::sin(), funct::tan(), x, and y.

Referenced by build().

◆ build()

void FWMuonDetailView::build ( const FWModelId id,
const reco::Muon iMuon 
)
overrideprivatevirtual

Implements FWDetailView< reco::Muon >.

Definition at line 44 of file FWMuonDetailView.cc.

44  {
45  if (nullptr == iMuon)
46  return;
47 
48  double eta = iMuon->eta();
49  double phi = iMuon->phi();
50  if (iMuon->isEnergyValid()) {
51  eta = iMuon->calEnergy().ecal_position.eta();
52  phi = iMuon->calEnergy().ecal_position.phi();
53  }
54 
55  m_builder = new FWECALDetailViewBuilder(id.item()->getEvent(), id.item()->getGeom(), eta, phi, 10);
56 
58  if (iMuon->isEnergyValid()) {
59  std::vector<DetId> ids;
60  ids.push_back(iMuon->calEnergy().ecal_id);
61  m_builder->setColor(kYellow, ids);
62  }
63 
64  TEveCaloLego* lego = m_builder->build();
65  m_data = lego->GetData();
66  m_data->IncDenyDestroy();
67  m_eveScene->AddElement(lego);
68  addSceneInfo(iMuon, m_eveScene);
69 
70  // draw axis at the window corners
71  TEveCaloLegoOverlay* overlay = new TEveCaloLegoOverlay();
72  overlay->SetShowPlane(kFALSE);
73  overlay->SetShowPerspective(kFALSE);
74  overlay->SetCaloLego(lego);
75  overlay->SetShowScales(false); // temporary
76  viewerGL()->AddOverlayElement(overlay);
77 
78  // set event handler and flip camera to top view at beginning
79  viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
80  FWGLEventHandler* eh = new FWGLEventHandler((TGWindow*)viewerGL()->GetGLWidget(), (TObject*)viewerGL(), lego);
81  viewerGL()->SetEventHandler(eh);
82 
83  viewerGL()->ResetCamerasAfterNextUpdate();
84  viewerGL()->UpdateScene(kFALSE);
85  gEve->Redraw3D();
86 
87  setTextInfo(id, iMuon);
88 }

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

◆ operator=()

const FWMuonDetailView& FWMuonDetailView::operator= ( const FWMuonDetailView )
privatedelete

◆ setTextInfo()

void FWMuonDetailView::setTextInfo ( const FWModelId id,
const reco::Muon muon 
)
overrideprivatevirtual

Implements FWDetailView< reco::Muon >.

Definition at line 90 of file FWMuonDetailView.cc.

90  {
91  m_infoCanvas->cd();
92  double y0 = 0.95;
93  double x0 = 0.02;
94 
95  TLatex* latex = new TLatex(x0, y0, "");
96  const double textsize(0.05);
97  latex->SetTextSize(2 * textsize);
98 
99  float_t x = x0;
100  float y = y0;
101  float fontsize = latex->GetTextSize() * 0.6;
102 
103  latex->DrawLatex(x, y, id.item()->modelName(id.index()).c_str());
104  y -= fontsize;
105  latex->SetTextSize(textsize);
106  fontsize = latex->GetTextSize() * 0.6;
107 
108  latex->DrawLatex(
109  x, y, Form(" p_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f", muon->pt(), muon->eta(), muon->phi()));
110  y -= fontsize;
111  // summary
112  if (muon->charge() > 0)
113  latex->DrawLatex(x, y, " charge = +1");
114  else
115  latex->DrawLatex(x, y, " charge = -1");
116  y -= fontsize;
117 
118  if (muon->isEnergyValid()) {
119  // delta phi/eta in
120  latex->DrawLatex(x, y, "ECAL energy in:");
121  y -= fontsize;
122  latex->DrawLatex(x, y, Form(" crossed crystalls = %.3f", muon->calEnergy().em));
123  y -= fontsize;
124  latex->DrawLatex(x, y, Form(" 3x3 crystall shape = %.3f", muon->calEnergy().emS9));
125  y -= fontsize;
126  latex->DrawLatex(x, y, Form(" 5x5 crystall shape = %.3f", muon->calEnergy().emS25));
127  }
128  m_builder->makeLegend(0.02, y);
129 }

References FWDetailViewBase::item(), m_builder, FWDetailViewGL< reco::Muon >::m_infoCanvas, FWECALDetailViewBuilder::makeLegend(), HLTEgPhaseIITestSequence_cff::modelName, x, and y.

Referenced by build().

Member Data Documentation

◆ m_builder

FWECALDetailViewBuilder* FWMuonDetailView::m_builder
private

Definition at line 34 of file FWMuonDetailView.h.

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

◆ m_data

TEveCaloData* FWMuonDetailView::m_data
private

Definition at line 33 of file FWMuonDetailView.h.

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

FWECALDetailViewBuilder::build
TEveCaloLego * build()
Definition: FWECALDetailViewBuilder.cc:99
DDAxes::y
FWMuonDetailView::m_builder
FWECALDetailViewBuilder * m_builder
Definition: FWMuonDetailView.h:34
mps_fire.i
i
Definition: mps_fire.py:428
FWDetailViewGL< reco::Muon >::m_eveScene
TEveScene * m_eveScene
Definition: FWDetailViewGL.h:29
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
FWECALDetailViewBuilder::makeLegend
double makeLegend(double x0=0.02, double y0=0.95, Color_t clustered1=kGreen+1, Color_t clustered2=kTeal, Color_t supercluster=kYellow)
Definition: FWECALDetailViewBuilder.cc:410
muon
Definition: MuonCocktails.h:17
reco::Muon::calEnergy
MuonEnergy calEnergy() const
get energy deposition information
Definition: Muon.h:106
FWDetailViewGL< reco::Muon >::viewerGL
TGLViewer * viewerGL() const
Definition: FWDetailViewGL.h:20
DDAxes::x
reco::Muon::isEnergyValid
bool isEnergyValid() const
Definition: Muon.h:104
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
HLTEgPhaseIITestSequence_cff.modelName
modelName
Definition: HLTEgPhaseIITestSequence_cff.py:16
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
FWDetailViewGL< reco::Muon >::m_infoCanvas
TCanvas * m_infoCanvas
Definition: FWDetailViewGL.h:25
PVValHelper::eta
Definition: PVValidationHelpers.h:70
FWECALDetailViewBuilder::showSuperClusters
void showSuperClusters(Color_t color1=kGreen+2, Color_t color2=kTeal)
Definition: FWECALDetailViewBuilder.cc:156
FWMuonDetailView::m_data
TEveCaloData * m_data
Definition: FWMuonDetailView.h:33
groupFilesInBlocks.lines
lines
Definition: groupFilesInBlocks.py:95
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
FWDetailViewBase::item
const FWEventItem * item()
Definition: FWDetailViewBase.h:48
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
compare.overlay
def overlay(hists, ytitle, header, addon)
Definition: compare.py:122
FWECALDetailViewBuilder
Definition: FWECALDetailViewBuilder.h:22
FWECALDetailViewBuilder::setColor
void setColor(Color_t color, const std::vector< DetId > &detIds)
Definition: FWECALDetailViewBuilder.cc:141
ecaldqm::binning::kUser
Definition: MESetBinningUtils.h:51
DDAxes::phi
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
FWDetailViewGL< reco::Muon >::m_eveViewer
TEveViewer * m_eveViewer
Definition: FWDetailViewGL.h:28
FWGLEventHandler
Definition: FWGLEventHandler.h:11
reco::MuonEnergy::ecal_position
math::XYZPointF ecal_position
Trajectory position at the calorimeter.
Definition: MuonEnergy.h:53
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
reco::MuonEnergy::ecal_id
DetId ecal_id
DetId of the central ECAL crystal.
Definition: MuonEnergy.h:57
FWMuonDetailView::setTextInfo
void setTextInfo(const FWModelId &, const reco::Muon *) override
Definition: FWMuonDetailView.cc:90
FWMuonDetailView::addSceneInfo
void addSceneInfo(const reco::Muon *i, TEveElementList *tList)
Definition: FWMuonDetailView.cc:131