CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWElectronDetailView Class Reference

#include <FWElectronDetailView.h>

Inheritance diagram for FWElectronDetailView:
FWDetailViewGL< reco::GsfElectron > FWDetailView< reco::GsfElectron > FWDetailViewBase

Public Member Functions

 FWElectronDetailView ()
 
 FWElectronDetailView (const FWElectronDetailView &)=delete
 
const FWElectronDetailViewoperator= (const FWElectronDetailView &)=delete
 
 ~FWElectronDetailView () override
 
- Public Member Functions inherited from FWDetailViewGL< reco::GsfElectron >
 FWDetailViewGL ()
 
void init (TEveWindowSlot *) override
 
void setBackgroundColor (Color_t) override
 
TGLViewer * viewerGL () const
 
 ~FWDetailViewGL () override
 
- Public Member Functions inherited from FWDetailView< reco::GsfElectron >
void build (const FWModelId &iID, const void *iData) override
 
 FWDetailView ()
 
- Public Member Functions inherited from FWDetailViewBase
void build (const FWModelId &)
 
const fireworks::Contextcontext () const
 
 FWDetailViewBase (const FWDetailViewBase &)=delete
 
const FWEventItemitem ()
 
const FWDetailViewBaseoperator= (const FWDetailViewBase &)=delete
 
void setItem (const FWEventItem *x)
 
virtual ~FWDetailViewBase ()
 

Private Member Functions

void addSceneInfo (const reco::GsfElectron *i, TEveElementList *tList)
 
void addTrackPointsInCaloData (const reco::GsfElectron *, TEveCaloLego *)
 
void build (const FWModelId &id, const reco::GsfElectron *) override
 
Bool_t checkRange (Double_t &, Double_t &, Double_t &, Double_t &, Double_t, Double_t)
 
double deltaEtaSuperClusterTrackAtVtx (const reco::GsfElectron &)
 
double deltaPhiSuperClusterTrackAtVtx (const reco::GsfElectron &)
 
void drawCrossHair (const reco::GsfElectron *, TEveCaloLego *, TEveElementList *)
 
void setTextInfo (const FWModelId &id, const reco::GsfElectron *) override
 

Private Attributes

FWECALDetailViewBuilderm_builder
 
TEveCaloData * m_data
 
TLegend * m_legend
 

Additional Inherited Members

- Static Public Member Functions inherited from FWDetailView< reco::GsfElectron >
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::GsfElectron >
TEveScene * m_eveScene
 
TEveViewer * m_eveViewer
 
TGCompositeFrame * m_guiFrame
 
TCanvas * m_infoCanvas
 

Detailed Description

Definition at line 31 of file FWElectronDetailView.h.

Constructor & Destructor Documentation

◆ FWElectronDetailView() [1/2]

FWElectronDetailView::FWElectronDetailView ( )

Definition at line 37 of file FWElectronDetailView.cc.

37 : m_data(nullptr), m_builder(nullptr), m_legend(nullptr) {}
FWECALDetailViewBuilder * m_builder

◆ ~FWElectronDetailView()

FWElectronDetailView::~FWElectronDetailView ( )
override

Definition at line 39 of file FWElectronDetailView.cc.

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

39  {
40  m_eveViewer->GetGLViewer()->DeleteOverlayElements(TGLOverlayElement::kUser);
41 
42  delete m_builder;
43  if (m_data)
44  m_data->DecDenyDestroy();
45 }
FWECALDetailViewBuilder * m_builder

◆ FWElectronDetailView() [2/2]

FWElectronDetailView::FWElectronDetailView ( const FWElectronDetailView )
delete

Member Function Documentation

◆ addSceneInfo()

void FWElectronDetailView::addSceneInfo ( const reco::GsfElectron i,
TEveElementList *  tList 
)
private

Definition at line 286 of file FWElectronDetailView.cc.

References dumpMFGeometry_cfg::delta, mps_fire::i, m_legend, x, y, and z.

Referenced by build().

286  {
287  // centroids
288  Double_t x(0), y(0), z(0);
289  Double_t delta(0.02);
290 
291  TEveStraightLineSet *scposition = new TEveStraightLineSet("sc position");
292  scposition->SetPickable(kTRUE);
293  scposition->SetTitle("Super cluster centroid");
294 
295  x = i->caloPosition().eta();
296  y = i->caloPosition().phi();
297 
298  scposition->AddLine(x - delta, y, z, x + delta, y, z);
299  scposition->AddLine(x, y - delta, z, x, y + delta, z);
300  scposition->AddLine(x, y, z - delta, x, y, z + delta);
301  scposition->SetLineColor(kBlue);
302  scposition->SetLineWidth(2);
303  scposition->SetDepthTest(kFALSE);
304  tList->AddElement(scposition);
305 
306  scposition->SetMarkerColor(kBlue);
307  scposition->SetMarkerStyle(2);
308  m_legend->AddEntry(scposition, "Super cluster centroid", "p");
309 
310  // seed position
311  TEveStraightLineSet *seedposition = new TEveStraightLineSet("seed position");
312  seedposition->SetTitle("Seed cluster centroid");
313  seedposition->SetPickable(kTRUE);
314 
315  x = i->superCluster()->seed()->position().eta();
316  y = i->superCluster()->seed()->position().phi();
317 
318  seedposition->AddLine(x - delta, y - delta, z, x + delta, y + delta, z);
319  seedposition->AddLine(x - delta, y + delta, z, x + delta, y - delta, z);
320  seedposition->SetLineColor(kRed);
321  seedposition->SetLineWidth(2);
322  seedposition->SetDepthTest(kFALSE);
323  tList->AddElement(seedposition);
324 
325  seedposition->SetMarkerColor(kRed);
326  seedposition->SetMarkerStyle(5);
327  m_legend->AddEntry(seedposition, "Seed cluster centroid", "p");
328 
329  // electron direction (show it if it's within
330  // the area of interest)
331  if (fabs(i->phi() - i->caloPosition().phi()) < 25 * 0.0172 &&
332  fabs(i->eta() - i->caloPosition().eta()) < 25 * 0.0172) {
333  TEveStraightLineSet *eldirection = new TEveStraightLineSet("seed position");
334  eldirection->SetTitle("Electron direction at vertex");
335  eldirection->SetPickable(kTRUE);
336 
337  x = i->eta();
338  y = i->phi();
339  eldirection->AddLine(x - delta, y - delta, z, x + delta, y + delta, z);
340  eldirection->AddLine(x - delta, y + delta, z, x + delta, y - delta, z);
341  eldirection->SetLineColor(kGreen + 1);
342  eldirection->SetDepthTest(kFALSE);
343  tList->AddElement(eldirection);
344 
345  eldirection->SetMarkerColor(kGreen);
346  eldirection->SetMarkerStyle(5);
347  m_legend->AddEntry(eldirection, "Direction at vertex", "p");
348  }
349 }

◆ addTrackPointsInCaloData()

void FWElectronDetailView::addTrackPointsInCaloData ( const reco::GsfElectron i,
TEveCaloLego *  lego 
)
private

Definition at line 246 of file FWElectronDetailView.cc.

References checkRange(), data, deltaEtaSuperClusterTrackAtVtx(), deltaPhiSuperClusterTrackAtVtx(), PVValHelper::eta, mps_fire::i, and phi.

Referenced by build().

246  {
247  return;
248  TEveCaloDataVec *data = (TEveCaloDataVec *)lego->GetData();
249  Double_t em, eM, pm, pM;
250  data->GetEtaLimits(em, eM);
251  data->GetPhiLimits(pm, pM);
252  data->IncDenyDestroy();
253  Bool_t changed = kFALSE;
254  // add cells in third layer if necessary
255 
256  // trackpositionAtCalo
257  {
258  double eta = i->superCluster()->seed()->position().eta() - i->deltaEtaSeedClusterTrackAtCalo();
259  double phi = i->superCluster()->seed()->position().phi() - i->deltaPhiSeedClusterTrackAtCalo();
260 
261  if (checkRange(em, eM, pm, pM, eta, phi))
262  changed = kTRUE;
263  }
264  // pinposition
265  {
266  double eta = i->caloPosition().eta() - deltaEtaSuperClusterTrackAtVtx(*i);
267  double phi = i->caloPosition().phi() - deltaPhiSuperClusterTrackAtVtx(*i);
268 
269  if (checkRange(em, eM, pm, pM, eta, phi))
270  changed = kTRUE;
271  }
272  if (changed) {
273  data->AddTower(em, eM, pm, pM);
274  data->FillSlice(2, 0);
275  data->DataChanged();
276 
277  lego->ComputeBBox();
278  Double_t legoScale = ((eM - em) < (pM - pm)) ? (eM - em) : (pM - pm);
279  lego->InitMainTrans();
280  lego->RefMainTrans().SetScale(legoScale, legoScale, legoScale * 0.5);
281  lego->RefMainTrans().SetPos((eM + em) * 0.5, (pM + pm) * 0.5, 0);
282  lego->ElementChanged(true);
283  }
284 }
Bool_t checkRange(Double_t &, Double_t &, Double_t &, Double_t &, Double_t, Double_t)
double deltaEtaSuperClusterTrackAtVtx(const reco::GsfElectron &)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
double deltaPhiSuperClusterTrackAtVtx(const reco::GsfElectron &)

◆ build()

void FWElectronDetailView::build ( const FWModelId id,
const reco::GsfElectron iElectron 
)
overrideprivatevirtual

Implements FWDetailView< reco::GsfElectron >.

Definition at line 50 of file FWElectronDetailView.cc.

References addSceneInfo(), addTrackPointsInCaloData(), FWECALDetailViewBuilder::build(), reco::GsfElectron::caloPosition(), drawCrossHair(), PVValHelper::eta, reco::LeafCandidate::eta(), edm::Ref< C, T, F >::isAvailable(), FWDetailViewBase::item(), m_builder, m_data, FWDetailViewGL< reco::GsfElectron >::m_eveScene, m_legend, compare::overlay(), phi, reco::LeafCandidate::phi(), setTextInfo(), FWECALDetailViewBuilder::showSuperCluster(), FWECALDetailViewBuilder::showSuperClusters(), reco::GsfElectron::superCluster(), and FWDetailViewGL< reco::GsfElectron >::viewerGL().

50  {
51  if (!iElectron)
52  return;
53  // If SuperCluster reference is not stored,
54  // take eta and phi of a Candidate
55  double eta = 0;
56  double phi = 0;
57  if (iElectron->superCluster().isAvailable()) {
58  eta = iElectron->caloPosition().eta();
59  phi = iElectron->caloPosition().phi();
60  } else {
61  eta = iElectron->eta();
62  phi = iElectron->phi();
63  }
64 
65  // build ECAL objects
66  m_builder = new FWECALDetailViewBuilder(id.item()->getEvent(), id.item()->getGeom(), eta, phi, 25);
67 
69  if (iElectron->superCluster().isAvailable())
70  m_builder->showSuperCluster(*(iElectron->superCluster()), kYellow + 1);
71 
72  TEveCaloLego *lego = m_builder->build();
73  m_data = lego->GetData();
74  m_eveScene->AddElement(lego);
75 
76  m_legend = new TLegend(0.01, 0.01, 0.99, 0.99, nullptr, "NDC");
77  m_legend->SetTextSize(0.075);
78  m_legend->SetBorderSize(0);
79  m_legend->SetMargin(0.15);
80  m_legend->SetEntrySeparation(0.05);
81 
82  // add Electron specific details
83  if (false && iElectron->superCluster().isAvailable()) {
84  addTrackPointsInCaloData(iElectron, lego);
85  drawCrossHair(iElectron, lego, m_eveScene);
86  addSceneInfo(iElectron, m_eveScene);
87  }
88 
89  // draw axis at the window corners
90  if (true) {
91  TEveCaloLegoOverlay *overlay = new TEveCaloLegoOverlay();
92  overlay->SetShowPlane(kFALSE);
93  overlay->SetShowPerspective(kFALSE);
94  overlay->SetCaloLego(lego);
95  overlay->SetShowScales(true); // temporary
96  viewerGL()->AddOverlayElement(overlay);
97  }
98  // set event handler and flip camera to top view at beginning
99  viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
100  FWGLEventHandler *eh = new FWGLEventHandler((TGWindow *)viewerGL()->GetGLWidget(), (TObject *)viewerGL(), lego);
101  viewerGL()->SetEventHandler(eh);
102  viewerGL()->ResetCamerasAfterNextUpdate();
103  viewerGL()->UpdateScene(kFALSE);
104  gEve->Redraw3D();
105 
106  setTextInfo(id, iElectron);
107 }
void showSuperCluster(const reco::SuperCluster &cluster, Color_t color=kYellow)
void setTextInfo(const FWModelId &id, const reco::GsfElectron *) override
math::XYZPoint caloPosition() const
Definition: GsfElectron.h:302
const FWEventItem * item()
FWECALDetailViewBuilder * m_builder
def overlay(hists, ytitle, header, addon)
Definition: compare.py:122
bool isAvailable() const
Definition: Ref.h:541
void showSuperClusters(Color_t color1=kGreen+2, Color_t color2=kTeal)
void drawCrossHair(const reco::GsfElectron *, TEveCaloLego *, TEveElementList *)
void addSceneInfo(const reco::GsfElectron *i, TEveElementList *tList)
void addTrackPointsInCaloData(const reco::GsfElectron *, TEveCaloLego *)
double phi() const final
momentum azimuthal angle
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
double eta() const final
momentum pseudorapidity

◆ checkRange()

Bool_t FWElectronDetailView::checkRange ( Double_t &  em,
Double_t &  eM,
Double_t &  pm,
Double_t &  pM,
Double_t  eta,
Double_t  phi 
)
private

Definition at line 222 of file FWElectronDetailView.cc.

References PVValHelper::eta, and phi.

Referenced by addTrackPointsInCaloData().

223  {
224  Bool_t changed = kFALSE;
225 
226  //check eta
227  if (eta < em) {
228  em = eta;
229  changed = kTRUE;
230  } else if (eta > eM) {
231  eM = eta;
232  changed = kTRUE;
233  }
234 
235  // check phi
236  if (phi < pm) {
237  pm = phi;
238  changed = kTRUE;
239  } else if (phi > pM) {
240  pM = phi;
241  changed = kTRUE;
242  }
243  return changed;
244 }

◆ deltaEtaSuperClusterTrackAtVtx()

double FWElectronDetailView::deltaEtaSuperClusterTrackAtVtx ( const reco::GsfElectron electron)
private

Definition at line 109 of file FWElectronDetailView.cc.

References HPSPFTauProducerPuppi_cfi::electron.

Referenced by addTrackPointsInCaloData(), and drawCrossHair().

109  {
110  return electron.deltaEtaSuperClusterTrackAtVtx();
111 }

◆ deltaPhiSuperClusterTrackAtVtx()

double FWElectronDetailView::deltaPhiSuperClusterTrackAtVtx ( const reco::GsfElectron electron)
private

Definition at line 113 of file FWElectronDetailView.cc.

References HPSPFTauProducerPuppi_cfi::electron.

Referenced by addTrackPointsInCaloData(), and drawCrossHair().

113  {
114  return electron.deltaPhiSuperClusterTrackAtVtx();
115 }

◆ drawCrossHair()

void FWElectronDetailView::drawCrossHair ( const reco::GsfElectron i,
TEveCaloLego *  lego,
TEveElementList *  tList 
)
private

Definition at line 176 of file FWElectronDetailView.cc.

References deltaEtaSuperClusterTrackAtVtx(), deltaPhiSuperClusterTrackAtVtx(), PVValHelper::eta, mps_fire::i, m_legend, phi, TrackerOfflineValidation_Dqm_cff::xmax, TrackerOfflineValidation_Dqm_cff::xmin, L1TOccupancyClient_cfi::ymax, and L1TOccupancyClient_cfi::ymin.

Referenced by build().

176  {
177  double ymax = lego->GetPhiMax();
178  double ymin = lego->GetPhiMin();
179  double xmax = lego->GetEtaMax();
180  double xmin = lego->GetEtaMin();
181 
182  // draw crosshairs for track intersections
183 
184  {
185  const double eta = i->superCluster()->seed()->position().eta() - i->deltaEtaSeedClusterTrackAtCalo();
186  const double phi = i->superCluster()->seed()->position().phi() - i->deltaPhiSeedClusterTrackAtCalo();
187 
188  TEveStraightLineSet *trackpositionAtCalo = new TEveStraightLineSet("sc trackpositionAtCalo");
189  trackpositionAtCalo->SetPickable(kTRUE);
190  trackpositionAtCalo->SetTitle("Track position at Calo propagating from the outermost state");
191 
192  trackpositionAtCalo->AddLine(eta, ymin, 0, eta, ymax, 0);
193  trackpositionAtCalo->AddLine(xmin, phi, 0, xmax, phi, 0);
194 
195  trackpositionAtCalo->SetDepthTest(kFALSE);
196  trackpositionAtCalo->SetLineColor(kBlue);
197  tList->AddElement(trackpositionAtCalo);
198 
199  m_legend->AddEntry(trackpositionAtCalo, "From outermost state", "l");
200  }
201  //
202  // pin position
203  //
204  {
205  TEveStraightLineSet *pinposition = new TEveStraightLineSet("pin position");
206  pinposition->SetPickable(kTRUE);
207  pinposition->SetTitle("Track position at Calo propagating from the innermost state");
208  Double_t eta = i->caloPosition().eta() - deltaEtaSuperClusterTrackAtVtx(*i);
209  Double_t phi = i->caloPosition().phi() - deltaPhiSuperClusterTrackAtVtx(*i);
210 
211  pinposition->AddLine(eta, ymax, 0, eta, ymin, 0);
212  pinposition->AddLine(xmin, phi, 0, xmax, phi, 0);
213 
214  pinposition->SetDepthTest(kFALSE);
215  pinposition->SetLineColor(kRed);
216  tList->AddElement(pinposition);
217 
218  m_legend->AddEntry(pinposition, "From innermost state", "l");
219  }
220 }
double deltaEtaSuperClusterTrackAtVtx(const reco::GsfElectron &)
double deltaPhiSuperClusterTrackAtVtx(const reco::GsfElectron &)

◆ operator=()

const FWElectronDetailView& FWElectronDetailView::operator= ( const FWElectronDetailView )
delete

◆ setTextInfo()

void FWElectronDetailView::setTextInfo ( const FWModelId id,
const reco::GsfElectron electron 
)
overrideprivatevirtual

Implements FWDetailView< reco::GsfElectron >.

Definition at line 117 of file FWElectronDetailView.cc.

References HPSPFTauProducerPuppi_cfi::electron, FWDetailViewBase::item(), m_builder, FWDetailViewGL< reco::GsfElectron >::m_infoCanvas, m_legend, FWECALDetailViewBuilder::makeLegend(), ecalBarrelClusterFastTimer_cfi::modelName, x, testProducerWithPsetDescEmpty_cfi::x2, and y.

Referenced by build().

117  {
118  m_infoCanvas->cd();
119 
120  float_t x = 0.02;
121  float_t x2 = 0.52;
122  float y = 0.95;
123 
124  TLatex *latex = new TLatex(x, y, "");
125  const double textsize(0.05);
126  latex->SetTextSize(2 * textsize);
127 
128  latex->DrawLatex(x, y, id.item()->modelName(id.index()).c_str());
129  y -= latex->GetTextSize() * 0.6;
130 
131  latex->SetTextSize(textsize);
132  float lineH = latex->GetTextSize() * 0.6;
133 
134  latex->DrawLatex(
135  x, y, Form(" E_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f", electron->et(), electron->eta(), electron->phi()));
136  y -= lineH;
137  // summary
138  if (electron->charge() > 0)
139  latex->DrawLatex(x, y, " charge = +1");
140  else
141  latex->DrawLatex(x, y, " charge = -1");
142  y -= lineH;
143 
144  if (electron->superCluster().isAvailable()) {
145  // delta phi/eta in
146  latex->DrawLatex(x, y, "SuperCluster vs inner state extrapolation");
147  y -= lineH;
148  latex->DrawLatex(x, y, TString::Format(" #Delta#eta_{in} = %.3f", electron->deltaEtaSuperClusterTrackAtVtx()));
149  latex->DrawLatex(x2, y, TString::Format("#Delta#varphi_{in} = %.3f", electron->deltaPhiSuperClusterTrackAtVtx()));
150  y -= lineH;
151 
152  // delta phi/eta out
153  latex->DrawLatex(x, y, "SeedCluster vs outer state extrapolation");
154  y -= lineH;
155 
156  latex->DrawLatex(x, y, TString::Format(" #Delta#eta_{out} = %.3f", electron->deltaEtaSeedClusterTrackAtCalo()));
157  latex->DrawLatex(x2, y, TString::Format(" #Delta#varphi_{out} = %.3f", electron->deltaPhiSeedClusterTrackAtCalo()));
158  y -= 2 * lineH;
159  } else {
160  latex->DrawLatex(x, y, "Ref to SuperCluster is not available");
161  }
162 
163  latex->DrawLatex(x, y, TString::Format(" Tracker driven seed: %s", electron->trackerDrivenSeed() ? "YES" : "NO"));
164  y -= lineH;
165  latex->DrawLatex(x, y, TString::Format(" ECAL driven seed: %s", electron->ecalDrivenSeed() ? "YES" : "NO"));
166  y -= lineH;
167 
168  y = m_builder->makeLegend(0.02, y);
169  y -= lineH;
170 
171  m_legend->SetY2(y);
172  m_legend->Draw();
173  m_legend = nullptr; // Deleted together with TPad.
174 }
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()
FWECALDetailViewBuilder * m_builder

Member Data Documentation

◆ m_builder

FWECALDetailViewBuilder* FWElectronDetailView::m_builder
private

Definition at line 56 of file FWElectronDetailView.h.

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

◆ m_data

TEveCaloData* FWElectronDetailView::m_data
private

Definition at line 55 of file FWElectronDetailView.h.

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

◆ m_legend

TLegend* FWElectronDetailView::m_legend
private

Definition at line 57 of file FWElectronDetailView.h.

Referenced by addSceneInfo(), build(), drawCrossHair(), and setTextInfo().