ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4CylinderGeomv4.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4CylinderGeomv4.cc
1 #include "PHG4CylinderGeomv4.h"
2 
3 #include <cmath>
4 
5 using namespace std;
6 
8  N_sensors_in_layer(-1),
9  layer(-1),
10  layer_radius(NAN),
11  radius_stagger(NAN),
12  layer_NZ(-1),
13  segment_z_step(NAN),
14  segment_phi_step(NAN),
15  sensor_x_offset(NAN),
16  sensor_y_offset(NAN),
17  N_strip_columns(-1),
18  N_strips_per_column(-1),
19  N_staggers(-1),
20  strip_z_spacing(NAN),
21  strip_y_spacing(NAN),
22  thickness(NAN),
23  strip_tilt(NAN)
24 
25 {
26  return;
27 }
28 
29 void
30 PHG4CylinderGeomv4::identify(std::ostream& os) const
31 {
32  os << "PHG4CylinderGeomv4: layer: " << layer
33  << ", layer_radius: " << layer_radius
34  << ", radius_stagger: " << radius_stagger
35  << ", N_sensors_in_layer: " << N_sensors_in_layer
36  << ", layer_NZ: " << layer_NZ
37  << ", segment_z_step: " << segment_z_step
38  << ", segment_phi_step: " << segment_phi_step
39  << ", sensor_x_offset: " << sensor_x_offset
40  << ", sensor_y_offset: " << sensor_y_offset
41  << ", N_strip_columns: " << N_strip_columns
42  << ", N_strips_per_column: " << N_strips_per_column
43  << ", N_staggers " << N_staggers
44  << ", strip_z_spacing: " << strip_z_spacing
45  << ", strip_y_spacing: " << strip_y_spacing
46  << ", strip_tilt: " << strip_tilt
47  << endl;
48  return;
49 }
50 
51 void PHG4CylinderGeomv4::find_segment_center(int segment_z_bin, int segment_phi_bin, double location[])
52 {
53  double z_location = (double) (segment_z_bin - layer_NZ/2) * segment_z_step;
54 
55 
56  // this determines the stggered layer radius
57  int istagger = segment_phi_bin % N_staggers;
58 
59  // We need to stagger the radii at alternate phi values by radius_stagger, since the ladders overlap in phi
60  // The number of staggers is an input number, since it has to be the same for both parts of a double layer!
61  double R_layer = layer_radius + (double) istagger * radius_stagger;
62 
63  // Place the ladder segment envelopes at the correct z and phi
64  double phi = (double) segment_phi_bin * segment_phi_step;
65 
66  double x_location = R_layer * cos(phi);
67  double y_location = R_layer * sin(phi);
68 
69  location[0] = x_location;
70  location[1] = y_location;
71  location[2] = z_location;
72 }
73 
74 void PHG4CylinderGeomv4::find_strip_center(int segment_z_bin, int segment_phi_bin, int strip_column, int strip_index, double location[])
75 {
76  // Start by getting the ladder segment center location in the sPHENIX frame
77  find_segment_center(segment_z_bin, segment_phi_bin, location);
78 
79  // Now calculate the strip x, y and z position in the frame of the ladder segment
80  // if N_strip_columns is even, the center of the sensor is a boundary between strip columns, the first sensor is 1/2 strip_z_spacing from zero
81  // if it is odd, the center of the sensor is in the middle of a strip column, one strip is centered at zero
82 
83  double strip_sensor_z = 0.0;
84  if(N_strip_columns%2)
85  strip_sensor_z = ((double) (strip_column - N_strip_columns/2) ) * strip_z_spacing;
86  else
87  strip_sensor_z = ((double) (strip_column - N_strip_columns/2) + 0.5) * strip_z_spacing;
88 
89  double strip_sensor_y = 0.0;
91  strip_sensor_y = (double) (strip_index - N_strips_per_column/2) * strip_y_spacing;
92  else
93  strip_sensor_y = ((double) (strip_index - N_strips_per_column/2) + 0.5) * strip_y_spacing;
94 
95  // The sensor is set forward of the center in the ladder segment volume
96  double strip_sensor_x = sensor_x_offset;
97 
98  // If there is only an upper ROC, the sensor is not centered in the ladder segment
99  // Add the sensor offset to the strip_sensor_y value
100 
101  strip_sensor_y += sensor_y_offset;
102 
103  // Now we need to transform the position in the ladder segment frame to that in the sPHENIX frame
104  // this is just a rotation around the z axis in phi
105  double phi = (double) segment_phi_bin * segment_phi_step;
106  double x = strip_sensor_x * cos(phi) - strip_sensor_y * sin(phi);
107  double y = strip_sensor_y * cos(phi) + strip_sensor_x * sin(phi);
108 
109  // now add these to the location of the sensor center in the sPHENIX frame
110  location[0] += x;
111  location[1] += y;
112  location[2] += strip_sensor_z;
113 
114  return;
115 }
116