Belle II Software  release-08-01-10
CDCSimpleSimulation.test.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include <tracking/trackFindingCDC/testFixtures/TrackFindingCDCTestWithSimpleSimulation.h>
9 
10 #include <tracking/trackFindingCDC/sim/CDCSimpleSimulation.h>
11 #include <tracking/trackFindingCDC/display/EventDataPlotter.h>
12 
13 using namespace Belle2;
14 using namespace TrackFindingCDC;
15 
16 TEST_F(TrackFindingCDCTestWithSimpleSimulation, sim_CDCSimpleSimulation_straight)
17 {
18  Helix straightOriginLine(0, 0, 0, 0, 0);
19  simulate({straightOriginLine});
20  saveDisplay("straight.svg");
21 }
22 
23 
24 TEST_F(TrackFindingCDCTestWithSimpleSimulation, sim_CDCSimpleSimulation_high)
25 {
26  Helix lowCurvOriginHelix(0.015, 0, 0, 1, 0);
27  simulate({lowCurvOriginHelix});
28 
29  for (const CDCRecoHit3D& recoHit3D : m_mcTracks[0]) {
30  EventDataPlotter::AttributeMap rl {{"stroke", recoHit3D.getRLInfo() == ERightLeft::c_Right ? "green" : "red"}};
31  draw(recoHit3D, rl);
32  }
33 
34  saveDisplay("low.svg");
35 }
36 
37 
38 TEST_F(TrackFindingCDCTestWithSimpleSimulation, sim_CDCSimpleSimulation_cosmic)
39 {
40  Helix straightOffOriginLine(0, 1, 20, 1, 75);
41  double outerWallR = CDCWireTopology::getInstance().getOuterCylindricalR();
42  double arcLengthToOuterWall =
43  straightOffOriginLine.arcLength2DToCylindricalR(outerWallR);
44 
45  Vector3D startPoint = straightOffOriginLine.atArcLength2D(-arcLengthToOuterWall);
46  CDCTrajectory3D cosmicTrajectory(straightOffOriginLine);
47  cosmicTrajectory.setLocalOrigin(startPoint);
48 
49  simulate({cosmicTrajectory});
50  saveDisplay("cosmic.svg");
51 }
52 
53 
54 TEST_F(TrackFindingCDCTestWithSimpleSimulation, sim_CDCSimpleSimulation_curl)
55 {
56  Helix highCurvOriginHelix(0.02, 1, 0, 0.5, 0);
57  simulate({highCurvOriginHelix});
58  saveDisplay("curl.svg");
59 }
60 
61 TEST_F(TrackFindingCDCTestWithSimpleSimulation, sim_CDCSimpleSimulation_secondary_curl)
62 {
63  Helix highCurvOffOriginHelix(0.02, 1, -30, 0.2, 0);
64  simulate({highCurvOffOriginHelix});
65  saveDisplay("secondary_curl.svg");
66 }
67 
68 
69 TEST_F(TrackFindingCDCTestWithSimpleSimulation, sim_CDCSimpleSimulation_photon_conversion)
70 {
71  // Should probably be placed at a vxd ladder
72  Vector3D vertex(1.0, 0.0, 0.0);
73  Vector3D momentum(1.0, 0.0, 0.0);
74  double time = 0.0;
75 
76  CDCTrajectory3D electronTrajectory(vertex, time, momentum, -1, 1.5);
77  CDCTrajectory3D positronTrajectory(vertex, time, momentum, 1, 1.5);
78 
79  simulate({electronTrajectory, positronTrajectory});
80  saveDisplay("photon_conversion.svg");
81 }
82 
83 TEST_F(TrackFindingCDCTestWithSimpleSimulation, sim_CDCSimpleSimulation_cosmic_with_delay)
84 {
85  m_simpleSimulation.activateTOFDelay();
86  m_simpleSimulation.activateInWireSignalDelay();
87 
88  Helix straightOffOriginLine(0, 1, 20, 1, 50);
89  double outerWallR = CDCWireTopology::getInstance().getOuterCylindricalR();
90  double arcLengthToOuterWall =
91  straightOffOriginLine.arcLength2DToCylindricalR(outerWallR);
92 
93  Vector3D startPoint = straightOffOriginLine.atArcLength2D(-arcLengthToOuterWall);
94  CDCTrajectory3D cosmicTrajectory(straightOffOriginLine);
95  cosmicTrajectory.setLocalOrigin(startPoint);
96 
97 
98  CDCTrack mcTrack = m_simpleSimulation.simulate(cosmicTrajectory);
100  draw(mcTrack);
101  saveDisplay("cosmic_with_delay.svg");
102 }
103 
104 
105 TEST_F(TrackFindingCDCTestWithSimpleSimulation, sim_prepared_event_rl_flags)
106 {
107  std::string svgFileName = "rl_flags_prepared_event.svg";
108  loadPreparedEvent();
109 
110  for (CDCTrack& track : m_mcTracks) {
111  for (const CDCRecoHit3D& recoHit3D : track) {
112  const CDCRLWireHit& rlWireHit = recoHit3D.getRLWireHit();
113  std::string color = "blue";
114  if (rlWireHit.getRLInfo() == ERightLeft::c_Right) {
115  color = "green";
116  } else if (rlWireHit.getRLInfo() == ERightLeft::c_Left) {
117  color = "red";
118  }
119  EventDataPlotter::AttributeMap strokeAttr {{"stroke", color}};
120  draw(rlWireHit.getWireHit(), strokeAttr);
121  }
122  }
123  saveDisplay(svgFileName);
124 }
Helix parameter class.
Definition: Helix.h:48
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:41
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
Definition: CDCRLWireHit.h:192
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRLWireHit.h:234
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
Particle full three dimensional trajectory.
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
double getOuterCylindricalR() const
Getter for the outer radius of the outer most wire layer.
PrimitivePlotter::AttributeMap AttributeMap
Forward the Attributre map from the primitive plotter.
A three dimensional vector.
Definition: Vector3D.h:33
TEST_F(GlobalLabelTest, LargeNumberOfTimeDependentParameters)
Test large number of time-dep params for registration and retrieval.
Definition: globalLabel.cc:72
Abstract base class for different kinds of events.