Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MvtxPrototype2Geom.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MvtxPrototype2Geom.cc
1 #include "MvtxPrototype2Geom.h"
2 
3 #include <iostream>
4 
5 
6 std::unique_ptr<MvtxPrototype2Geom> MvtxPrototype2Geom::s_instance;
7 
9 {
10  if (isBuilt()) {
11  std::cout << "Already built" << std::endl;
12  return; // already initialized
13  }
14 
16  int num_of_chips = 0;
17  for (int iLay = 0; iLay < m_numOfLayers; ++iLay){
18  num_of_chips += m_numOfStaves * m_numOfChips;
19  m_lastChipIndex[iLay] = num_of_chips - 1;
20  }
21  setSize(num_of_chips);
23 }
24 
25 
27 {
28  if (m_size < 1) {
29  std::cout << "Build was not called yet. Calling now..." << std::endl;
30  Build();
31  }
33  for (int i = 0; i < m_size; i++) {
34  TGeoHMatrix* hm = extractMatrixSensor(i);
35  m_l2G.setMatrix(*hm, i);
36  }
37 
38  return;
39 }
40 
41 
43 {
44  int lay = index / getNumberOfChipsInLay();
45  int indexInLay = index % getNumberOfChipsInLay();
46  int stv = indexInLay / m_numOfChips;
47  int indexInStv = indexInLay % m_numOfChips;
48 
49  float shift_dz = (2 * SegmentationAlpide::PassiveEdgeSide) + \
51 
52  float dx = 0.f;
53  float dy = (lay - m_numOfLayers + 1) * s_gapLayers_TB;
54  float dz = (indexInStv - 4) * shift_dz;
55 
56  if (Verbose()>0) {
57  std::cout << "Filling matrix for sensor in chip " << indexInStv << " in stave " << stv;
58  std::cout << " of layer " << lay << "\n";
59  std::cout << "shift in z " << dz << " and in dx " << dx << std::endl;
60  }
61 
62  static TGeoHMatrix matTmp;
63  matTmp = TGeoTranslation(dx, dy, dz);
64  static TGeoTranslation tra(0., -.5 * Segmentation::SensorLayerThicknessEff, 0.);
65  matTmp *= tra;
66 
67  return &matTmp;
68 }