8#include <tracking/trackFindingCDC/filters/cluster/BasicClusterVarSet.h>
10#include <tracking/trackFindingCDC/eventdata/segments/CDCWireHitCluster.h>
11#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
13#include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
14#include <tracking/trackFindingCDC/topology/ISuperLayer.h>
16#include <cdc/dataobjects/CDCHit.h>
21using namespace TrackFindingCDC;
25 if (not ptrCluster)
return false;
34 double superLayerCenter = superLayer.getMiddleCylindricalR();
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;
bool extract(const CDCWireHitCluster *ptrCluster) final
Generate and assign the contained variables.
An aggregation of CDCWireHits.
Class representing a hit wire in the central drift chamber.
Class representing a sense wire superlayer in the central drift chamber.
Class representing the sense wire arrangement in the whole of the central drift chamber.
const CDCWireSuperLayer & getWireSuperLayer(const WireID &wireID) const
Getter for wire superlayer getter by wireID object.
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
static constexpr int named(const char *name)
Getter for the index from the name.
Float_t & var()
Reference getter for the value of the ith variable. Static version.
Abstract base class for different kinds of events.
static bool isAxial(ISuperLayer iSuperLayer)
Returns if the super layer with the given id is axial.
static bool isInCDC(ISuperLayer iSuperLayer)
Indicates if the given number corresponds to a true cdc superlayer - excludes the logic ids for inner...
static ISuperLayer getFrom(const T &t)
Returns the superlayer of an object.