StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
l3CoordinateTransformer.h
1 #define DIST_SWITCH
2 
3 
4 #ifndef L3_COORDINATE_TRANSFORMER_H
5 #define L3_COORDINATE_TRANSFORMER_H
6 
7 #include "l3Coordinates.h"
8 
9 #include <math.h>
10 
12  public:
13  // basic geometry fixed here ... this could be also taken from db
14  static int numberOfPadsAtRow[45];
15  static double radialDistanceAtRow[45];
16  static double SectorSin[24];
17  static double SectorCos[24];
18  static double innerSectorPadPitch;
19  static double outerSectorPadPitch;
20 
21  // parameters of the transformation in different regions of the tpc
22  // east means sector 13-24, west means 1-12
23  double drift_length_inner ;
24  double drift_length_outer ;
25  double lengthPerTb;
26 
27  public:
28 
29  // max tb
30  double max_tb_inner;
31  double max_tb_outer;
32  int transformation_errors;
33 
34  public:
35  // Constructors
36  l3CoordinateTransformer() ; // Init parameters and variables
37  virtual ~l3CoordinateTransformer() ; // Delete variables
38 
39  int LoadTPCLookupTable(char * filename = "/L3/etc/map.bin");
40 
41  // Memberfunctions
42  // raw -> global
43  void raw_to_global(const l3ptrsCoordinate &raw,
44  l3xyzCoordinate &global);
45 
46  void raw_to_local(const l3ptrsCoordinate &raw,
47  l3xyzCoordinate &local ) ;
48 
49  void local_to_global(const l3ptrsCoordinate &raw ,
50  const l3xyzCoordinate &local ,
51  l3xyzCoordinate &global ) ;
52 
53  // global -> raw
54  void global_to_raw(const l3xyzCoordinate &global ,
55  l3ptrsCoordinate &raw ) ;
56  void global_to_raw(int sector, int row,
57  const l3xyzCoordinate &global ,
58  l3ptrsCoordinate &raw ) ;
59  void global_to_local(const l3xyzCoordinate &global,
60  l3xyzCoordinate &local ,
61  l3ptrsCoordinate &raw) ;
62  void global_to_local(int sector, int row,
63  const l3xyzCoordinate &global,
64  l3xyzCoordinate &local ) ;
65  void local_to_raw(const l3xyzCoordinate &global ,
66  const l3xyzCoordinate &local ,
67  l3ptrsCoordinate &raw ) ;
68  void local_to_raw( int row ,
69  const l3xyzCoordinate &local ,
70  l3ptrsCoordinate &raw ) ;
71 
72  //
73  // Get parameters
74  inline double GetSectorCos ( int i ) {
75  if ( i < 0 || i >= 24 )
76  return -999. ;
77  else
78  return SectorCos[i] ;
79  };
80 
81  inline double GetSectorSin ( int i ) {
82  if ( i < 0 || i >= 24 )
83  return -999. ;
84  else
85  return SectorSin[i] ;
86  };
87 
88  inline double GetRadialDistanceAtRow ( int i ) {
89  if ( i < 0 || i >= 45 )
90  return -999. ;
91  else
92  return radialDistanceAtRow[i] ;
93  };
94 
95  inline int GetNumberOfPadsAtRow ( int i )
96  {
97  if ( i < 0 || i >= 45 )
98  return -999 ;
99  else
100  return numberOfPadsAtRow[i] ;
101  } ;
102 
103 
104  // Set paramaters needed for the transformation in different ways
105  // This is only for the transformation z <-> timebucket the others are fixed
106 
107 
108  //void Set_parameters_by_hand(const double lengthPerTb = .6176, // 3.85 GeV
109  void Set_parameters_by_hand(const double lengthPerTb = 0.584,
110  const double drift_length_inner = 201.,
111  const double drift_length_outer = 201.) ;
112  void Get_parameters_from_db() ;
113  void Use_transformation_provided_by_db() ;
114  void Print_parameters() ;
115 
116  inline double Get_drift_length_inner() { return drift_length_inner ;} ;
117  inline double Get_drift_length_outer() { return drift_length_outer ;} ;
118  inline double Get_lengthPerTb() { return lengthPerTb ; } ;
119  inline double Get_max_timebucket_inner() { return max_tb_inner; } ;
120  inline double Get_max_timebucket_outter() { return max_tb_outer; } ;
121 
122  inline int Get_transformation_errors() { return transformation_errors; } ;
123 
124  private:
125  float dpad;
126  float dtb;
127  float maxtb;
128 
129  int npad, ntb;
130 
131  //int fd;
132  //void * file;
133  //int filesize;
134 
135  float *TPCmap;
136 };
137 
138 #endif