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 Belle2::TrackFindingCDC::Circle2D &circle, AttributeMap attributeMap=AttributeMap())
 Draws a filled circle.
 
void draw (const Belle2::TrackFindingCDC::CDCWire &wire, const AttributeMap &attributeMap=AttributeMap())
 Draws the CDCWire as a small circle at the reference position.
 
void draw (const Belle2::TrackFindingCDC::CDCWireSuperLayer &wireSuperLayer, const AttributeMap &attributeMap=AttributeMap())
 Draws the inner and the outer bound of the super layer.
 
void draw (const Belle2::TrackFindingCDC::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 Belle2::TrackFindingCDC::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 Belle2::TrackFindingCDC::CDCRecoHit2D &recoHit2D, const AttributeMap &attributeMap=AttributeMap())
 Draws the CDCRecoHit2D as a drift circle at the two dimensional reference wire position and a point at the reconstructed position""".
 
void draw (const Belle2::TrackFindingCDC::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 Belle2::TrackFindingCDC::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 CDCTrajectory2D &trajectory2D, AttributeMap attributeMap=AttributeMap())
 Draws the CDCTrajectory from the start point until it first exits the CDC.
 
void draw (const CDCWireHitCluster &wireHitCluster, const AttributeMap &attributeMap=AttributeMap())
 Draws all CDCWireHits of the cluster.
 
void draw (const CDCSegment2D &segment2D, const AttributeMap &attributeMap=AttributeMap())
 Draws all CDCRecoHits2D of the segment.
 
void draw (const CDCSegment3D &segment3D, const AttributeMap &attributeMap=AttributeMap())
 Draws all CDCRecoHits3D of the segment.
 
void draw (const CDCAxialSegmentPair &axialSegmentPair, const AttributeMap &attributeMap=AttributeMap())
 Draws the pair of segments as an arrow connecting the centers of them.
 
void draw (const CDCSegmentPair &segmentPair, const AttributeMap &attributeMap=AttributeMap())
 Draws the pair of segments as an arrow connecting the centers of them.
 
void draw (const 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 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 CDCSegment2D &segment, const AttributeMap &attributeMap=AttributeMap())
 Draws trajectory of the CDCSegment2D.
 
void drawTrajectory (const CDCSegmentTriple &segmentTriple, const AttributeMap &attributeMap=AttributeMap())
 Draws trajectory of the CDCSegmentTriple.
 
void drawTrajectory (const 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 54 of file EventDataPlotter.h.

Member Typedef Documentation

◆ AttributeMap

Forward the Attribute map from the primitive plotter.

Definition at line 59 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 46 of file EventDataPlotter.cc.

48 AttributeMap{{"stroke", "orange"}, {"stroke-width", "0.55"}, {"fill", "none"}}))
49, m_animate(animate)
50, m_forwardFade(forwardFade)
51{
52}
bool m_forwardFade
Memory for the flag whether the orientation of tracks segments etc should be shown as dimming opacity...
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.
A concrete plotter that can draw primitive objects to standalone SVG files.

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

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

◆ EventDataPlotter() [3/3]

EventDataPlotter ( const EventDataPlotter eventDataPlotter)

Copy constructor.

Definition at line 65 of file EventDataPlotter.cc.

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

Member Function Documentation

◆ clear()

void clear ( )

Clears all drawn elements from the plotter.

Definition at line 82 of file EventDataPlotter.cc.

83{
85 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
86 return primitivePlotter.clear();
87 }
88}
A base class for plots of primitive objects.
virtual void clear()
Clears all drawn elements from the plotter.

◆ draw() [1/21]

void draw ( const Belle2::TrackFindingCDC::CDCRecoHit2D recoHit2D,
const AttributeMap attributeMap = AttributeMap() 
)

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

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

Definition at line 391 of file EventDataPlotter.cc.

392{
393 if (not m_ptrPrimitivePlotter) return;
394 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
395
396 const CDCWireHit& wireHit = recoHit2D.getWireHit();
397
398 startAnimationGroup(wireHit.getHit());
399
400 const Vector2D& refPos2D = wireHit.getRefPos2D();
401 const Vector2D& recoPos2D = recoHit2D.getRecoPos2D();
402
403 float x = refPos2D.x();
404 float y = refPos2D.y();
405 float radius = wireHit.getRefDriftLength();
406 primitivePlotter.drawCircle(x, y, radius, attributeMap);
407
408 if (not recoPos2D.hasNAN()) {
409 float supportPointRadius = 0.2;
410 Circle2D supportPoint(recoPos2D, supportPointRadius);
411 draw(supportPoint, attributeMap);
412 }
413
414 primitivePlotter.endGroup();
415}
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the reconstructed hit.
Definition: CDCRecoHit2D.h:193
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
Definition: CDCRecoHit2D.h:238
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition: CDCWireHit.h:159
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCWireHit.h:224
const Vector2D & getRefPos2D() const
The two dimensional reference position (z=0) of the underlying wire.
Definition: CDCWireHit.cc:212
A two dimensional circle in its natural representation using center and radius as parameters.
Definition: Circle2D.h:26
void draw(const Belle2::TrackFindingCDC::Circle2D &circle, AttributeMap attributeMap=AttributeMap())
Draws a filled circle.
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 drawCircle(float centerX, float centerY, float radius, const AttributeMap &attributeMap=AttributeMap())
Adds a circle to the plot.
virtual void endGroup()
Indicates the end of a group of drawn elements.
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition: Vector2D.h:32
double x() const
Getter for the x coordinate.
Definition: Vector2D.h:595
bool hasNAN() const
Checks if one of the coordinates is NAN.
Definition: Vector2D.h:149
double y() const
Getter for the y coordinate.
Definition: Vector2D.h:605

◆ draw() [2/21]

void draw ( const Belle2::TrackFindingCDC::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 441 of file EventDataPlotter.cc.

443{
444 draw(recoHit3D.getRecoHit2D(), attributeMap);
445}
CDCRecoHit2D getRecoHit2D() const
Constructs a two dimensional reconstructed hit by carrying out the stereo ! projection to the wire re...

◆ draw() [3/21]

void draw ( const Belle2::TrackFindingCDC::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 418 of file EventDataPlotter.cc.

419{
420 if (not m_ptrPrimitivePlotter) return;
421 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
422
423 const Vector2D fromPos = tangent.getFromRecoPos2D();
424 const float fromX = fromPos.x();
425 const float fromY = fromPos.y();
426
427 const Vector2D toPos = tangent.getToRecoPos2D();
428 const float toX = toPos.x();
429 const float toY = toPos.y();
430
431 primitivePlotter.drawLine(fromX, fromY, toX, toY, attributeMap);
432
433 float touchPointRadius = 0.015;
434 const Circle2D fromTouchPoint(fromPos, touchPointRadius);
435 draw(fromTouchPoint, attributeMap);
436
437 const Circle2D toTouchPoint(toPos, touchPointRadius);
438 draw(toTouchPoint, attributeMap);
439}
const Vector2D & getFromRecoPos2D() const
Getter for the touching point of the tangent to the first drift circle.
Definition: CDCTangent.h:63
Vector2D getToRecoPos2D() const
Getter for the touching point of the tangent to the second drift circle.
Definition: CDCTangent.h:70
virtual void drawLine(float startX, float startY, float endX, float endY, const AttributeMap &attributeMap=AttributeMap())
Adds a line to the plot.

◆ draw() [4/21]

void draw ( const Belle2::TrackFindingCDC::CDCWire wire,
const AttributeMap attributeMap = AttributeMap() 
)

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

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

Definition at line 292 of file EventDataPlotter.cc.

293{
294 const float wireRadius = 0.25;
295 const Vector2D& refPos = wire.getRefPos2D();
296
297 draw(Circle2D(refPos, wireRadius), attributeMap);
298}
const Vector2D & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
Definition: CDCWire.h:229

◆ draw() [5/21]

void draw ( const Belle2::TrackFindingCDC::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 370 of file EventDataPlotter.cc.

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

◆ draw() [6/21]

void draw ( const Belle2::TrackFindingCDC::CDCWireSuperLayer wireSuperLayer,
const AttributeMap attributeMap = AttributeMap() 
)

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

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

Definition at line 301 of file EventDataPlotter.cc.

303{
304 if (not m_ptrPrimitivePlotter) return;
305 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
306
307 primitivePlotter.startGroup(attributeMap);
308 for (const CDCWireLayer& wireLayer : wireSuperLayer) {
309 for (const CDCWire& wire : wireLayer) {
310 draw(wire);
311 }
312 }
313 primitivePlotter.endGroup();
314}
Class representing a sense wire layer in the central drift chamber.
Definition: CDCWireLayer.h:42
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:58
virtual void startGroup(const AttributeMap &attributeMap=AttributeMap())
Indicates the start of a group of drawn elements.

◆ draw() [7/21]

void draw ( const Belle2::TrackFindingCDC::CDCWireTopology wireTopology,
AttributeMap  attributeMap = AttributeMap() 
)

Draws the all wires in the CDC.

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

Definition at line 317 of file EventDataPlotter.cc.

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

◆ draw() [8/21]

void draw ( const Belle2::TrackFindingCDC::Circle2D circle,
AttributeMap  attributeMap = AttributeMap() 
)

Draws a filled circle.

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

Definition at line 269 of file EventDataPlotter.cc.

270{
271 if (not m_ptrPrimitivePlotter) return;
272 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
273
274 float radius = circle.radius();
275
276 if (not attributeMap.count("fill") or attributeMap["fill"] != "") {
277 if (attributeMap.count("stroke")) {
278 attributeMap["fill"] = attributeMap["stroke"];
279 attributeMap.erase("stroke");
280 }
281 }
282
283 const Vector2D& pos = circle.center();
284
285 float x = pos.x();
286 float y = pos.y();
287
288 primitivePlotter.drawCircle(x, y, radius, attributeMap);
289}
double radius() const
Getter for the signed radius.
Definition: Circle2D.h:197
Vector2D center() const
Getter for the central point of the circle.
Definition: Circle2D.h:221

◆ draw() [9/21]

void draw ( const CDCAxialSegmentPair axialSegmentPair,
const AttributeMap attributeMap = AttributeMap() 
)

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

Definition at line 550 of file EventDataPlotter.cc.

552{
553 if (not m_ptrPrimitivePlotter) return;
554 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
555
556 const CDCSegment2D* ptrFromSegment = axialSegmentPair.getStartSegment();
557 const CDCSegment2D* ptrToSegment = axialSegmentPair.getEndSegment();
558
559 if (not ptrFromSegment or not ptrToSegment) return;
560
561 const CDCSegment2D& fromSegment = *ptrFromSegment;
562 const CDCSegment2D& toSegment = *ptrToSegment;
563
564 const Vector2D& fromPos = fromSegment.back().getWire().getRefPos2D();
565 const Vector2D& toPos = toSegment.front().getWire().getRefPos2D();
566
567 if (fromPos.hasNAN()) {
568 B2WARNING("Center of mass of first segment in a pair contains NAN values.");
569 return;
570 }
571
572 if (toPos.hasNAN()) {
573 B2WARNING("Center of mass of second segment in a pair contains NAN values.");
574 return;
575 }
576
577 const float fromX = fromPos.x();
578 const float fromY = fromPos.y();
579
580 const float toX = toPos.x();
581 const float toY = toPos.y();
582
583 primitivePlotter.drawArrow(fromX, fromY, toX, toY, attributeMap);
584}
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
virtual void drawArrow(float startX, float startY, float endX, float endY, const AttributeMap &attributeMap=AttributeMap())
Adds an arrow to the plot.

◆ draw() [10/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 363 of file EventDataPlotter.cc.

364{
365 CDCWireHit wireHit(&hit);
366 draw(wireHit, attributeMap);
367}

◆ draw() [11/21]

void draw ( const CDCSegment2D segment2D,
const AttributeMap attributeMap = AttributeMap() 
)

Draws all CDCRecoHits2D of the segment.

Definition at line 532 of file EventDataPlotter.cc.

533{
534 if (m_forwardFade) {
535 drawRangeWithFade(segment2D, attributeMap);
536 } else {
537 drawRange(segment2D, attributeMap);
538 }
539}
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() [12/21]

void draw ( const CDCSegment3D segment3D,
const AttributeMap attributeMap = AttributeMap() 
)

Draws all CDCRecoHits3D of the segment.

Definition at line 541 of file EventDataPlotter.cc.

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

◆ draw() [13/21]

void draw ( const CDCSegmentPair segmentPair,
const AttributeMap attributeMap = AttributeMap() 
)

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

Definition at line 586 of file EventDataPlotter.cc.

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

◆ draw() [14/21]

void draw ( const 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 621 of file EventDataPlotter.cc.

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

◆ draw() [15/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 335 of file EventDataPlotter.cc.

336{
337 if (not m_ptrPrimitivePlotter) return;
338 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
339
340 startAnimationGroup(simHit);
341
342 // Draw hit position as a small circle
343 ROOT::Math::XYZVector position = simHit.getPosTrack();
344 float x = position.X();
345 float y = position.Y();
346 float radius = 0.2;
347
348 primitivePlotter.drawCircle(x, y, radius, attributeMap);
349
350 // Draw momentum as an arrow proportional to the transverse component of the momentum
351 const float momentumToArrowLength = 1.5;
352
353 ROOT::Math::XYZVector momentum = simHit.getMomentum();
354 float endX = x + momentum.X() * momentumToArrowLength;
355 float endY = y + momentum.Y() * momentumToArrowLength;
356
357 primitivePlotter.drawArrow(x, y, endX, endY, attributeMap);
358
359 primitivePlotter.endGroup();
360}
B2Vector3D getPosTrack() const
The method to get position on the track.
Definition: CDCSimHit.h:217
B2Vector3D getMomentum() const
The method to get momentum.
Definition: CDCSimHit.h:193

◆ draw() [16/21]

void draw ( const CDCTrack track,
const AttributeMap attributeMap = AttributeMap() 
)

Draws all CDCRecoHits3D of the segment.

Definition at line 678 of file EventDataPlotter.cc.

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

◆ draw() [17/21]

void draw ( const CDCTrajectory2D trajectory2D,
AttributeMap  attributeMap = AttributeMap() 
)

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

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

Definition at line 448 of file EventDataPlotter.cc.

449{
450 if (not m_ptrPrimitivePlotter) return;
451 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
452
453 AttributeMap defaultAttributeMap{};
454
455 // Make the default color charge dependent
456 int charge = trajectory2D.getChargeSign();
457 if (charge > 0) {
458 defaultAttributeMap["stroke"] = "red";
459 } else if (charge < 0) {
460 defaultAttributeMap["stroke"] = "blue";
461 } else {
462 defaultAttributeMap["stroke"] = "green";
463 }
464
465 // Add attributes if not present
466 attributeMap.insert(defaultAttributeMap.begin(), defaultAttributeMap.end());
467
468 Vector2D trajectoryExit = trajectory2D.getOuterExit();
469 if (trajectoryExit.hasNAN()) {
470 // Curlers do not leave the CDC
471 // Stop the trajectory at the inner wall to be able to
472 // see the start point
473 trajectoryExit = trajectory2D.getInnerExit();
474 }
475
476 if (trajectory2D.getLocalCircle()->isCircle()) {
477 if (trajectoryExit.hasNAN()) {
478 // No exit point out of the cdc could be detected.
479 // Draw full circle
480 const float radius = trajectory2D.getLocalCircle()->absRadius();
481 const Vector2D center = trajectory2D.getGlobalCircle().center();
482 float centerX = center.x();
483 float centerY = center.y();
484
485 primitivePlotter.drawCircle(centerX, centerY, radius);
486
487 } else {
488 const float radius = trajectory2D.getLocalCircle()->absRadius();
489 const Vector2D start = trajectory2D.getSupport();
490 float startX = start.x();
491 float startY = start.y();
492
493 float endX = trajectoryExit.x();
494 float endY = trajectoryExit.y();
495
496 const int curvature = -charge;
497 const bool sweepFlag = curvature > 0;
498
499 // check if exit point is on the close or
500 // on the far side of the circle
501 const bool longArc = (trajectory2D.calcArcLength2D(trajectoryExit) > 0) ? false : true;
502 primitivePlotter.drawCircleArc(startX,
503 startY,
504 endX,
505 endY,
506 radius,
507 longArc,
508 sweepFlag,
509 attributeMap);
510 }
511 } else {
512 // trajectory is a straight line
513 if (trajectoryExit.hasNAN()) {
514 B2WARNING("Could not compute point off exit in a straight line case.");
515 } else {
516 const Vector2D start = trajectory2D.getSupport();
517 float startX = start.x();
518 float startY = start.y();
519
520 float endX = trajectoryExit.x();
521 float endY = trajectoryExit.y();
522 primitivePlotter.drawLine(startX, startY, endX, endY, attributeMap);
523 }
524 }
525}
PerigeeCircle getGlobalCircle() const
Getter for the circle in global coordinates.
Vector2D getOuterExit(double factor=1) const
Calculates the point where the trajectory meets the outer wall of the CDC.
double calcArcLength2D(const Vector2D &point) const
Calculate the travel distance from the start position of the trajectory.
ESign getChargeSign() const
Gets the charge sign of the trajectory.
Vector2D getSupport() const
Get the support point of the trajectory in global coordinates.
const UncertainPerigeeCircle & getLocalCircle() const
Getter for the circle in local coordinates.
Vector2D getInnerExit() const
Calculates the point where the trajectory meets the inner wall of the CDC.
Vector2D center() const
Getter for the center of the circle. If it was a line both components will be infinity.
bool isCircle() const
Indicates if the perigee parameters represent a closed circle.
double absRadius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
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.
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44

◆ draw() [18/21]

void draw ( const CDCWireHitCluster wireHitCluster,
const AttributeMap attributeMap = AttributeMap() 
)

Draws all CDCWireHits of the cluster.

Definition at line 527 of file EventDataPlotter.cc.

528{
529 drawRange(wireHitCluster, attributeMap);
530}

◆ draw() [19/21]

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

Draws the hit content of the RecoTrack.

Definition at line 687 of file EventDataPlotter.cc.

688{
689 if (not m_ptrPrimitivePlotter) return;
690 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
691
692 primitivePlotter.startGroup(attributeMap);
693 for (const CDCHit* ptrHit : recoTrack.getCDCHitList()) {
694 if (ptrHit) {
695 const CDCHit& hit = *ptrHit;
696 draw(hit);
697 }
698 }
699 primitivePlotter.endGroup();
700}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
std::vector< Belle2::RecoTrack::UsedCDCHit * > getCDCHitList() const
Return an unsorted list of cdc hits.
Definition: RecoTrack.h:455

◆ draw() [20/21]

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

Draw store array.

Definition at line 260 of file EventDataPlotter.h.

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

◆ draw() [21/21]

void draw ( const T *  ptr,
const AttributeMap attributeMap = AttributeMap() 
)
inline

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

Definition at line 253 of file EventDataPlotter.h.

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

◆ drawInnerCDCWall()

void drawInnerCDCWall ( const AttributeMap attributeMap = AttributeMap())

Draw the inner wall of the CDC.

Definition at line 208 of file EventDataPlotter.cc.

209{
210 if (not m_ptrPrimitivePlotter) return;
211 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
212
213 const CDCWireTopology& wireTopology = CDCWireTopology::getInstance();
214
215 const CDCWireSuperLayer& wireSuperLayer = wireTopology.getWireSuperLayers().front();
216
217 float centerX = 0.0;
218 float centerY = 0.0;
219 float innerR = wireSuperLayer.getInnerCylindricalR();
220
221 primitivePlotter.drawCircle(centerX, centerY, innerR, attributeMap);
222}
double getInnerCylindricalR() const
Getter for the inner radius of the layer as retrieved from the CDCGeometryPar by the inner most layer...
Class representing the sense wire arrangement in the whole of the central drift chamber.
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 196 of file EventDataPlotter.cc.

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

◆ drawLine()

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

Draws a straight Line.

Definition at line 256 of file EventDataPlotter.cc.

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

◆ drawOuterCDCWall()

void drawOuterCDCWall ( const AttributeMap attributeMap = AttributeMap())

Draw the outer wall of the CDC.

Definition at line 224 of file EventDataPlotter.cc.

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

◆ drawRange()

void drawRange ( const ARange &  range,
const AttributeMap attributeMap = AttributeMap() 
)
inline

Draws a range iterable collection of drawable elements.

Definition at line 268 of file EventDataPlotter.h.

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

◆ drawRangeWithFade()

void drawRangeWithFade ( const ARange &  range,
const AttributeMap attributeMap = AttributeMap() 
)
inline

Draws a range iterable collection of drawable elements.

Definition at line 281 of file EventDataPlotter.h.

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

◆ drawSuperLayerBoundaries()

void drawSuperLayerBoundaries ( const AttributeMap attributeMap = AttributeMap())

Draw the super layer bounds of the CDC.

Definition at line 240 of file EventDataPlotter.cc.

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

◆ drawTrajectory() [1/5]

void drawTrajectory ( const CDCSegment2D segment,
const AttributeMap attributeMap = AttributeMap() 
)

Draws trajectory of the CDCSegment2D.

Definition at line 713 of file EventDataPlotter.cc.

715{
716 draw(segment.getTrajectory2D(), attributeMap);
717}

◆ drawTrajectory() [2/5]

void drawTrajectory ( const CDCSegmentTriple segmentTriple,
const AttributeMap attributeMap = AttributeMap() 
)

Draws trajectory of the CDCSegmentTriple.

Definition at line 719 of file EventDataPlotter.cc.

721{
722 draw(segmentTriple.getTrajectory3D().getTrajectory2D(), attributeMap);
723}
const CDCTrajectory3D & getTrajectory3D() const
Getter for the three dimensional helix trajectory.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.

◆ drawTrajectory() [3/5]

void drawTrajectory ( const CDCTrack track,
const AttributeMap attributeMap = AttributeMap() 
)

Draws trajectory of the CDCTrack.

Definition at line 725 of file EventDataPlotter.cc.

726{
727 draw(track.getStartTrajectory3D().getTrajectory2D(), attributeMap);
728}

◆ drawTrajectory() [4/5]

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

Draws the trajectory that is represented by the MC particle.

Definition at line 702 of file EventDataPlotter.cc.

703{
704 if (not mcParticle.isPrimaryParticle()) return;
705 Vector3D pos(mcParticle.getVertex());
706 Vector3D mom(mcParticle.getMomentum());
707 double charge = mcParticle.getCharge();
708 double time = mcParticle.getProductionTime();
709 CDCTrajectory2D trajectory2D(pos.xy(), time, mom.xy(), charge);
710 draw(trajectory2D, attributeMap);
711}
ROOT::Math::XYZVector getVertex() const
Return production vertex position, shorthand for getProductionVertex().
Definition: MCParticle.h:183
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:159
ROOT::Math::XYZVector getMomentum() const
Return momentum.
Definition: MCParticle.h:198
Particle trajectory as it is seen in xy projection represented as a circle.
A three dimensional vector.
Definition: Vector3D.h:33
bool isPrimaryParticle() const
Check if particle is a primary particle which was created by the generator (and not,...
Definition: MCParticle.h:595

◆ drawTrajectory() [5/5]

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

Draws curve along the fitted points of the RecoTrack.

Definition at line 730 of file EventDataPlotter.cc.

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

◆ endGroup()

void endGroup ( )

Indicates the end of a group of drawn elements.

Definition at line 152 of file EventDataPlotter.cc.

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

◆ getAnimationTimeFromNanoSeconds()

std::string getAnimationTimeFromNanoSeconds ( float  nanoseconds)
inline

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

Definition at line 134 of file EventDataPlotter.h.

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

◆ getBoundingBox()

BoundingBox getBoundingBox ( ) const

Getter for the current bounding box.

Definition at line 90 of file EventDataPlotter.cc.

91{
93 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
94 return primitivePlotter.getBoundingBox();
95 } else {
96 return BoundingBox(0, 0, 0, 0);
97 }
98}
A two dimensional rectangle that keeps track of the extend of a drawing.
Definition: BoundingBox.h:21
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 118 of file EventDataPlotter.cc.

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

◆ getCanvasWidth()

float getCanvasWidth ( ) const

Getter for the canvas width in pixels.

Definition at line 108 of file EventDataPlotter.cc.

109{
111 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
112 return primitivePlotter.getCanvasWidth();
113 } else {
114 return NAN;
115 }
116}
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 72 of file EventDataPlotter.cc.

73{
75 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
76 return primitivePlotter.save(fileName);
77 } else {
78 return "";
79 }
80}
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 100 of file EventDataPlotter.cc.

101{
103 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
104 return primitivePlotter.setBoundingBox(boundingBox);
105 }
106}
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 136 of file EventDataPlotter.cc.

137{
139 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
140 primitivePlotter.setCanvasHeight(height);
141 }
142}
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 128 of file EventDataPlotter.cc.

129{
131 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
132 primitivePlotter.setCanvasWidth(width);
133 }
134}
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 177 of file EventDataPlotter.cc.

178{
179 if (not m_ptrPrimitivePlotter) return;
180 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
181
182 if (m_animate) {
183 if (ptrHit) {
184 const CDCHit& hit = *ptrHit;
185 const CDCSimHit* ptrSimHit = hit.getRelated<CDCSimHit>();
186 if (ptrSimHit) {
187 const CDCSimHit& simHit = *ptrSimHit;
188 startAnimationGroup(simHit);
189 return;
190 }
191 }
192 }
193 primitivePlotter.startGroup();
194}
Example Detector.
Definition: CDCSimHit.h:21

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

161{
162 // In case the event should be animated
163 // uncover the group of elements at the time of flight of the CDCSimHit.
164 if (not m_ptrPrimitivePlotter) return;
165 PrimitivePlotter& primitivePlotter = *m_ptrPrimitivePlotter;
166
167 if (m_animate) {
168 float tof = simHit.getFlightTime();
169 AttributeMap groupAttributeMap{{"_showAt", getAnimationTimeFromNanoSeconds(tof)}};
170 primitivePlotter.startGroup(groupAttributeMap);
171
172 } else {
173 primitivePlotter.startGroup();
174 }
175}
double getFlightTime() const
The method to get flight time.
Definition: CDCSimHit.h:184
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 144 of file EventDataPlotter.cc.

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

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 305 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 308 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 302 of file EventDataPlotter.h.


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