LDMX Software
DBScanClusterBuilder.h
Go to the documentation of this file.
1
7#ifndef DBSCANCLUSTERBUILDER_H
8#define DBSCANCLUSTERBUILDER_H
9
10#include <cmath>
11
12#include "Framework/Logger.h"
15
16namespace recon {
17
23 public:
25
26 DBScanClusterBuilder(float minHitEnergy, float clusterHitDist,
27 float clusterZBias,
28 float minClusterHitMult); // overloaded constructor
29
30 std::vector<std::vector<const ldmx::CalorimeterHit*> > runDBSCAN(
31 const std::vector<const ldmx::CalorimeterHit*>& hits_);
32
33 void fillClusterInfoFromHits(ldmx::CaloCluster* cl,
34 std::vector<const ldmx::CalorimeterHit*> hits_,
35 bool logEnergyWeight,
36 bool saveHitContribs = true);
37
38 void setMinHitEnergy(float x_) { min_hit_energy_ = x_; }
39
40 void setMinHitDistance(float x_) { cluster_hit_dist_ = x_; }
41
42 void setZBias(float x_) {
43 cluster_z_bias_ = x_;
44 } // set the z_ bias of the cluster
45
46 void setMinHitMultiplicity(int x_) { min_cluster_hit_mult_ = x_; }
47
48 float getMinHitEnergy() const { return min_hit_energy_; };
49
50 float setMinHitDistance() const { return cluster_hit_dist_; }
51
52 int setMinHitMultiplicity() const { return min_cluster_hit_mult_; }
53
54 private:
55 bool isIn(unsigned int i, const std::vector<unsigned int>& l) {
56 return std::find(l.begin(), l.end(), i) != l.end();
57 }
58 float dist(const ldmx::CalorimeterHit* a, const ldmx::CalorimeterHit* b) {
59 return sqrt(pow(a->getXPos() - b->getXPos(), 2) // distance
60 + pow(a->getYPos() - b->getYPos(), 2) +
61 pow((a->getZPos() - b->getZPos()) / cluster_z_bias_,
62 2)); // divide by the z_ bias
63 }
64
65 float min_hit_energy_{0};
66 float cluster_hit_dist_{100.};
67 float cluster_z_bias_{1.}; // private parameter for z_ bias
68 int min_cluster_hit_mult_{2};
70 enableLogging("DBScanClusterBuilder")
71};
72} // namespace recon
73
74#endif /* DBSCANCLUSTERBUILDER_H */
Class that stores calorimeter cluster information.
Class that represents a reconstructed hit in a calorimeter cell within the detector.
Stores cluster information from the ECal.
Definition CaloCluster.h:25
Represents a reconstructed hit in a calorimeter cell within the detector.
float getYPos() const
Get the Y position of the hit [mm].
float getZPos() const
Get the Z position of the hit [mm].
float getXPos() const
Get the X position of the hit [mm].