10#include <tracking/trackFindingCDC/display/EventDataPlotter.h>
11#include <tracking/trackFindingCDC/sim/CDCSimpleSimulation.h>
13#include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
14#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment3D.h>
15#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
16#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
18#include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
20#include <tracking/trackFindingCDC/geometry/Helix.h>
22#include <tracking/trackFindingCDC/testFixtures/TrackFindingCDCTestWithTopology.h>
23#include <tracking/trackFindingCDC/utilities/TimeIt.h>
32 namespace TrackFindingCDC {
50 bool run_disabled = ::testing::GTEST_FLAG(also_run_disabled_tests);
66 void simulate(
const std::initializer_list<Helix>& helices)
68 simulate(std::vector<Helix>(helices));
73 void simulate(
const std::vector<Helix>& helices)
75 std::vector<CDCTrajectory3D> trajectories;
76 trajectories.reserve(helices.size());
77 for (
const Helix& helix : helices) {
85 void simulate(
const std::initializer_list<CDCTrajectory3D>& trajectories)
87 simulate(std::vector<CDCTrajectory3D>(trajectories));
91 void simulate(
const std::vector<CDCTrajectory3D>& trajectories)
116 for (
size_t iTrack = 0; iTrack <
m_mcTracks.size(); ++iTrack) {
117 B2INFO(
"Size mc track " << iTrack <<
" : " <<
m_mcTracks[iTrack].size());
122 std::vector<CDCSegment3D> segment3DsInTrack = mcTrack.splitIntoSegments();
123 for (
const CDCSegment3D& segment3D : segment3DsInTrack) {
130 if (segment2D.getStereoKind() == EStereoKind::c_Axial) {
137 if (wireHit.isAxial()) {
168 bool run_disabled = ::testing::GTEST_FLAG(also_run_disabled_tests);
172 B2INFO(
"Not writing display file. To activate svg display output run with --gtest_also_run_disabled_tests");
181 template<
class AFunction >
184 bool activateCallgrind,
185 const AFunction& function,
186 const std::function<
void()>& setUp = doNothing,
187 const std::function<
void()>& tearDown = doNothing)
189 bool run_disabled = ::testing::GTEST_FLAG(also_run_disabled_tests);
190 if (not run_disabled) {
193 return Belle2::TrackFindingCDC::timeIt(nExecutions,
202 template<
class... Ts>
231 const std::array<std::string, 6>
m_colors{{
"red",
"blue",
"green",
"yellow",
"violet",
"cyan" }};
ELogLevel getLogLevel() const
Returns the configured log level.
ELogLevel
Definition of the supported log levels.
@ c_Info
Info: for informational messages, e.g.
@ c_Debug
Debug: for code development.
unsigned int getLogInfo(ELogLevel logLevel) const
Returns the configured log information for the given level.
@ c_Level
Log level of the message.
@ c_Message
Log message text.
void setLogLevel(ELogLevel logLevel)
Configure the log level.
void setLogInfo(ELogLevel logLevel, unsigned int logInfo)
Configure the printed log information for the given level.
LogConfig * getLogConfig()
Returns global log system configuration.
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
A reconstructed sequence of two dimensional hits in one super layer.
A segment consisting of three dimensional reconstructed hits.
Class providing a simple simulation of the CDC mainly for quick unit test checks.
ConstVectorRange< CDCWireHit > getWireHits() const
Getter for the wire hits created in the simulation.
std::vector< CDCTrack > simulate(const std::vector< CDCTrajectory3D > &trajectories3D)
Propagates the trajectories through the CDC as without energy loss until they first leave the CDC.
std::vector< CDCTrack > loadPreparedEvent()
Fills the wire hits with a hard coded event from the real simulation.
Class representing a sequence of three dimensional reconstructed hits.
Particle full three dimensional trajectory.
Class representing a hit wire in the central drift chamber.
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
A class that can plot event related data types.
const std::string save(const std::string &fileName)
Saves the current plot stead to a file.
void clear()
Clears all drawn elements from the plotter.
void draw(const Belle2::TrackFindingCDC::Circle2D &circle, AttributeMap attributeMap=AttributeMap())
Draws a filled circle.
Extension of the generalized circle also caching the perigee coordinates.
Class to capture the time a repeated execution took.
void simulate(const std::vector< CDCTrajectory3D > &trajectories)
Populate the event with hits generated from the given trajectories.
void simulate(const std::initializer_list< CDCTrajectory3D > &trajectories)
Populate the event with hits generated from the given trajectories.
void simulate(const std::initializer_list< Helix > &helices)
Populate the event with hits generated from the given helices.
void SetUp() override
Preparations before the test.
void draw(Ts &&... args)
Forwarding draw class to the plotter instance.
void saveDisplay(const std::string &svgFileName)
Save content of the plotter to svg file only if running in unrestricted mode –gtest_also_run_disabled...
std::vector< CDCTrack > m_mcTracks
Memory for the Monte Carlo tracks of the current event.
std::vector< const CDCSegment2D * > m_mcAxialSegment2Ds
Memory for the axial Monte Carlo segments of the current event.
std::vector< CDCSegment2D > m_mcSegment2Ds
Memory for the Monte Carlo segments of the current event.
void loadPreparedEvent()
Populate the event with hits hard codes presimulated hits.
CDCSimpleSimulation m_simpleSimulation
Simple simulation generating the hits.
void simulate(const std::vector< Helix > &helices)
Populate the event with hits generated from the given helices.
TimeItResult timeIt(size_t nExecutions, bool activateCallgrind, const AFunction &function, const std::function< void()> &setUp=doNothing, const std::function< void()> &tearDown=doNothing)
Repeat a time critical simulation section a couple of times.
EventDataPlotter m_plotter
Plotter facility to generate visual representations.
std::vector< const CDCWireHit * > m_wireHits
Memory for the hits of the current event.
void plotMCTrajectories()
Add the Monte Carlo trajectories to the event plot.
LogConfig::ELogLevel m_savedLogLevel
Memory for the log level that was set before the test.
void fillCaches()
Prepare a set of hits, axial hits, segments, axial segments and track hits.
void plotMCTracks()
Add the Monte Carlo tracks to the event plot.
void TearDown() override
Clean up after test.
std::vector< const CDCWireHit * > m_axialWireHits
Memory for the axial hits of the current event.
unsigned int m_savedDebugLogInfo
Memory for the log info of debug that was set before the test.
std::vector< CDCTrajectory3D > m_mcTrajectories
Memory for the Monte Carlo trajectories of the current event.
const std::array< std::string, 6 > m_colors
Some colors to cycle for plotting.
This class provides the declaration of the common test fixture to all test of the track finding in th...
A general helix class including a covariance matrix.
Abstract base class for different kinds of events.