StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSvtGeometry.cc
1 /***************************************************************************
2  *
3  * $Id: StSvtGeometry.cc,v 1.3 2005/07/23 03:37:33 perev Exp $
4  *
5  * Author: Marcelo Munhoz
6  ***************************************************************************
7  *
8  * Description: SVT Geometry
9  *
10  ***************************************************************************
11  *
12  * $Log: StSvtGeometry.cc,v $
13  * Revision 1.3 2005/07/23 03:37:33 perev
14  * IdTruth + Cleanup
15  *
16  * Revision 1.2 2002/01/31 21:57:35 caines
17  * Get ladder and barrels correct for the middle layer
18  *
19  * Revision 1.1 2001/08/16 21:02:03 munhoz
20  * changing StObjArray to StStrArray. StSvtConfig reestructured. New classes for geometry DB
21  *
22  *
23  **************************************************************************/
25 // //
26 // This class represents the SVT Geometry object. //
27 // //
29 
30 #include "StSvtGeometry.hh"
31 #include "StMessMgr.h"
32 
33 #include "tables/St_svg_geom_Table.h"
34 #include "tables/St_svg_shape_Table.h"
35 #include "tables/St_srs_srspar_Table.h"
36 
37 ClassImp(StSvtGeometry)
38 
40 {}
41 
42 StSvtGeometry::StSvtGeometry(const char* config) : StSvtWaferCollection(config)
43 {}
44 
45 StSvtGeometry::StSvtGeometry(StSvtConfig* config) : StSvtWaferCollection(config)
46 {}
47 
48 StSvtGeometry::StSvtGeometry(srs_srspar_st* param, svg_geom_st *geom, svg_shape_st *shape) : StSvtWaferCollection()
49 {
50 
51 }
52 
53 StSvtGeometry::~StSvtGeometry()
54 {}
55 
56 StSvtGeometry::StSvtGeometry(const StSvtGeometry& geom)
57 {}
58 
59 StSvtGeometry& StSvtGeometry::operator = (const StSvtGeometry& geom)
60 {
61  return *this;
62 }
63 
64 int StSvtGeometry::getBarrelID(int layer, int ladder)
65 {
66  int barrel = -1;
67 static const int tbBarrel[6][2]={
68 {1,-1},{-1,1},{2,-1},{-1,2},{3,-1},{-1,3}};
69 
70  if (layer>0 && layer<=6) barrel = tbBarrel[layer-1][ladder&1];
71 
72  return barrel;
73 }
74 
75 int StSvtGeometry::getWaferIndex(int barrel, int ladder, int wafer)
76 {
77  return StSvtWaferCollection::getWaferIndex( barrel, ladder, wafer);
78 }
79 
80 int StSvtGeometry::getWaferIndex(int HardWarePos)
81 {
82  int layer = (int)(HardWarePos/1000);
83  int wafer = (int)(HardWarePos/100 )%10;
84  int ladder = (int)(HardWarePos%100 );
85  int barrel = getBarrelID(layer,ladder);
86 
87  if (barrel > 0)
88  return getWaferIndex(barrel,ladder,wafer);
89  else
90  return -1;
91 }