CMS 3D CMS Logo

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

#include <FWPFCandidateDetailView.h>

Inheritance diagram for FWPFCandidateDetailView:
FWDetailViewGL< reco::PFCandidate > CSGActionSupervisor FWDetailView< reco::PFCandidate > FWDetailViewBase

Public Member Functions

 FWPFCandidateDetailView ()
 
 FWPFCandidateDetailView (const FWPFCandidateDetailView &)=delete
 
const FWPFCandidateDetailViewoperator= (const FWPFCandidateDetailView &)=delete
 
 ~FWPFCandidateDetailView () override
 
- Public Member Functions inherited from FWDetailViewGL< reco::PFCandidate >
 FWDetailViewGL ()
 
void init (TEveWindowSlot *) override
 
void setBackgroundColor (Color_t) override
 
TGLViewer * viewerGL () const
 
 ~FWDetailViewGL () override
 
- Public Member Functions inherited from FWDetailView< reco::PFCandidate >
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 ()
 
- Public Member Functions inherited from CSGActionSupervisor
Bool_t activateMenuEntry (int entry)
 
Bool_t activateToolBarEntry (int entry)
 
void addToActionMap (CSGAction *action)
 
 CSGActionSupervisor ()
 
 CSGActionSupervisor (const CSGActionSupervisor &)=delete
 
virtual void defaultAction ()
 
virtual void enableActions (bool enable=true)
 
CSGActiongetAction (const std::string &name)
 
const std::vector< CSGAction * > & getListOfActions () const
 
Long_t getToolTipDelay () const
 
virtual void HandleMenu (Int_t id)
 
const CSGActionSupervisoroperator= (const CSGActionSupervisor &)=delete
 
void resizeMenu (TGPopupMenu *menu)
 
virtual ~CSGActionSupervisor ()
 

Private Member Functions

void addClusters (const std::vector< reco::PFCluster > *)
 
void addHits (const std::vector< reco::PFRecHit > *)
 
void addTracks (const std::vector< reco::PFRecTrack > *)
 
void build (const FWModelId &id, const reco::PFCandidate *) override
 
void buildGLEventScene ()
 
float eta ()
 
float etaMax ()
 
float etaMin ()
 
bool isPntInRng (float x, float y)
 
void makeLegend (void)
 
float phi ()
 
float phiMax ()
 
float phiMin ()
 
void plotEtChanged ()
 
void rangeChanged (int x)
 
void rnrHcalChanged ()
 
void setTextInfo (const FWModelId &id, const reco::PFCandidate *) override
 
void voteMaxEtEVal (const std::vector< reco::PFRecHit > *hits)
 

Private Attributes

const reco::PFCandidatem_candidate
 
TEveElementList * m_eventList
 
TLegend * m_legend
 
bool m_plotEt
 
float m_range
 
bool m_rnrHcal
 
TGSlider * m_slider
 
FWIntValueListenerm_sliderListener
 

Additional Inherited Members

- Static Public Member Functions inherited from FWDetailView< reco::PFCandidate >
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::PFCandidate >
TEveScene * m_eveScene
 
TEveViewer * m_eveViewer
 
TGCompositeFrame * m_guiFrame
 
TCanvas * m_infoCanvas
 
- Protected Attributes inherited from CSGActionSupervisor
std::vector< CSGAction * > m_actionList
 

Detailed Description

Definition at line 24 of file FWPFCandidateDetailView.h.

Constructor & Destructor Documentation

◆ FWPFCandidateDetailView() [1/2]

FWPFCandidateDetailView::FWPFCandidateDetailView ( )

Definition at line 48 of file FWPFCandidateDetailView.cc.

49  : m_range(1),
50  m_candidate(nullptr),
51  m_legend(nullptr),
52  m_slider(nullptr),
54  m_eventList(nullptr),
55  m_plotEt(true),
56  m_rnrHcal(true) {}
FWIntValueListener * m_sliderListener
const reco::PFCandidate * m_candidate

◆ ~FWPFCandidateDetailView()

FWPFCandidateDetailView::~FWPFCandidateDetailView ( )
override

Definition at line 58 of file FWPFCandidateDetailView.cc.

58 {}

◆ FWPFCandidateDetailView() [2/2]

FWPFCandidateDetailView::FWPFCandidateDetailView ( const FWPFCandidateDetailView )
delete

Member Function Documentation

◆ addClusters()

void FWPFCandidateDetailView::addClusters ( const std::vector< reco::PFCluster > *  cluster)
private

Definition at line 273 of file FWPFCandidateDetailView.cc.

References cuy::col, isPntInRng(), eostools::ls(), and m_eventList.

Referenced by buildGLEventScene().

273  {
274  if (!cluster)
275  return;
276 
277  Color_t col = kViolet + 9;
278 
279  TEveStraightLineSet* ls = new TEveStraightLineSet("cluster_ls");
280  ls->SetMainColor(col);
281  m_eventList->AddElement(ls);
282 
283  TEvePointSet* ps = new TEvePointSet("cluster_ps");
284  ps->SetMainColor(col);
285  ps->SetMarkerStyle(2);
286  ps->SetMarkerSize(0.005);
287  m_eventList->AddElement(ps);
288 
289  for (std::vector<reco::PFCluster>::const_iterator it = cluster->begin(); it != cluster->end(); ++it) {
290  if (!isPntInRng(it->position().Eta(), it->position().Phi()))
291  continue;
292 
293  ps->SetNextPoint(it->position().Eta(), it->position().Phi(), 0);
294 
295  /*
296  const std::vector< reco::PFRecHitFraction >& fractions = it->recHitFractions();
297  for (std::vector< reco::PFRecHitFraction >::const_iterator fi = fractions.begin(); fi != fractions.end(); ++fi)
298  {
299  // !!! AMT can't get fi->recHitRef().position()
300  // ls->AddLine(it->position().Eta(), it->position().Phi(), 0,
301  // fi->recHitRef().position().Eta(), fi->recHitRef().position().Phi(), 0);
302  }
303  */
304  }
305 }
bool isPntInRng(float x, float y)
def ls(path, rec=False)
Definition: eostools.py:349
col
Definition: cuy.py:1009

◆ addHits()

void FWPFCandidateDetailView::addHits ( const std::vector< reco::PFRecHit > *  hits)
private

Definition at line 338 of file FWPFCandidateDetailView.cc.

References FWPFMaths::calculateEt(), FWDetailViewBase::context(), eta(), fireworks::Context::getMaxEnergyInEvent(), hfClusterShapes_cfi::hits, isPntInRng(), dqmdumpme::k, eostools::ls(), m_eventList, m_plotEt, phi(), x, y, and z.

Referenced by buildGLEventScene().

338  {
339  TEveStraightLineSet* lsOutline = (TEveStraightLineSet*)m_eventList->FindChild("outlines");
340 
341  TEvePointSet* ps = new TEvePointSet("test");
342  m_eventList->AddElement(ps);
343  ps->SetMainColor(kOrange);
344 
345  // FIXME, requires access to geometry
346  if ((!hits->empty()) && hits->front().hasCaloCell())
347  for (std::vector<reco::PFRecHit>::const_iterator it = hits->begin(); it != hits->end(); ++it) {
348  const auto& corners = it->getCornersXYZ();
349  if (!isPntInRng(corners[0].eta(), corners[0].phi()))
350  continue;
351 
352  std::vector<TEveVector> hc;
353  hc.reserve(4);
354  for (int k = 0; k < 4; ++k) {
355  hc.push_back(TEveVector(corners[k].eta(), corners[k].phi(), 0));
356  // ps->SetNextPoint(corners[k].eta(),corners[k].phi(),0 ); //debug
357  }
358 
359  WrapTwoPi(hc, corners[0].phi());
360 
361  AddLineToLineSet(lsOutline, hc, 0, 1);
362  AddLineToLineSet(lsOutline, hc, 1, 2);
363  AddLineToLineSet(lsOutline, hc, 2, 3);
364  AddLineToLineSet(lsOutline, hc, 3, 0);
365 
366  // get scaled corners
367  TEveVector centerOfGravity = hc[0] + hc[1] + hc[2] + hc[3];
368  centerOfGravity *= 0.25;
369 
370  std::vector<TEveVector> radialVectors;
371  radialVectors.reserve(4);
372  for (int k = 0; k < 4; ++k)
373  radialVectors.push_back(TEveVector(hc[k] - centerOfGravity));
374 
375  float factor = 1;
376  if (m_plotEt) {
377  float Et = FWPFMaths::calculateEt(TEveVector(corners[0].x(), corners[0].y(), corners[0].z()), it->energy());
379  } else
380  factor = it->energy() / context().getMaxEnergyInEvent(false);
381 
382  std::vector<TEveVector> scaledCorners;
383  for (int k = 0; k < 4; ++k) {
384  radialVectors[k] *= factor;
385  scaledCorners.push_back(TEveVector(radialVectors[k] + centerOfGravity));
386  }
387 
388  TEveStraightLineSet* ls = (TEveStraightLineSet*)m_eventList->FindChild(Form("%d_rechit", it->depth()));
389  AddLineToLineSet(ls, scaledCorners, 0, 1);
390  AddLineToLineSet(ls, scaledCorners, 1, 2);
391  AddLineToLineSet(ls, scaledCorners, 2, 3);
392  // AddLineToLineSet(ls, scaledCorners, 3, 0);
393  TEveStraightLineSet::Line_t* li = AddLineToLineSet(ls, scaledCorners, 3, 0);
394  ls->AddMarker(centerOfGravity, li->fId);
395  }
396 }
bool isPntInRng(float x, float y)
float getMaxEnergyInEvent(bool isEt) const
Definition: Context.cc:181
const fireworks::Context & context() const
float calculateEt(const TEveVector &centre, float e)
Definition: FWPFMaths.cc:115
def ls(path, rec=False)
Definition: eostools.py:349

◆ addTracks()

void FWPFCandidateDetailView::addTracks ( const std::vector< reco::PFRecTrack > *  tracks)
private

AMT trackRef() is a collection !!!

Definition at line 249 of file FWPFCandidateDetailView.cc.

References pwdgSkimBPark_cfi::tracks.

Referenced by buildGLEventScene().

249  {
250  for (std::vector<reco::PFRecTrack>::const_iterator it = tracks->begin(); it != tracks->end(); ++it) {
252  /*
253  if (!isPntInRng(it->trackRef().innerMomentum().Eta(), it->position().Phi()))
254  continue;
255 
256  TEveLine* line = new TEveLine("Track");
257  line->SetMainColor(kYellow);
258  int N = it->nTrajectoryPoints();
259 
260  for (int p = 0 ; p<N; ++p) {
261  pos = track.extrapolatedPoint(p).position();
262 
263  if( pos.Eta() !=0 and pos.Phi() !=0)
264  line->SetNextPoint(pos.Eta(), pos.Phi(), 0);
265  }
266  m_eventList->AddElement(line);
267  */
268  }
269 }

◆ build()

void FWPFCandidateDetailView::build ( const FWModelId id,
const reco::PFCandidate candidate 
)
overrideprivatevirtual

Implements FWDetailView< reco::PFCandidate >.

Definition at line 143 of file FWPFCandidateDetailView.cc.

References writedatasetfile::action, b, buildGLEventScene(), DMR_cfg::cerr, cms::cuda::co, f, FWGUIManager::getCurrentEvent(), FWGUIManager::getGUIManager(), m_candidate, m_eventList, FWDetailViewGL< reco::PFCandidate >::m_eveScene, FWDetailViewGL< reco::PFCandidate >::m_guiFrame, m_slider, m_sliderListener, makeLegend(), AlCaHLTBitMon_ParallelJobs::p, plotEtChanged(), edm::Handle< T >::product(), rangeChanged(), rnrHcalChanged(), setTextInfo(), FWIntValueListener::valueChanged_, FWDetailViewGL< reco::PFCandidate >::viewerGL(), voteMaxEtEVal(), and cms::Exception::what().

143  {
144  m_candidate = candidate;
145 
146  // ROOT GUI
147  //
148  {
149  TGCompositeFrame* f = new TGVerticalFrame(m_guiFrame);
150  m_guiFrame->AddFrame(f);
151  f->AddFrame(new TGLabel(f, "Rng:"), new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
152  m_slider = new TGHSlider(f, 120, kSlider1 | kScaleNo);
153  f->AddFrame(m_slider, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 1, 4));
154  m_slider->SetRange(1, 50);
155  m_slider->SetPosition(8);
156 
158  TQObject::Connect(
159  m_slider, "PositionChanged(Int_t)", "FWIntValueListenerBase", m_sliderListener, "setValue(Int_t)");
161  std::bind(&FWPFCandidateDetailView::rangeChanged, this, std::placeholders::_1));
162  {
163  CSGAction* action = new CSGAction(this, "Scale Et");
164  TGCheckButton* b = new TGCheckButton(m_guiFrame, action->getName().c_str());
165  b->SetState(kButtonDown, true);
166  m_guiFrame->AddFrame(b, new TGLayoutHints(kLHintsNormal, 2, 3, 1, 4));
167  TQObject::Connect(b, "Clicked()", "CSGAction", action, "activate()");
168  action->activated.connect(sigc::mem_fun(*this, &FWPFCandidateDetailView::plotEtChanged));
169  }
170  {
171  CSGAction* action = new CSGAction(this, "RnrHcal");
172  TGCheckButton* b = new TGCheckButton(m_guiFrame, action->getName().c_str());
173  b->SetState(kButtonDown, true);
174  m_guiFrame->AddFrame(b, new TGLayoutHints(kLHintsNormal, 2, 3, 1, 4));
175  TQObject::Connect(b, "Clicked()", "CSGAction", action, "activate()");
176  action->activated.connect(sigc::mem_fun(*this, &FWPFCandidateDetailView::rnrHcalChanged));
177  }
178  }
179  makeLegend();
180  setTextInfo(id, candidate);
181 
182  TGCompositeFrame* p = (TGCompositeFrame*)m_guiFrame->GetParent();
183  p->MapSubwindows();
184  p->Layout();
185 
187  // GL stuff
188 
189  m_candidate = candidate;
190 
191  try {
194  event->getByLabel(edm::InputTag("particleFlowRecHitECAL"), ecalH);
195  if (ecalH.product())
196  voteMaxEtEVal(ecalH.product());
197 
199  event->getByLabel(edm::InputTag("particleFlowRecHitHBHEHO"), hcalH);
200  if (hcalH.product())
201  voteMaxEtEVal(hcalH.product());
202  } catch (const cms::Exception& iE) {
203  std::cerr << iE.what();
204  }
205 
206  m_eveScene->GetGLScene()->SetSelectable(false);
207  m_eventList = new TEveElementList("PFDetailView");
208  m_eveScene->AddElement(m_eventList);
209 
210  viewerGL()->SetStyle(TGLRnrCtx::kOutline);
211  viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
212 
213  TGLCameraOverlay* co = viewerGL()->GetCameraOverlay();
214  co->SetShowOrthographic(kTRUE);
215  co->SetOrthographicMode(TGLCameraOverlay::kAxis);
216 
217  viewerGL()->ResetCamerasAfterNextUpdate();
218  try {
220  } catch (...) {
221  printf("unknown exception \n");
222  }
223 
224  viewerGL()->UpdateScene(kFALSE);
225 
226  gEve->Redraw3D();
227 
228  // gEve->AddToListTree(m_eventList, true);//debug, used with --eve option
229 }
FWIntValueListener * m_sliderListener
sigc::signal< void(Int_t)> valueChanged_
T const * product() const
Definition: Handle.h:70
void setTextInfo(const FWModelId &id, const reco::PFCandidate *) override
__host__ __device__ VT * co
Definition: prefixScan.h:47
const edm::EventBase * getCurrentEvent() const
double f[11][100]
void voteMaxEtEVal(const std::vector< reco::PFRecHit > *hits)
static FWGUIManager * getGUIManager()
const reco::PFCandidate * m_candidate
double b
Definition: hdecay.h:118
char const * what() const noexcept override
Definition: Exception.cc:103

◆ buildGLEventScene()

void FWPFCandidateDetailView::buildGLEventScene ( )
private

Definition at line 400 of file FWPFCandidateDetailView.cc.

References addClusters(), addHits(), addTracks(), DMR_cfg::cerr, LEDCalibrationChannels::depth, FWGUIManager::getCurrentEvent(), FWGUIManager::getGUIManager(), eostools::ls(), m_eventList, m_rnrHcal, edm::Handle< T >::product(), and cms::Exception::what().

Referenced by build(), plotEtChanged(), rangeChanged(), and rnrHcalChanged().

400  {
401  if (m_eventList->HasChildren())
402  m_eventList->DestroyElements();
403 
404  for (int depth = 0; depth < 6; ++depth) {
405  TEveStraightLineSet* ls = new TEveStraightLineSet(Form("%d_rechit", depth));
406 
407  if (depth == 0)
408  ls->SetLineColor(kGray);
409  else if (depth == 1)
410  ls->SetLineColor(kRed);
411  else if (depth == 2)
412  ls->SetLineColor(kGreen);
413  else if (depth == 3)
414  ls->SetLineColor(kMagenta);
415  else if (depth == 4)
416  ls->SetLineColor(kOrange);
417  else if (depth == 5)
418  ls->SetLineColor(kYellow);
419 
420  ls->SetMarkerStyle(1);
421  m_eventList->AddElement(ls);
422  }
423 
424  TEveStraightLineSet* ls = new TEveStraightLineSet("outlines");
425  ls->SetLineColor(kGray);
426  ls->SetMainTransparency(80);
427  m_eventList->AddElement(ls);
428 
430 
431  //
432  // recHits
433  //
434  try {
436  event->getByLabel(edm::InputTag("particleFlowRecHitECAL"), ecalH);
437  addHits(ecalH.product());
438  } catch (const cms::Exception& iE) {
439  std::cerr << iE.what();
440  }
441 
442  if (m_rnrHcal) {
443  try {
445  event->getByLabel(edm::InputTag("particleFlowRecHitHF"), ecalH);
446  addHits(ecalH.product());
447  } catch (const cms::Exception& iE) {
448  std::cerr << iE.what();
449  }
450 
451  try {
453  event->getByLabel(edm::InputTag("particleFlowRecHitHBHEHO"), hcalH);
454  addHits(hcalH.product());
455  } catch (const cms::Exception& iE) {
456  std::cerr << iE.what();
457  }
458  }
459 
460  //
461  // clusters
462  //
463  try {
465  event->getByLabel(edm::InputTag("particleFlowClusterECAL"), ecalClustersH);
466  addClusters(ecalClustersH.product());
467  } catch (const cms::Exception& iE) {
468  std::cerr << iE.what();
469  }
470 
471  //
472  // tracks
473  //
474  try {
476  event->getByLabel(edm::InputTag("pfTrack"), trackH);
477  addTracks(trackH.product());
478  } catch (const cms::Exception& iE) {
479  std::cerr << iE.what();
480  }
481 }
T const * product() const
Definition: Handle.h:70
const edm::EventBase * getCurrentEvent() const
def ls(path, rec=False)
Definition: eostools.py:349
static FWGUIManager * getGUIManager()
void addHits(const std::vector< reco::PFRecHit > *)
void addClusters(const std::vector< reco::PFCluster > *)
char const * what() const noexcept override
Definition: Exception.cc:103
void addTracks(const std::vector< reco::PFRecTrack > *)

◆ eta()

float FWPFCandidateDetailView::eta ( void  )
private

Definition at line 60 of file FWPFCandidateDetailView.cc.

References reco::LeafCandidate::eta(), and m_candidate.

Referenced by Particle.Particle::__str__(), addHits(), etaMax(), etaMin(), Jet.Jet::jetID(), and Jet.Jet::puJetId().

60 { return m_candidate->eta(); }
const reco::PFCandidate * m_candidate
double eta() const final
momentum pseudorapidity

◆ etaMax()

float FWPFCandidateDetailView::etaMax ( )
inlineprivate

Definition at line 56 of file FWPFCandidateDetailView.h.

References eta(), and m_range.

◆ etaMin()

float FWPFCandidateDetailView::etaMin ( )
inlineprivate

Definition at line 55 of file FWPFCandidateDetailView.h.

References eta(), and m_range.

◆ isPntInRng()

bool FWPFCandidateDetailView::isPntInRng ( float  x,
float  y 
)
private

Definition at line 64 of file FWPFCandidateDetailView.cc.

References PVValHelper::dx, PVValHelper::dy, reco::LeafCandidate::eta(), m_candidate, m_range, reco::LeafCandidate::phi(), x, and y.

Referenced by addClusters(), and addHits().

64  {
65  float dx = m_candidate->eta() - x;
66  float dy = m_candidate->phi() - y;
67  float sd = TMath::Sqrt(dx * dx + dy * dy);
68  return sd < m_range;
69 }
const reco::PFCandidate * m_candidate
double phi() const final
momentum azimuthal angle
double eta() const final
momentum pseudorapidity

◆ makeLegend()

void FWPFCandidateDetailView::makeLegend ( void  )
private

Definition at line 73 of file FWPFCandidateDetailView.cc.

References m_legend.

Referenced by build().

73  {
74  m_legend = new TLegend(0.01, 0.01, 0.99, 0.99, nullptr, "NDC");
75  m_legend->SetFillColor(kWhite);
76  m_legend->SetTextSize(0.07);
77  m_legend->SetBorderSize(0);
78  m_legend->SetMargin(0.15);
79  m_legend->SetEntrySeparation(0.01);
80 }

◆ operator=()

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

◆ phi()

float FWPFCandidateDetailView::phi ( void  )
private

Definition at line 62 of file FWPFCandidateDetailView.cc.

References m_candidate, and reco::LeafCandidate::phi().

Referenced by Particle.Particle::__str__(), addHits(), phiMax(), phiMin(), and ntupleDataFormat.Track::phiPull().

62 { return m_candidate->phi(); }
const reco::PFCandidate * m_candidate
double phi() const final
momentum azimuthal angle

◆ phiMax()

float FWPFCandidateDetailView::phiMax ( )
inlineprivate

Definition at line 58 of file FWPFCandidateDetailView.h.

References m_range, and phi().

◆ phiMin()

float FWPFCandidateDetailView::phiMin ( )
inlineprivate

Definition at line 57 of file FWPFCandidateDetailView.h.

References m_range, and phi().

◆ plotEtChanged()

void FWPFCandidateDetailView::plotEtChanged ( )
private

Definition at line 129 of file FWPFCandidateDetailView.cc.

References buildGLEventScene(), and m_plotEt.

Referenced by build().

129  {
130  printf("plotEt = %d \n", m_plotEt);
131  m_plotEt = !m_plotEt;
133 }

◆ rangeChanged()

void FWPFCandidateDetailView::rangeChanged ( int  x)
private

Definition at line 84 of file FWPFCandidateDetailView.cc.

References buildGLEventScene(), m_eventList, m_range, and x.

Referenced by build().

84  {
85  static float kSliderRangeFactor = 0.2;
86 
87  m_range = x * kSliderRangeFactor;
88 
89  if (m_eventList)
91 
92  gEve->Redraw3D();
93 }

◆ rnrHcalChanged()

void FWPFCandidateDetailView::rnrHcalChanged ( )
private

Definition at line 135 of file FWPFCandidateDetailView.cc.

References buildGLEventScene(), and m_rnrHcal.

Referenced by build().

135  {
136  printf("rnrHcal = %d \n", m_rnrHcal);
137  m_rnrHcal = !m_rnrHcal;
139 }

◆ setTextInfo()

void FWPFCandidateDetailView::setTextInfo ( const FWModelId id,
const reco::PFCandidate track 
)
overrideprivatevirtual

Implements FWDetailView< reco::PFCandidate >.

Definition at line 97 of file FWPFCandidateDetailView.cc.

References FWDetailViewBase::item(), FWDetailViewGL< reco::PFCandidate >::m_infoCanvas, m_legend, ecalBarrelClusterFastTimer_cfi::modelName, HLT_2023v12_cff::track, x, and y.

Referenced by build().

97  {
98  m_infoCanvas->cd();
99 
100  float_t x = 0.02;
101  float y = 0.95;
102 
103  TLatex* latex = new TLatex(x, y, "");
104  const double textsize(0.07);
105  latex->SetTextSize(textsize);
106 
107  latex->DrawLatex(x, y, id.item()->modelName(id.index()).c_str());
108  y -= latex->GetTextSize() * 0.6;
109 
110  latex->SetTextSize(textsize);
111  float lineH = latex->GetTextSize() * 0.6;
112 
113  latex->DrawLatex(
114  x, y, Form(" P_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f", track->pt(), track->eta(), track->phi()));
115  y -= lineH;
116 
117  if (track->charge() > 0)
118  latex->DrawLatex(x, y, " charge = +1");
119  else
120  latex->DrawLatex(x, y, " charge = -1");
121  y -= lineH;
122  y -= lineH;
123 
124  m_legend->SetY2(y);
125  m_legend->Draw();
126  m_legend = nullptr; // Deleted together with TPad.
127 }
const FWEventItem * item()

◆ voteMaxEtEVal()

void FWPFCandidateDetailView::voteMaxEtEVal ( const std::vector< reco::PFRecHit > *  hits)
private

Definition at line 233 of file FWPFCandidateDetailView.cc.

References FWPFMaths::calculateEt(), FWEventItem::context(), hfClusterShapes_cfi::hits, FWDetailViewBase::item(), and fireworks::Context::voteMaxEtAndEnergy().

Referenced by build().

233  {
234  if (!hits)
235  return;
236 
237  // FIXME: require access to geometry while reading from reco file
238  if ((!hits->empty()) && hits->front().hasCaloCell())
239  for (std::vector<reco::PFRecHit>::const_iterator it = hits->begin(); it != hits->end(); ++it) {
240  TEveVector centre(it->position().x(), it->position().y(), it->position().z());
241  float E = it->energy();
242  float Et = FWPFMaths::calculateEt(centre, E);
243  item()->context().voteMaxEtAndEnergy(Et, E);
244  }
245 }
const FWEventItem * item()
const fireworks::Context & context() const
Definition: FWEventItem.h:121
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:169
float calculateEt(const TEveVector &centre, float e)
Definition: FWPFMaths.cc:115

Member Data Documentation

◆ m_candidate

const reco::PFCandidate* FWPFCandidateDetailView::m_candidate
private

Definition at line 61 of file FWPFCandidateDetailView.h.

Referenced by build(), eta(), isPntInRng(), and phi().

◆ m_eventList

TEveElementList* FWPFCandidateDetailView::m_eventList
private

◆ m_legend

TLegend* FWPFCandidateDetailView::m_legend
private

Definition at line 63 of file FWPFCandidateDetailView.h.

Referenced by makeLegend(), and setTextInfo().

◆ m_plotEt

bool FWPFCandidateDetailView::m_plotEt
private

Definition at line 70 of file FWPFCandidateDetailView.h.

Referenced by addHits(), and plotEtChanged().

◆ m_range

float FWPFCandidateDetailView::m_range
private

Definition at line 60 of file FWPFCandidateDetailView.h.

Referenced by etaMax(), etaMin(), isPntInRng(), phiMax(), phiMin(), and rangeChanged().

◆ m_rnrHcal

bool FWPFCandidateDetailView::m_rnrHcal
private

Definition at line 72 of file FWPFCandidateDetailView.h.

Referenced by buildGLEventScene(), and rnrHcalChanged().

◆ m_slider

TGSlider* FWPFCandidateDetailView::m_slider
private

Definition at line 65 of file FWPFCandidateDetailView.h.

Referenced by build().

◆ m_sliderListener

FWIntValueListener* FWPFCandidateDetailView::m_sliderListener
private

Definition at line 66 of file FWPFCandidateDetailView.h.

Referenced by build().