Belle II Software release-09-00-00
CDCSVGPlotter Class Reference

Helper class to generated the svg image from the various tracking objects. More...

#include <CDCSVGPlotter.h>

Collaboration diagram for CDCSVGPlotter:

Public Member Functions

 CDCSVGPlotter (bool animate=false, bool forwardFade=false)
 Constructor.
 
CDCSVGPlotterclone ()
 Make a copy of the current status of the plotter.
 
void drawWires (const CDCWireTopology &cdcWireTopology)
 Draws the wires.
 
void drawInteractionPoint ()
 Draws the interaction point.
 
void drawSuperLayerBoundaries (const std::string &stroke)
 Draws the individual super layer boundaries.
 
void drawOuterCDCWall (const std::string &stroke)
 Draws the outer CDCWall.
 
void drawInnerCDCWall (const std::string &stroke)
 Draws the inner CDCWall.
 
void drawHits (const std::string &storeArrayName, const std::string &stroke, const std::string &strokeWidth)
 Draws CDCHits.
 
void drawSimHits (const std::string &storeArrayName, const std::string &stroke, const std::string &strokeWidth)
 Draws CDCSimHits.
 
void drawClusters (const std::string &storeObjName, const std::string &stroke, const std::string &strokeWidth)
 Draws CDCWireHitClusters.
 
void drawSegments (const std::string &storeObjName, const std::string &stroke, const std::string &strokeWidth)
 Draws CDCSegments.
 
void drawSegmentTrajectories (const std::string &storeObjName, const std::string &stroke, const std::string &strokeWidth)
 Draws SegmentTrajectories.
 
void drawSegmentPairs (const std::string &storeObjName, const std::string &stroke, const std::string &strokeWidth)
 Draw the axial to stereo segment pairs.
 
void drawAxialSegmentPairs (const std::string &storeObjName, const std::string &stroke, const std::string &strokeWidth)
 Draw the axial to axial segment pairs.
 
void drawSegmentTriples (const std::string &storeObjName, const std::string &stroke, const std::string &strokeWidth)
 Draw the axial, stereo, axial segment triples.
 
void drawSegmentTripleTrajectories (const std::string &storeObjName, const std::string &stroke, const std::string &strokeWidth)
 Draw the trajectories of the axial, stereo, axial segment triples.
 
void drawTracks (const std::string &storeObjName, const std::string &stroke, const std::string &strokeWidth)
 Draws CDCTracks.
 
void drawTrackTrajectories (const std::string &storeObjName, const std::string &stroke, const std::string &strokeWidth)
 Draws trajectories of the tracks.
 
void drawRecoTracks (const std::string &storeArrayName, const std::string &stroke, const std::string &strokeWidth)
 Draw RecoTracks.
 
void drawRecoTrackTrajectories (const std::string &storeArrayName, const std::string &stroke, const std::string &strokeWidth)
 Draw RecoTracks trajectories.
 
void drawMCParticleTrajectories (const std::string &storeArrayName, const std::string &stroke, const std::string &strokeWidth)
 Draw MCParticles.
 
void drawWrongRLHitsInSegments (const std::string &segmentsStoreObjName)
 Draw the CDCRLWireHits in the CDCSegments colored by the match of the right left passage informations.
 
void drawWrongRLHitsInTracks (const std::string &tracksStoreObjName)
 Draw the CDCRLWireHits in the CDCTracks colored by the match of the right left passage informations.
 
void drawSimHitsConnectByToF (const std::string &simHitStoreArrayName, const std::string &stroke, const std::string &strokeWidth)
 Draw the CDCSimHits connected in the order of their getFlightTime for each Monte Carlo particle.
 
void drawMCSegmentPairs (const std::string &segmentsStoreObjName, const std::string &stroke, const std::string &strokeWidth)
 Draws the Monte Carlo true CDCSegmentPairs.
 
void drawMCAxialSegmentPairs (const std::string &segmentsStoreObjName, const std::string &stroke, const std::string &strokeWidth)
 Draws the Monte Carlo true CDCAxialSegmentPairs.
 
void drawMCSegmentTriples (const std::string &segmentsStoreObjName, const std::string &stroke, const std::string &strokeWidth)
 Draws the Monte Carlo true CDCSegmentTriples.
 
std::string saveFile (const std::string &fileName="display.svg")
 Save the current dom object representation to disk.
 

Private Member Functions

template<class ACDCHitCollection >
void drawWrongRLHits (const std::string &storeObjName)
 Draw the CDCRLWireHits in the ACDCHitCollection colored by the match of the right left passage informations.
 
template<class AItem , bool a_drawTrajectories = false>
void drawStoreArray (const std::string &storeArrayName, Styling< AItem > &styling)
 Function Template for drawing the elements of a given StoreArray.
 
template<class AItem , bool a_drawTrajectories = false>
void drawStoreVector (const std::string &storeObjName, Styling< AItem > &styling)
 Function Template for drawing the elements of a given StoreVector.
 
template<bool a_drawTrajectory = false, class AIterable , class AStyling >
void drawIterable (const AIterable &items, AStyling &styling)
 Draw every element of an iterable object.
 
template<bool a_drawTrajectory = false, class AObject >
void draw (const AObject &object, const AttributeMap &attributeMap)
 Draws the object or its trajectory with the given attributes.
 

Private Attributes

EventDataPlotter m_eventdataPlotter
 The plotter instance to translate event data objects to svg expressions.
 

Detailed Description

Helper class to generated the svg image from the various tracking objects.

Definition at line 23 of file CDCSVGPlotter.h.

Constructor & Destructor Documentation

◆ CDCSVGPlotter()

CDCSVGPlotter ( bool  animate = false,
bool  forwardFade = false 
)

Constructor.

Definition at line 102 of file CDCSVGPlotter.cc.

102 :
103 m_eventdataPlotter(std::make_unique<SVGPrimitivePlotter>(c_defaultSVGAttributes), animate, forwardFade)
104{
105 int top = -112;
106 int left = -112;
107 int right = 112;
108 int bottom = 112;
109
110 TrackFindingCDC::BoundingBox default_bound(left, bottom, right, top);
111 int default_width = 1120;
112 int default_height = 1120;
113
114 m_eventdataPlotter.setBoundingBox(default_bound);
115 m_eventdataPlotter.setCanvasHeight(default_height);
116 m_eventdataPlotter.setCanvasWidth(default_width);
117}
A two dimensional rectangle that keeps track of the extend of a drawing.
Definition: BoundingBox.h:21
EventDataPlotter m_eventdataPlotter
The plotter instance to translate event data objects to svg expressions.
void setCanvasHeight(float height)
Setter for the canvas height in pixels The canvas height denotes the size of the image being produced...
void setBoundingBox(const BoundingBox &boundingBox)
Setter for the bounding box of all drawed objects.
void setCanvasWidth(float width)
Setter for the canvas width in pixels.

Member Function Documentation

◆ clone()

CDCSVGPlotter * clone ( )

Make a copy of the current status of the plotter.

Definition at line 119 of file CDCSVGPlotter.cc.

120{
121 return (new CDCSVGPlotter(*this));
122}
Helper class to generated the svg image from the various tracking objects.
Definition: CDCSVGPlotter.h:23

◆ drawAxialSegmentPairs()

void drawAxialSegmentPairs ( const std::string &  storeObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draw the axial to axial segment pairs.

Parameters
storeObjNameThe name of the StoreVector containing the CDCAxialSegmentPairs.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCAxialSegmentPair and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCAxialSegmentPair and its id to a stroke-width.

Definition at line 222 of file CDCSVGPlotter.cc.

225{
227 if (stroke != "") styling.setStroke(stroke);
228 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
229 drawStoreVector<const CDCAxialSegmentPair>(storeObjName, styling);
230}
void setStrokeWidth(const std::string &mappingName)
Legacy method to set the mapping on how to match a object to the stroke width.
Definition: Styling.h:173
void setStroke(const std::string &mappingName)
Legacy method to set the mapping on how to match a object to the stroke color.
Definition: Styling.h:163
Class template for coloring objects with stroke colors prepared to be the default color cycle.
Definition: Styling.h:185

◆ drawClusters()

void drawClusters ( const std::string &  storeObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draws CDCWireHitClusters.

Parameters
storeObjNameThe name of the StoreVector containing the CDCWireHitClusters.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCHit and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCHit and its id to a stroke-width.

Definition at line 191 of file CDCSVGPlotter.cc.

194{
196 if (stroke != "") styling.setStroke(stroke);
197 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
198 drawStoreVector<const CDCWireHitCluster>(storeObjName, styling);
199}

◆ drawHits()

void drawHits ( const std::string &  storeArrayName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draws CDCHits.

Parameters
storeArrayNameThe name of the StoreArray containing the CDCHits.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCHit and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCHit and its id to a stroke-width.

Definition at line 155 of file CDCSVGPlotter.cc.

158{
159 ChooseableHitStyling styling;
160 if (stroke != "") styling.setStroke(stroke);
161 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
162 drawStoreArray<const CDCHit>(storeArrayName, styling);
163}
This Class handles the mapping from the colormapping-method name given as a string to the actual colo...
Definition: Styling.h:234

◆ drawInnerCDCWall()

void drawInnerCDCWall ( const std::string &  stroke)

Draws the inner CDCWall.

Parameters
strokeThe color to be used for drawing.

Definition at line 143 of file CDCSVGPlotter.cc.

144{
145 AttributeMap attributeMap;
146 attributeMap.emplace("stroke", stroke);
148}
void drawInnerCDCWall(const AttributeMap &attributeMap=AttributeMap())
Draw the inner wall of the CDC.

◆ drawInteractionPoint()

void drawInteractionPoint ( )

Draws the interaction point.

Definition at line 124 of file CDCSVGPlotter.cc.

125{
127}
void drawInteractionPoint()
Marks the position of the interaction point with a filled circle.

◆ drawIterable()

void drawIterable ( const AIterable &  items,
AStyling &  styling 
)
private

Draw every element of an iterable object.

Template Parameters
a_drawTrajectorySwitch to draw the fitted trajectory from the object instead.
Parameters
itemsAn iterable object (StoreArray, std::vector...).
stylingStyling object from which drawing attributes are constructed

◆ drawMCAxialSegmentPairs()

void drawMCAxialSegmentPairs ( const std::string &  segmentsStoreObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draws the Monte Carlo true CDCAxialSegmentPairs.

This routine creates the true axial segment pairs from the stored segments to get an overview which cases the segment triple reconstruction should cover.

Parameters
segmentsStoreObjNameThe name of the StoreVector containing the CDCSegment2Ds, from which the pair should be constructed.
strokeColor of the lines to be drawn.
strokeWidthWidth of the lines to be drawn.

Definition at line 471 of file CDCSVGPlotter.cc.

474{
475 B2INFO("Draw axial to axial segment pairs");
476 StoreWrappedObjPtr<std::vector<CDCSegment2D>> storedSegments(segmentsStoreObjName);
477 if (not storedSegments) {
478 B2WARNING(segmentsStoreObjName << "does not exist in current DataStore");
479 printDataStoreContent();
480 return;
481 }
482
483 std::vector<CDCSegment2D>& segments = *storedSegments;
484 B2INFO("#Segments: " << segments.size());
485
486 std::vector<const CDCAxialSegment2D*> axialSegments;
487 for (const CDCAxialSegment2D& segment : segments) {
488 if (segment.isAxial()) axialSegments.push_back(&segment);
489 }
490
491 MCAxialSegmentPairFilter mcAxialSegmentPairFilter;
492 std::vector<CDCAxialSegmentPair> mcAxialSegmentPairs;
493 for (const CDCAxialSegment2D* fromSegment : axialSegments) {
494 for (const CDCAxialSegment2D* toSegment : axialSegments) {
495 if (fromSegment == toSegment) continue;
496 mcAxialSegmentPairs.emplace_back(fromSegment, toSegment);
497 Weight mcWeight = mcAxialSegmentPairFilter(mcAxialSegmentPairs.back());
498 // Remove segment pairs that are not true
499 if (std::isnan(mcWeight)) {
500 mcAxialSegmentPairs.pop_back();
501 }
502 }
503 }
504 B2INFO("# Axial segment pairs: " << mcAxialSegmentPairs.size());
506 if (stroke != "") styling.setStroke(stroke);
507 if (strokeWidth != "") styling.setStroke(strokeWidth);
508 drawIterable(mcAxialSegmentPairs, styling);
509}
void drawIterable(const AIterable &items, AStyling &styling)
Draw every element of an iterable object.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
Implementation of a styling from fixed attribute map.
Definition: Styling.h:54
void setStroke(const std::string &value)
Legacy - Sets the stroke color to the fixed value.
Definition: Styling.h:81
Filter for the constuction of axial to axial segment pairs based on simple criterions.
This class is for convenience access and registration of objects, that are stored inside the StoreWra...

◆ drawMCParticleTrajectories()

void drawMCParticleTrajectories ( const std::string &  storeArrayName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draw MCParticles.

Parameters
storeArrayNameThe name of the StoreArray containing the RecoTracks.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCHit and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCHit and its id to a stroke-width.

Definition at line 305 of file CDCSVGPlotter.cc.

308{
310 if (stroke != "") styling.setStroke(stroke);
311 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
312 const bool drawTrajectories = true;
313 drawStoreArray<const MCParticle, drawTrajectories>(storeArrayName, styling);
314}

◆ drawMCSegmentPairs()

void drawMCSegmentPairs ( const std::string &  segmentsStoreObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draws the Monte Carlo true CDCSegmentPairs.

This routine creates the true segment pairs from the stored segments to get an overview which cases the segment triple reconstruction should cover.

Parameters
segmentsStoreObjNameThe name of the StoreVector containing the CDCSegment2Ds, from which the pair should be constructed.
strokeColor of the lines to be drawn.
strokeWidthWidth of the lines to be drawn.

Definition at line 511 of file CDCSVGPlotter.cc.

514{
515 B2INFO("Draw axial to stero segment pairs");
516 StoreWrappedObjPtr<std::vector<CDCSegment2D>> storedSegments(segmentsStoreObjName);
517 if (not storedSegments) {
518 B2WARNING(segmentsStoreObjName << "does not exist in current DataStore");
519 printDataStoreContent();
520 return;
521 }
522
523 std::vector<CDCSegment2D>& segments = *storedSegments;
524 B2INFO("#Segments: " << segments.size());
525
526 std::vector<const CDCAxialSegment2D*> axialSegments;
527 std::vector<const CDCStereoSegment2D*> stereoSegments;
528 for (const CDCAxialSegment2D& segment : segments) {
529 if (segment.isAxial()) {
530 axialSegments.push_back(&segment);
531 } else {
532 stereoSegments.push_back(&segment);
533 }
534 }
535
536 MCSegmentPairFilter mcSegmentPairFilter;
537 std::vector<CDCSegmentPair> mcSegmentPairs;
538 for (const CDCAxialSegment2D* axialSegment : axialSegments) {
539 for (const CDCStereoSegment2D* stereoSegment : stereoSegments) {
540 // Axial first
541 {
542 mcSegmentPairs.emplace_back(axialSegment, stereoSegment);
543 Weight mcWeight = mcSegmentPairFilter(mcSegmentPairs.back());
544 // Remove segment pairs that are not true
545 if (std::isnan(mcWeight)) {
546 mcSegmentPairs.pop_back();
547 }
548 }
549 // Stereo first
550 {
551 mcSegmentPairs.emplace_back(stereoSegment, axialSegment);
552 Weight mcWeight = mcSegmentPairFilter(mcSegmentPairs.back());
553 // Remove segment pairs that are not true
554 if (std::isnan(mcWeight)) {
555 mcSegmentPairs.pop_back();
556 }
557 }
558 }
559 }
560 B2INFO("# Segment pairs: " << mcSegmentPairs.size());
562 if (stroke != "") styling.setStroke(stroke);
563 if (strokeWidth != "") styling.setStroke(strokeWidth);
564 drawIterable(mcSegmentPairs, styling);
565}
Filter for the constuction of axial to stereo segment pairs based on MC information.

◆ drawMCSegmentTriples()

void drawMCSegmentTriples ( const std::string &  segmentsStoreObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draws the Monte Carlo true CDCSegmentTriples.

This routine creates the true segment triples from the stored segments to get an overview which cases the segment triple reconstruction should cover.

Parameters
segmentsStoreObjNameThe name of the StoreVector containing the CDCSegment2Ds, from which the pair should be constructed.
strokeColor of the lines to be drawn.
strokeWidthWidth of the lines to be drawn.

Definition at line 567 of file CDCSVGPlotter.cc.

570{
571 B2INFO("Draw segment triples");
572 StoreWrappedObjPtr<std::vector<CDCSegment2D>> storedSegments(segmentsStoreObjName);
573 if (not storedSegments) {
574 B2WARNING(segmentsStoreObjName << "does not exist in current DataStore");
575 printDataStoreContent();
576 return;
577 }
578
579 std::vector<CDCSegment2D>& segments = *storedSegments;
580 B2INFO("#Segment " << segments.size());
581
582 std::vector<const CDCAxialSegment2D*> axialSegments;
583 std::vector<const CDCStereoSegment2D*> stereoSegments;
584 for (const CDCSegment2D& segment : segments) {
585 if (segment.isAxial()) {
586 axialSegments.push_back(&segment);
587 } else {
588 stereoSegments.push_back(&segment);
589 }
590 }
591
592 MCSegmentTripleFilter mcSegmentTripleFilter;
593 std::vector<CDCSegmentTriple> mcSegmentTriples;
594 for (const CDCAxialSegment2D* startSegment : axialSegments) {
595 for (const CDCStereoSegment2D* middleSegment : stereoSegments) {
596 for (const CDCAxialSegment2D* endSegment : axialSegments) {
597 if (startSegment == endSegment) continue;
598 mcSegmentTriples.emplace_back(startSegment, middleSegment, endSegment);
599 Weight mcWeight = mcSegmentTripleFilter(mcSegmentTriples.back());
600 // Remove segment pairs that are not true
601 if (std::isnan(mcWeight)) {
602 mcSegmentTriples.pop_back();
603 }
604 }
605 }
606 }
607 B2INFO("# Segment triples: " << mcSegmentTriples.size());
609 if (stroke != "") styling.setStroke(stroke);
610 if (strokeWidth != "") styling.setStroke(strokeWidth);
611 drawIterable(mcSegmentTriples, styling);
612}
Filter for the constuction of segment triples based on monte carlo information.

◆ drawOuterCDCWall()

void drawOuterCDCWall ( const std::string &  stroke)

Draws the outer CDCWall.

Parameters
strokeThe color to be used for drawing.

Definition at line 136 of file CDCSVGPlotter.cc.

137{
138 AttributeMap attributeMap;
139 attributeMap.emplace("stroke", stroke);
141}
void drawOuterCDCWall(const AttributeMap &attributeMap=AttributeMap())
Draw the outer wall of the CDC.

◆ drawRecoTracks()

void drawRecoTracks ( const std::string &  storeArrayName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draw RecoTracks.

Parameters
storeArrayNameThe name of the StoreArray containing the RecoTracks.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCHit and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCHit and its id to a stroke-width.

Definition at line 284 of file CDCSVGPlotter.cc.

287{
289 if (stroke != "") styling.setStroke(stroke);
290 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
291 drawStoreArray<const RecoTrack>(storeArrayName, styling);
292}
This Class handles the mapping from the colormapping-method name given as a string to the actual colo...
Definition: Styling.h:198

◆ drawRecoTrackTrajectories()

void drawRecoTrackTrajectories ( const std::string &  storeArrayName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draw RecoTracks trajectories.

Parameters
storeArrayNameThe name of the StoreArray containing the RecoTracks.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCHit and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCHit and its id to a stroke-width.

Definition at line 294 of file CDCSVGPlotter.cc.

297{
299 if (stroke != "") styling.setStroke(stroke);
300 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
301 const bool drawTrajectories = true;
302 drawStoreArray<const RecoTrack, drawTrajectories>(storeArrayName, styling);
303}

◆ drawSegmentPairs()

void drawSegmentPairs ( const std::string &  storeObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draw the axial to stereo segment pairs.

Parameters
storeObjNameThe name of the StoreVector containing the CDCSegmentPairs.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCSegmentPair and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCSegmentPair and its id to a stroke-width.

Definition at line 232 of file CDCSVGPlotter.cc.

235{
237 if (stroke != "") styling.setStroke(stroke);
238 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
239 drawStoreVector<const CDCSegmentPair>(storeObjName, styling);
240}

◆ drawSegments()

void drawSegments ( const std::string &  storeObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draws CDCSegments.

Parameters
storeObjNameThe name of the StoreVector containing the CDCSegments.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCHit and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCHit and its id to a stroke-width.

Definition at line 201 of file CDCSVGPlotter.cc.

204{
206 if (stroke != "") styling.setStroke(stroke);
207 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
208 drawStoreVector<const CDCSegment2D>(storeObjName, styling);
209}
This Class handles the mapping from the colormapping-method name given as a string to the actual ACol...
Definition: Styling.h:216

◆ drawSegmentTrajectories()

void drawSegmentTrajectories ( const std::string &  storeObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draws SegmentTrajectories.

Parameters
storeObjNameThe name of the StoreVector containing the CDCSegments.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCHit and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCHit and its id to a stroke-width.

Definition at line 211 of file CDCSVGPlotter.cc.

214{
216 if (stroke != "") styling.setStroke(stroke);
217 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
218 const bool drawTrajectories = true;
219 drawStoreVector<const CDCSegment2D, drawTrajectories>(storeObjName, styling);
220}
void setStrokeWidth(const std::string &value)
Legacy - Sets the stroke width to the fixed value.
Definition: Styling.h:87

◆ drawSegmentTriples()

void drawSegmentTriples ( const std::string &  storeObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draw the axial, stereo, axial segment triples.

Parameters
storeObjNameThe name of the StoreVector containing the CDCSegmentTriples.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCSegmentTriple and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCSegmentTriple and its id to a stroke-width.

Definition at line 242 of file CDCSVGPlotter.cc.

245{
247 if (stroke != "") styling.setStroke(stroke);
248 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
249 drawStoreVector<const CDCSegmentTriple>(storeObjName, styling);
250}

◆ drawSegmentTripleTrajectories()

void drawSegmentTripleTrajectories ( const std::string &  storeObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draw the trajectories of the axial, stereo, axial segment triples.

Parameters
storeObjNameThe name of the StoreVector containing the CDCSegmentTriples.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCSegmentTriple and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCSegmentTriple and its id to a stroke-width.

Definition at line 252 of file CDCSVGPlotter.cc.

255{
257 if (stroke != "") styling.setStroke(stroke);
258 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
259 const bool drawTrajectories = true;
260 drawStoreVector<const CDCSegmentTriple, drawTrajectories>(storeObjName, styling);
261}

◆ drawSimHits()

void drawSimHits ( const std::string &  storeArrayName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draws CDCSimHits.

Parameters
storeArrayNameThe name of the StoreArray containing the CDCSimHits.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCSimHit and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCSimHit and its id to a stroke-width.

Definition at line 165 of file CDCSVGPlotter.cc.

168{
169 B2INFO("Drawing simulated hits");
170 StoreArray<CDCHit> storeArray(storeArrayName);
171 if (not storeArray) {
172 B2WARNING("StoreArray " << storeArrayName << " not present");
173 printDataStoreContent();
174 return;
175 }
176 std::vector<CDCSimHit> simHitsRelatedToHits;
177 for (const CDCHit& hit : storeArray) {
178 simHitsRelatedToHits.push_back(*hit.getRelated<CDCSimHit>("CDCSimHits"));
179 }
180 B2INFO("#CDCSimHits: " << storeArray.getEntries());
182 if (stroke != "") {
183 styling.setStroke("orange");
184 } else {
185 styling.setStroke(stroke);
186 }
187 styling.setStrokeWidth(strokeWidth);
188 drawIterable(simHitsRelatedToHits, styling);
189}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
Example Detector.
Definition: CDCSimHit.h:21
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113

◆ drawSimHitsConnectByToF()

void drawSimHitsConnectByToF ( const std::string &  simHitStoreArrayName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draw the CDCSimHits connected in the order of their getFlightTime for each Monte Carlo particle.

Parameters
simHitStoreArrayNameThe name of the StoreArray containing the CDCSimHits.
strokeColor of the lines to be drawn.
strokeWidthWidth of the lines to be drawn.

Definition at line 316 of file CDCSVGPlotter.cc.

319{
320 B2INFO("Drawing simulated hits connected by tof");
321 StoreArray<CDCHit> hitStoreArray(hitStoreArrayName);
322 if (not hitStoreArray) {
323 B2WARNING("StoreArray " << hitStoreArrayName << " not present");
324 printDataStoreContent();
325 return;
326 }
327 std::vector<CDCSimHit*> simHits;
328 for (const CDCHit& hit : hitStoreArray) {
329 simHits.push_back(hit.getRelated<CDCSimHit>());
330 }
331
332 // group them by their mcparticle id
333 std::map<int, std::set<CDCSimHit*, FlightTimeOrder>> simHitsByMcParticleId;
334 for (CDCSimHit* simHit : simHits) {
335 MCParticle* mcParticle = simHit->getRelated<MCParticle>();
336 if (mcParticle != nullptr) {
337 int mcTrackId = mcParticle->getArrayIndex();
338 simHitsByMcParticleId[mcTrackId].insert(simHit);
339 }
340 }
341
342 AttributeMap defaultAttributeMap = {{"stroke", stroke}, {"stroke-width", strokeWidth}};
343
344 for (const auto& mcParticleIdAndSimHits : simHitsByMcParticleId) {
345 const std::set<CDCSimHit*, FlightTimeOrder>& simHitsForMcParticle =
346 mcParticleIdAndSimHits.second;
347
348 auto drawConnectSimHits = [this, &defaultAttributeMap](CDCSimHit * fromSimHit, CDCSimHit * toSimHit) {
349
350 CDCHit* fromHit = fromSimHit->getRelated<CDCHit>();
351 CDCHit* toHit = toSimHit->getRelated<CDCHit>();
352 if (fromHit == nullptr) return false;
353 if (toHit == nullptr) return false;
354
355 CDCWireHit fromWireHit(fromHit);
356 CDCWireHit toWireHit(toHit);
357
358 CDCRLWireHit fromRLWireHit(&fromWireHit);
359 CDCRLWireHit toRLWireHit(&toWireHit);
360
361 Vector3D fromDisplacement(fromSimHit->getPosTrack() - fromSimHit->getPosWire());
362 Vector3D toDisplacement(toSimHit->getPosTrack() - toSimHit->getPosWire());
363
364 CDCRecoHit2D fromRecoHit2D(fromRLWireHit, fromDisplacement.xy());
365 CDCRecoHit2D toRecoHit2D(toRLWireHit, toDisplacement.xy());
366
367 bool falseOrder = false;
368 if (fromSimHit->getArrayIndex() > toSimHit->getArrayIndex()) {
369 bool fromReassigned = fromHit->getRelatedWithWeight<MCParticle>().second < 0;
370 bool toReassigned = toHit->getRelatedWithWeight<MCParticle>().second < 0;
371 if (not fromReassigned and not toReassigned) {
372 falseOrder = true;
373 }
374 }
375
376 AttributeMap attributeMap = defaultAttributeMap;
377 if (falseOrder) {
378 attributeMap["stroke"] = "red";
379 attributeMap["stroke-width"] = "1.0";
380 }
381 draw(fromRecoHit2D, attributeMap);
382 draw(toRecoHit2D, attributeMap);
383
384 const Vector2D fromPos = fromRecoHit2D.getRecoPos2D();
385 const float fromX = fromPos.x();
386 const float fromY = fromPos.y();
387
388 const Vector2D toPos = toRecoHit2D.getRecoPos2D();
389 const float toX = toPos.x();
390 const float toY = toPos.y();
391
392 m_eventdataPlotter.drawLine(fromX, fromY, toX, toY, attributeMap);
393 return false;
394 };
395
396 // cppcheck-suppress ignoredReturnValue
397 std::adjacent_find(simHitsForMcParticle.begin(),
398 simHitsForMcParticle.end(),
399 drawConnectSimHits);
400 }
401}
B2Vector3D getPosWire() const
The method to get position on wire.
Definition: CDCSimHit.h:199
B2Vector3D getPosTrack() const
The method to get position on the track.
Definition: CDCSimHit.h:217
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
int getArrayIndex() const
Get 0-based index of the particle in the corresponding MCParticle list.
Definition: MCParticle.h:244
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
std::pair< T *, float > getRelatedWithWeight(const std::string &name="", const std::string &namedRelation="") const
Get first related object & weight of relation pointing from/to an array.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:41
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47
void draw(const AObject &object, const AttributeMap &attributeMap)
Draws the object or its trajectory with the given attributes.
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
void drawLine(float startX, float startY, float endX, float endY, const AttributeMap &attributeMap=AttributeMap())
Draws a straight Line.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
double x() const
Getter for the x coordinate.
Definition: Vector2D.h:595
double y() const
Getter for the y coordinate.
Definition: Vector2D.h:605
A three dimensional vector.
Definition: Vector3D.h:33

◆ drawStoreArray()

void drawStoreArray ( const std::string &  storeArrayName,
Styling< AItem > &  styling 
)
private

Function Template for drawing the elements of a given StoreArray.

Needs to know the type of the objects in the StoreArray and the right styling for these objects.

Template Parameters
a_drawTrajectoriesSwitch to draw the fitted trajectory from the object instead.
Parameters
storeArrayNameThe name of the StoreArray containing the objects.
stylingFunctional object to construct attributes for each object to be drawn

◆ drawStoreVector()

void drawStoreVector ( const std::string &  storeObjName,
Styling< AItem > &  styling 
)
private

Function Template for drawing the elements of a given StoreVector.

Needs to know the type of the objects in the store objects and the right styling for these objects.

Template Parameters
a_drawTrajectoriesSwitch to draw the fitted trajectory from the object instead.
Parameters
storeObjNamename of the StoreObject containing the objects.
stylingFunctional object to construct attributes for each object to be drawn

◆ drawSuperLayerBoundaries()

void drawSuperLayerBoundaries ( const std::string &  stroke)

Draws the individual super layer boundaries.

Parameters
strokeThe color to be used for drawing.

Definition at line 129 of file CDCSVGPlotter.cc.

130{
131 AttributeMap attributeMap;
132 attributeMap.emplace("stroke", stroke);
134}
void drawSuperLayerBoundaries(const AttributeMap &attributeMap=AttributeMap())
Draw the super layer bounds of the CDC.

◆ drawTracks()

void drawTracks ( const std::string &  storeObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draws CDCTracks.

Parameters
storeObjNameThe name of the StoreVector containing the CDCTracks.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCSegmentTriple and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCSegmentTriple and its id to a stroke-width.

Definition at line 263 of file CDCSVGPlotter.cc.

266{
268 if (stroke != "") styling.setStroke(stroke);
269 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
270 drawStoreVector<const CDCTrack>(storeObjName, styling);
271}

◆ drawTrackTrajectories()

void drawTrackTrajectories ( const std::string &  storeObjName,
const std::string &  stroke,
const std::string &  strokeWidth 
)

Draws trajectories of the tracks.

Parameters
storeObjNameThe name of the StoreVector containing the CDCTracks.
strokeEither the color to be used for drawing or the name of the method, which maps the CDCHit and its id to a color.
strokeWidthEither the stroke-width to be used for drawing or the name of the method, which maps the CDCHit and its id to a stroke-width.

Definition at line 273 of file CDCSVGPlotter.cc.

276{
278 if (stroke != "") styling.setStroke(stroke);
279 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
280 const bool drawTrajectories = true;
281 drawStoreVector<const CDCTrack, drawTrajectories>(storeObjName, styling);
282}

◆ drawWires()

void drawWires ( const CDCWireTopology cdcWireTopology)

Draws the wires.

Definition at line 150 of file CDCSVGPlotter.cc.

151{
152 m_eventdataPlotter.draw(cdcWireTopology);
153}
void draw(const Belle2::TrackFindingCDC::Circle2D &circle, AttributeMap attributeMap=AttributeMap())
Draws a filled circle.

◆ drawWrongRLHits()

void drawWrongRLHits ( const std::string &  storeObjName)
private

Draw the CDCRLWireHits in the ACDCHitCollection colored by the match of the right left passage informations.

It respects hit collections reconstructed backwards to have the opposite rl informations.

◆ drawWrongRLHitsInSegments()

void drawWrongRLHitsInSegments ( const std::string &  segmentsStoreObjName)

Draw the CDCRLWireHits in the CDCSegments colored by the match of the right left passage informations.

It respects segments reconstructed backwards to have the opposite rl informations

Definition at line 403 of file CDCSVGPlotter.cc.

404{
405 this->drawWrongRLHits<CDCSegment2D>(segmentsStoreObjName);
406}

◆ drawWrongRLHitsInTracks()

void drawWrongRLHitsInTracks ( const std::string &  tracksStoreObjName)

Draw the CDCRLWireHits in the CDCTracks colored by the match of the right left passage informations.

It respects tracks reconstructed backwards to have the opposite rl informations

Definition at line 408 of file CDCSVGPlotter.cc.

409{
410 this->drawWrongRLHits<CDCTrack>(tracksStoreObjName);
411}

◆ saveFile()

std::string saveFile ( const std::string &  fileName = "display.svg")

Save the current dom object representation to disk.

Parameters
fileNameThe Name of the saved file. Defaults to "display.svg".

Definition at line 614 of file CDCSVGPlotter.cc.

615{
617
618 float height = boundingBox.getHeight();
619 float width = boundingBox.getWidth();
620
621 int totalPoints = 1120 * 1120;
622 float svgHeight = roundf(sqrt(totalPoints * height / width));
623 float svgWidth = roundf(sqrt(totalPoints * width / height));
624
627
628 return (m_eventdataPlotter.save(fileName));
629}
float getWidth() const
Getter for the width of the bounding box rectangle.
Definition: BoundingBox.h:63
float getHeight() const
Getter for the height of the bounding box rectangle.
Definition: BoundingBox.h:67
const std::string save(const std::string &fileName)
Saves the current plot stead to a file.
BoundingBox getBoundingBox() const
Getter for the current bounding box.
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

Member Data Documentation

◆ m_eventdataPlotter

EventDataPlotter m_eventdataPlotter
private

The plotter instance to translate event data objects to svg expressions.

Definition at line 330 of file CDCSVGPlotter.h.


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