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 50 of file EventDataPlotter.cc.

51 : m_ptrPrimitivePlotter(new SVGPrimitivePlotter(
52 AttributeMap{{"stroke", "orange"}, {"stroke-width", "0.55"}, {"fill", "none"}}))
53, m_animate(animate)
54, m_forwardFade(forwardFade)
55{
56}
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 58 of file EventDataPlotter.cc.

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

◆ EventDataPlotter() [3/3]

EventDataPlotter ( const EventDataPlotter & eventDataPlotter)

Copy constructor.

Definition at line 69 of file EventDataPlotter.cc.

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

Member Function Documentation

◆ clear()

void clear ( )

Clears all drawn elements from the plotter.

Definition at line 86 of file EventDataPlotter.cc.

87{
89 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
90 return primitivePlotter.clear();
91 }
92}
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 296 of file EventDataPlotter.cc.

297{
298 const float wireRadius = 0.25;
299 const ROOT::Math::XYVector& refPos = wire.getRefPos2D();
300
301 draw(Circle2D(refPos, wireRadius), attributeMap);
302}
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 305 of file EventDataPlotter.cc.

307{
308 if (not m_ptrPrimitivePlotter) return;
309 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
310
311 primitivePlotter.startGroup(attributeMap);
312 for (const CDCWireLayer& wireLayer : wireSuperLayer) {
313 for (const CDCWire& wire : wireLayer) {
314 draw(wire);
315 }
316 }
317 primitivePlotter.endGroup();
318}
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 321 of file EventDataPlotter.cc.

322{
323 for (const CDCWireSuperLayer& wireSuperLayer : wireTopology.getWireSuperLayers()) {
324 AttributeMap defaultSuperLayerAttributeMap{{"fill",
325 wireSuperLayer.isAxial() ? "black" : "gray"
326 },
327 {"stroke", "none"}};
328
329 AttributeMap superLayerAttributeMap(attributeMap);
330
331 // Insert the values as defaults. Does not overwrite attributes with the same name.
332 superLayerAttributeMap.insert(defaultSuperLayerAttributeMap.begin(),
333 defaultSuperLayerAttributeMap.end());
334 draw(wireSuperLayer, superLayerAttributeMap);
335 }
336}
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 367 of file EventDataPlotter.cc.

368{
369 CDCWireHit wireHit(&hit);
370 draw(wireHit, attributeMap);
371}

◆ 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 339 of file EventDataPlotter.cc.

340{
341 if (not m_ptrPrimitivePlotter) return;
342 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
343
344 startAnimationGroup(simHit);
345
346 // Draw hit position as a small circle
347 ROOT::Math::XYZVector position = simHit.getPosTrack();
348 float x = position.X();
349 float y = position.Y();
350 float radius = 0.2;
351
352 primitivePlotter.drawCircle(x, y, radius, attributeMap);
353
354 // Draw momentum as an arrow proportional to the transverse component of the momentum
355 const float momentumToArrowLength = 1.5;
356
357 ROOT::Math::XYZVector momentum = simHit.getMomentum();
358 float endX = x + momentum.X() * momentumToArrowLength;
359 float endY = y + momentum.Y() * momentumToArrowLength;
360
361 primitivePlotter.drawArrow(x, y, endX, endY, attributeMap);
362
363 primitivePlotter.endGroup();
364}
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 691 of file EventDataPlotter.cc.

692{
693 if (not m_ptrPrimitivePlotter) return;
694 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
695
696 primitivePlotter.startGroup(attributeMap);
697 for (const CDCHit* ptrHit : recoTrack.getCDCHitList()) {
698 if (ptrHit) {
699 const CDCHit& hit = *ptrHit;
700 draw(hit);
701 }
702 }
703 primitivePlotter.endGroup();
704}
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 554 of file EventDataPlotter.cc.

556{
557 if (not m_ptrPrimitivePlotter) return;
558 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
559
560 const CDCSegment2D* ptrFromSegment = axialSegmentPair.getStartSegment();
561 const CDCSegment2D* ptrToSegment = axialSegmentPair.getEndSegment();
562
563 if (not ptrFromSegment or not ptrToSegment) return;
564
565 const CDCSegment2D& fromSegment = *ptrFromSegment;
566 const CDCSegment2D& toSegment = *ptrToSegment;
567
568 const ROOT::Math::XYVector& fromPos = fromSegment.back().getWire().getRefPos2D();
569 const ROOT::Math::XYVector& toPos = toSegment.front().getWire().getRefPos2D();
570
571 if (VectorUtil::hasNAN(fromPos)) {
572 B2WARNING("Center of mass of first segment in a pair contains NAN values.");
573 return;
574 }
575
576 if (VectorUtil::hasNAN(toPos)) {
577 B2WARNING("Center of mass of second segment in a pair contains NAN values.");
578 return;
579 }
580
581 const float fromX = fromPos.x();
582 const float fromY = fromPos.y();
583
584 const float toX = toPos.x();
585 const float toY = toPos.y();
586
587 primitivePlotter.drawArrow(fromX, fromY, toX, toY, attributeMap);
588}

◆ 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 395 of file EventDataPlotter.cc.

396{
397 if (not m_ptrPrimitivePlotter) return;
398 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
399
400 const CDCWireHit& wireHit = recoHit2D.getWireHit();
401
402 startAnimationGroup(wireHit.getHit());
403
404 const ROOT::Math::XYVector& refPos2D = wireHit.getRefPos2D();
405 const ROOT::Math::XYVector& recoPos2D = recoHit2D.getRecoPos2D();
406
407 float x = refPos2D.x();
408 float y = refPos2D.y();
409 float radius = wireHit.getRefDriftLength();
410 primitivePlotter.drawCircle(x, y, radius, attributeMap);
411
412 if (not VectorUtil::hasNAN(recoPos2D)) {
413 float supportPointRadius = 0.2;
414 Circle2D supportPoint(recoPos2D, supportPointRadius);
415 draw(supportPoint, attributeMap);
416 }
417
418 primitivePlotter.endGroup();
419}
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition CDCWireHit.h:160
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition CDCWireHit.h:225
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 445 of file EventDataPlotter.cc.

447{
448 draw(recoHit3D.getRecoHit2D(), attributeMap);
449}

◆ draw() [12/21]

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

Draws all CDCRecoHits2D of the segment.

Definition at line 536 of file EventDataPlotter.cc.

537{
538 if (m_forwardFade) {
539 drawRangeWithFade(segment2D, attributeMap);
540 } else {
541 drawRange(segment2D, attributeMap);
542 }
543}
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 545 of file EventDataPlotter.cc.

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

◆ 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 590 of file EventDataPlotter.cc.

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

◆ 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 625 of file EventDataPlotter.cc.

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

◆ 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 422 of file EventDataPlotter.cc.

423{
424 if (not m_ptrPrimitivePlotter) return;
425 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
426
427 const ROOT::Math::XYVector fromPos = tangent.getFromRecoPos2D();
428 const float fromX = fromPos.x();
429 const float fromY = fromPos.y();
430
431 const ROOT::Math::XYVector toPos = tangent.getToRecoPos2D();
432 const float toX = toPos.x();
433 const float toY = toPos.y();
434
435 primitivePlotter.drawLine(fromX, fromY, toX, toY, attributeMap);
436
437 float touchPointRadius = 0.015;
438 const Circle2D fromTouchPoint(fromPos, touchPointRadius);
439 draw(fromTouchPoint, attributeMap);
440
441 const Circle2D toTouchPoint(toPos, touchPointRadius);
442 draw(toTouchPoint, attributeMap);
443}
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 682 of file EventDataPlotter.cc.

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

◆ 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 452 of file EventDataPlotter.cc.

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

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

◆ draw() [20/21]

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

Draws all CDCWireHits of the cluster.

Definition at line 531 of file EventDataPlotter.cc.

532{
533 drawRange(wireHitCluster, attributeMap);
534}

◆ draw() [21/21]

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

Draws a filled circle.

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

Definition at line 273 of file EventDataPlotter.cc.

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

◆ drawInnerCDCWall()

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

Draw the inner wall of the CDC.

Definition at line 212 of file EventDataPlotter.cc.

213{
214 if (not m_ptrPrimitivePlotter) return;
215 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
216
217 const CDCWireTopology& wireTopology = CDCWireTopology::getInstance();
218
219 const CDCWireSuperLayer& wireSuperLayer = wireTopology.getWireSuperLayers().front();
220
221 float centerX = 0.0;
222 float centerY = 0.0;
223 float innerR = wireSuperLayer.getInnerCylindricalR();
224
225 primitivePlotter.drawCircle(centerX, centerY, innerR, attributeMap);
226}
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 200 of file EventDataPlotter.cc.

201{
202 ROOT::Math::XYVector center(0.0, 0.0);
203 float radius = 1.0;
204
205 const Circle2D interactionPoint(center, radius);
206
207 AttributeMap attributeMap{{"fill", "black"}, {"stroke-width", "0"}};
208
209 draw(interactionPoint, attributeMap);
210}

◆ drawLine()

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

Draws a straight Line.

Definition at line 260 of file EventDataPlotter.cc.

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

◆ drawOuterCDCWall()

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

Draw the outer wall of the CDC.

Definition at line 228 of file EventDataPlotter.cc.

229{
230 if (not m_ptrPrimitivePlotter) return;
231 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
232
233 const CDCWireTopology& wireTopology = CDCWireTopology::getInstance();
234
235 const CDCWireSuperLayer& wireSuperLayer = wireTopology.getWireSuperLayers().back();
236
237 float centerX = 0.0;
238 float centerY = 0.0;
239 float outerR = wireSuperLayer.getOuterCylindricalR();
240
241 primitivePlotter.drawCircle(centerX, centerY, outerR, attributeMap);
242}
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 244 of file EventDataPlotter.cc.

245{
246 if (not m_ptrPrimitivePlotter) return;
247 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
248
249 const CDCWireTopology& wireTopology = CDCWireTopology::getInstance();
250
251 for (const CDCWireSuperLayer& wireSuperLayer : wireTopology.getWireSuperLayers()) {
252 float centerX = 0.0;
253 float centerY = 0.0;
254 float outerR = wireSuperLayer.getInnerCylindricalR();
255 primitivePlotter.drawCircle(centerX, centerY, outerR, attributeMap);
256 }
257 drawOuterCDCWall(attributeMap);
258}
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 706 of file EventDataPlotter.cc.

707{
708 if (not mcParticle.isPrimaryParticle()) return;
709 ROOT::Math::XYZVector pos(mcParticle.getVertex());
710 ROOT::Math::XYZVector mom(mcParticle.getMomentum());
711 double charge = mcParticle.getCharge();
712 double time = mcParticle.getProductionTime();
713 CDCTrajectory2D trajectory2D(VectorUtil::getXYVector(pos), time, VectorUtil::getXYVector(mom), charge);
714 draw(trajectory2D, attributeMap);
715}
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

◆ drawTrajectory() [2/5]

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

Draws curve along the fitted points of the RecoTrack.

Definition at line 734 of file EventDataPlotter.cc.

735{
736 if (not m_ptrPrimitivePlotter) return;
737 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
738
739 primitivePlotter.startGroup(attributeMap);
740
741 bool fitSuccessful = not recoTrack.getRepresentations().empty() and recoTrack.wasFitSuccessful();
742 if (fitSuccessful) {
743 std::vector<std::array<float, 2>> points;
744 std::vector<std::array<float, 2>> tangents;
745
746 for (auto recoHit : recoTrack.getRecoHitInformations()) {
747 // skip for reco hits which have not been used in the fit (and therefore have no fitted information on the plane
748 if (!recoHit->useInFit())
749 continue;
750
751 TVector3 pos;
752 TVector3 mom;
753 TMatrixDSym cov;
754
755 try {
756 const auto* trackPoint = recoTrack.getCreatedTrackPoint(recoHit);
757 const auto* fittedResult = trackPoint->getFitterInfo();
758 if (not fittedResult) {
759 B2WARNING("Skipping unfitted track point");
760 continue;
761 }
762 const genfit::MeasuredStateOnPlane& state = fittedResult->getFittedState();
763 state.getPosMomCov(pos, mom, cov);
764 } catch (const genfit::Exception&) {
765 B2WARNING("Skipping state with strange pos, mom or cov");
766 continue;
767 }
768
769 float x = pos.X();
770 float y = pos.Y();
771 float px = mom.X();
772 float py = mom.Y();
773
774 points.push_back({{x, y}});
775 tangents.push_back({{px, py}});
776 }
777 primitivePlotter.drawCurve(points, tangents, attributeMap);
778 }
779
780 primitivePlotter.endGroup();
781}
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 717 of file EventDataPlotter.cc.

719{
720 draw(segment.getTrajectory2D(), attributeMap);
721}

◆ drawTrajectory() [4/5]

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

Draws trajectory of the CDCSegmentTriple.

Definition at line 723 of file EventDataPlotter.cc.

725{
726 draw(segmentTriple.getTrajectory3D().getTrajectory2D(), attributeMap);
727}

◆ drawTrajectory() [5/5]

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

Draws trajectory of the CDCTrack.

Definition at line 729 of file EventDataPlotter.cc.

730{
731 draw(track.getStartTrajectory3D().getTrajectory2D(), attributeMap);
732}

◆ endGroup()

void endGroup ( )

Indicates the end of a group of drawn elements.

Definition at line 156 of file EventDataPlotter.cc.

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

◆ 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 94 of file EventDataPlotter.cc.

95{
97 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
98 return primitivePlotter.getBoundingBox();
99 } else {
100 return BoundingBox(0, 0, 0, 0);
101 }
102}
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 122 of file EventDataPlotter.cc.

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

◆ getCanvasWidth()

float getCanvasWidth ( ) const

Getter for the canvas width in pixels.

Definition at line 112 of file EventDataPlotter.cc.

113{
115 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
116 return primitivePlotter.getCanvasWidth();
117 } else {
118 return NAN;
119 }
120}
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 76 of file EventDataPlotter.cc.

77{
79 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
80 return primitivePlotter.save(fileName);
81 } else {
82 return "";
83 }
84}
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 104 of file EventDataPlotter.cc.

105{
107 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
108 return primitivePlotter.setBoundingBox(boundingBox);
109 }
110}
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 140 of file EventDataPlotter.cc.

141{
143 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
144 primitivePlotter.setCanvasHeight(height);
145 }
146}
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 132 of file EventDataPlotter.cc.

133{
135 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
136 primitivePlotter.setCanvasWidth(width);
137 }
138}
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 181 of file EventDataPlotter.cc.

182{
183 if (not m_ptrPrimitivePlotter) return;
184 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
185
186 if (m_animate) {
187 if (ptrHit) {
188 const CDCHit& hit = *ptrHit;
189 const CDCSimHit* ptrSimHit = hit.getRelated<CDCSimHit>();
190 if (ptrSimHit) {
191 const CDCSimHit& simHit = *ptrSimHit;
192 startAnimationGroup(simHit);
193 return;
194 }
195 }
196 }
197 primitivePlotter.startGroup();
198}
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 164 of file EventDataPlotter.cc.

165{
166 // In case the event should be animated
167 // uncover the group of elements at the time of flight of the CDCSimHit.
168 if (not m_ptrPrimitivePlotter) return;
169 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
170
171 if (m_animate) {
172 float tof = simHit.getFlightTime();
173 AttributeMap groupAttributeMap{{"_showAt", getAnimationTimeFromNanoSeconds(tof)}};
174 primitivePlotter.startGroup(groupAttributeMap);
175
176 } else {
177 primitivePlotter.startGroup();
178 }
179}
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 148 of file EventDataPlotter.cc.

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

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: