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

229{
230 DefaultColorCycleStyling<const CDCAxialSegmentPair> styling;
231 if (stroke != "") styling.setStroke(stroke);
232 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
233 drawStoreVector<const CDCAxialSegmentPair>(storeObjName, styling);
234}
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 474 of file CDCSVGPlotter.cc.

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

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

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

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

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

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

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

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

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

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

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

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

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

218{
219 FixedStyling<const CDCSegment2D> styling;
220 if (stroke != "") styling.setStroke(stroke);
221 if (strokeWidth != "") styling.setStrokeWidth(strokeWidth);
222 const bool drawTrajectories = true;
224}
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 246 of file CDCSVGPlotter.cc.

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

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

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

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

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

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

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

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

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

407{
408 this->drawWrongRLHits<CDCSegment2D>(segmentsStoreObjName);
409}
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 411 of file CDCSVGPlotter.cc.

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

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

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