Belle II Software development
EventDataPlotter Class Reference

A class that can plot event related data types. More...

#include <EventDataPlotter.h>

Public Types

using AttributeMap = PrimitivePlotter::AttributeMap
 Forward the Attribute map from the primitive plotter.
 

Public Member Functions

 EventDataPlotter (bool animate=false, bool forwardFade=false)
 Default constructor for ROOT compatibility. Uses an SVGPrimitivePlotter as backend.
 
 EventDataPlotter (std::unique_ptr< PrimitivePlotter > ptrPrimitivePlotter, bool animate=false, bool forwardFade=false)
 Constructor taking the specific PrimitivePlotter instance as backend.
 
 EventDataPlotter (const EventDataPlotter &eventDataPlotter)
 Copy constructor.
 
const std::string save (const std::string &fileName)
 Saves the current plot stead to a file.
 
void clear ()
 Clears all drawn elements from the plotter.
 
BoundingBox getBoundingBox () const
 Getter for the current bounding box.
 
void setBoundingBox (const BoundingBox &boundingBox)
 Setter for the bounding box of all drawn objects.
 
float getCanvasWidth () const
 Getter for the canvas width in pixels.
 
float getCanvasHeight () const
 Getter for the canvas height in pixels.
 
void setCanvasWidth (float width)
 Setter for the canvas width in pixels.
 
void setCanvasHeight (float height)
 Setter for the canvas height in pixels The canvas height denotes the size of the image being produced.
 
void startGroup (const AttributeMap &attributeMap=AttributeMap())
 Indicates the start of a group of drawn elements.
 
void endGroup ()
 Indicates the end of a group of drawn elements.
 
std::string getAnimationTimeFromNanoSeconds (float nanoseconds)
 Converts a time given in nanoseconds to a time string of the from "%fs".
 
void drawInteractionPoint ()
 Marks the position of the interaction point with a filled circle.
 
void drawInnerCDCWall (const AttributeMap &attributeMap=AttributeMap())
 Draw the inner wall of the CDC.
 
void drawOuterCDCWall (const AttributeMap &attributeMap=AttributeMap())
 Draw the outer wall of the CDC.
 
void drawSuperLayerBoundaries (const AttributeMap &attributeMap=AttributeMap())
 Draw the super layer bounds of the CDC.
 
void drawLine (float startX, float startY, float endX, float endY, const AttributeMap &attributeMap=AttributeMap())
 Draws a straight Line.
 
void draw (const TrackingUtilities::Circle2D &circle, AttributeMap attributeMap=AttributeMap())
 Draws a filled circle.
 
void draw (const CDC::CDCWire &wire, const AttributeMap &attributeMap=AttributeMap())
 Draws the CDCWire as a small circle at the reference position.
 
void draw (const CDC::CDCWireSuperLayer &wireSuperLayer, const AttributeMap &attributeMap=AttributeMap())
 Draws the inner and the outer bound of the super layer.
 
void draw (const CDC::CDCWireTopology &wireTopology, AttributeMap attributeMap=AttributeMap())
 Draws the all wires in the CDC.
 
void draw (const CDCSimHit &simHit, const AttributeMap &attributeMap=AttributeMap())
 Draws the CDCSimHit as a momentum arrow starting at the track position with a length proportional to its momentum.
 
void draw (const CDCHit &hit, const AttributeMap &attributeMap=AttributeMap())
 Draws the CDCHit as the wire position and its drift circle at the wire reference position.
 
void draw (const TrackingUtilities::CDCWireHit &wireHit, const AttributeMap &attributeMap=AttributeMap())
 Draws the CDCWireHit as the wire position and its drift circle at the wire reference position.
 
void draw (const TrackingUtilities::CDCRecoHit2D &recoHit2D, const AttributeMap &attributeMap=AttributeMap())
 Draws the TrackingUtilities::CDCRecoHit2D as a drift circle at the two dimensional reference wire position and a point at the reconstructed position""".
 
void draw (const TrackingUtilities::CDCRecoHit3D &recoHit3D, const AttributeMap &attributeMap=AttributeMap())
 Draws the CDCRecoHit3D as a drift circle at the two dimensional reference wire position and a point at the reconstructed position""".
 
void draw (const TrackingUtilities::CDCTangent &tangent, const AttributeMap &attributeMap=AttributeMap())
 Draws the CDCRecoHit3D as a drift circle at the two dimensional reference wire position and a point at the reconstructed position""".
 
void draw (const TrackingUtilities::CDCTrajectory2D &trajectory2D, AttributeMap attributeMap=AttributeMap())
 Draws the CDCTrajectory from the start point until it first exits the CDC.
 
void draw (const TrackingUtilities::CDCWireHitCluster &wireHitCluster, const AttributeMap &attributeMap=AttributeMap())
 Draws all CDCWireHits of the cluster.
 
void draw (const TrackingUtilities::CDCSegment2D &segment2D, const AttributeMap &attributeMap=AttributeMap())
 Draws all CDCRecoHits2D of the segment.
 
void draw (const TrackingUtilities::CDCSegment3D &segment3D, const AttributeMap &attributeMap=AttributeMap())
 Draws all CDCRecoHits3D of the segment.
 
void draw (const TrackingUtilities::CDCAxialSegmentPair &axialSegmentPair, const AttributeMap &attributeMap=AttributeMap())
 Draws the pair of segments as an arrow connecting the centers of them.
 
void draw (const TrackingUtilities::CDCSegmentPair &segmentPair, const AttributeMap &attributeMap=AttributeMap())
 Draws the pair of segments as an arrow connecting the centers of them.
 
void draw (const TrackingUtilities::CDCSegmentTriple &segmentTriple, const AttributeMap &attributeMap=AttributeMap())
 Draws the triple of segments as two arrows connecting the centers from start to the middle segment and from the middle to the end segment.
 
void draw (const TrackingUtilities::CDCTrack &track, const AttributeMap &attributeMap=AttributeMap())
 Draws all CDCRecoHits3D of the segment.
 
void draw (const RecoTrack &recoTrack, const AttributeMap &attributeMap=AttributeMap())
 Draws the hit content of the RecoTrack.
 
void drawTrajectory (const MCParticle &mcParticle, const AttributeMap &attributeMap=AttributeMap())
 Draws the trajectory that is represented by the MC particle.
 
void drawTrajectory (const TrackingUtilities::CDCSegment2D &segment, const AttributeMap &attributeMap=AttributeMap())
 Draws trajectory of the CDCSegment2D.
 
void drawTrajectory (const TrackingUtilities::CDCSegmentTriple &segmentTriple, const AttributeMap &attributeMap=AttributeMap())
 Draws trajectory of the CDCSegmentTriple.
 
void drawTrajectory (const TrackingUtilities::CDCTrack &track, const AttributeMap &attributeMap=AttributeMap())
 Draws trajectory of the CDCTrack.
 
void drawTrajectory (const RecoTrack &recoTrack, const AttributeMap &attributeMap=AttributeMap())
 Draws curve along the fitted points of the RecoTrack.
 
template<class T>
void draw (const T *ptr, const AttributeMap &attributeMap=AttributeMap())
 Allow the drawing of pointers checking if the pointer is nonzero.
 
template<class T>
void draw (const StoreArray< T > &storeArray, const AttributeMap &attributeMap=AttributeMap())
 Draw store array.
 
template<class ARange>
void drawRange (const ARange &range, const AttributeMap &attributeMap=AttributeMap())
 Draws a range iterable collection of drawable elements.
 
template<class ARange>
void drawRangeWithFade (const ARange &range, const AttributeMap &attributeMap=AttributeMap())
 Draws a range iterable collection of drawable elements.
 

Private Member Functions

void startAnimationGroup (const Belle2::CDCSimHit &simHit)
 Start a group in the underlying plotter with an animation uncovering the elements at the time of flight of the CDCSimHit.
 
void startAnimationGroup (const Belle2::CDCHit *ptrHit)
 Start a group in the underlying plotter with an animation uncovering the elements at the time of flight of the related CDCSimHit.
 

Private Attributes

std::unique_ptr< PrimitivePlotterm_ptrPrimitivePlotter
 Reference to the primitivePlotter instance used as backend for the draw commands.
 
bool m_animate = false
 Memory for the flag if the event data should be animated. If animation is supported is backend dependent.
 
bool m_forwardFade = false
 Memory for the flag whether the orientation of tracks segments etc should be shown as dimming opacity.
 

Detailed Description

A class that can plot event related data types.

Definition at line 53 of file EventDataPlotter.h.

Member Typedef Documentation

◆ AttributeMap

Forward the Attribute map from the primitive plotter.

Definition at line 58 of file EventDataPlotter.h.

Constructor & Destructor Documentation

◆ EventDataPlotter() [1/3]

EventDataPlotter ( bool animate = false,
bool forwardFade = false )
explicit

Default constructor for ROOT compatibility. Uses an SVGPrimitivePlotter as backend.

Definition at line 48 of file EventDataPlotter.cc.

49 : m_ptrPrimitivePlotter(new SVGPrimitivePlotter(
50 AttributeMap{{"stroke", "orange"}, {"stroke-width", "0.55"}, {"fill", "none"}}))
51, m_animate(animate)
52, m_forwardFade(forwardFade)
53{
54}
bool m_forwardFade
Memory for the flag whether the orientation of tracks segments etc should be shown as dimming opacity...
PrimitivePlotter::AttributeMap AttributeMap
Forward the Attribute map from the primitive plotter.
bool m_animate
Memory for the flag if the event data should be animated. If animation is supported is backend depend...
std::unique_ptr< PrimitivePlotter > m_ptrPrimitivePlotter
Reference to the primitivePlotter instance used as backend for the draw commands.

◆ EventDataPlotter() [2/3]

EventDataPlotter ( std::unique_ptr< PrimitivePlotter > ptrPrimitivePlotter,
bool animate = false,
bool forwardFade = false )
explicit

Constructor taking the specific PrimitivePlotter instance as backend.

Note that the EventDataPlotter takes ownership of the PrimitivePlotter and destroys it on its on own deconstruction.

Definition at line 56 of file EventDataPlotter.cc.

59 : m_ptrPrimitivePlotter(std::move(ptrPrimitivePlotter))
60 , m_animate(animate)
61 , m_forwardFade(forwardFade)
62{
63 B2ASSERT("EventDataPlotter initialized with nullptr. Using default backend SVGPrimitivePlotter.",
65}

◆ EventDataPlotter() [3/3]

EventDataPlotter ( const EventDataPlotter & eventDataPlotter)

Copy constructor.

Definition at line 67 of file EventDataPlotter.cc.

68 : m_ptrPrimitivePlotter(eventDataPlotter.m_ptrPrimitivePlotter->clone())
69 , m_animate(eventDataPlotter.m_animate)
70 , m_forwardFade(eventDataPlotter.m_forwardFade)
71{
72}

Member Function Documentation

◆ clear()

void clear ( )

Clears all drawn elements from the plotter.

Definition at line 84 of file EventDataPlotter.cc.

85{
87 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
88 return primitivePlotter.clear();
89 }
90}
virtual void clear()
Clears all drawn elements from the plotter.

◆ draw() [1/21]

void draw ( const CDC::CDCWire & wire,
const AttributeMap & attributeMap = AttributeMap() )

Draws the CDCWire as a small circle at the reference position.

------------------— Draw CDCWire ---------------------—

Definition at line 294 of file EventDataPlotter.cc.

295{
296 const float wireRadius = 0.25;
297 const Vector2D& refPos = wire.getRefPos2D();
298
299 draw(Circle2D(refPos, wireRadius), attributeMap);
300}
const ROOT::Math::XYVector & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
Definition CDCWire.h:221
void draw(const TrackingUtilities::Circle2D &circle, AttributeMap attributeMap=AttributeMap())
Draws a filled circle.

◆ draw() [2/21]

void draw ( const CDC::CDCWireSuperLayer & wireSuperLayer,
const AttributeMap & attributeMap = AttributeMap() )

Draws the inner and the outer bound of the super layer.

------------------— Draw CDCWireSuperLayer ---------------------—

Definition at line 303 of file EventDataPlotter.cc.

305{
306 if (not m_ptrPrimitivePlotter) return;
307 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
308
309 primitivePlotter.startGroup(attributeMap);
310 for (const CDCWireLayer& wireLayer : wireSuperLayer) {
311 for (const CDCWire& wire : wireLayer) {
312 draw(wire);
313 }
314 }
315 primitivePlotter.endGroup();
316}
virtual void startGroup(const AttributeMap &attributeMap=AttributeMap())
Indicates the start of a group of drawn elements.
virtual void endGroup()
Indicates the end of a group of drawn elements.

◆ draw() [3/21]

void draw ( const CDC::CDCWireTopology & wireTopology,
AttributeMap attributeMap = AttributeMap() )

Draws the all wires in the CDC.

------------------— Draw CDCWireTopology---------------------—

Definition at line 319 of file EventDataPlotter.cc.

320{
321 for (const CDCWireSuperLayer& wireSuperLayer : wireTopology.getWireSuperLayers()) {
322 AttributeMap defaultSuperLayerAttributeMap{{"fill",
323 wireSuperLayer.isAxial() ? "black" : "gray"
324 },
325 {"stroke", "none"}};
326
327 AttributeMap superLayerAttributeMap(attributeMap);
328
329 // Insert the values as defaults. Does not overwrite attributes with the same name.
330 superLayerAttributeMap.insert(defaultSuperLayerAttributeMap.begin(),
331 defaultSuperLayerAttributeMap.end());
332 draw(wireSuperLayer, superLayerAttributeMap);
333 }
334}
const std::vector< CDCWireSuperLayer > & getWireSuperLayers() const
Getter for the underlying storing superlayer vector.

◆ draw() [4/21]

void draw ( const CDCHit & hit,
const AttributeMap & attributeMap = AttributeMap() )

Draws the CDCHit as the wire position and its drift circle at the wire reference position.

------------------— Draw CDCHit ---------------------—

Definition at line 365 of file EventDataPlotter.cc.

366{
367 CDCWireHit wireHit(&hit);
368 draw(wireHit, attributeMap);
369}

◆ draw() [5/21]

void draw ( const CDCSimHit & simHit,
const AttributeMap & attributeMap = AttributeMap() )

Draws the CDCSimHit as a momentum arrow starting at the track position with a length proportional to its momentum.

------------------— Draw CDCSimHit ---------------------—

Definition at line 337 of file EventDataPlotter.cc.

338{
339 if (not m_ptrPrimitivePlotter) return;
340 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
341
342 startAnimationGroup(simHit);
343
344 // Draw hit position as a small circle
345 ROOT::Math::XYZVector position = simHit.getPosTrack();
346 float x = position.X();
347 float y = position.Y();
348 float radius = 0.2;
349
350 primitivePlotter.drawCircle(x, y, radius, attributeMap);
351
352 // Draw momentum as an arrow proportional to the transverse component of the momentum
353 const float momentumToArrowLength = 1.5;
354
355 ROOT::Math::XYZVector momentum = simHit.getMomentum();
356 float endX = x + momentum.X() * momentumToArrowLength;
357 float endY = y + momentum.Y() * momentumToArrowLength;
358
359 primitivePlotter.drawArrow(x, y, endX, endY, attributeMap);
360
361 primitivePlotter.endGroup();
362}
B2Vector3D getPosTrack() const
The method to get position on the track.
Definition CDCSimHit.h:216
B2Vector3D getMomentum() const
The method to get momentum.
Definition CDCSimHit.h:192
void startAnimationGroup(const Belle2::CDCSimHit &simHit)
Start a group in the underlying plotter with an animation uncovering the elements at the time of flig...
virtual void drawArrow(float startX, float startY, float endX, float endY, const AttributeMap &attributeMap=AttributeMap())
Adds an arrow to the plot.
virtual void drawCircle(float centerX, float centerY, float radius, const AttributeMap &attributeMap=AttributeMap())
Adds a circle to the plot.

◆ draw() [6/21]

void draw ( const RecoTrack & recoTrack,
const AttributeMap & attributeMap = AttributeMap() )

Draws the hit content of the RecoTrack.

Definition at line 689 of file EventDataPlotter.cc.

690{
691 if (not m_ptrPrimitivePlotter) return;
692 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
693
694 primitivePlotter.startGroup(attributeMap);
695 for (const CDCHit* ptrHit : recoTrack.getCDCHitList()) {
696 if (ptrHit) {
697 const CDCHit& hit = *ptrHit;
698 draw(hit);
699 }
700 }
701 primitivePlotter.endGroup();
702}
std::vector< Belle2::RecoTrack::UsedCDCHit * > getCDCHitList() const
Return an unsorted list of cdc hits.
Definition RecoTrack.h:455

◆ draw() [7/21]

template<class T>
void draw ( const StoreArray< T > & storeArray,
const AttributeMap & attributeMap = AttributeMap() )
inline

Draw store array.

Definition at line 259 of file EventDataPlotter.h.

260 {
261 if (not storeArray) return;
262 drawRange(storeArray, attributeMap);
263 }

◆ draw() [8/21]

template<class T>
void draw ( const T * ptr,
const AttributeMap & attributeMap = AttributeMap() )
inline

Allow the drawing of pointers checking if the pointer is nonzero.

Definition at line 252 of file EventDataPlotter.h.

253 {
254 if (ptr) draw(*ptr, attributeMap);
255 }

◆ draw() [9/21]

void draw ( const TrackingUtilities::CDCAxialSegmentPair & axialSegmentPair,
const AttributeMap & attributeMap = AttributeMap() )

Draws the pair of segments as an arrow connecting the centers of them.

Definition at line 552 of file EventDataPlotter.cc.

554{
555 if (not m_ptrPrimitivePlotter) return;
556 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
557
558 const CDCSegment2D* ptrFromSegment = axialSegmentPair.getStartSegment();
559 const CDCSegment2D* ptrToSegment = axialSegmentPair.getEndSegment();
560
561 if (not ptrFromSegment or not ptrToSegment) return;
562
563 const CDCSegment2D& fromSegment = *ptrFromSegment;
564 const CDCSegment2D& toSegment = *ptrToSegment;
565
566 const Vector2D& fromPos = fromSegment.back().getWire().getRefPos2D();
567 const Vector2D& toPos = toSegment.front().getWire().getRefPos2D();
568
569 if (fromPos.hasNAN()) {
570 B2WARNING("Center of mass of first segment in a pair contains NAN values.");
571 return;
572 }
573
574 if (toPos.hasNAN()) {
575 B2WARNING("Center of mass of second segment in a pair contains NAN values.");
576 return;
577 }
578
579 const float fromX = fromPos.x();
580 const float fromY = fromPos.y();
581
582 const float toX = toPos.x();
583 const float toY = toPos.y();
584
585 primitivePlotter.drawArrow(fromX, fromY, toX, toY, attributeMap);
586}
double x() const
Getter for the x coordinate.
Definition Vector2D.h:626
bool hasNAN() const
Checks if one of the coordinates is NAN.
Definition Vector2D.h:169
double y() const
Getter for the y coordinate.
Definition Vector2D.h:641

◆ draw() [10/21]

void draw ( const TrackingUtilities::CDCRecoHit2D & recoHit2D,
const AttributeMap & attributeMap = AttributeMap() )

Draws the TrackingUtilities::CDCRecoHit2D as a drift circle at the two dimensional reference wire position and a point at the reconstructed position""".

------------------— Draw CDCRecoHit2D ---------------------—

Definition at line 393 of file EventDataPlotter.cc.

394{
395 if (not m_ptrPrimitivePlotter) return;
396 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
397
398 const CDCWireHit& wireHit = recoHit2D.getWireHit();
399
400 startAnimationGroup(wireHit.getHit());
401
402 const Vector2D& refPos2D = wireHit.getRefPos2D();
403 const Vector2D& recoPos2D = recoHit2D.getRecoPos2D();
404
405 float x = refPos2D.x();
406 float y = refPos2D.y();
407 float radius = wireHit.getRefDriftLength();
408 primitivePlotter.drawCircle(x, y, radius, attributeMap);
409
410 if (not recoPos2D.hasNAN()) {
411 float supportPointRadius = 0.2;
412 Circle2D supportPoint(recoPos2D, supportPointRadius);
413 draw(supportPoint, attributeMap);
414 }
415
416 primitivePlotter.endGroup();
417}
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition CDCWireHit.h:162
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition CDCWireHit.h:227
const ROOT::Math::XYVector & getRefPos2D() const
The two dimensional reference position (z=0) of the underlying wire.

◆ draw() [11/21]

void draw ( const TrackingUtilities::CDCRecoHit3D & recoHit3D,
const AttributeMap & attributeMap = AttributeMap() )

Draws the CDCRecoHit3D as a drift circle at the two dimensional reference wire position and a point at the reconstructed position""".

Definition at line 443 of file EventDataPlotter.cc.

445{
446 draw(recoHit3D.getRecoHit2D(), attributeMap);
447}

◆ draw() [12/21]

void draw ( const TrackingUtilities::CDCSegment2D & segment2D,
const AttributeMap & attributeMap = AttributeMap() )

Draws all CDCRecoHits2D of the segment.

Definition at line 534 of file EventDataPlotter.cc.

535{
536 if (m_forwardFade) {
537 drawRangeWithFade(segment2D, attributeMap);
538 } else {
539 drawRange(segment2D, attributeMap);
540 }
541}
void drawRange(const ARange &range, const AttributeMap &attributeMap=AttributeMap())
Draws a range iterable collection of drawable elements.
void drawRangeWithFade(const ARange &range, const AttributeMap &attributeMap=AttributeMap())
Draws a range iterable collection of drawable elements.

◆ draw() [13/21]

void draw ( const TrackingUtilities::CDCSegment3D & segment3D,
const AttributeMap & attributeMap = AttributeMap() )

Draws all CDCRecoHits3D of the segment.

Definition at line 543 of file EventDataPlotter.cc.

544{
545 if (m_forwardFade) {
546 drawRange(segment3D, attributeMap);
547 } else {
548 drawRange(segment3D, attributeMap);
549 }
550}

◆ draw() [14/21]

void draw ( const TrackingUtilities::CDCSegmentPair & segmentPair,
const AttributeMap & attributeMap = AttributeMap() )

Draws the pair of segments as an arrow connecting the centers of them.

Definition at line 588 of file EventDataPlotter.cc.

589{
590 if (not m_ptrPrimitivePlotter) return;
591 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
592
593 const CDCSegment2D* ptrFromSegment = segmentPair.getFromSegment();
594 const CDCSegment2D* ptrToSegment = segmentPair.getToSegment();
595
596 if (not ptrFromSegment or not ptrToSegment) return;
597
598 const CDCSegment2D& fromSegment = *ptrFromSegment;
599 const CDCSegment2D& toSegment = *ptrToSegment;
600
601 const Vector2D& fromPos = fromSegment.back().getWire().getRefPos2D();
602 const Vector2D& toPos = toSegment.front().getWire().getRefPos2D();
603
604 if (fromPos.hasNAN()) {
605 B2WARNING("Center of mass of first segment in a pair contains NAN values.");
606 return;
607 }
608
609 if (toPos.hasNAN()) {
610 B2WARNING("Center of mass of second segment in a pair contains NAN values.");
611 return;
612 }
613
614 const float fromX = fromPos.x();
615 const float fromY = fromPos.y();
616
617 const float toX = toPos.x();
618 const float toY = toPos.y();
619
620 primitivePlotter.drawArrow(fromX, fromY, toX, toY, attributeMap);
621}

◆ draw() [15/21]

void draw ( const TrackingUtilities::CDCSegmentTriple & segmentTriple,
const AttributeMap & attributeMap = AttributeMap() )

Draws the triple of segments as two arrows connecting the centers from start to the middle segment and from the middle to the end segment.

Definition at line 623 of file EventDataPlotter.cc.

624{
625 if (not m_ptrPrimitivePlotter) return;
626 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
627
628 const CDCSegment2D* ptrStartSegment = segmentTriple.getStartSegment();
629 const CDCSegment2D* ptrMiddleSegment = segmentTriple.getMiddleSegment();
630 const CDCSegment2D* ptrEndSegment = segmentTriple.getEndSegment();
631
632 if (not ptrStartSegment or not ptrMiddleSegment or not ptrEndSegment) return;
633
634 const CDCSegment2D& startSegment = *ptrStartSegment;
635 const CDCSegment2D& middleSegment = *ptrMiddleSegment;
636 const CDCSegment2D& endSegment = *ptrEndSegment;
637
638 const Vector2D& startBackPos2D = startSegment.back().getRefPos2D();
639 const Vector2D& middleFrontPos2D = middleSegment.front().getRefPos2D();
640 const Vector2D& middleBackPos2D = middleSegment.back().getRefPos2D();
641 const Vector2D& endFrontPos2D = endSegment.front().getRefPos2D();
642
643 if (startBackPos2D.hasNAN()) {
644 B2WARNING("Back position of start segment in a triple contains NAN values.");
645 return;
646 }
647
648 if (middleFrontPos2D.hasNAN()) {
649 B2WARNING("Front position of middle segment in a triple contains NAN values.");
650 return;
651 }
652
653 if (middleBackPos2D.hasNAN()) {
654 B2WARNING("Back position of middle segment in a triple contains NAN values.");
655 return;
656 }
657
658 if (endFrontPos2D.hasNAN()) {
659 B2WARNING("Front position of end segment in a triple contains NAN values.");
660 return;
661 }
662
663 const float startBackX = startBackPos2D.x();
664 const float startBackY = startBackPos2D.y();
665
666 const float middleFrontX = middleFrontPos2D.x();
667 const float middleFrontY = middleFrontPos2D.y();
668
669 primitivePlotter.drawArrow(startBackX, startBackY, middleFrontX, middleFrontY, attributeMap);
670
671 const float middleBackX = middleBackPos2D.x();
672 const float middleBackY = middleBackPos2D.y();
673
674 const float endFrontX = endFrontPos2D.x();
675 const float endFrontY = endFrontPos2D.y();
676
677 primitivePlotter.drawArrow(middleBackX, middleBackY, endFrontX, endFrontY, attributeMap);
678}

◆ draw() [16/21]

void draw ( const TrackingUtilities::CDCTangent & tangent,
const AttributeMap & attributeMap = AttributeMap() )

Draws the CDCRecoHit3D as a drift circle at the two dimensional reference wire position and a point at the reconstructed position""".

------------------— Draw CDCRecoHit2D ---------------------—

Definition at line 420 of file EventDataPlotter.cc.

421{
422 if (not m_ptrPrimitivePlotter) return;
423 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
424
425 const Vector2D fromPos = tangent.getFromRecoPos2D();
426 const float fromX = fromPos.x();
427 const float fromY = fromPos.y();
428
429 const Vector2D toPos = tangent.getToRecoPos2D();
430 const float toX = toPos.x();
431 const float toY = toPos.y();
432
433 primitivePlotter.drawLine(fromX, fromY, toX, toY, attributeMap);
434
435 float touchPointRadius = 0.015;
436 const Circle2D fromTouchPoint(fromPos, touchPointRadius);
437 draw(fromTouchPoint, attributeMap);
438
439 const Circle2D toTouchPoint(toPos, touchPointRadius);
440 draw(toTouchPoint, attributeMap);
441}
virtual void drawLine(float startX, float startY, float endX, float endY, const AttributeMap &attributeMap=AttributeMap())
Adds a line to the plot.

◆ draw() [17/21]

void draw ( const TrackingUtilities::CDCTrack & track,
const AttributeMap & attributeMap = AttributeMap() )

Draws all CDCRecoHits3D of the segment.

Definition at line 680 of file EventDataPlotter.cc.

681{
682 if (m_forwardFade) {
683 drawRangeWithFade(track, attributeMap);
684 } else {
685 drawRange(track, attributeMap);
686 }
687}

◆ draw() [18/21]

void draw ( const TrackingUtilities::CDCTrajectory2D & trajectory2D,
AttributeMap attributeMap = AttributeMap() )

Draws the CDCTrajectory from the start point until it first exits the CDC.

------------------— Draw CDCTrajectory2D ---------------------—

Definition at line 450 of file EventDataPlotter.cc.

451{
452 if (not m_ptrPrimitivePlotter) return;
453 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
454
455 AttributeMap defaultAttributeMap{};
456
457 // Make the default color charge dependent
458 int charge = trajectory2D.getChargeSign();
459 if (charge > 0) {
460 defaultAttributeMap["stroke"] = "red";
461 } else if (charge < 0) {
462 defaultAttributeMap["stroke"] = "blue";
463 } else {
464 defaultAttributeMap["stroke"] = "green";
465 }
466
467 // Add attributes if not present
468 attributeMap.insert(defaultAttributeMap.begin(), defaultAttributeMap.end());
469
470 Vector2D trajectoryExit = trajectory2D.getOuterExit();
471 if (trajectoryExit.hasNAN()) {
472 // Curlers do not leave the CDC
473 // Stop the trajectory at the inner wall to be able to
474 // see the start point
475 trajectoryExit = trajectory2D.getInnerExit();
476 }
477
478 if (trajectory2D.getLocalCircle()->isCircle()) {
479 if (trajectoryExit.hasNAN()) {
480 // No exit point out of the cdc could be detected.
481 // Draw full circle
482 const float radius = trajectory2D.getLocalCircle()->absRadius();
483 const Vector2D center = trajectory2D.getGlobalCircle().center();
484 float centerX = center.x();
485 float centerY = center.y();
486
487 primitivePlotter.drawCircle(centerX, centerY, radius);
488
489 } else {
490 const float radius = trajectory2D.getLocalCircle()->absRadius();
491 const Vector2D start = trajectory2D.getSupport();
492 float startX = start.x();
493 float startY = start.y();
494
495 float endX = trajectoryExit.x();
496 float endY = trajectoryExit.y();
497
498 const int curvature = -charge;
499 const bool sweepFlag = curvature > 0;
500
501 // check if exit point is on the close or
502 // on the far side of the circle
503 const bool longArc = (trajectory2D.calcArcLength2D(trajectoryExit) > 0) ? false : true;
504 primitivePlotter.drawCircleArc(startX,
505 startY,
506 endX,
507 endY,
508 radius,
509 longArc,
510 sweepFlag,
511 attributeMap);
512 }
513 } else {
514 // trajectory is a straight line
515 if (trajectoryExit.hasNAN()) {
516 B2WARNING("Could not compute point off exit in a straight line case.");
517 } else {
518 const Vector2D start = trajectory2D.getSupport();
519 float startX = start.x();
520 float startY = start.y();
521
522 float endX = trajectoryExit.x();
523 float endY = trajectoryExit.y();
524 primitivePlotter.drawLine(startX, startY, endX, endY, attributeMap);
525 }
526 }
527}
virtual void drawCircleArc(float startX, float startY, float endX, float endY, float radius, bool longArc, bool sweepFlag, const AttributeMap &attributeMap=AttributeMap())
Adds a circle arc to the plot.

◆ draw() [19/21]

void draw ( const TrackingUtilities::CDCWireHit & wireHit,
const AttributeMap & attributeMap = AttributeMap() )

Draws the CDCWireHit as the wire position and its drift circle at the wire reference position.

------------------— Draw CDCWireHit ---------------------—

Definition at line 372 of file EventDataPlotter.cc.

373{
374 if (not m_ptrPrimitivePlotter) return;
375 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
376
377 startAnimationGroup(wireHit.getHit());
378
379 const Vector2D& refPos = wireHit.getRefPos2D();
380
381 float x = refPos.x();
382 float y = refPos.y();
383 float radius = wireHit.getRefDriftLength();
384
385 if (fabs(radius) < 100) {
386 primitivePlotter.drawCircle(x, y, radius, attributeMap);
387 }
388
389 primitivePlotter.endGroup();
390}

◆ draw() [20/21]

void draw ( const TrackingUtilities::CDCWireHitCluster & wireHitCluster,
const AttributeMap & attributeMap = AttributeMap() )

Draws all CDCWireHits of the cluster.

Definition at line 529 of file EventDataPlotter.cc.

530{
531 drawRange(wireHitCluster, attributeMap);
532}

◆ draw() [21/21]

void draw ( const TrackingUtilities::Circle2D & circle,
AttributeMap attributeMap = AttributeMap() )

Draws a filled circle.

------------------— Draw Circle2D ---------------------—

Definition at line 271 of file EventDataPlotter.cc.

272{
273 if (not m_ptrPrimitivePlotter) return;
274 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
275
276 float radius = circle.radius();
277
278 if (not attributeMap.count("fill") or attributeMap["fill"] != "") {
279 if (attributeMap.count("stroke")) {
280 attributeMap["fill"] = attributeMap["stroke"];
281 attributeMap.erase("stroke");
282 }
283 }
284
285 const Vector2D& pos = circle.center();
286
287 float x = pos.x();
288 float y = pos.y();
289
290 primitivePlotter.drawCircle(x, y, radius, attributeMap);
291}

◆ drawInnerCDCWall()

void drawInnerCDCWall ( const AttributeMap & attributeMap = AttributeMap())

Draw the inner wall of the CDC.

Definition at line 210 of file EventDataPlotter.cc.

211{
212 if (not m_ptrPrimitivePlotter) return;
213 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
214
215 const CDCWireTopology& wireTopology = CDCWireTopology::getInstance();
216
217 const CDCWireSuperLayer& wireSuperLayer = wireTopology.getWireSuperLayers().front();
218
219 float centerX = 0.0;
220 float centerY = 0.0;
221 float innerR = wireSuperLayer.getInnerCylindricalR();
222
223 primitivePlotter.drawCircle(centerX, centerY, innerR, attributeMap);
224}
double getInnerCylindricalR() const
Getter for the inner radius of the layer as retrieved from the CDCGeometryPar by the inner most layer...
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.

◆ drawInteractionPoint()

void drawInteractionPoint ( )

Marks the position of the interaction point with a filled circle.

Definition at line 198 of file EventDataPlotter.cc.

199{
200 Vector2D center(0.0, 0.0);
201 float radius = 1.0;
202
203 const Circle2D interactionPoint(center, radius);
204
205 AttributeMap attributeMap{{"fill", "black"}, {"stroke-width", "0"}};
206
207 draw(interactionPoint, attributeMap);
208}

◆ drawLine()

void drawLine ( float startX,
float startY,
float endX,
float endY,
const AttributeMap & attributeMap = AttributeMap() )

Draws a straight Line.

Definition at line 258 of file EventDataPlotter.cc.

263{
264 if (not m_ptrPrimitivePlotter) return;
265 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
266
267 primitivePlotter.drawLine(startX, startY, endX, endY, attributeMap);
268}

◆ drawOuterCDCWall()

void drawOuterCDCWall ( const AttributeMap & attributeMap = AttributeMap())

Draw the outer wall of the CDC.

Definition at line 226 of file EventDataPlotter.cc.

227{
228 if (not m_ptrPrimitivePlotter) return;
229 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
230
231 const CDCWireTopology& wireTopology = CDCWireTopology::getInstance();
232
233 const CDCWireSuperLayer& wireSuperLayer = wireTopology.getWireSuperLayers().back();
234
235 float centerX = 0.0;
236 float centerY = 0.0;
237 float outerR = wireSuperLayer.getOuterCylindricalR();
238
239 primitivePlotter.drawCircle(centerX, centerY, outerR, attributeMap);
240}
double getOuterCylindricalR() const
Getter for the outer radius of the layer as retrieved from the CDCGeometryPar by the outer most layer...

◆ drawRange()

template<class ARange>
void drawRange ( const ARange & range,
const AttributeMap & attributeMap = AttributeMap() )
inline

Draws a range iterable collection of drawable elements.

Definition at line 267 of file EventDataPlotter.h.

268 {
269 if (not m_ptrPrimitivePlotter) return;
270 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
271 primitivePlotter.startGroup(attributeMap);
272 for (const auto& element : range) {
273 draw(element);
274 }
275 primitivePlotter.endGroup();
276 }

◆ drawRangeWithFade()

template<class ARange>
void drawRangeWithFade ( const ARange & range,
const AttributeMap & attributeMap = AttributeMap() )
inline

Draws a range iterable collection of drawable elements.

Definition at line 280 of file EventDataPlotter.h.

281 {
282 if (not m_ptrPrimitivePlotter) return;
283 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
284 primitivePlotter.startGroup(attributeMap);
285 float opacity = 1;
286 float endOpacity = 0.5;
287 int n = std::distance(std::begin(range), std::end(range));
288 if (n == 0) return;
289 float opacityFactor = std::pow(endOpacity / opacity, 1.0 / (n - 1));
290 for (const auto& element : range) {
291 const auto opacity_str = std::to_string(opacity);
292 AttributeMap elementAttributeMap{{"opacity", opacity_str}};
293 draw(element, elementAttributeMap);
294 opacity *= opacityFactor;
295 }
296 primitivePlotter.endGroup();
297 }

◆ drawSuperLayerBoundaries()

void drawSuperLayerBoundaries ( const AttributeMap & attributeMap = AttributeMap())

Draw the super layer bounds of the CDC.

Definition at line 242 of file EventDataPlotter.cc.

243{
244 if (not m_ptrPrimitivePlotter) return;
245 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
246
247 const CDCWireTopology& wireTopology = CDCWireTopology::getInstance();
248
249 for (const CDCWireSuperLayer& wireSuperLayer : wireTopology.getWireSuperLayers()) {
250 float centerX = 0.0;
251 float centerY = 0.0;
252 float outerR = wireSuperLayer.getInnerCylindricalR();
253 primitivePlotter.drawCircle(centerX, centerY, outerR, attributeMap);
254 }
255 drawOuterCDCWall(attributeMap);
256}
void drawOuterCDCWall(const AttributeMap &attributeMap=AttributeMap())
Draw the outer wall of the CDC.

◆ drawTrajectory() [1/5]

void drawTrajectory ( const MCParticle & mcParticle,
const AttributeMap & attributeMap = AttributeMap() )

Draws the trajectory that is represented by the MC particle.

Definition at line 704 of file EventDataPlotter.cc.

705{
706 if (not mcParticle.isPrimaryParticle()) return;
707 Vector3D pos(mcParticle.getVertex());
708 Vector3D mom(mcParticle.getMomentum());
709 double charge = mcParticle.getCharge();
710 double time = mcParticle.getProductionTime();
711 CDCTrajectory2D trajectory2D(pos.xy(), time, mom.xy(), charge);
712 draw(trajectory2D, attributeMap);
713}
ROOT::Math::XYZVector getVertex() const
Return production vertex position, shorthand for getProductionVertex().
Definition MCParticle.h:172
float getCharge() const
Return the particle charge defined in TDatabasePDG.
Definition MCParticle.cc:36
float getProductionTime() const
Return production time in ns.
Definition MCParticle.h:148
ROOT::Math::XYZVector getMomentum() const
Return momentum.
Definition MCParticle.h:187
bool isPrimaryParticle() const
Check if particle is a primary particle which was created by the generator (and not,...
Definition MCParticle.h:585
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition Cell.h:34

◆ drawTrajectory() [2/5]

void drawTrajectory ( const RecoTrack & recoTrack,
const AttributeMap & attributeMap = AttributeMap() )

Draws curve along the fitted points of the RecoTrack.

Definition at line 732 of file EventDataPlotter.cc.

733{
734 if (not m_ptrPrimitivePlotter) return;
735 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
736
737 primitivePlotter.startGroup(attributeMap);
738
739 bool fitSuccessful = not recoTrack.getRepresentations().empty() and recoTrack.wasFitSuccessful();
740 if (fitSuccessful) {
741 std::vector<std::array<float, 2>> points;
742 std::vector<std::array<float, 2>> tangents;
743
744 for (auto recoHit : recoTrack.getRecoHitInformations()) {
745 // skip for reco hits which have not been used in the fit (and therefore have no fitted information on the plane
746 if (!recoHit->useInFit())
747 continue;
748
749 TVector3 pos;
750 TVector3 mom;
751 TMatrixDSym cov;
752
753 try {
754 const auto* trackPoint = recoTrack.getCreatedTrackPoint(recoHit);
755 const auto* fittedResult = trackPoint->getFitterInfo();
756 if (not fittedResult) {
757 B2WARNING("Skipping unfitted track point");
758 continue;
759 }
760 const genfit::MeasuredStateOnPlane& state = fittedResult->getFittedState();
761 state.getPosMomCov(pos, mom, cov);
762 } catch (const genfit::Exception&) {
763 B2WARNING("Skipping state with strange pos, mom or cov");
764 continue;
765 }
766
767 float x = pos.X();
768 float y = pos.Y();
769 float px = mom.X();
770 float py = mom.Y();
771
772 points.push_back({{x, y}});
773 tangents.push_back({{px, py}});
774 }
775 primitivePlotter.drawCurve(points, tangents, attributeMap);
776 }
777
778 primitivePlotter.endGroup();
779}
const std::vector< genfit::AbsTrackRep * > & getRepresentations() const
Return a list of track representations. You are not allowed to modify or delete them!
Definition RecoTrack.h:638
bool wasFitSuccessful(const genfit::AbsTrackRep *representation=nullptr) const
Returns true if the last fit with the given representation was successful.
Definition RecoTrack.cc:336
const genfit::TrackPoint * getCreatedTrackPoint(const RecoHitInformation *recoHitInformation) const
Get a pointer to the TrackPoint that was created from this hit.
Definition RecoTrack.cc:230
std::vector< RecoHitInformation * > getRecoHitInformations(bool getSorted=false) const
Return a list of all RecoHitInformations associated with the RecoTrack.
Definition RecoTrack.cc:557
virtual void drawCurve(const std::vector< std::array< float, 2 > > &points, const std::vector< std::array< float, 2 > > &tangents, const AttributeMap &attributeMap=AttributeMap())
Adds a smooth curve to the plot.

◆ drawTrajectory() [3/5]

void drawTrajectory ( const TrackingUtilities::CDCSegment2D & segment,
const AttributeMap & attributeMap = AttributeMap() )

Draws trajectory of the CDCSegment2D.

Definition at line 715 of file EventDataPlotter.cc.

717{
718 draw(segment.getTrajectory2D(), attributeMap);
719}

◆ drawTrajectory() [4/5]

void drawTrajectory ( const TrackingUtilities::CDCSegmentTriple & segmentTriple,
const AttributeMap & attributeMap = AttributeMap() )

Draws trajectory of the CDCSegmentTriple.

Definition at line 721 of file EventDataPlotter.cc.

723{
724 draw(segmentTriple.getTrajectory3D().getTrajectory2D(), attributeMap);
725}

◆ drawTrajectory() [5/5]

void drawTrajectory ( const TrackingUtilities::CDCTrack & track,
const AttributeMap & attributeMap = AttributeMap() )

Draws trajectory of the CDCTrack.

Definition at line 727 of file EventDataPlotter.cc.

728{
729 draw(track.getStartTrajectory3D().getTrajectory2D(), attributeMap);
730}

◆ endGroup()

void endGroup ( )

Indicates the end of a group of drawn elements.

Definition at line 154 of file EventDataPlotter.cc.

155{
157 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
158 primitivePlotter.endGroup();
159 }
160}

◆ getAnimationTimeFromNanoSeconds()

std::string getAnimationTimeFromNanoSeconds ( float nanoseconds)
inline

Converts a time given in nanoseconds to a time string of the from "%fs".

Definition at line 133 of file EventDataPlotter.h.

134 {
135 return std::to_string(nanoseconds) + "s";
136 }

◆ getBoundingBox()

BoundingBox getBoundingBox ( ) const

Getter for the current bounding box.

Definition at line 92 of file EventDataPlotter.cc.

93{
95 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
96 return primitivePlotter.getBoundingBox();
97 } else {
98 return BoundingBox(0, 0, 0, 0);
99 }
100}
const BoundingBox & getBoundingBox() const
Getter for the bounding box of all drawn objects.

◆ getCanvasHeight()

float getCanvasHeight ( ) const

Getter for the canvas height in pixels.

Definition at line 120 of file EventDataPlotter.cc.

121{
123 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
124 return primitivePlotter.getCanvasHeight();
125 } else {
126 return NAN;
127 }
128}
float getCanvasHeight()
Getter for the canvas height in pixels.

◆ getCanvasWidth()

float getCanvasWidth ( ) const

Getter for the canvas width in pixels.

Definition at line 110 of file EventDataPlotter.cc.

111{
113 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
114 return primitivePlotter.getCanvasWidth();
115 } else {
116 return NAN;
117 }
118}
float getCanvasWidth()
Getter for the canvas width in pixels.

◆ save()

const std::string save ( const std::string & fileName)

Saves the current plot stead to a file.

Deriving instances may should implement the appropriate thing here and may return a modified string indicating the file name to which the plot as been written. It is allowed to append or change the file extension if the concrete implementation PrimitivePlotter decides to do so.

Parameters
fileNamefileName where the plot shall be saved
Returns
Potentially modified file name where the file has actually been written to.

Definition at line 74 of file EventDataPlotter.cc.

75{
77 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
78 return primitivePlotter.save(fileName);
79 } else {
80 return "";
81 }
82}
virtual const std::string save(const std::string &fileName)
Saves the current plot state to a file.

◆ setBoundingBox()

void setBoundingBox ( const BoundingBox & boundingBox)

Setter for the bounding box of all drawn objects.

Definition at line 102 of file EventDataPlotter.cc.

103{
105 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
106 return primitivePlotter.setBoundingBox(boundingBox);
107 }
108}
void setBoundingBox(const BoundingBox &boundingBox)
Setter for the bounding box of all drawn objects.

◆ setCanvasHeight()

void setCanvasHeight ( float height)

Setter for the canvas height in pixels The canvas height denotes the size of the image being produced.

The coordinates space that is visible in the picture is a separate concept which is stored in the bounding box (getBoundingBox()).

Definition at line 138 of file EventDataPlotter.cc.

139{
141 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
142 primitivePlotter.setCanvasHeight(height);
143 }
144}
void setCanvasHeight(float height)
Setter for the canvas height in pixels The canvas height denotes the size of the image being produced...

◆ setCanvasWidth()

void setCanvasWidth ( float width)

Setter for the canvas width in pixels.

The canvas height denotes the size of the image being produced. The coordinates space that is visible in the picture is a separate concept which is stored in the bounding box (getBoundingBox()).

Definition at line 130 of file EventDataPlotter.cc.

131{
133 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
134 primitivePlotter.setCanvasWidth(width);
135 }
136}
void setCanvasWidth(float width)
Setter for the canvas width in pixels.

◆ startAnimationGroup() [1/2]

void startAnimationGroup ( const Belle2::CDCHit * ptrHit)
private

Start a group in the underlying plotter with an animation uncovering the elements at the time of flight of the related CDCSimHit.

Definition at line 179 of file EventDataPlotter.cc.

180{
181 if (not m_ptrPrimitivePlotter) return;
182 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
183
184 if (m_animate) {
185 if (ptrHit) {
186 const CDCHit& hit = *ptrHit;
187 const CDCSimHit* ptrSimHit = hit.getRelated<CDCSimHit>();
188 if (ptrSimHit) {
189 const CDCSimHit& simHit = *ptrSimHit;
190 startAnimationGroup(simHit);
191 return;
192 }
193 }
194 }
195 primitivePlotter.startGroup();
196}
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.

◆ startAnimationGroup() [2/2]

void startAnimationGroup ( const Belle2::CDCSimHit & simHit)
private

Start a group in the underlying plotter with an animation uncovering the elements at the time of flight of the CDCSimHit.

Definition at line 162 of file EventDataPlotter.cc.

163{
164 // In case the event should be animated
165 // uncover the group of elements at the time of flight of the CDCSimHit.
166 if (not m_ptrPrimitivePlotter) return;
167 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
168
169 if (m_animate) {
170 float tof = simHit.getFlightTime();
171 AttributeMap groupAttributeMap{{"_showAt", getAnimationTimeFromNanoSeconds(tof)}};
172 primitivePlotter.startGroup(groupAttributeMap);
173
174 } else {
175 primitivePlotter.startGroup();
176 }
177}
double getFlightTime() const
The method to get flight time.
Definition CDCSimHit.h:183
std::string getAnimationTimeFromNanoSeconds(float nanoseconds)
Converts a time given in nanoseconds to a time string of the from "%fs".

◆ startGroup()

void startGroup ( const AttributeMap & attributeMap = AttributeMap())

Indicates the start of a group of drawn elements.

Definition at line 146 of file EventDataPlotter.cc.

147{
149 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
150 primitivePlotter.startGroup(attributeMap);
151 }
152}

Member Data Documentation

◆ m_animate

bool m_animate = false
private

Memory for the flag if the event data should be animated. If animation is supported is backend dependent.

Definition at line 304 of file EventDataPlotter.h.

◆ m_forwardFade

bool m_forwardFade = false
private

Memory for the flag whether the orientation of tracks segments etc should be shown as dimming opacity.

Definition at line 307 of file EventDataPlotter.h.

◆ m_ptrPrimitivePlotter

std::unique_ptr<PrimitivePlotter> m_ptrPrimitivePlotter
private

Reference to the primitivePlotter instance used as backend for the draw commands.

Definition at line 301 of file EventDataPlotter.h.


The documentation for this class was generated from the following files: