File indexing completed on 2025-08-06 08:18:57
0001 #include "PHG4CylinderGeomv4.h"
0002
0003 #include <cmath>
0004
0005 void PHG4CylinderGeomv4::identify(std::ostream& os) const
0006 {
0007 os << "PHG4CylinderGeomv4: layer: " << layer
0008 << ", layer_radius: " << layer_radius
0009 << ", radius_stagger: " << radius_stagger
0010 << ", N_sensors_in_layer: " << N_sensors_in_layer
0011 << ", layer_NZ: " << layer_NZ
0012 << ", segment_z_step: " << segment_z_step
0013 << ", segment_phi_step: " << segment_phi_step
0014 << ", sensor_x_offset: " << sensor_x_offset
0015 << ", sensor_y_offset: " << sensor_y_offset
0016 << ", N_strip_columns: " << N_strip_columns
0017 << ", N_strips_per_column: " << N_strips_per_column
0018 << ", N_staggers " << N_staggers
0019 << ", strip_z_spacing: " << strip_z_spacing
0020 << ", strip_y_spacing: " << strip_y_spacing
0021 << ", strip_tilt: " << strip_tilt
0022 << std::endl;
0023 return;
0024 }
0025
0026 void PHG4CylinderGeomv4::find_segment_center(int segment_z_bin, int segment_phi_bin, double location[])
0027 {
0028
0029 double z_location = (double) (segment_z_bin - layer_NZ / 2) * segment_z_step;
0030
0031
0032 int istagger = segment_phi_bin % N_staggers;
0033
0034
0035
0036 double R_layer = layer_radius + (double) istagger * radius_stagger;
0037
0038
0039 double phi = (double) segment_phi_bin * segment_phi_step;
0040
0041 double x_location = R_layer * cos(phi);
0042 double y_location = R_layer * sin(phi);
0043
0044 location[0] = x_location;
0045 location[1] = y_location;
0046 location[2] = z_location;
0047 }
0048
0049 void PHG4CylinderGeomv4::find_strip_center(int segment_z_bin, int segment_phi_bin, int strip_column, int strip_index, double location[])
0050 {
0051
0052 find_segment_center(segment_z_bin, segment_phi_bin, location);
0053
0054
0055
0056
0057
0058 double strip_sensor_z = 0.0;
0059 if (N_strip_columns % 2)
0060 {
0061
0062 strip_sensor_z = ((double) (strip_column - N_strip_columns / 2)) * strip_z_spacing;
0063 }
0064 else
0065 {
0066
0067 strip_sensor_z = ((double) (strip_column - N_strip_columns / 2) + 0.5) * strip_z_spacing;
0068 }
0069
0070 double strip_sensor_y = 0.0;
0071 if (N_strips_per_column % 2)
0072 {
0073
0074 strip_sensor_y = (double) (strip_index - N_strips_per_column / 2) * strip_y_spacing;
0075 }
0076 else
0077 {
0078
0079 strip_sensor_y = ((double) (strip_index - N_strips_per_column / 2) + 0.5) * strip_y_spacing;
0080 }
0081
0082
0083 double strip_sensor_x = sensor_x_offset;
0084
0085
0086
0087
0088 strip_sensor_y += sensor_y_offset;
0089
0090
0091
0092 double phi = (double) segment_phi_bin * segment_phi_step;
0093 double x = strip_sensor_x * cos(phi) - strip_sensor_y * sin(phi);
0094 double y = strip_sensor_y * cos(phi) + strip_sensor_x * sin(phi);
0095
0096
0097 location[0] += x;
0098 location[1] += y;
0099 location[2] += strip_sensor_z;
0100
0101 return;
0102 }