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

106 :
107 m_eventdataPlotter(std::make_unique<SVGPrimitivePlotter>(c_defaultSVGAttributes), animate, forwardFade)
108{
109 int top = -112;
110 int left = -112;
111 int right = 112;
112 int bottom = 112;
113
114 TrackFindingCDC::BoundingBox default_bound(left, bottom, right, top);
115 int default_width = 1120;
116 int default_height = 1120;
117
118 m_eventdataPlotter.setBoundingBox(default_bound);
119 m_eventdataPlotter.setCanvasHeight(default_height);
120 m_eventdataPlotter.setCanvasWidth(default_width);
121}
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 123 of file CDCSVGPlotter.cc.

124{
125 return (new CDCSVGPlotter(*this));
126}
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 195 of file CDCSVGPlotter.cc.

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

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

162{
163 ChooseableHitStyling styling;
164 if (stroke != "") styling.setStroke(stroke);
165 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
166 drawStoreArray<const CDCHit>(storeArrayName, styling);
167}
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 147 of file CDCSVGPlotter.cc.

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

◆ drawInteractionPoint()

void drawInteractionPoint ( )

Draws the interaction point.

Definition at line 128 of file CDCSVGPlotter.cc.

129{
130 m_eventdataPlotter.drawInteractionPoint();
131}

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

484{
485 B2INFO("Draw axial to axial segment pairs");
486 StoreWrappedObjPtr<std::vector<CDCSegment2D>> storedSegments(segmentsStoreObjName);
487 if (not storedSegments) {
488 B2WARNING(segmentsStoreObjName << "does not exist in current DataStore");
489 printDataStoreContent();
490 return;
491 }
492
493 const std::vector<CDCSegment2D>& segments = *storedSegments;
494 B2INFO("#Segments: " << segments.size());
495
496 std::vector<const CDCAxialSegment2D*> axialSegments;
497 for (const CDCAxialSegment2D& segment : segments) {
498 if (segment.isAxial()) axialSegments.push_back(&segment);
499 }
500
501 MCAxialSegmentPairFilter mcAxialSegmentPairFilter;
502 std::vector<CDCAxialSegmentPair> mcAxialSegmentPairs;
503 for (const CDCAxialSegment2D* fromSegment : axialSegments) {
504 for (const CDCAxialSegment2D* toSegment : axialSegments) {
505 if (fromSegment == toSegment) continue;
506 mcAxialSegmentPairs.emplace_back(fromSegment, toSegment);
507 Weight mcWeight = mcAxialSegmentPairFilter(mcAxialSegmentPairs.back());
508 // Remove segment pairs that are not true
509 if (std::isnan(mcWeight)) {
510 mcAxialSegmentPairs.pop_back();
511 }
512 }
513 }
514 B2INFO("# Axial segment pairs: " << mcAxialSegmentPairs.size());
515 FixedStyling<const CDCAxialSegmentPair> styling;
516 if (stroke != "") styling.setStroke(stroke);
517 if (strokeWidth != "") styling.setStroke(strokeWidth);
518 drawIterable(mcAxialSegmentPairs, styling);
519}
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 314 of file CDCSVGPlotter.cc.

317{
318 DefaultColorCycleStyling<const MCParticle> styling;
319 if (stroke != "") styling.setStroke(stroke);
320 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
321 const bool drawTrajectories = true;
323}

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

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

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

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

◆ drawOuterCDCWall()

void drawOuterCDCWall ( const std::string & stroke)

Draws the outer CDCWall.

Parameters
strokeThe color to be used for drawing.

Definition at line 140 of file CDCSVGPlotter.cc.

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

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

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

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

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

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

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

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

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

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

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

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

328{
329 B2INFO("Drawing simulated hits connected by tof");
330 StoreArray<CDCHit> hitStoreArray(hitStoreArrayName);
331 if (not hitStoreArray) {
332 B2WARNING("StoreArray " << hitStoreArrayName << " not present");
333 printDataStoreContent();
334 return;
335 }
336 std::vector<CDCSimHit*> simHits;
337 for (const CDCHit& hit : hitStoreArray) {
338 simHits.push_back(hit.getRelated<CDCSimHit>());
339 }
340
341 // group them by their mcparticle id
342 std::map<int, std::set<CDCSimHit*, FlightTimeOrder>> simHitsByMcParticleId;
343 for (CDCSimHit* simHit : simHits) {
344 const MCParticle* mcParticle = simHit->getRelated<MCParticle>();
345 if (mcParticle != nullptr) {
346 int mcTrackId = mcParticle->getArrayIndex();
347 simHitsByMcParticleId[mcTrackId].insert(simHit);
348 }
349 }
350
351 AttributeMap defaultAttributeMap = {{"stroke", stroke}, {"stroke-width", strokeWidth}};
352
353 for (const auto& mcParticleIdAndSimHits : simHitsByMcParticleId) {
354 const std::set<CDCSimHit*, FlightTimeOrder>& simHitsForMcParticle =
355 mcParticleIdAndSimHits.second;
356
357 auto drawConnectSimHits = [this, &defaultAttributeMap](CDCSimHit * fromSimHit, CDCSimHit * toSimHit) {
358
359 CDCHit* fromHit = fromSimHit->getRelated<CDCHit>();
360 CDCHit* toHit = toSimHit->getRelated<CDCHit>();
361 if (fromHit == nullptr) return false;
362 if (toHit == nullptr) return false;
363
364 CDCWireHit fromWireHit(fromHit);
365 CDCWireHit toWireHit(toHit);
366
367 CDCRLWireHit fromRLWireHit(&fromWireHit);
368 CDCRLWireHit toRLWireHit(&toWireHit);
369
370 ROOT::Math::XYZVector fromDisplacement(fromSimHit->getPosTrack() - fromSimHit->getPosWire());
371 ROOT::Math::XYZVector toDisplacement(toSimHit->getPosTrack() - toSimHit->getPosWire());
372
373 CDCRecoHit2D fromRecoHit2D(fromRLWireHit, VectorUtil::getXYVector(fromDisplacement));
374 CDCRecoHit2D toRecoHit2D(toRLWireHit, VectorUtil::getXYVector(toDisplacement));
375
376 bool falseOrder = false;
377 if (fromSimHit->getArrayIndex() > toSimHit->getArrayIndex()) {
378 bool fromReassigned = fromHit->getRelatedWithWeight<MCParticle>().second < 0;
379 bool toReassigned = toHit->getRelatedWithWeight<MCParticle>().second < 0;
380 if (not fromReassigned and not toReassigned) {
381 falseOrder = true;
382 }
383 }
384
385 AttributeMap attributeMap = defaultAttributeMap;
386 if (falseOrder) {
387 attributeMap["stroke"] = "red";
388 attributeMap["stroke-width"] = "1.0";
389 }
390 draw(fromRecoHit2D, attributeMap);
391 draw(toRecoHit2D, attributeMap);
392
393 const ROOT::Math::XYVector fromPos = fromRecoHit2D.getRecoPos2D();
394 const float fromX = fromPos.x();
395 const float fromY = fromPos.y();
396
397 const ROOT::Math::XYVector toPos = toRecoHit2D.getRecoPos2D();
398 const float toX = toPos.x();
399 const float toY = toPos.y();
400
401 m_eventdataPlotter.drawLine(fromX, fromY, toX, toY, attributeMap);
402 return false;
403 };
404
405 std::ignore = std::adjacent_find(simHitsForMcParticle.begin(),
406 simHitsForMcParticle.end(),
407 drawConnectSimHits);
408 }
409}
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.

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

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

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

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

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

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

◆ drawWires()

void drawWires ( const CDC::CDCWireTopology & cdcWireTopology)

Draws the wires.

Definition at line 154 of file CDCSVGPlotter.cc.

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

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

413{
414 this->drawWrongRLHits<CDCSegment2D>(segmentsStoreObjName);
415}
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 418 of file CDCSVGPlotter.cc.

419{
420 this->drawWrongRLHits<CDCTrack>(tracksStoreObjName);
421}

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

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