10 #include <tracking/trackFindingCDC/filters/cluster/BasicClusterVarSet.h>
12 #include <tracking/trackFindingCDC/eventdata/segments/CDCWireHitCluster.h>
13 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
15 #include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
16 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
18 #include <cdc/dataobjects/CDCHit.h>
23 using namespace TrackFindingCDC;
27 if (not ptrCluster)
return false;
36 double superLayerCenter = superLayer.getMiddleCylindricalR();
37 unsigned int size = cluster.size();
39 int totalNNeighbors = 0;
40 double totalInnerDistance = 0;
41 double totalDriftLength = 0;
42 double totalDriftLengthSquared = 0;
43 double driftVariance = 0;
44 double totalADCCount = 0;
45 double totalADCCountSquared = 0;
46 double adcCountVariance;
51 int nNeighbors = wireHit->getAutomatonCell().getCellWeight();
52 totalNNeighbors += nNeighbors;
55 totalInnerDistance += wireHit->getRefPos2D().norm();
58 double driftLength = wireHit->getRefDriftLength();
59 totalDriftLength += driftLength;
60 totalDriftLengthSquared += driftLength * driftLength;
63 double adc =
static_cast<double>(wireHit->getHit()->getADCCount());
65 totalADCCountSquared += adc * adc;
68 double driftLengthVarianceSquared =
69 (totalDriftLengthSquared - totalDriftLength * totalDriftLength / size) / (size - 1.0);
70 double adcVarianceSquared =
71 (totalADCCountSquared - totalADCCount * totalADCCount / size) / (size - 1.0);
73 if (driftLengthVarianceSquared > 0) {
74 driftVariance = std::sqrt(driftLengthVarianceSquared);
79 if (adcVarianceSquared > 0) {
80 adcCountVariance = std::sqrt(adcVarianceSquared);
87 adcCountVariance = -1;
93 var<
named(
"total_number_of_neighbors")>() = totalNNeighbors;
94 var<
named(
"total_drift_length")>() = totalDriftLength;
95 var<
named(
"total_adc_count")>() = totalADCCount;
96 var<
named(
"total_inner_distance")>() = totalInnerDistance;
98 var<
named(
"variance_drift_length")>() = driftVariance;
99 var<
named(
"variance_adc_count")>() = adcCountVariance;
101 var<
named(
"distance_to_superlayer_center")>() = superLayerCenter - totalInnerDistance / size;
102 var<
named(
"superlayer_id")>() = iSuperLayer;
104 var<
named(
"mean_drift_length")>() = totalDriftLength / size;
105 var<
named(
"mean_adc_count")>() = totalADCCount / size;
106 var<
named(
"mean_inner_distance")>() = totalInnerDistance / size;
107 var<
named(
"mean_number_of_neighbors")>() = 1.0 * totalNNeighbors / size;