Belle II Software  release-08-01-10
eclHit.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/ECLHit.h>
9 
10 #include <gtest/gtest.h>
11 
12 using namespace std;
13 
14 namespace Belle2 {
21  class ECLHitTest : public ::testing::Test {
22  };
23 
25  TEST_F(ECLHitTest, Constructors)
26  {
27  ECLHit myHit;
28  EXPECT_EQ(myHit.getCellId(), 0);
29  EXPECT_EQ(myHit.getEnergyDep(), 0);
30  EXPECT_EQ(myHit.getTimeAve(), 0);
31 
32  const int cellId = 1;
33  const float edep = 1.234;
34  const float timeAve = 4.321;
35  ECLHit myHit2(cellId, edep, timeAve);
36  EXPECT_EQ(myHit2.getCellId(), cellId);
37  EXPECT_EQ(myHit2.getEnergyDep(), edep);
38  EXPECT_EQ(myHit2.getTimeAve(), timeAve);
39  } // Testcases for Something
40 
42  TEST_F(ECLHitTest, SettersAndGetters)
43  {
44  const int cellId = 1;
45  const float edep = 1.234;
46  const float timeAve = 4.321;
47  const float deltaTimeShift = 2.5;
48  ECLHit myHit;
49  myHit.setCellId(cellId);
50  myHit.setEnergyDep(edep);
51  myHit.setTimeAve(timeAve);
52  EXPECT_EQ(myHit.getCellId(), cellId);
53  EXPECT_EQ(myHit.getEnergyDep(), edep);
54  EXPECT_EQ(myHit.getTimeAve(), timeAve);
55  myHit.shiftInTime(deltaTimeShift);
56  EXPECT_EQ(myHit.getTimeAve(), timeAve + deltaTimeShift);
57 
58  } // Testcases for Setters and Getters
59 
61 } // namespace
Set up a few arrays and objects in the datastore.
Definition: eclHit.cc:21
Class to store simulated hits which equate to average of ECLSImHit on crystals input for digitization...
Definition: ECLHit.h:25
double getTimeAve() const
Get average time.
Definition: ECLHit.h:75
void setEnergyDep(double Edep)
Set deposit energy.
Definition: ECLHit.h:55
int getCellId() const
Get Cell ID.
Definition: ECLHit.h:65
void setCellId(int CellId)
Set Cell ID.
Definition: ECLHit.h:51
double getEnergyDep() const
Get deposit energy.
Definition: ECLHit.h:70
void shiftInTime(float delta) override
Shift the Hit in time (needed for beam background mixing)
Definition: ECLHit.h:85
void setTimeAve(double TimeAve)
Set average time.
Definition: ECLHit.h:59
TEST_F(ECLHitTest, SettersAndGetters)
Test Setters and Getters.
Definition: eclHit.cc:42
Abstract base class for different kinds of events.