LDMX Software
MyClusterWeight.h
Go to the documentation of this file.
1
5#ifndef ECAL_MYCLUSTERWEIGHT_H_
6#define ECAL_MYCLUSTERWEIGHT_H_
7
8#include <cmath>
9
10#include "Ecal/Event/EcalHit.h"
12
13namespace ecal {
14
24 public:
26
34 double operator()(const ClusterType& a, const ClusterType& b) {
35 // Moliere radius of detector, roughly. In mm
36 double rmol = 10.00;
37 // Characteristic cluster longitudinal variable in mm
38 double dzchar = 100.0;
39
40 double a_e = a.energy();
41 double a_x = a.centroidX();
42 double a_y = a.centroidY();
43 double a_z = a.centroidZ();
44
45 double b_e = b.energy();
46 double b_x = b.centroidX();
47 double b_y = b.centroidY();
48 double b_z = b.centroidZ();
49
50 double dijz;
51 if (a_e >= b_e) {
52 dijz = b_z - a_z;
53 } else {
54 dijz = a_z - b_z;
55 }
56
57 double dij_t = std::sqrt(std::pow(a_x - b_x, 2) + std::pow(a_y - b_y, 2));
58
59 double weight_t = std::exp(std::pow(dij_t / rmol, 2)) - 1;
60 double weight_z = std::exp(std::abs(dijz) / dzchar) - 1;
61
62 // Return the highest of the two weights
63 return std::max(weight_t, weight_z);
64 }
65};
66
67} // namespace ecal
68
69#endif // ECAL_MYCLUSTERWEIGHT_H_
In-memory tool for working on clusters during reconstruction.
Computes the weight (distance) between two Ecal clusters.
double operator()(const ClusterType &a, const ClusterType &b)
Compute the weight between two clusters.
double centroidY() const
Get the centroid Y position (energy-weighted).
double centroidX() const
Get the centroid X position (energy-weighted).
double centroidZ() const
Get the centroid Z position (energy-weighted).
double energy() const
Get the total energy of the cluster.