Belle II Software  release-05-01-25
DATCONSVDSimpleClusterCandidate.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <framework/logging/Logger.h>
12 #include <tracking/modules/DATCON/DATCONSVDSimpleClusterCandidate.h>
13 #include <vxd/geometry/GeoCache.h>
14 
15 using namespace std;
16 
17 namespace Belle2 {
23  DATCONSVDSimpleClusterCandidate::DATCONSVDSimpleClusterCandidate(VxdID vxdID, bool isUside)
24  : m_vxdID(vxdID)
25  , m_isUside(isUside) { m_maxClusterSize = 0; };
26 
27  DATCONSVDSimpleClusterCandidate::DATCONSVDSimpleClusterCandidate(VxdID vxdID, bool isUside, unsigned short maxClusterSize)
28  : m_vxdID(vxdID)
29  , m_isUside(isUside)
30  , m_maxClusterSize(maxClusterSize) {};
31 
32  bool DATCONSVDSimpleClusterCandidate::add(VxdID vxdID, bool isUside, unsigned short index, unsigned short charge,
33  unsigned short cellID)
34  {
35 
36  bool added = false;
37 
38  // do not add if you are on the wrong sensor or side
39  if ((m_vxdID != vxdID) || (m_isUside != isUside))
40  return false;
41 
42  // add if it's the first strip
43  if (m_size == 0)
44  added = true;
45 
50  if (m_size > 0 && cellID == m_strips.at(m_strips.size() - 1) + 1
51  && cellID < m_strips.at(0) + m_maxClusterSize)
52  added = true;
53 
54  //add it to the vector od strips, update the seed charge and index:
55  if (added) {
56  m_size++;
57  m_strips.push_back(cellID);
58  m_charges.push_back(charge);
59  m_digitIndices.push_back(index);
60 
61  if (charge > m_seedCharge) {
62  m_seedCharge = charge;
63 // m_seedIndex = m_strips.size() - 1;
64  }
65  }
66  return added;
67 
68  };
69 
71  {
72 
73  B2ERROR("This mode is currently not supported, nothing will happen, no DATCONSVDClusters will be created!");
74  return;
75 
76  };
77 
78 
80  {
81 
83  const VXD::SensorInfoBase& info = geo.getSensorInfo(m_vxdID);
84 
85  double pitch = m_isUside ? info.getUPitch() : info.getVPitch();
86  unsigned short numberofStrips = m_isUside ? info.getUCells() : info.getVCells();
87 
88  unsigned short minStripCellID = m_strips.at(0);
89 
90  unsigned short clusterSize = m_strips.size();
91  unsigned short seedStripIndex = clusterSize / 2 + 1;
92  unsigned short seedStrip = (minStripCellID + seedStripIndex - 1);
93  double clusterPosition = pitch * (seedStrip - numberofStrips / 2);
94 
95  m_size = clusterSize;
96  m_seedStrip = seedStrip;
97  m_seedStripIndex = seedStripIndex;
99  m_position = clusterPosition;
100  };
101 
102 
104  {
105 
106  bool isGood = false;
107 
108  if (m_seedCharge > 0)
109  isGood = true;
110 
111  return isGood;
112  };
113 
115 } //Belle2 namespace
Belle2::DATCONSVDSimpleClusterCandidate::m_seedStripIndex
unsigned short m_seedStripIndex
Index of the seed strip of the cluster (0...m_Size)
Definition: DATCONSVDSimpleClusterCandidate.h:144
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::DATCONSVDSimpleClusterCandidate::finalizeCluster
void finalizeCluster()
compute the position of the cluster
Definition: DATCONSVDSimpleClusterCandidate.cc:70
Belle2::DATCONSVDSimpleClusterCandidate::m_strips
std::vector< unsigned short > m_strips
Vector containing strips (DATCONSVDDigits) that are added.
Definition: DATCONSVDSimpleClusterCandidate.h:147
Belle2::DATCONSVDSimpleClusterCandidate::m_position
float m_position
Position of the cluster.
Definition: DATCONSVDSimpleClusterCandidate.h:135
Belle2::DATCONSVDSimpleClusterCandidate::m_size
unsigned short m_size
Size of the cluster.
Definition: DATCONSVDSimpleClusterCandidate.h:141
Belle2::DATCONSVDSimpleClusterCandidate::DATCONSVDSimpleClusterCandidate
DATCONSVDSimpleClusterCandidate()
Constructor to create an empty Cluster.
Belle2::DATCONSVDSimpleClusterCandidate::isGoodCluster
bool isGoodCluster()
return true if the cluster candidate can be promoted to cluster
Definition: DATCONSVDSimpleClusterCandidate.cc:103
Belle2::VXD::SensorInfoBase
Base class to provide Sensor Information for PXD and SVD.
Definition: SensorInfoBase.h:40
Belle2::DATCONSVDSimpleClusterCandidate::m_digitIndices
std::vector< unsigned short > m_digitIndices
Vector of the indices in the DATCONSVDDigit StoreArray of the added strips.
Definition: DATCONSVDSimpleClusterCandidate.h:153
Belle2::VXD::GeoCache::getInstance
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:215
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::DATCONSVDSimpleClusterCandidate::m_seedCharge
unsigned short m_seedCharge
Seed Charge of the cluster.
Definition: DATCONSVDSimpleClusterCandidate.h:132
Belle2::DATCONSVDSimpleClusterCandidate::m_isUside
bool m_isUside
side of the cluster
Definition: DATCONSVDSimpleClusterCandidate.h:123
Belle2::DATCONSVDSimpleClusterCandidate::m_vxdID
VxdID m_vxdID
VxdID of the cluster.
Definition: DATCONSVDSimpleClusterCandidate.h:120
Belle2::DATCONSVDSimpleClusterCandidate::finalizeSimpleCluster
void finalizeSimpleCluster()
compute the simple cluster position as in phase 2 FPGA implementation
Definition: DATCONSVDSimpleClusterCandidate.cc:79
Belle2::DATCONSVDSimpleClusterCandidate::m_charges
std::vector< unsigned short > m_charges
Vector containing the charges of the corresponding strips that are added.
Definition: DATCONSVDSimpleClusterCandidate.h:150
Belle2::DATCONSVDSimpleClusterCandidate::m_maxClusterSize
unsigned short m_maxClusterSize
Maximum cluster size (mainly for the simple clusterizer)
Definition: DATCONSVDSimpleClusterCandidate.h:126
Belle2::VXD::GeoCache
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
Definition: GeoCache.h:41
Belle2::DATCONSVDSimpleClusterCandidate::m_seedStrip
unsigned short m_seedStrip
SVD strip (i.e.
Definition: DATCONSVDSimpleClusterCandidate.h:138
Belle2::VXD::GeoCache::getSensorInfo
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:68
Belle2::DATCONSVDSimpleClusterCandidate::add
bool add(VxdID vxdID, bool isUside, unsigned short index, unsigned short charge, unsigned short cellID)
Add a Strip to the current cluster.
Definition: DATCONSVDSimpleClusterCandidate.cc:32