Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DBCALGeometry.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DBCALGeometry.h
4 // Created: Thu Nov 17 15:10:51 CST 2005
5 // Creator: gluexuser (on Linux hydra.phys.uregina.ca 2.4.20-8smp i686)
6 //
7 
8 #ifndef _DBCALGeometry_
9 #define _DBCALGeometry_
10 
11 #include <JANA/JObject.h>
12 #include <JANA/JFactory.h>
13 using namespace jana;
14 
15 // create a single number channel id which is useful in algorithms
16 // if M L S are module layer sector the bit map looks like:
17 // MMMM MMMM LLLL SSSS
18 
19 #define MODULE_SHIFT 8
20 #define MODULE_MASK 0xFF00
21 #define LAYER_SHIFT 4
22 #define LAYER_MASK 0x00F0
23 #define SECTOR_SHIFT 0
24 #define SECTOR_MASK 0X000F
25 
26 class DBCALGeometry : public JObject {
27 
28 public:
29 
30  JOBJECT_PUBLIC( DBCALGeometry );
31 
32  DBCALGeometry(int runnumber);
33 
34  enum End { kUpstream, kDownstream };
35 
36  // Methods to access and initialize the private variables
37  float GetBCAL_inner_rad() const;
38  const float* GetBCAL_radii() const;
39  float GetBCAL_center() const;
40  float GetBCAL_length() const;
41  float GetBCAL_phi_shift() const;
42 
43  float GetBCAL_outer_rad() const { return BCALOUTERRAD; }
44  float GetBCAL_middle_rad() const { return BCALMIDRAD; }
45  float GetBCAL_middle_cell() const { return BCALMID; }
46  float *GetBCAL_cell_radii() { return &(m_radius[0]); }
47 
48  // as-built geometry
49  float GetBCAL_Nmodules() const { return NBCALMODS; }
50  float GetBCAL_Nlayers() const { return NBCALLAYERS; }
51  float GetBCAL_Nsectors() const { return NBCALSECTORS; }
52 
53  float GetBCAL_NInnerLayers() const { return NBCALLAYSIN; }
54  float GetBCAL_NOuterLayers() const { return NBCALLAYSOUT; }
55  float GetBCAL_NInnerSectors() const { return NBCALSECSIN; }
56  float GetBCAL_NOuterSectors() const { return NBCALSECSOUT; }
57  // define these for completeness, but they aren't used outside of this class
58  // right now, so comment them out
59  //vector<float> GetBCAL_NSummedInnerLayers() const { return NSUMLAYSIN; }
60  //vector<float> GetBCAL_NSummedOuterLayers() const { return NSUMLAYSOUT; }
61 
62 
63  // nominal effective velocity
64  float GetBCAL_c_effective() const { return C_EFFECTIVE; }
65 
66  // nominal attenuation length
67  float GetBCAL_attenutation_length() const { return ATTEN_LENGTH; }
68 
69  ///these functions are about encoding/decoding module/layer/sector info in a cellId
70  int cellId( int module, int layer, int sector ) const; ///< This object can be used for the SiPM ID or for the fADC ID since they are defined in the same way (4 bits for sector then 4 bits for layer then 8 bits for module.)
71  int module( int cellId ) const; ///< This method can be used for the SiPM ID or for the fADC ID since they are defined in the same way
72  int layer( int cellId ) const; ///< This method can be used for the SiPM ID or for the fADC ID since they are defined in the same way
73  int sector( int cellId ) const; ///< This method can be used for the SiPM ID or for the fADC ID since they are defined in the same way
74 
75  ///these functions are about finding which readout cell contains a specific SiPM cell
76  int fADC_layer( int SiPM_cellId ) const;
77  int fADC_sector( int SiPM_cellId ) const;
78  int fADCId( int module, int SiPM_layer, int SiPM_sector ) const;
79  int NSiPMs(int fADCId) const;
80 
81  ///these functions are about the physical location and dimensions of a readout cell
82  float phi( int fADC_cellId ) const;
83  float phiSize( int fADC_cellId ) const;
84  float r( int fADC_cellId ) const;
85  float rSize( int fADC_cellId ) const;
86 
87  ///these are missing functions that fill in some previous gaps.
88  int fADCcellId_rphi( float r, float phi ) const; ///< Method to get the fADC cell ID from an (R, phi) combination.\n R in cm and phi in radians.
89  int getglobalchannelnumber(int module, int layer, int sector, int end) const; ///< Return a BCAL channel number, in order of significance (module, layer, sector, end).
90  int getendchannelnumber(int module, int layer, int sector) const; ///< Return a channel number for either end, in order of significance (module, layer, sector).
91  int getglobalsector(int module, int sector) const;
92  int getsector(int globalsector) const;
93  int getmodule(int globalsector) const;
94 
95 private:
96 
97  DBCALGeometry(); // forbid the default constructor
98  void Initialize(int runnumber); // this is old, but keep it around for now, make sure no one else can call it
99 
100  // as-built geometry
101  const int NBCALMODS=48; ///< number of modules
102  const int NBCALLAYERS=4; ///< number of layers in a module
103  const int NBCALSECTORS=4; ///< number of sectors in a module
104 
105  //the distinction between inner layers and outer layers is important, since only the inner layers have TDC readout
106  const int NBCALLAYSIN=3; ///< number of readout layers in inner BCAL (first 6 SiPM layers)
107  const int NBCALLAYSOUT=1; ///< number of readout layers in outer BCAL (outer 4 SiPM layers)
108 
109  // On each module there is a 10x4 (r/phi) array of SiPMs
110  // 1.2.3.4 summing configuration - This is used in the BCAL as built
111  vector<int> NSUMLAYSIN = {1,2,3}; ///< number of radial SiPM layers summed for digitization in each inner readout layer
112  vector<int> NSUMLAYSOUT = {4}; ///< number of radial SiPM layers summed for digitization in each outer readout layer
113  const int NBCALSECSIN=4; ///<number of sectors in inner region
114  const int NBCALSECSOUT=4; ///<number of sectors in outer region
115  // the following are completely deprecated
116  //const int NSUMSECSIN=1; ///< for the inner layers, the number of SiPM that will be summed in the azimuthal direction
117  //const int NSUMSECSOUT=1; ///< for the outer layer(s), the number of SiPM that will be summed in the azimuthal direction
118  //const int NBCALSECSIN=4/NSUMSECSIN; ///<number of sectors in inner region
119  //const int NBCALSECSOUT=4/NSUMSECSOUT; ///<number of sectors in outer region
120 
121  float BCALINNERRAD=0.; ///< innner radius of BCAL in cm
122  float fADC_radius[5] = {}; ///< BCAL layer radii (4 layers total)
123  float GLOBAL_CENTER=0.; ///< center of BCAL in gloobal coordinate system
124  float BCALFIBERLENGTH=0.; ///< BCAL Scintilator fiber lenth in cm
125  float BCAL_PHI_SHIFT=0.; ///< overall phi roation of BCAL in radians
126 
127  // Enter the index of the SiPM that designates the first
128  // (counting radially outward) of the outer cells (default 7)
129  const int BCALMID=7; ///< first outer layer (default 7)
130  float BCALMIDRAD = m_radius[BCALMID-1]; ///< mid radius of BCAL in cm (boundary between inner and outer layers)
131  float BCALOUTERRAD=86.17; ///< outer radius of BCAL in cm
132 
133  float C_EFFECTIVE=16.75; ///< speed of light in fibers
134  float ATTEN_LENGTH=520.; ///< attenuation length
135 
136  float m_radius[11] = { 64.3,
137  66.3,
138  68.3,
139  70.3,
140  72.3,
141  74.3,
142  76.3,
143  78.77,
144  81.24,
145  83.70,
146  86.17};
147 
148 
149 };
150 
151 #endif // _DBCALGeometry_
Int_t layer
float GetBCAL_NOuterLayers() const
Definition: DBCALGeometry.h:54
float GetBCAL_Nlayers() const
Definition: DBCALGeometry.h:50
float * GetBCAL_cell_radii()
Definition: DBCALGeometry.h:46
float GetBCAL_attenutation_length() const
Definition: DBCALGeometry.h:67
float GetBCAL_NOuterSectors() const
Definition: DBCALGeometry.h:56
float GetBCAL_Nmodules() const
Definition: DBCALGeometry.h:49
float GetBCAL_middle_rad() const
Definition: DBCALGeometry.h:44
static float BCAL_PHI_SHIFT
float GetBCAL_NInnerSectors() const
Definition: DBCALGeometry.h:55
float GetBCAL_outer_rad() const
Definition: DBCALGeometry.h:43
float GetBCAL_NInnerLayers() const
Definition: DBCALGeometry.h:53
float GetBCAL_c_effective() const
Definition: DBCALGeometry.h:64
float GetBCAL_middle_cell() const
Definition: DBCALGeometry.h:45
float GetBCAL_Nsectors() const
Definition: DBCALGeometry.h:51