Belle II Software  release-08-01-10
ARICHGeoHAPD.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <arich/dbobjects/ARICHGeoHAPD.h>
10 #include <iostream>
11 
12 using namespace std;
13 using namespace Belle2;
14 
15 void ARICHGeoHAPD::getXYChannelPos(int chX, int chY, double& x, double& y) const
16 {
17 
18  if (chX < m_nPadX / 2.) x = -m_chipGap / 2. + (chX - m_nPadX / 2.) * m_padSize + m_padSize / 2.;
19  else x = m_chipGap / 2. + (chX - m_nPadX / 2.) * m_padSize + m_padSize / 2.;
20 
21  if (chY < m_nPadY / 2.) y = -m_chipGap / 2. + (chY - m_nPadY / 2.) * m_padSize + m_padSize / 2.;
22  else y = m_chipGap / 2. + (chY - m_nPadY / 2.) * m_padSize + m_padSize / 2.;
23 
24 }
25 
26 
27 void ARICHGeoHAPD::getXYChannel(double x, double y, int& chX, int& chY) const
28 {
29 
30  if (x < - m_chipGap / 2.) chX = int((x + m_chipGap / 2.) / m_padSize) + m_nPadX / 2. - 1;
31  else if (x > m_chipGap / 2.) chX = (x - m_chipGap / 2.) / m_padSize + m_nPadX / 2.;
32  else {chX = -1; chY = -1; return;}
33 
34  if (y < - m_chipGap / 2.) chY = int((y + m_chipGap / 2.) / m_padSize) + m_nPadY / 2. - 1;
35  else if (y > m_chipGap / 2.) chY = (y - m_chipGap / 2.) / m_padSize + m_nPadY / 2.;
36  else {chX = -1; chY = -1; return;}
37 
38  if (chX + 1 > int(m_nPadX) || chY + 1 > int(m_nPadY) || chX < 0 || chY < 0) {
39  chX = -1; chY = -1;
40  }
41 
42 }
43 
44 
45 unsigned ARICHGeoHAPD::getChipID(double x, double y) const
46 {
47  if (x > 0) {
48  if (y > 0) return 0;
49  return 1;
50  }
51  if (y > 0) return 2;
52  return 3;
53 }
54 
55 
56 bool ARICHGeoHAPD::isConsistent() const
57 {
58  if (m_HAPDSizeX <= 0) return false;
59  if (m_HAPDSizeY <= 0) return false;
60  if (m_HAPDSizeZ <= 0) return false;
61  if (m_wallThickness <= 0) return false;
62  if (m_winThickness <= 0) return false;
63  if (m_padSize <= 0) return false;
64  if (m_nPadX == 0) return false;
65  if (m_nPadY == 0) return false;
66  if (m_APDSizeZ <= 0) return false;
67  if (m_APDSizeX <= 0) return false;
68  if (m_APDSizeY <= 0) return false;
69  if (m_FEBSizeX <= 0) return false;
70  if (m_FEBSizeY <= 0) return false;
71  if (m_FEBSizeZ <= 0) return false;
72  if (m_moduleSizeZ <= 0) return false;
73  if (m_winRefIndex < 1.) return false;
74 
75  if (m_wallMaterial.empty()) return false;
76  if (m_winMaterial.empty()) return false;
77  if (m_apdMaterial.empty()) return false;
78  if (m_febMaterial.empty()) return false;
79  if (m_fillMaterial.empty()) return false;
80 
81  return true;
82 }
83 
84 
85 void ARICHGeoHAPD::print(const std::string& title) const
86 {
87  ARICHGeoBase::print(title);
88 
89  cout << " outer HAPD dimensions: " << getSizeX() << " X " << getSizeY() << " X " << getSizeZ() << " " << s_unitName << endl;
90  cout << " wall thickness: " << getWallThickness() << " " << s_unitName << endl;
91  cout << " window thickness: " << getWinThickness() << " " << s_unitName << endl;
92  cout << " pad size: " << getPadSize() << " " << s_unitName << endl;
93  cout << " number of pixels: " << getNumPadsX() << " X " << getNumPadsY() << endl;
94  cout << " gap between APD chips: " << getChipGap() << " " << s_unitName << endl;
95  cout << " APD dimensions: " << getAPDSizeX() << " X " << getAPDSizeY() << " X " << getAPDSizeZ() << " " << s_unitName <<
96  endl;
97  cout << " FEB dimensions: " << getFEBSizeX() << " X " << getFEBSizeY() << " X " << getFEBSizeZ() << " " << s_unitName <<
98  endl;
99  cout << " window ref. index: " << getWinRefIndex() << endl;
100  cout << " module height (Z): " << getModuleSizeZ() << " " << s_unitName << endl;
101  cout << " wall material: " << getWallMaterial() << endl;
102  cout << " window material: " << getWinMaterial() << endl;
103  cout << " HAPD fill material: " << getFillMaterial() << endl;
104  cout << " FEB material: " << getFEBMaterial() << endl;
105  cout << " APD material: " << getAPDMaterial() << endl;
106 
107  // add material names!
108  printSurface(m_apdSurface);
109 }
Abstract base class for different kinds of events.