24
24
SciFiClusterRec::SciFiClusterRec(int cluster_exception,
26
const std::map<int, SciFiPlaneGeometry> &geometry_map):
26
const SciFiTrackerMap& geometry_map):
27
27
_size_exception(cluster_exception),
29
29
_geometry_map(geometry_map) {}
34
34
return ( a->get_npe() > b->get_npe() );
37
void SciFiClusterRec::process(SciFiEvent &evt) {
37
void SciFiClusterRec::process(SciFiEvent &evt) const {
38
38
// Create and fill the seeds vector.
39
39
std::vector<SciFiDigit*> seeds = get_seeds(evt);
50
50
make_clusters(evt, seeds);
53
std::vector<SciFiDigit*> SciFiClusterRec::get_seeds(SciFiEvent &evt) {
53
std::vector<SciFiDigit*> SciFiClusterRec::get_seeds(SciFiEvent &evt) const {
54
54
std::vector<SciFiDigit*> seeds_in_event;
55
55
for ( size_t dig = 0; dig < evt.digits().size(); ++dig ) {
56
56
if ( evt.digits()[dig]->get_npe() > _min_npe/2.0 )
59
59
return seeds_in_event;
62
void SciFiClusterRec::make_clusters(SciFiEvent &evt, std::vector<SciFiDigit*> &seeds) {
62
void SciFiClusterRec::make_clusters(SciFiEvent &evt, std::vector<SciFiDigit*> &seeds) const {
63
63
size_t seeds_size = seeds.size();
64
64
for ( size_t i = 0; i < seeds_size; i++ ) {
65
65
if ( !(seeds[i]->is_used()) ) {
90
90
} // ends loop over seeds
93
void SciFiClusterRec::process_cluster(SciFiCluster *clust) {
93
void SciFiClusterRec::process_cluster(SciFiCluster *clust) const {
94
94
int tracker = clust->get_tracker();
95
95
int station = clust->get_station();
96
96
int plane = clust->get_plane();
98
98
int id = 3*(station-1) + (plane+1);
99
id = ( tracker == 0 ? -id : id );
102
std::map<int, SciFiPlaneGeometry>::iterator iterator;
103
iterator = _geometry_map.find(id);
99
SciFiPlaneMap::const_iterator iterator = _geometry_map.find(tracker)->second.Planes.find(id);
100
// iterator = _geometry_map.find(id);
104
101
// Throw if the plane isn't found.
105
if ( iterator == _geometry_map.end() ) {
102
// if ( iterator == _geometry_map.end() ) {
103
if ( iterator == _geometry_map.find(tracker)->second.Planes.end() ) {
106
104
throw(Exception(Exception::nonRecoverable,
107
105
"Failed to find SciFi plane in _geometry_map.",
108
106
"SciFiClusterRec::process_cluster"));
108
id = ( tracker == 0 ? -id : id );
110
110
SciFiPlaneGeometry this_plane = (*iterator).second;
111
111
ThreeVector plane_direction = this_plane.Direction;
112
112
ThreeVector plane_position = this_plane.Position;
113
113
double Pitch = this_plane.Pitch;
114
114
double CentralFibre = this_plane.CentralFibre;
115
115
// alpha is the distance to the central fibre.
116
double alpha = clust->get_channel()-CentralFibre;
117
double dist_mm = Pitch * 7.0 / 2.0 * alpha;
116
double alpha = clust->get_channel() - CentralFibre;
117
double dist_mm = Pitch * (7.0 / 2.0) * alpha;
119
119
ThreeVector perp = plane_direction.Orthogonal();
120
120
ThreeVector position = dist_mm * perp + plane_position;
122
122
clust->set_direction(plane_direction);
123
123
clust->set_position(position);
124
clust->set_alpha(alpha);
124
clust->set_alpha(dist_mm);
127
bool SciFiClusterRec::are_neighbours(SciFiDigit *seed_i, SciFiDigit *seed_j) {
127
bool SciFiClusterRec::are_neighbours(SciFiDigit *seed_i, SciFiDigit *seed_j) const {
128
128
bool neigh = false;
130
130
if ( !(seed_j->is_used()) && // seed is unused