Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DFCALGeometry.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DFCALGeometry.h
4 // Created: Wed Aug 24 10:09:27 EST 2005
5 // Creator: shepherd (on Darwin 129-79-159-16.dhcp-bl.indiana.edu 8.2.0 powerpc)
6 //
7 
8 #ifndef _DFCALGeometry_
9 #define _DFCALGeometry_
10 
11 #include <JANA/JFactory.h>
12 #include <JANA/JObject.h>
13 using namespace jana;
14 
15 #include "DVector2.h"
16 #include "units.h"
17 
18 class DFCALGeometry : public JObject {
19 
20  /*
21 #define kBlocksWide 59
22 #define kBlocksTall 59
23 #define kMaxChannels kBlocksWide * kBlocksTall
24 // Do not forget to adjust below formula if number of blocks chage in any direction:
25 // this is now used to convert from row/col to coordiantes y/x and back - MK
26 #define kMidBlock (kBlocksWide-1)/2
27 #define kBeamHoleSize 3
28  */
29 
30 public:
31 
32  JOBJECT_PUBLIC(DFCALGeometry);
33 
34  DFCALGeometry();
36 
37  // these numbers are fixed for the FCAL as constructed
38  // it probably doesn't make sense to retrieve them
39  // from a database as they aren't going to change unless
40  // the detector is reconstructed
41 
42  enum { kBlocksWide = 59 };
43  enum { kBlocksTall = 59 };
44  enum { kMaxChannels = kBlocksWide * kBlocksTall };
45  enum { kMidBlock = ( kBlocksWide - 1 ) / 2 };
46  enum { kBeamHoleSize = 3 };
47 
48  static double blockSize() { return 4.0157*k_cm; }
49  static double radius() { return 1.20471*k_m; }
50  static double blockLength() { return 45.0*k_cm; }
51  // static double fcalFaceZ() { return 625.3*k_cm; }
52 
53  // static double fcalMidplane() { return fcalFaceZ() + 0.5 * blockLength() ; }
54 
55  bool isBlockActive( int row, int column ) const;
56  int numActiveBlocks() const { return m_numActiveBlocks; }
57 
58 
59  DVector2 positionOnFace( int row, int column ) const;
60  DVector2 positionOnFace( int channel ) const;
61 
62  int channel( int row, int column ) const;
63 
64  int row ( int channel ) const { return m_row[channel]; }
65  int column( int channel ) const { return m_column[channel]; }
66 
67  // get row and column from x and y positions
68  int row ( float y ) const;
69  int column( float x ) const;
70 
71  void toStrings(vector<pair<string,string> > &items) const {
72  AddString(items, "kBlocksWide", "%d", (int)kBlocksWide);
73  AddString(items, "kBlocksTall", "%d", (int)kBlocksTall);
74  AddString(items, "kMaxChannels", "%d", (int)kMaxChannels);
75  AddString(items, "kBeamHoleSize", "%2.3f", (int)kBeamHoleSize);
76  }
77 
78 private:
79 
80  bool m_activeBlock[kBlocksTall][kBlocksWide];
81  DVector2 m_positionOnFace[kBlocksTall][kBlocksWide];
82 
83  int m_channelNumber[kBlocksTall][kBlocksWide];
84  int m_row[kMaxChannels];
85  int m_column[kMaxChannels];
86 
88 };
89 
90 #endif // _DFCALGeometry_
91 
static double blockLength()
Definition: DFCALGeometry.h:50
TVector2 DVector2
Definition: DVector2.h:9
Double_t x[NCHANNELS]
Definition: st_tw_resols.C:39
void toStrings(vector< pair< string, string > > &items) const
Definition: DFCALGeometry.h:71
#define y
const double k_m
Definition: units.h:13
const double k_cm
Definition: units.h:14
static double blockSize()
Definition: DFCALGeometry.h:48
int column(int channel) const
Definition: DFCALGeometry.h:65
static double radius()
Definition: DFCALGeometry.h:49
int row(int channel) const
Definition: DFCALGeometry.h:64
int numActiveBlocks() const
Definition: DFCALGeometry.h:56