Macros | Functions
MCParticle_test.cxx File Reference

Test for simb::MCParticle data product. More...

#include "cetlib/quiet_unit_test.hpp"
#include <boost/test/test_tools.hpp>
#include "nusimdata/SimulationBase/MCParticle.h"
#include "nusimdata/SimulationBase/MCTrajectory.h"
#include "TLorentzVector.h"
#include <vector>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   ( mcparticle_test )
 

Functions

void MCTrajectoryMoveTest ()
 
void MCParticleMoveTest ()
 
 BOOST_AUTO_TEST_CASE (MCParticleTestCase)
 

Detailed Description

Test for simb::MCParticle data product.

Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.fnal..nosp@m.gov)
Date
November 21, 2017

Current checks:

See http://www.boost.org/libs/test for the Boost test library home page.

Definition in file MCParticle_test.cxx.

Macro Definition Documentation

#define BOOST_TEST_MODULE   ( mcparticle_test )

Definition at line 14 of file MCParticle_test.cxx.

Function Documentation

BOOST_AUTO_TEST_CASE ( MCParticleTestCase  )

Definition at line 76 of file MCParticle_test.cxx.

76  {
79 } // BOOST_AUTO_TEST_CASE(MCParticleTestCase)
void MCTrajectoryMoveTest()
void MCParticleMoveTest()
void MCParticleMoveTest ( )

Definition at line 49 of file MCParticle_test.cxx.

49  {
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()
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
Definition: MCParticle.h:257
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:253
def move(depos, offset)
Definition: depos.py:107
ProcessMap const & TrajectoryProcesses() const
Definition: MCTrajectory.h:188
void MCTrajectoryMoveTest ( )

Definition at line 31 of file MCParticle_test.cxx.

31  {
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()
void Add(TLorentzVector const &p, TLorentzVector const &m)
def move(depos, offset)
Definition: depos.py:107
ProcessMap const & TrajectoryProcesses() const
Definition: MCTrajectory.h:188