Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
nusimdata
test
SimulationBase
MCParticle_test.cxx
Go to the documentation of this file.
1
/**
2
* @file MCParticle_test.cxx
3
* @brief Test for simb::MCParticle data product
4
* @author Gianluca Petrillo (petrillo@fnal.gov)
5
* @date November 21, 2017
6
*
7
* Current checks:
8
* * move constructor actially moves (see issue #12067)
9
*
10
* See http://www.boost.org/libs/test for the Boost test library home page.
11
*
12
*/
13
14
#define BOOST_TEST_MODULE ( mcparticle_test )
15
#include "
cetlib/quiet_unit_test.hpp
"
// BOOST_AUTO_TEST_CASE()
16
#include <boost/test/test_tools.hpp>
// BOOST_CHECK()
17
// #include <boost/test/floating_point_comparison.hpp> // BOOST_CHECK_CLOSE()
18
19
// nutools libraries
20
#include "
nusimdata/SimulationBase/MCParticle.h
"
21
#include "
nusimdata/SimulationBase/MCTrajectory.h
"
22
23
// ROOT libraries
24
#include "TLorentzVector.h"
25
26
// C/C++ standard libraries
27
#include <vector>
28
29
30
//------------------------------------------------------------------------------
31
void
MCTrajectoryMoveTest
() {
32
33
simb::MCTrajectory
traj;
34
traj.
Add
(TLorentzVector(), TLorentzVector(),
"hadElastic"
);
35
traj.
Add
(TLorentzVector(), TLorentzVector(),
"hadElastic"
);
36
37
// if the object is moved, we'll find the process map data at the same place
38
auto
const
* pProcessMap = traj.
TrajectoryProcesses
().data();
39
40
simb::MCTrajectory
movedTraj(
std::move
(traj));
41
42
BOOST_CHECK_EQUAL
43
((
void
*) movedTraj.
TrajectoryProcesses
().data(), (
void
*) pProcessMap);
44
BOOST_CHECK_NE((
void
*) traj.
TrajectoryProcesses
().data(), (
void
*) pProcessMap);
45
46
}
// MCTrajectoryMoveTest()
47
48
//------------------------------------------------------------------------------
49
void
MCParticleMoveTest
() {
50
51
simb::MCParticle
part;
52
part.
AddTrajectoryPoint
(TLorentzVector(), TLorentzVector(),
"hadElastic"
);
53
part.
AddTrajectoryPoint
(TLorentzVector(), TLorentzVector(),
"hadElastic"
);
54
55
// if the object is moved, we'll find the process map data at the same place
56
auto
const
* pProcessMap = part.
Trajectory
().
TrajectoryProcesses
().data();
57
58
simb::MCParticle
movedPart(
std::move
(part));
59
60
BOOST_CHECK_EQUAL(
61
(
void
*) movedPart.
Trajectory
().
TrajectoryProcesses
().data(),
62
(
void
*) pProcessMap
63
);
64
BOOST_CHECK_NE(
65
(
void
*) part.
Trajectory
().
TrajectoryProcesses
().data(),
66
(
void
*) pProcessMap
67
);
68
69
70
}
// MCParticleMoveTest()
71
72
//------------------------------------------------------------------------------
73
//--- registration of tests
74
//
75
76
BOOST_AUTO_TEST_CASE
(MCParticleTestCase) {
77
MCTrajectoryMoveTest
();
78
MCParticleMoveTest
();
79
}
// BOOST_AUTO_TEST_CASE(MCParticleTestCase)
80
81
82
//------------------------------------------------------------------------------
simb::MCTrajectory::Add
void Add(TLorentzVector const &p, TLorentzVector const &m)
MCTrajectory.h
Trajectory class.
simb::MCParticle::AddTrajectoryPoint
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
Definition:
MCParticle.h:257
simb::MCParticle::Trajectory
const simb::MCTrajectory & Trajectory() const
Definition:
MCParticle.h:253
simb::MCTrajectory
Definition:
MCTrajectory.h:58
MCTrajectoryMoveTest
void MCTrajectoryMoveTest()
Definition:
MCParticle_test.cxx:31
simb::MCParticle
Definition:
MCParticle.h:24
MCParticle.h
Particle class.
MCParticleMoveTest
void MCParticleMoveTest()
Definition:
MCParticle_test.cxx:49
wirecell.gen.depos.move
def move(depos, offset)
Definition:
depos.py:107
quiet_unit_test.hpp
simb::MCTrajectory::TrajectoryProcesses
ProcessMap const & TrajectoryProcesses() const
Definition:
MCTrajectory.h:188
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(MCParticleTestCase)
Definition:
MCParticle_test.cxx:76
Generated by
1.8.11