LDMX Software
MyClusterWeight.h
1
2#ifndef ECAL_MYCLUSTERWEIGHT_H_
3#define ECAL_MYCLUSTERWEIGHT_H_
4
5#include <iostream>
6
7#include "Ecal/IntermediateCluster.h"
8
9namespace ecal {
10
12 public:
13 // returns weighting function, where smallest, weights will be combined first
14 double operator()(const IntermediateCluster& a,
15 const IntermediateCluster& b) {
16 // Moliere radius_ of detector, roughly. In mm
17 double rmol = 10.00;
18 // Characteristic cluster longitudinal variable TO
19 // BE DETERMINED! in mm
20 double dzchar = 100.0;
21
22 double a_e = a.centroid().E();
23 double a_x = a.centroid().Px();
24 double a_y = a.centroid().Py();
25 double a_z = a.centroid().Pz();
26
27 double b_e = b.centroid().E();
28 double b_x = b.centroid().Px();
29 double b_y = b.centroid().Py();
30 double b_z = b.centroid().Pz();
31
32 double dijz;
33 if (a_e >= b_e) {
34 dijz = b_z - a_z;
35 } else {
36 dijz = a_z - b_z;
37 }
38
39 double dij_t = pow(pow(a_x - b_x, 2) + pow(a_y - b_y, 2), 0.5);
40
41 double weight_t = exp(pow(dij_t / rmol, 2)) - 1;
42 double weight_z = (exp(std::abs(dijz) / dzchar) - 1);
43
44 // Return the highest of the two weights
45 if (weight_t <= weight_z) {
46 return weight_z;
47 } else {
48 return weight_t;
49 }
50 }
51};
52} // namespace ecal
53
54#endif