Belle II Software development
CDCSVGPlotter Class Reference

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

#include <CDCSVGPlotter.h>

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 CDC::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 information.
 
void drawWrongRLHitsInTracks (const std::string &tracksStoreObjName)
 Draw the CDCRLWireHits in the CDCTracks colored by the match of the right left passage information.
 
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 information.
 
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 107 of file CDCSVGPlotter.cc.

107 :
108 m_eventdataPlotter(std::make_unique<SVGPrimitivePlotter>(c_defaultSVGAttributes), animate, forwardFade)
109{
110 int top = -112;
111 int left = -112;
112 int right = 112;
113 int bottom = 112;
114
115 TrackFindingCDC::BoundingBox default_bound(left, bottom, right, top);
116 int default_width = 1120;
117 int default_height = 1120;
118
119 m_eventdataPlotter.setBoundingBox(default_bound);
120 m_eventdataPlotter.setCanvasHeight(default_height);
121 m_eventdataPlotter.setCanvasWidth(default_width);
122}
EventDataPlotter m_eventdataPlotter
The plotter instance to translate event data objects to svg expressions.

Member Function Documentation

◆ clone()

CDCSVGPlotter * clone ( )

Make a copy of the current status of the plotter.

Definition at line 124 of file CDCSVGPlotter.cc.

125{
126 return (new CDCSVGPlotter(*this));
127}
CDCSVGPlotter(bool animate=false, bool forwardFade=false)
Constructor.

◆ 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 227 of file CDCSVGPlotter.cc.

230{
231 DefaultColorCycleStyling<const CDCAxialSegmentPair> styling;
232 if (stroke != "") styling.setStroke(stroke);
233 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
234 drawStoreVector<const CDCAxialSegmentPair>(storeObjName, styling);
235}
void drawStoreVector(const std::string &storeObjName, Styling< AItem > &styling)
Function Template for drawing the elements of a given StoreVector.
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:175
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:165

◆ 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 196 of file CDCSVGPlotter.cc.

199{
200 DefaultColorCycleStyling<const CDCWireHitCluster> styling;
201 if (stroke != "") styling.setStroke(stroke);
202 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
203 drawStoreVector<const CDCWireHitCluster>(storeObjName, styling);
204}

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

163{
164 ChooseableHitStyling styling;
165 if (stroke != "") styling.setStroke(stroke);
166 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
167 drawStoreArray<const CDCHit>(storeArrayName, styling);
168}
void drawStoreArray(const std::string &storeArrayName, Styling< AItem > &styling)
Function Template for drawing the elements of a given StoreArray.

◆ drawInnerCDCWall()

void drawInnerCDCWall ( const std::string & stroke)

Draws the inner CDCWall.

Parameters
strokeThe color to be used for drawing.

Definition at line 148 of file CDCSVGPlotter.cc.

149{
150 AttributeMap attributeMap;
151 attributeMap.emplace("stroke", stroke);
152 m_eventdataPlotter.drawInnerCDCWall(attributeMap);
153}

◆ drawInteractionPoint()

void drawInteractionPoint ( )

Draws the interaction point.

Definition at line 129 of file CDCSVGPlotter.cc.

130{
131 m_eventdataPlotter.drawInteractionPoint();
132}

◆ drawIterable()

template<bool a_drawTrajectory = false, class AIterable, class AStyling>
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 475 of file CDCSVGPlotter.cc.

478{
479 B2INFO("Draw axial to axial segment pairs");
480 StoreWrappedObjPtr<std::vector<CDCSegment2D>> storedSegments(segmentsStoreObjName);
481 if (not storedSegments) {
482 B2WARNING(segmentsStoreObjName << "does not exist in current DataStore");
483 printDataStoreContent();
484 return;
485 }
486
487 std::vector<CDCSegment2D>& segments = *storedSegments;
488 B2INFO("#Segments: " << segments.size());
489
490 std::vector<const CDCAxialSegment2D*> axialSegments;
491 for (const CDCAxialSegment2D& segment : segments) {
492 if (segment.isAxial()) axialSegments.push_back(&segment);
493 }
494
495 MCAxialSegmentPairFilter mcAxialSegmentPairFilter;
496 std::vector<CDCAxialSegmentPair> mcAxialSegmentPairs;
497 for (const CDCAxialSegment2D* fromSegment : axialSegments) {
498 for (const CDCAxialSegment2D* toSegment : axialSegments) {
499 if (fromSegment == toSegment) continue;
500 mcAxialSegmentPairs.emplace_back(fromSegment, toSegment);
501 Weight mcWeight = mcAxialSegmentPairFilter(mcAxialSegmentPairs.back());
502 // Remove segment pairs that are not true
503 if (std::isnan(mcWeight)) {
504 mcAxialSegmentPairs.pop_back();
505 }
506 }
507 }
508 B2INFO("# Axial segment pairs: " << mcAxialSegmentPairs.size());
509 FixedStyling<const CDCAxialSegmentPair> styling;
510 if (stroke != "") styling.setStroke(stroke);
511 if (strokeWidth != "") styling.setStroke(strokeWidth);
512 drawIterable(mcAxialSegmentPairs, styling);
513}
void drawIterable(const AIterable &items, AStyling &styling)
Draw every element of an iterable object.
void setStroke(const std::string &value)
Legacy - Sets the stroke color to the fixed value.
Definition Styling.h:83

◆ 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 310 of file CDCSVGPlotter.cc.

313{
314 DefaultColorCycleStyling<const MCParticle> styling;
315 if (stroke != "") styling.setStroke(stroke);
316 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
317 const bool drawTrajectories = true;
319}

◆ 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 515 of file CDCSVGPlotter.cc.

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

◆ 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 571 of file CDCSVGPlotter.cc.

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

◆ drawOuterCDCWall()

void drawOuterCDCWall ( const std::string & stroke)

Draws the outer CDCWall.

Parameters
strokeThe color to be used for drawing.

Definition at line 141 of file CDCSVGPlotter.cc.

142{
143 AttributeMap attributeMap;
144 attributeMap.emplace("stroke", stroke);
145 m_eventdataPlotter.drawOuterCDCWall(attributeMap);
146}

◆ 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 289 of file CDCSVGPlotter.cc.

292{
293 ChooseableRecoTrackStyling styling;
294 if (stroke != "") styling.setStroke(stroke);
295 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
296 drawStoreArray<const RecoTrack>(storeArrayName, styling);
297}

◆ 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 299 of file CDCSVGPlotter.cc.

302{
303 DefaultColorCycleStyling<const RecoTrack> styling;
304 if (stroke != "") styling.setStroke(stroke);
305 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
306 const bool drawTrajectories = true;
308}

◆ 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 237 of file CDCSVGPlotter.cc.

240{
241 DefaultColorCycleStyling<const CDCSegmentPair> styling;
242 if (stroke != "") styling.setStroke(stroke);
243 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
244 drawStoreVector<const CDCSegmentPair>(storeObjName, styling);
245}

◆ 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 206 of file CDCSVGPlotter.cc.

209{
210 ChooseableSegmentStyling styling;
211 if (stroke != "") styling.setStroke(stroke);
212 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
213 drawStoreVector<const CDCSegment2D>(storeObjName, styling);
214}

◆ 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 216 of file CDCSVGPlotter.cc.

219{
220 FixedStyling<const CDCSegment2D> styling;
221 if (stroke != "") styling.setStroke(stroke);
222 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
223 const bool drawTrajectories = true;
225}
void setStrokeWidth(const std::string &value)
Legacy - Sets the stroke width to the fixed value.
Definition Styling.h:89

◆ 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 247 of file CDCSVGPlotter.cc.

250{
251 DefaultColorCycleStyling<const CDCSegmentTriple> styling;
252 if (stroke != "") styling.setStroke(stroke);
253 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
254 drawStoreVector<const CDCSegmentTriple>(storeObjName, styling);
255}

◆ 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 257 of file CDCSVGPlotter.cc.

260{
261 DefaultColorCycleStyling<const CDCSegmentTriple> styling;
262 if (stroke != "") styling.setStroke(stroke);
263 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
264 const bool drawTrajectories = true;
266}

◆ 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 170 of file CDCSVGPlotter.cc.

173{
174 B2INFO("Drawing simulated hits");
175 StoreArray<CDCHit> storeArray(storeArrayName);
176 if (not storeArray) {
177 B2WARNING("StoreArray " << storeArrayName << " not present");
178 printDataStoreContent();
179 return;
180 }
181 std::vector<CDCSimHit> simHitsRelatedToHits;
182 for (const CDCHit& hit : storeArray) {
183 simHitsRelatedToHits.push_back(*hit.getRelated<CDCSimHit>("CDCSimHits"));
184 }
185 B2INFO("#CDCSimHits: " << storeArray.getEntries());
186 FixedStyling<const CDCSimHit> styling;
187 if (stroke != "") {
188 styling.setStroke("orange");
189 } else {
190 styling.setStroke(stroke);
191 }
192 styling.setStrokeWidth(strokeWidth);
193 drawIterable(simHitsRelatedToHits, styling);
194}

◆ 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 321 of file CDCSVGPlotter.cc.

324{
325 B2INFO("Drawing simulated hits connected by tof");
326 StoreArray<CDCHit> hitStoreArray(hitStoreArrayName);
327 if (not hitStoreArray) {
328 B2WARNING("StoreArray " << hitStoreArrayName << " not present");
329 printDataStoreContent();
330 return;
331 }
332 std::vector<CDCSimHit*> simHits;
333 for (const CDCHit& hit : hitStoreArray) {
334 simHits.push_back(hit.getRelated<CDCSimHit>());
335 }
336
337 // group them by their mcparticle id
338 std::map<int, std::set<CDCSimHit*, FlightTimeOrder>> simHitsByMcParticleId;
339 for (CDCSimHit* simHit : simHits) {
340 MCParticle* mcParticle = simHit->getRelated<MCParticle>();
341 if (mcParticle != nullptr) {
342 int mcTrackId = mcParticle->getArrayIndex();
343 simHitsByMcParticleId[mcTrackId].insert(simHit);
344 }
345 }
346
347 AttributeMap defaultAttributeMap = {{"stroke", stroke}, {"stroke-width", strokeWidth}};
348
349 for (const auto& mcParticleIdAndSimHits : simHitsByMcParticleId) {
350 const std::set<CDCSimHit*, FlightTimeOrder>& simHitsForMcParticle =
351 mcParticleIdAndSimHits.second;
352
353 auto drawConnectSimHits = [this, &defaultAttributeMap](CDCSimHit * fromSimHit, CDCSimHit * toSimHit) {
354
355 CDCHit* fromHit = fromSimHit->getRelated<CDCHit>();
356 CDCHit* toHit = toSimHit->getRelated<CDCHit>();
357 if (fromHit == nullptr) return false;
358 if (toHit == nullptr) return false;
359
360 CDCWireHit fromWireHit(fromHit);
361 CDCWireHit toWireHit(toHit);
362
363 CDCRLWireHit fromRLWireHit(&fromWireHit);
364 CDCRLWireHit toRLWireHit(&toWireHit);
365
366 Vector3D fromDisplacement(fromSimHit->getPosTrack() - fromSimHit->getPosWire());
367 Vector3D toDisplacement(toSimHit->getPosTrack() - toSimHit->getPosWire());
368
369 CDCRecoHit2D fromRecoHit2D(fromRLWireHit, fromDisplacement.xy());
370 CDCRecoHit2D toRecoHit2D(toRLWireHit, toDisplacement.xy());
371
372 bool falseOrder = false;
373 if (fromSimHit->getArrayIndex() > toSimHit->getArrayIndex()) {
374 bool fromReassigned = fromHit->getRelatedWithWeight<MCParticle>().second < 0;
375 bool toReassigned = toHit->getRelatedWithWeight<MCParticle>().second < 0;
376 if (not fromReassigned and not toReassigned) {
377 falseOrder = true;
378 }
379 }
380
381 AttributeMap attributeMap = defaultAttributeMap;
382 if (falseOrder) {
383 attributeMap["stroke"] = "red";
384 attributeMap["stroke-width"] = "1.0";
385 }
386 draw(fromRecoHit2D, attributeMap);
387 draw(toRecoHit2D, attributeMap);
388
389 const Vector2D fromPos = fromRecoHit2D.getRecoPos2D();
390 const float fromX = fromPos.x();
391 const float fromY = fromPos.y();
392
393 const Vector2D toPos = toRecoHit2D.getRecoPos2D();
394 const float toX = toPos.x();
395 const float toY = toPos.y();
396
397 m_eventdataPlotter.drawLine(fromX, fromY, toX, toY, attributeMap);
398 return false;
399 };
400
401 std::ignore = std::adjacent_find(simHitsForMcParticle.begin(),
402 simHitsForMcParticle.end(),
403 drawConnectSimHits);
404 }
405}
B2Vector3D getPosWire() const
The method to get position on wire.
Definition CDCSimHit.h:198
B2Vector3D getPosTrack() const
The method to get position on the track.
Definition CDCSimHit.h:216
int getArrayIndex() const
Get 0-based index of the particle in the corresponding MCParticle list.
Definition MCParticle.h:233
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.
void draw(const AObject &object, const AttributeMap &attributeMap)
Draws the object or its trajectory with the given attributes.
double x() const
Getter for the x coordinate.
Definition Vector2D.h:626
double y() const
Getter for the y coordinate.
Definition Vector2D.h:641
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition Cell.h:34

◆ drawStoreArray()

template<class AItem, bool a_drawTrajectories = false>
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()

template<class AItem, bool a_drawTrajectories = false>
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 134 of file CDCSVGPlotter.cc.

135{
136 AttributeMap attributeMap;
137 attributeMap.emplace("stroke", stroke);
138 m_eventdataPlotter.drawSuperLayerBoundaries(attributeMap);
139}

◆ 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 268 of file CDCSVGPlotter.cc.

271{
272 DefaultColorCycleStyling<const CDCTrack> styling;
273 if (stroke != "") styling.setStroke(stroke);
274 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
275 drawStoreVector<const CDCTrack>(storeObjName, styling);
276}

◆ 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 278 of file CDCSVGPlotter.cc.

281{
282 DefaultColorCycleStyling<const CDCTrack> styling;
283 if (stroke != "") styling.setStroke(stroke);
284 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
285 const bool drawTrajectories = true;
287}

◆ drawWires()

void drawWires ( const CDC::CDCWireTopology & cdcWireTopology)

Draws the wires.

Definition at line 155 of file CDCSVGPlotter.cc.

156{
157 m_eventdataPlotter.draw(cdcWireTopology);
158}

◆ drawWrongRLHits()

template<class ACDCHitCollection>
void drawWrongRLHits ( const std::string & storeObjName)
private

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

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

◆ drawWrongRLHitsInSegments()

void drawWrongRLHitsInSegments ( const std::string & segmentsStoreObjName)

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

It respects segments reconstructed backwards to have the opposite rl information

Definition at line 407 of file CDCSVGPlotter.cc.

408{
409 this->drawWrongRLHits<CDCSegment2D>(segmentsStoreObjName);
410}
void drawWrongRLHits(const std::string &storeObjName)
Draw the CDCRLWireHits in the ACDCHitCollection colored by the match of the right left passage inform...

◆ drawWrongRLHitsInTracks()

void drawWrongRLHitsInTracks ( const std::string & tracksStoreObjName)

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

It respects tracks reconstructed backwards to have the opposite rl information

Definition at line 412 of file CDCSVGPlotter.cc.

413{
414 this->drawWrongRLHits<CDCTrack>(tracksStoreObjName);
415}

◆ 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 618 of file CDCSVGPlotter.cc.

619{
620 TrackFindingCDC::BoundingBox boundingBox = m_eventdataPlotter.getBoundingBox();
621
622 float height = boundingBox.getHeight();
623 float width = boundingBox.getWidth();
624
625 int totalPoints = 1120 * 1120;
626 float svgHeight = roundf(sqrt(totalPoints * height / width));
627 float svgWidth = roundf(sqrt(totalPoints * width / height));
628
629 m_eventdataPlotter.setCanvasHeight(svgHeight);
630 m_eventdataPlotter.setCanvasWidth(svgWidth);
631
632 return (m_eventdataPlotter.save(fileName));
633}
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
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: