Belle II Software  release-05-01-25
BKLMHit1d.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Leo Piilonen *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 /* Own header. */
12 #include <klm/dataobjects/bklm/BKLMHit1d.h>
13 
14 /* KLM headers. */
15 #include <klm/dataobjects/bklm/BKLMStatus.h>
16 
17 /* Belle 2 headers. */
18 #include <framework/logging/Logger.h>
19 
20 /* C++ headers. */
21 #include <algorithm>
22 #include <climits>
23 
24 using namespace Belle2;
25 
26 // empty constructor for ROOT - do not use this
29  m_ModuleID(0),
30  m_Time(0.0),
31  m_EnergyDeposit(0.0)
32 {
33 }
34 
35 // Constructor with a cluster of contiguous parallel KLMDigits
36 BKLMHit1d::BKLMHit1d(const std::vector<const KLMDigit*>& digits) :
38  m_ModuleID(0),
39  m_Time(0.0),
40  m_EnergyDeposit(0.0)
41 {
42  if (digits.size() == 0) {
43  B2WARNING("Attempt to create a BKLMHit1d with no KLMDigits");
44  return;
45  }
46  int stripMin = INT_MAX;
47  int stripMax = INT_MIN;
48  const KLMDigit* bklmDigit = digits.front();
49  if (bklmDigit->getSubdetector() != KLMElementNumbers::c_BKLM)
50  B2FATAL("Trying to construct a BKLMHit1d using KLMDigits from EKLM.");
56  for (std::vector<const KLMDigit*>::const_iterator iDigit = digits.begin(); iDigit != digits.end(); ++iDigit) {
57  const KLMDigit* digit = *iDigit;
58  if (!(bklmDigit->getSection() == digit->getSection() &&
59  bklmDigit->getSector() == digit->getSector() &&
60  bklmDigit->getLayer() == digit->getLayer() &&
61  bklmDigit->getPlane() == digit->getPlane())) {
62  B2WARNING("Attempt to combine non-parallel or distinct-module KLMDigits");
63  continue;
64  }
65  m_Time += digit->getTime();
67  int strip = digit->getStrip();
68  stripMin = std::min(stripMin, strip);
69  stripMax = std::max(stripMax, strip);
70  addRelationTo(digit);
71  }
72 
73  if (stripMax >= stripMin) {
74  m_Time /= ((stripMax - stripMin) + 1.0);
77  }
78 }
79 
80 // Copy constructor
82  RelationsObject(h),
83  m_ModuleID(h.m_ModuleID),
84  m_Time(h.m_Time),
85  m_EnergyDeposit(h.m_EnergyDeposit)
86 {
87 }
88 
89 // Assignment operator
91 {
92  m_ModuleID = h.m_ModuleID;
93  m_Time = h.m_Time;
94  m_EnergyDeposit = h.m_EnergyDeposit;
95  return *this;
96 }
Belle2::KLMDigit::getSubdetector
int getSubdetector() const
Get subdetector number.
Definition: KLMDigit.h:89
Belle2::BKLMHit1d::operator=
BKLMHit1d & operator=(const BKLMHit1d &)
Assignment operator.
Definition: BKLMHit1d.cc:90
Belle2::BKLMHit1d::m_EnergyDeposit
float m_EnergyDeposit
reconstructed pulse height (MeV)
Definition: BKLMHit1d.h:157
Belle2::KLMDigit::getPlane
int getPlane() const
Get plane number.
Definition: KLMDigit.h:161
Belle2::BKLMStatus::setMaximalStrip
static void setMaximalStrip(int &module, int strip)
Set maximal strip number.
Definition: BKLMStatus.h:95
Belle2::BKLMHit1d
Store one reconstructed BKLM 1D hit as a ROOT object.
Definition: BKLMHit1d.h:39
Belle2::BKLMHit1d::m_Time
float m_Time
reconstructed hit time (ns)
Definition: BKLMHit1d.h:154
Belle2::BKLMElementNumbers::setSectionInModule
static void setSectionInModule(int &module, int section)
Set section number in module identifier.
Definition: BKLMElementNumbers.h:334
Belle2::BKLMHit1d::BKLMHit1d
BKLMHit1d()
Empty constructor for ROOT IO (needed to make the class storable)
Definition: BKLMHit1d.cc:27
Belle2::BKLMElementNumbers::setLayerInModule
static void setLayerInModule(int &module, int layer)
Set layer number in module identifier.
Definition: BKLMElementNumbers.h:354
Belle2::RelationsInterface::addRelationTo
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).
Definition: RelationsObject.h:144
Belle2::KLMDigit::getSection
int getSection() const
Get section number.
Definition: KLMDigit.h:107
Belle2::KLMDigit::getSector
int getSector() const
Get sector number.
Definition: KLMDigit.h:125
Belle2::KLMDigit::getTime
float getTime() const
Get hit time.
Definition: KLMDigit.h:293
Belle2::KLMDigit::getLayer
int getLayer() const
Get layer number.
Definition: KLMDigit.h:143
Belle2::BKLMElementNumbers::setPlaneInModule
static void setPlaneInModule(int &module, int plane)
Set plane number in module identifier.
Definition: BKLMElementNumbers.h:364
Belle2::BKLMElementNumbers::setSectorInModule
static void setSectorInModule(int &module, int sector)
Set sector number in module identifier.
Definition: BKLMElementNumbers.h:344
Belle2::KLMDigit
KLM digit (class representing a digitized hit in RPCs or scintillators).
Definition: KLMDigit.h:40
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::KLMDigit::getEnergyDeposit
float getEnergyDeposit() const
Get energy deposit.
Definition: KLMDigit.h:311
Belle2::KLMElementNumbers::c_BKLM
@ c_BKLM
BKLM.
Definition: KLMElementNumbers.h:47
Belle2::BKLMHit1d::m_ModuleID
int m_ModuleID
detector-module identifier
Definition: BKLMHit1d.h:151
Belle2::KLMDigit::getStrip
int getStrip() const
Get strip number.
Definition: KLMDigit.h:179
Belle2::RelationsInterface
Defines interface for accessing relations of objects in StoreArray.
Definition: RelationsObject.h:102
Belle2::BKLMElementNumbers::setStripInModule
static void setStripInModule(int &module, int strip)
Set strip number in module identifier.
Definition: BKLMElementNumbers.h:374