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
16{
17namespace trk
18{
19std::unique_ptr<o2::trk::GeometryTGeo> GeometryTGeo::sInstance;
20
21// Names
22std::string GeometryTGeo::sVolumeName = "TRKV";
23std::string GeometryTGeo::sStaveName = "TRKStave";
24std::string GeometryTGeo::sLayerName = "TRKLayer";
25std::string GeometryTGeo::sChipName = "TRKChip";
26std::string GeometryTGeo::sSensorName = "TRKSensor";
27
28GeometryTGeo::GeometryTGeo(bool build, int loadTrans) : DetMatrixCache()
29{
30 if (sInstance) {
31 LOGP(fatal, "Invalid use of public constructor: o2::trk::GeometryTGeo instance exists");
32 }
33 if (build) {
34 Build(loadTrans);
35 }
36}
37
38void GeometryTGeo::Build(int loadTrans)
39{
40 if (isBuilt()) {
41 LOGP(warning, "Already built");
42 return; // already initialized
43 }
44
45 if (!gGeoManager) {
46 LOGP(fatal, "Geometry is not loaded");
47 }
48
49 fillMatrixCache(loadTrans);
50}
51
55
57{
58 if (!sInstance) {
59 sInstance = std::unique_ptr<GeometryTGeo>(new GeometryTGeo(true, 0));
60 }
61 return sInstance.get();
62}
63
64const char* GeometryTGeo::composeSymNameLayer(int d, int lr)
65{
66 return Form("%s/%s%d", composeSymNameTRK(d), getTRKLayerPattern(), lr);
67}
68
69const char* GeometryTGeo::composeSymNameStave(int d, int lr)
70{
71 return Form("%s/%s%d", composeSymNameLayer(d, lr), getTRKStavePattern(), lr);
72}
73
74const char* GeometryTGeo::composeSymNameChip(int d, int lr)
75{
76 return Form("%s/%s%d", composeSymNameStave(d, lr), getTRKChipPattern(), lr);
77}
78
79const char* GeometryTGeo::composeSymNameSensor(int d, int lr)
80{
81 return Form("%s/%s%d", composeSymNameChip(d, lr), getTRKSensorPattern(), lr);
82}
83
84} // namespace trk
85} // namespace o2
static const char * composeSymNameLayer(int d, int layer)
static const char * getTRKStavePattern()
static const char * getTRKChipPattern()
static std::string sVolumeName
static const char * getTRKSensorPattern()
static std::string sStaveName
static GeometryTGeo * Instance()
static const char * composeSymNameChip(int d, int lr)
static const char * getTRKLayerPattern()
static std::string sChipName
static std::string sSensorName
void fillMatrixCache(int mask)
static std::string sLayerName
static const char * composeSymNameSensor(int d, int layer)
static const char * composeSymNameStave(int d, int layer)
static const char * composeSymNameTRK(int d)
void Build(int loadTrans)
GeometryTGeo(bool build=false, int loadTrans=0)
GLint GLuint mask
Definition glcorearb.h:291
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...