Belle II Software development
eclSimHit.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 <ecl/dataobjects/ECLSimHit.h>
9
10#include <gtest/gtest.h>
11
12using namespace std;
13
14namespace Belle2 {
21 class ECLSimHitTest : public ::testing::Test {
22 };
23
25 TEST_F(ECLSimHitTest, Constructors)
26 {
27 ECLSimHit myECLSimHit;
28 EXPECT_EQ(myECLSimHit.getCellId(), 0);
29 EXPECT_EQ(myECLSimHit.getTrackId(), 0);
30 EXPECT_EQ(myECLSimHit.getPDGCode(), 0);
31 EXPECT_EQ(myECLSimHit.getFlightTime(), 0);
32 EXPECT_EQ(myECLSimHit.getEnergyDep(), 0);
33 const auto momentum = myECLSimHit.getMomentum();
34 EXPECT_EQ(momentum.x(), 0);
35 EXPECT_EQ(momentum.y(), 0);
36 EXPECT_EQ(momentum.z(), 0);
37 const auto position = myECLSimHit.getPosition();
38 EXPECT_EQ(position.x(), 0);
39 EXPECT_EQ(position.y(), 0);
40 EXPECT_EQ(position.z(), 0);
41
42 const int cellId = 1;
43 const int trackId = 2;
44 const int pdg = 3;
45 const float flightTime = 4.1;
46 const float edep = 4.2;
47 const G4ThreeVector init_momentum(1, 2, 3);
48 const G4ThreeVector init_position(4, 5, 6);
49 ECLSimHit myECLSimHit2(cellId, trackId, pdg, flightTime, edep, init_momentum, init_position, 0);
50 EXPECT_EQ(myECLSimHit2.getCellId(), cellId);
51 EXPECT_EQ(myECLSimHit2.getTrackId(), trackId);
52 EXPECT_EQ(myECLSimHit2.getPDGCode(), pdg);
53 EXPECT_EQ(myECLSimHit2.getFlightTime(), flightTime);
54 EXPECT_EQ(myECLSimHit2.getEnergyDep(), edep);
55 const auto momentum2 = myECLSimHit2.getMomentum();
56 EXPECT_EQ(momentum2.x(), init_momentum.x());
57 EXPECT_EQ(momentum2.y(), init_momentum.y());
58 EXPECT_EQ(momentum2.z(), init_momentum.z());
59 const auto position2 = myECLSimHit2.getPosition();
60 EXPECT_EQ(position2.x(), init_position.x());
61 EXPECT_EQ(position2.y(), init_position.y());
62 EXPECT_EQ(position2.z(), init_position.z());
63
64 } // Testcases for Something
65
66
68 TEST_F(ECLSimHitTest, SettersAndGetters)
69 {
70 const int cellId = 1;
71 const int trackId = 2;
72 const int pdg = 3;
73 const float flightTime = 4.1;
74 const float edep = 4.2;
75 const G4ThreeVector init_momentum(1, 2, 3);
76 const G4ThreeVector init_position(4, 5, 6);
77 ECLSimHit myECLSimHit;
78 myECLSimHit.setCellId(cellId);
79 myECLSimHit.setTrackId(trackId);
80 myECLSimHit.setPDGCode(pdg);
81 myECLSimHit.setFlightTime(flightTime);
82 myECLSimHit.setEnergyDep(edep);
83 myECLSimHit.setPosition(init_position);
84 myECLSimHit.setMomentum(init_momentum);
85
86 EXPECT_EQ(myECLSimHit.getCellId(), cellId);
87 EXPECT_EQ(myECLSimHit.getTrackId(), trackId);
88 EXPECT_EQ(myECLSimHit.getPDGCode(), pdg);
89 EXPECT_EQ(myECLSimHit.getFlightTime(), flightTime);
90 EXPECT_EQ(myECLSimHit.getEnergyDep(), edep);
91 const auto momentum = myECLSimHit.getMomentum();
92 EXPECT_EQ(momentum.x(), init_momentum.x());
93 EXPECT_EQ(momentum.y(), init_momentum.y());
94 EXPECT_EQ(momentum.z(), init_momentum.z());
95 const auto position = myECLSimHit.getPosition();
96 EXPECT_EQ(position.x(), init_position.x());
97 EXPECT_EQ(position.y(), init_position.y());
98 EXPECT_EQ(position.z(), init_position.z());
99
100 } // Testcases for Setters and Getters
101
103} // namespace
Set up a few arrays and objects in the datastore.
Definition: eclSimHit.cc:21
ClassECLSimHit - Geant4 simulated hit for the ECL.
Definition: ECLSimHit.h:29
int getPDGCode() const
Get Particle PDG (can be one of secondaries)
Definition: ECLSimHit.h:96
void setEnergyDep(double Edep)
Set Deposit energy.
Definition: ECLSimHit.h:69
int getTrackId() const
Get Track ID.
Definition: ECLSimHit.h:91
void setMomentum(const G4ThreeVector &Momentum)
Set Momentum.
Definition: ECLSimHit.h:73
int getCellId() const
Get Cell ID.
Definition: ECLSimHit.h:86
double getFlightTime() const
Get Flight time from IP.
Definition: ECLSimHit.h:101
void setPDGCode(int Pdg)
Set Particle PDG (can be one of secondaries)
Definition: ECLSimHit.h:61
void setCellId(int CellId)
Set Cell ID.
Definition: ECLSimHit.h:53
double getEnergyDep() const
Get Deposit energy.
Definition: ECLSimHit.h:106
G4ThreeVector getPosition() const
Get Position.
Definition: ECLSimHit.h:126
G4ThreeVector getMomentum() const
Get Momentum.
Definition: ECLSimHit.h:116
void setTrackId(int TrackId)
Set Track ID.
Definition: ECLSimHit.h:57
void setFlightTime(double FlightTime)
Set Flight time from IP.
Definition: ECLSimHit.h:65
void setPosition(const G4ThreeVector &Position)
Set Position.
Definition: ECLSimHit.h:81
Abstract base class for different kinds of events.
STL namespace.