Project
Loading...
Searching...
No Matches
GeometryTGeo.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13#include <TGeoManager.h>
14
15namespace o2::mi3
16{
17std::unique_ptr<o2::mi3::GeometryTGeo> GeometryTGeo::sInstance;
18
19std::string GeometryTGeo::sVolumeName = "MIDV";
20std::string GeometryTGeo::sLayerName = "MIDLayer";
21std::string GeometryTGeo::sStaveName = "MIDStave";
22std::string GeometryTGeo::sModuleName = "MIDModule";
23std::string GeometryTGeo::sSensorName = "MIDSensor";
24
25GeometryTGeo::GeometryTGeo(bool build, int loadTrans) : DetMatrixCache()
26{
27 if (sInstance) {
28 LOGP(fatal, "Invalid use of public constructor: o2::mi3::GeometryTGeo instance exists");
29 }
30 if (build) {
31 Build(loadTrans);
32 }
33}
34
35void GeometryTGeo::Build(int loadTrans)
36{
37 if (isBuilt()) {
38 LOGP(warning, "Already built");
39 return; // already initialized
40 }
41
42 if (!gGeoManager) {
43 LOGP(fatal, "Geometry is not loaded");
44 }
45
46 fillMatrixCache(loadTrans);
47}
48
52
54{
55 if (!sInstance) {
56 sInstance = std::unique_ptr<GeometryTGeo>(new GeometryTGeo(true, 0));
57 }
58 return sInstance.get();
59}
60
62{
63 return Form("%s/%s%d", composeSymNameMID(0), getMIDLayerPattern(), layer);
64}
65
67 const int stave)
68{
69 return Form("%s/%s%d", composeSymNameLayer(layer), getMIDStavePattern(), stave);
70}
71
73 const int stave,
74 const int module)
75{
76 return Form("%s/%s%d", composeSymNameStave(layer, stave), getMIDModulePattern(), module);
77}
78
80 const int stave,
81 const int module,
82 const int sensor)
83{
84 return Form("%s/%s%d", composeSymNameModule(layer, stave, module), getMIDSensorPattern(), sensor);
85}
86} // namespace o2::mi3
static std::string sLayerName
static std::string sModuleName
GeometryTGeo(bool build=false, int loadTrans=0)
void fillMatrixCache(int mask)
static const char * composeSymNameSensor(const int layer, const int stave, const int module, const int sensor)
static std::string sVolumeName
static std::string sStaveName
static const char * composeSymNameModule(const int layer, const int stave, const int module)
static const char * getMIDModulePattern()
static const char * composeSymNameStave(const int layer, const int stave)
static const char * composeSymNameMID(int d)
static const char * getMIDLayerPattern()
void Build(int loadTrans)
static const char * getMIDSensorPattern()
static const char * composeSymNameLayer(const int layer)
static const char * getMIDStavePattern()
static GeometryTGeo * Instance()
static std::string sSensorName
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLint GLuint mask
Definition glcorearb.h:291