Belle II Software  release-06-02-00
BKLMHit2d.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 
9 /* Own header. */
10 #include <klm/dataobjects/bklm/BKLMHit2d.h>
11 
12 /* KLM headers. */
13 #include <klm/dataobjects/bklm/BKLMHit1d.h>
14 
15 /* Belle 2 headers. */
16 #include <framework/logging/Logger.h>
17 
18 using namespace Belle2;
19 
20 // empty constructor for ROOT - do not use this
23  m_ModuleID(0),
24  m_ZStrips(0),
25  m_GlobalPosition{0, 0, 0},
26  m_Time(0.0),
27  m_EnergyDeposit(0.0)
28 {
29 }
30 
31 // Constructor with orthogonal 1D hits
32 BKLMHit2d::BKLMHit2d(const BKLMHit1d* hitPhi, const BKLMHit1d* hitZ, const CLHEP::Hep3Vector& globalPos, double time) :
34 {
35  m_ModuleID = hitPhi->getModuleID() | (hitZ->getModuleID() & BKLM_STATUS_MASK);
36  m_ZStrips = ((hitZ->getStripMin() - 1) << BKLM_ZSTRIP_BIT) | ((hitZ->getStripMax() - 1) << BKLM_ZMAXSTRIP_BIT);
37 
39  B2WARNING("Attempt to form a 2D hit from distinct-module 1D hits");
40  }
41 
42  m_GlobalPosition[0] = globalPos.x();
43  m_GlobalPosition[1] = globalPos.y();
44  m_GlobalPosition[2] = globalPos.z();
45  m_Time = time;
47 
48  addRelationTo(hitPhi);
49  addRelationTo(hitZ);
50 }
51 
52 // Copy constructor
54  RelationsObject(h),
55  m_ModuleID(h.m_ModuleID),
56  m_ZStrips(h.m_ZStrips),
57  m_Time(h.m_Time),
58  m_EnergyDeposit(h.m_EnergyDeposit)
59 {
60  m_GlobalPosition[0] = h.m_GlobalPosition[0];
61  m_GlobalPosition[1] = h.m_GlobalPosition[1];
62  m_GlobalPosition[2] = h.m_GlobalPosition[2];
63 }
64 
65 // Assignment operator
67 {
68  m_ModuleID = h.m_ModuleID;
69  m_ZStrips = h.m_ZStrips;
70  m_Time = h.m_Time;
71  m_EnergyDeposit = h.m_EnergyDeposit;
72  m_GlobalPosition[0] = h.m_GlobalPosition[0];
73  m_GlobalPosition[1] = h.m_GlobalPosition[1];
74  m_GlobalPosition[2] = h.m_GlobalPosition[2];
75  return *this;
76 }
static bool hitsFromSameModule(int module1, int module2)
Check whether the hits are from the same module.
Store one reconstructed BKLM 1D hit as a ROOT object.
Definition: BKLMHit1d.h:30
int getStripMin() const
Get lowest strip number of this 1D hit.
Definition: BKLMHit1d.h:97
int getModuleID() const
Get detector-module identifier.
Definition: BKLMHit1d.h:119
float getEnergyDeposit() const
Get energy deposition.
Definition: BKLMHit1d.h:140
int getStripMax() const
Get highest strip number of this 1D hit.
Definition: BKLMHit1d.h:104
Store one BKLM strip hit as a ROOT object.
Definition: BKLMHit2d.h:32
float m_GlobalPosition[3]
position of the 2D hit in global coordinates (cm)
Definition: BKLMHit2d.h:258
static constexpr int BKLM_ZMAXSTRIP_BIT
BKLMHit2d Zstrips bit position for maxStrip-1 [0..47].
Definition: BKLMHit2d.h:241
float m_Time
reconstructed hit time relative to trigger (ns)
Definition: BKLMHit2d.h:261
static constexpr int BKLM_ZSTRIP_BIT
BKLMHit2d Zstrips bit position for strip-1 [0..47].
Definition: BKLMHit2d.h:238
float m_EnergyDeposit
reconstructed pulse height (MeV)
Definition: BKLMHit2d.h:264
int m_ModuleID
detector-module identifier
Definition: BKLMHit2d.h:251
int m_ZStrips
z-measuring strip numbers of the 2D hit
Definition: BKLMHit2d.h:255
BKLMHit2d & operator=(const BKLMHit2d &)
Assignment operator.
Definition: BKLMHit2d.cc:66
BKLMHit2d()
Empty constructor for ROOT IO (needed to make the class storable)
Definition: BKLMHit2d.cc:21
Defines interface for accessing relations of objects in StoreArray.
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
Abstract base class for different kinds of events.