MiniballSort
Loading...
Searching...
No Matches
MiniballGeometry.cc
Go to the documentation of this file.
1
2#include "MiniballGeometry.hh"
3
5
6void MiniballGeometry::SetupCluster( double user_theta, double user_phi, double user_alpha, double user_r, double user_z ) {
7
8 // Set the user value
9 theta = user_theta * TMath::DegToRad();
10 phi = user_phi * TMath::DegToRad();
11 alpha = user_alpha * TMath::DegToRad();
12 r = user_r;
13 z = user_z;
14
15 // Resize arrays
16 seg_offset.resize( ncry );
17 for( unsigned int i = 0; i < ncry; ++i )
18 seg_offset[i].resize( nseg );
19
20 // Set individual values
22
23 return;
24
25}
26
27
29
30 // Some constants
31 double root32 = TMath::Sqrt(3.0) / 2.0;
32
33 // Parameters determined by Hannah Kleis for new cryostats
34 double interaction_depth = 18.0;
35 double inter_crystal_gap = 1.0;
36 double dist_cap_crystal = 0.55;
37 double cap_thickness = 0.70;
38 double alpha_taper = 4.125 * TMath::DegToRad();
39 double dist_flat_to_flat = 61.35;
40 double dist_core_corner = dist_flat_to_flat / TMath::Sqrt(3.0);
41 double R = 0.5 * dist_core_corner - dist_cap_crystal - cap_thickness;
42 double focal_length = ( dist_core_corner + inter_crystal_gap * 0.5 );
43 focal_length /= TMath::Tan( alpha_taper );
44
45 // Old parameters to which the online angles were optimised
46 if( type == 0 ) {
47
48 interaction_depth = 0.0;
49 dist_core_corner = 34.0;
50 focal_length = 400.0;
51 R = dist_core_corner * 0.5;
52 alpha_taper = TMath::ATan( dist_core_corner / focal_length );
53
54 }
55
56 // These values assume we are going to rotate the crystals to make a cluster
57 // The real life clock positions will be 4 hours earlier after rotation
58 // Therefore we need to start 4 hours later, then we rotate to the right position
59 // Z is beam direction
60 // Y is out to the right (horizontal)
61 // X is directly upwards (vertical)
62 // Offset from centre of a detector to centre of a segment
63 for( unsigned char i = 0; i < ncry; i++ ) {
64
65 seg_offset[i][0].SetXYZ( 0.0 , 0.0, 0.0 ); // core in centre
66 seg_offset[i][1].SetXYZ( R / 2, -R * root32, 0.0 ); // 10 o'clock
67 seg_offset[i][2].SetXYZ( -R / 2, -R * root32, 0.0 ); // 8 o'clock
68 seg_offset[i][3].SetXYZ( R , 0.0, 0.0 ); // 12 o'clock
69 seg_offset[i][4].SetXYZ( R / 2, R * root32, 0.0 ); // 2 o'clock
70 seg_offset[i][5].SetXYZ( -R , 0.0, 0.0 ); // 6 o'clock
71 seg_offset[i][6].SetXYZ( -R / 2, R * root32, 0.0 ); // 4 o'clock
72
73 }
74
75 // Nominal distance for the Miniball clusters is at some larger distance
76 // So we push the crystal out there, shift it out a bit
77 // then rotate it around.
78 for( unsigned char i = 0; i < ncry; i++ ) {
79
80 for( unsigned char j = 0; j < nseg; j++ ) {
81
82 // out to nominal distance in beam direction
83 seg_offset[i][j].SetZ( focal_length );
84
85 // Rotate out to focal point of crystal (goes up in MB frame)
86 seg_offset[i][j].RotateY( alpha_taper );
87
88 // rotate around the appropriate angle for each crystal
89 seg_offset[i][j].RotateZ( -TMath::TwoPi() * i / 3.0 );
90
91 // Now bring it all back to the correct distance and shift to the interaction depth
92 seg_offset[i][j].SetZ( seg_offset[i][j].Z() - focal_length + interaction_depth + r );
93
94 }
95
96 }
97
98 //std::cout << "X = " << seg_offset[0][0].X() << ", ";
99 //std::cout << "Y = " << seg_offset[0][0].Y() << ", ";
100 //std::cout << "Z = " << seg_offset[0][0].Z() << std::endl;
101
102 // Offsets - We start now with the crystal in beam direction (X)
103 double myalpha, myphi, mytheta;
104
105 if( phi > TMath::Pi() || phi < 0 ) {
106 myalpha = alpha;
107 myphi = TMath::PiOver2() + phi;
108 mytheta = theta;
109 }
110 else {
111 myalpha = alpha;
112 myphi = TMath::PiOver2() - phi;
113 mytheta = -theta;
114 }
115
116 // Rotate segments to appropriate angle
117 for( unsigned char i = 0; i < ncry; i++ ) {
118 for( unsigned char j = 0; j < nseg; j++ ) {
119 seg_offset[i][j].RotateZ( -myalpha ); // anti-clockwise to agree with old convention
120 seg_offset[i][j].RotateY( myphi );
121 seg_offset[i][j].RotateX( mytheta );
122 }
123 }
124
125 // Shift Miniball so that target it as origin
126 mbzoffset.SetXYZ( 0.0, 0.0, -z );
127 for( unsigned char i = 0; i < ncry; i++ ) {
128 for( unsigned char j = 0; j < nseg; j++ ) {
129 seg_offset[i][j] += mbzoffset;
130 }
131 }
132
133 return;
134
135}
136
ClassImp(MiniballGeometry) void MiniballGeometry
Functions to convert Miniball angles read from the frame.
std::vector< std::vector< TVector3 > > seg_offset
vector for segment centre (0 = core)
void SetupCluster()
Setup cluster main routine.
const unsigned char nseg
const unsigned char ncry
double theta
theta angle in radians
double alpha
alpha angle in radians
unsigned char type
geometry defintion type
double phi
phi angle in radians
double z
distance from target to origin (beam direction is positive) in mm
double r
distance from target to detector in mm
TVector3 mbzoffset
This shift is independent of the CD detector distance which is relative.