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