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