StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
gl3Hit.cxx
1 #include "gl3Hit.h"
2 
3 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // Print a gl3Hit
5 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 void gl3Hit::print ( ){
7  printf ( "%d %d %d %7.2f %7.2f %7.2f %7.2f\n", rowSector, mezzanninneCard, readoutBoard, x, y, z,sqrt(x*x + y*y) );
8 }
9 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10 // Set a gl3Hit from a l3_cluster structure
11 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12 int gl3Hit::set ( l3CoordinateTransformer* transformer,
13  int sector, l3_cluster* cluster ){
14 
15  l3xyzCoordinate XYZ(0,0,0) ;
16  l3ptrsCoordinate PTRS(0,0,0,0) ;
17 
18  double pad = double(cluster->pad)/64.;
19  double time = double(cluster->time)/64.;
20 
21  //printf("pad=%7.2lf time=%7.2lf padrow=%d sector=%d\n",pad,time,cluster->padrow,sector);
22 
23  readoutBoard = cluster->RB_MZ / 16 ;
24  if ( readoutBoard > 5 && sector%2==1) sector++ ; // when two sectors in one crate
25  // last 3 readout boards belong to next sector
26  mezzanninneCard = cluster->RB_MZ%16 ;
27 
28  rowSector = sector * 100 + cluster->padrow ;
29 
30 
31  //printf("--->pad=%7.2lf time=%7.2lf padrow=%d sector=%d\n",pad,time,cluster->padrow,sector);
32 
33 
34 // rawToGlobal(sector, (int)cluster->padrow, pad, time, &xx, &yy, &zz);
35 
36  PTRS.Setptrs((double)pad, (double)time,(double)(cluster->padrow+1), (double) sector) ;
37  transformer->raw_to_global(PTRS,XYZ) ;
38 
39  x = XYZ.Getx();
40  y = XYZ.Gety();
41  z = XYZ.Getz();
42 
43  trackId = cluster->trackId ;
44  flags = cluster->flags ;
45 
46  nextHit = 0 ; // needed for the linked hit list
47 
48  charge = cluster->charge ;
49 
50  // printf("tpx: %lf\n", z);
51 
52  //printf("tpx: %d\n", rowSector);
53  return 0 ;
54 }
55 
56 void gl3Hit::setITPCHit(l3CoordinateTransformer *trans, int sec, int row, double pad, double tb, unsigned short charge, unsigned short flags) {
57 
58  int pads = 2 * (row + 25 - (int)((double)row/7.0));
59  int padpos = pad - pads/2;
60 
61  l3ptrsCoordinate raw;
62  l3xyzCoordinate local;
63  l3xyzCoordinate global;
64 
65  raw.Sets(sec);
66  local.Setx(padpos * .5);
67  local.Sety(55.80 + 1.6 * (row - 1));
68  local.Setz(trans->drift_length_inner - tb * trans->lengthPerTb);
69 
70  trans->local_to_global(raw, local, global);
71 
72  x = global.Getx();
73  y = global.Gety();
74  z = global.Getz();
75 
76 
77 
78  //printf("drift_length_inner = %lf length_per_tb = %lf drift_length_outer = %lf\n",
79  // trans->drift_length_inner, trans->lengthPerTb, trans->drift_length_outer);
80  //printf("itpc: %lf\n", z);
81 
82  rowSector = sec * 100 + row ;
83  //printf("itpc: %d\n", rowSector);
84 
85  this->flags = flags;
86  this->charge = charge;
87 }