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