00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #define DIST_SWITCH
00016
00017
00018 #ifndef St_l3_Coordinate_Transformer_hh
00019 #define St_l3_Coordinate_Transformer_hh
00020
00021 #include "St_l3_Coordinates.h"
00022
00023 #include <math.h>
00024
00025 class St_l3_Coordinate_Transformer{
00026 private:
00027
00028 static int numberOfPadsAtRow[45];
00029 static double radialDistanceAtRow[45];
00030 static double SectorSin[24];
00031 static double SectorCos[24];
00032 static double innerSectorPadPitch;
00033 static double outerSectorPadPitch;
00034
00035
00036
00037 double drift_length_inner ;
00038 double drift_length_outer ;
00039 double lengthPerTb;
00040
00041 private:
00042
00043
00044 double max_tb_inner;
00045 double max_tb_outer;
00046 int transformation_errors;
00047
00048 public:
00049
00050 St_l3_Coordinate_Transformer() ;
00051 virtual ~St_l3_Coordinate_Transformer() ;
00052
00053 int LoadTPCLookupTable(char * filename = "/L3/etc/map.bin");
00054
00055
00056
00057 void raw_to_global(const St_l3_ptrs_Coordinate &raw,
00058 St_l3_xyz_Coordinate &global);
00059
00060 void raw_to_local(const St_l3_ptrs_Coordinate &raw,
00061 St_l3_xyz_Coordinate &local ) ;
00062
00063 void local_to_global(const St_l3_ptrs_Coordinate &raw ,
00064 const St_l3_xyz_Coordinate &local ,
00065 St_l3_xyz_Coordinate &global ) ;
00066
00067
00068 void global_to_raw(const St_l3_xyz_Coordinate &global ,
00069 St_l3_ptrs_Coordinate &raw ) ;
00070 void global_to_raw(int sector, int row,
00071 const St_l3_xyz_Coordinate &global ,
00072 St_l3_ptrs_Coordinate &raw ) ;
00073 void global_to_local(const St_l3_xyz_Coordinate &global,
00074 St_l3_xyz_Coordinate &local ,
00075 St_l3_ptrs_Coordinate &raw) ;
00076 void global_to_local(int sector, int row,
00077 const St_l3_xyz_Coordinate &global,
00078 St_l3_xyz_Coordinate &local ) ;
00079 void local_to_raw(const St_l3_xyz_Coordinate &global ,
00080 const St_l3_xyz_Coordinate &local ,
00081 St_l3_ptrs_Coordinate &raw ) ;
00082 void local_to_raw( int row ,
00083 const St_l3_xyz_Coordinate &local ,
00084 St_l3_ptrs_Coordinate &raw ) ;
00085
00086
00087
00088 inline double GetSectorCos ( int i ) {
00089 if ( i < 0 || i >= 24 )
00090 return -999. ;
00091 else
00092 return SectorCos[i] ;
00093 };
00094
00095 inline double GetSectorSin ( int i ) {
00096 if ( i < 0 || i >= 24 )
00097 return -999. ;
00098 else
00099 return SectorSin[i] ;
00100 };
00101
00102 inline double GetRadialDistanceAtRow ( int i ) {
00103 if ( i < 0 || i >= 45 )
00104 return -999. ;
00105 else
00106 return radialDistanceAtRow[i] ;
00107 };
00108
00109 inline int GetNumberOfPadsAtRow ( int i )
00110 {
00111 if ( i < 0 || i >= 45 )
00112 return -999 ;
00113 else
00114 return numberOfPadsAtRow[i] ;
00115 } ;
00116
00117
00118
00119
00120
00121 void Set_parameters_by_hand(const double lengthPerTb = 0.584,
00122 const double drift_length_inner = 201.,
00123 const double drift_length_outer = 201.) ;
00124 void Get_parameters_from_db() ;
00125 void Use_transformation_provided_by_db() ;
00126 void Print_parameters() ;
00127
00128 inline double Get_drift_length_inner() { return drift_length_inner ;} ;
00129 inline double Get_drift_length_outer() { return drift_length_outer ;} ;
00130 inline double Get_lengthPerTb() { return lengthPerTb ; } ;
00131 inline double Get_max_timebucket_inner() { return max_tb_inner; } ;
00132 inline double Get_max_timebucket_outter() { return max_tb_outer; } ;
00133
00134 inline int Get_transformation_errors() { return transformation_errors; } ;
00135
00136 private:
00137 float dpad;
00138 float dtb;
00139 float maxtb;
00140
00141 int npad, ntb;
00142
00143
00144
00145
00146
00147 float *TPCmap;
00148 };
00149
00150 #endif //St_l3_Coordinate_Transformer_hh