9 #include <framework/logging/Logger.h>
10 #include <svd/reconstruction/SVDClusterPosition.h>
11 #include <svd/reconstruction/SVDCoG3Time.h>
12 #include <svd/reconstruction/SVDELS3Time.h>
13 #include <svd/reconstruction/SVDELS3Charge.h>
14 #include <svd/reconstruction/SVDMaxSampleCharge.h>
15 #include <svd/reconstruction/SVDSumSamplesCharge.h>
16 #include <svd/reconstruction/SVDMaxSumAlgorithm.h>
17 #include <vxd/geometry/GeoCache.h>
18 #include <svd/geometry/SensorInfo.h>
33 void SVDClusterPosition::applyCoGPosition(
const Belle2::SVD::RawCluster& rawCluster,
double& position,
double& positionError)
45 for (
auto aStrip : strips) {
47 double stripPos = rawCluster.
isUSide() ? info.getUCellPosition(aStrip.cellID) : info.getVCellPosition(aStrip.cellID);
50 double stripCharge = aStrip.charge;
52 position += stripPos * stripCharge;
53 charge += stripCharge;
60 double pitch = rawCluster.
isUSide() ? info.getUPitch() : info.getVPitch();
61 double sumStripCharge = getSumOfStripCharges(rawCluster);
63 positionError = m_CoGOnlyErr.getPositionError(rawCluster.
getSensorID(), rawCluster.
isUSide(), 0,
64 sumStripCharge / getClusterNoise(rawCluster), rawCluster.
getSize(), pitch);
70 void SVDClusterPosition::applyAHTPosition(
const Belle2::SVD::RawCluster& rawCluster,
double& position,
double& positionError)
78 double pitch = rawCluster.
isUSide() ? info.getUPitch() : info.getVPitch();
84 int headStripCellID = strips.at(strips.size() - 1).cellID;
85 double headStripCharge = strips.at(strips.size() - 1).charge;
87 int tailStripCellID = strips.at(0).cellID;
88 double tailStripCharge = strips.at(0).charge;
92 double centreCharge = (getSumOfStripCharges(rawCluster) - tailStripCharge - headStripCharge) / (strips.size() - 2);
94 tailStripCharge = (tailStripCharge < centreCharge) ? tailStripCharge : centreCharge;
95 headStripCharge = (headStripCharge < centreCharge) ? headStripCharge : centreCharge;
96 double tailPos = rawCluster.
isUSide() ? info.getUCellPosition(tailStripCellID) : info.getVCellPosition(tailStripCellID);
97 double headPos = rawCluster.
isUSide() ? info.getUCellPosition(headStripCellID) : info.getVCellPosition(headStripCellID);
98 position = 0.5 * (tailPos + headPos + (headStripCharge - tailStripCharge) / centreCharge * pitch);
101 double cutAdjacent = m_ClusterCal.getMinAdjSNR(rawCluster.
getSensorID(), rawCluster.
isUSide());
102 double sn = centreCharge / cutAdjacent / getClusterNoise(rawCluster);
105 double landauHead = tailStripCharge / centreCharge;
106 double landauTail = headStripCharge / centreCharge;
107 positionError = 0.5 * pitch * sqrt(1.0 / sn / sn +
108 0.5 * landauHead * landauHead +
109 0.5 * landauTail * landauTail);
116 double sumStripCharge = 0;
122 for (
auto aStrip : strips) {
124 double stripCharge = aStrip.charge;
125 sumStripCharge += stripCharge;
127 return sumStripCharge;
133 double clusterNoise = 0;
139 for (
auto aStrip : strips) {
141 float averageNoiseInElectrons = m_NoiseCal.getNoiseInElectrons(rawCluster.
getSensorID(), rawCluster.
isUSide(), aStrip.cellID);
142 clusterNoise += averageNoiseInElectrons * averageNoiseInElectrons;
144 return sqrt(clusterNoise);
150 double averageNoise = 0;
156 for (
auto aStrip : strips) {
158 float averageNoiseInElectrons = m_NoiseCal.getNoiseInElectrons(rawCluster.
getSensorID(), rawCluster.
isUSide(), aStrip.cellID);
159 averageNoise += averageNoiseInElectrons;
161 return averageNoise / strips.size();
171 for (
int i = 0; i < (int)strips.size(); i++) {
179 if (m_stripTimeAlgo.compare(
"dontdo") != 0) {
182 double timeError = 0;
185 if (m_stripTimeAlgo ==
"ELS3") {
189 }
else if (m_stripTimeAlgo ==
"CoG3") {
199 if (m_stripChargeAlgo.compare(
"dontdo") != 0) {
204 if (m_stripChargeAlgo ==
"ELS3") {
210 cc.computeClusterCharge(tmp, charge, SNR, seedCharge);
212 double maxSample_charge = 0;
216 if ((abs(charge - maxSample_charge) / maxSample_charge > 0.3) || charge < 0)
221 }
else if (m_stripChargeAlgo ==
"SumSamples") {
223 cc.computeClusterCharge(tmp, charge, SNR, seedCharge);
228 cc.computeClusterCharge(tmp, charge, SNR, seedCharge);
233 B2ERROR(
"this should not happen...");
Class representing a raw cluster candidate during clustering of the SVD.
void setStripCharge(int index, double charge)
set the strip charge
VxdID getSensorID() const
const std::vector< StripInRawCluster > getStripsInRawCluster() const
void setStripTime(int index, double time)
set the strip time
Derived Class representing the SVD cluster time computed with the CoG3 algorithm.
void computeClusterTime(Belle2::SVD::RawCluster &rawCluster, double &time, double &timeError, int &firstFrame) override
computes the cluster time, timeError and FirstFrame with the CoG3 algorithm
Derived Class representing the SVD cluster charge computed with the ELS3 algorithm.
Derived Class representing the SVD cluster time computed with the ELS3 algorithm.
void computeClusterTime(Belle2::SVD::RawCluster &rawCluster, double &time, double &timeError, int &firstFrame) override
computes the cluster time, timeError and FirstFrame with the ELS3 algorithm
Derived Class representing the SVD cluster charge computed summing the max sample of each strip.
void computeClusterCharge(Belle2::SVD::RawCluster &rawCluster, double &charge, double &SNR, double &seedCharge) override
compute the cluster charge, charge error and SNR with MaxSample
Derived Class representing the SVD cluster charge computed summing the samples of each strip.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Base class to provide Sensor Information for PXD and SVD.
Abstract base class for different kinds of events.
structure containing the relevant informations of each strip of the raw cluster