25 if (not ptrCluster)
return false;
35 unsigned int size = cluster.size();
37 int totalNNeighbors = 0;
38 double totalInnerDistance = 0;
39 double totalDriftLength = 0;
40 double totalDriftLengthSquared = 0;
41 double driftVariance = 0;
42 double totalADCCount = 0;
43 double totalADCCountSquared = 0;
44 double adcCountVariance;
49 int nNeighbors = wireHit->getAutomatonCell().getCellWeight();
50 totalNNeighbors += nNeighbors;
53 totalInnerDistance += wireHit->getRefPos2D().norm();
56 double driftLength = wireHit->getRefDriftLength();
57 totalDriftLength += driftLength;
58 totalDriftLengthSquared += driftLength * driftLength;
61 double adc =
static_cast<double>(wireHit->getHit()->getADCCount());
63 totalADCCountSquared += adc * adc;
66 double driftLengthVarianceSquared =
67 (totalDriftLengthSquared - totalDriftLength * totalDriftLength / size) / (size - 1.0);
68 double adcVarianceSquared =
69 (totalADCCountSquared - totalADCCount * totalADCCount / size) / (size - 1.0);
71 if (driftLengthVarianceSquared > 0) {
72 driftVariance = std::sqrt(driftLengthVarianceSquared);
77 if (adcVarianceSquared > 0) {
78 adcCountVariance = std::sqrt(adcVarianceSquared);
85 adcCountVariance = -1;
91 var<
named(
"total_number_of_neighbors")>() = totalNNeighbors;
92 var<
named(
"total_drift_length")>() = totalDriftLength;
93 var<
named(
"total_adc_count")>() = totalADCCount;
94 var<
named(
"total_inner_distance")>() = totalInnerDistance;
96 var<
named(
"variance_drift_length")>() = driftVariance;
97 var<
named(
"variance_adc_count")>() = adcCountVariance;
99 var<
named(
"distance_to_superlayer_center")>() = superLayerCenter - totalInnerDistance / size;
100 var<
named(
"superlayer_id")>() = iSuperLayer;
102 var<
named(
"mean_drift_length")>() = totalDriftLength / size;
103 var<
named(
"mean_adc_count")>() = totalADCCount / size;
104 var<
named(
"mean_inner_distance")>() = totalInnerDistance / size;
105 var<
named(
"mean_number_of_neighbors")>() = 1.0 * totalNNeighbors / size;