StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtCosmicTestStandGeom.h
1 /* StFgtCosmicRayTestStandGeom.h
2  *
3  * FGT geometry class declaration.
4  * ONLY USE FOR COSMIC RAY TEST STAND
5  *
6  * \author W. Witzke (wowitz0@uky.edu)
7  *
8  */
9 
10 #ifndef _ST_FGT_CS_GEOM_H_
11 #define _ST_FGT_CS_GEOM_H_
12 
13 #include <TObject.h>
14 #include <TVector3.h>
15 #include <string>
16 #include <sstream>
17 #include <cstdlib>
18 #include <cmath>
19 
20 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
21 
23 {
24  public:
25 
26 
27 
28  static Int_t getNaiveGeoIdFromElecCoord
29  (
30  Int_t rdo, Int_t arm, Int_t apv, Int_t channel
31  )
32  {
33 
34  Short_t disc = int(arm/2) + (rdo-1)*3;
35 
36  Short_t quadrant = (arm & 1)*2 + int( apv/12 );
37 
38  if ((arm==0)&&(apv<12)&&(apv>=0))
39  {
40  disc=0;
41  quadrant=0;
42  }
43 
44  if ((arm==1)&&(apv<12)&&(apv>=0))
45  {
46  disc=1;
47  quadrant=0;
48  }
49 
50  if ((arm ==1)&&(apv<24)&&(apv>=12))
51  {
52  disc=2;
53  quadrant=0;
54  }
55 
56  if ( apv >= 12 )
57  apv -= 12;
58 
59  return
60  ( disc*kFgtNumQuads + quadrant ) * kFgtNumLayers * kFgtNumStrips
61  + mNaiveMapping[ apv*128+channel ];
62  }
63 
64  static void getNaiveElecCoordFromGeoId(
65  Int_t geoId, Int_t& rdo, Int_t& arm, Int_t& apv, Int_t& channel
66  )
67  {
68  // start with doing the same as for FGT-in-star
69  Short_t disc, quadrant, strip;
70  Char_t layer;
71 
72  decodeGeoId( geoId, disc, quadrant, layer, strip );
73 
74  if( !mReverseNaiveMappingValid )
75  makeReverseNaiveMappingValid();
76 
77  Int_t key = ( (layer=='P')*kFgtNumStrips + strip );
78  channel = mReverseNaiveMapping[ key ];
79  apv = channel / 128;
80  channel %= 128;
81 
82  if( quadrant % 2 )
83  apv += 12;
84 
85  rdo = disc/3+1;
86  arm = (disc % 3)*2 + (quadrant>1);
87 
88  // set apv into range 0-11
89  apv %= 12;
90 
91  // adjust values
92  if( quadrant == 0 ){
93  if( disc == 0 ){
94  arm = 0;
95  } else if( disc == 1 ){
96  arm = 1;
97  } else if( disc == 2 ){
98  arm = 1;
99  apv += 12;
100  };
101  };
102  };
103 
104 
105 };
106 
107 #endif
108 
109 /*
110  * $Id: StFgtCosmicTestStandGeom.h,v 1.1 2012/01/31 15:50:08 wwitzke Exp $
111  * $Log: StFgtCosmicTestStandGeom.h,v $
112  * Revision 1.1 2012/01/31 15:50:08 wwitzke
113  * Added StFgtCosmicTestStandGeom in StFgtPool.
114  *
115  * Revision 1.5 2012/01/26 13:13:12 sgliske
116  * Updated to use StFgtConsts, which
117  * replaces StFgtEnums and StFgtGeomDefs
118  *
119  * Revision 1.4 2011/10/06 15:17:27 sgliske
120  * CVS says it updated the file, but I don't see a change
121  *
122  * Revision 1.3 2011/09/29 18:34:53 sgliske
123  * Fixed phiQuadXaxis, added asserts to getQuad,and added reverse lookup: elec. coord. from geoId
124  *
125  *
126  */