13#include <TGeoManager.h>
22std::unique_ptr<o2::trk::GeometryTGeo> GeometryTGeo::sInstance;
45 LOGP(fatal,
"Invalid use of public constructor: o2::trk::GeometryTGeo instance exists");
62 LOGP(warning,
"Already built");
66 if (gGeoManager ==
nullptr) {
67 LOGP(fatal,
"Geometry is not loaded");
87 std::cout <<
"Layer MLOT: " <<
i << std::endl;
92 int numberOfChipsTotal = 0;
155 }
else if (subDetID == 1) {
172 }
else if (subDetID == 1) {
190 }
else if (subDetID == 1) {
223 }
else if (subDetID == 1) {
239 }
else if (subDetID == 1) {
266 int subDetID, petalcase, disk,
layer, stave, halfstave;
279 }
else if (
layer >= 0) {
285 }
else if (subDetID == 1) {
309 static TGeoHMatrix matTmp;
310 gGeoManager->PushPath();
312 if (!gGeoManager->cd(
path.Data())) {
313 gGeoManager->PopPath();
314 LOG(error) <<
"Error in cd-ing to " <<
path.Data();
318 matTmp = *gGeoManager->GetCurrentMatrix();
323 gGeoManager->PopPath();
325 static int chipInGlo{0};
347 LOG(warning) <<
"The method Build was not called yet";
355 LOGP(info,
"Loading {} L2G matrices from TGeo; there are {} matrices",
getName(),
mSize);
357 cacheL2G.setSize(
mSize);
361 cacheL2G.setMatrix(
Mat3D(*hm),
i);
394 if (!nms.BeginsWith(prefix)) {
397 nms.Remove(0, strlen(prefix));
398 if (!isdigit(nms.Data()[0])) {
407 int numberOfLayers = 0;
409 if (trkV ==
nullptr) {
415 TObjArray*
nodes = trkV->GetNodes();
417 int nNodes =
nodes->GetEntriesFast();
418 for (
int j = 0;
j < nNodes;
j++) {
420 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
421 const char*
name = nd->GetName();
425 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
431 LOG(fatal) <<
"Failed to extract wrapper ID from the " <<
name;
433 TObjArray* nodesW = nd->GetNodes();
434 int nNodesW = nodesW->GetEntriesFast();
436 for (
int jw = 0; jw < nNodesW; jw++) {
437 auto ndW =
dynamic_cast<TGeoNode*
>(nodesW->At(jw))->GetName();
440 LOGP(fatal,
"Failed to extract layer ID from wrapper volume '{}' from one of its nodes '{}'",
name, ndW);
448 return numberOfLayers;
455 int numberOfParts = 0;
458 if (vdV ==
nullptr) {
463 TObjArray*
nodes = vdV->GetNodes();
464 int nNodes =
nodes->GetEntriesFast();
465 for (
int j = 0;
j < nNodes;
j++) {
467 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
468 const char*
name = nd->GetName();
473 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
477 return numberOfParts;
484 int numberOfDisks = 0;
487 if (vdV ==
nullptr) {
492 TObjArray*
nodes = vdV->GetNodes();
493 int nNodes =
nodes->GetEntriesFast();
494 for (
int j = 0;
j < nNodes;
j++) {
496 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
497 const char*
name = nd->GetName();
502 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
506 return numberOfDisks;
513 int numberOfChips = 0;
516 if (vdV ==
nullptr) {
521 TObjArray*
nodes = vdV->GetNodes();
522 int nNodes =
nodes->GetEntriesFast();
523 for (
int j = 0;
j < nNodes;
j++) {
525 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
526 const char*
name = nd->GetName();
531 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
535 return numberOfChips;
542 int numberOfLayers = 0;
545 if (vdV ==
nullptr) {
550 TObjArray*
nodes = vdV->GetNodes();
551 int nNodes =
nodes->GetEntriesFast();
552 for (
int j = 0;
j < nNodes;
j++) {
554 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
555 const char*
name = nd->GetName();
560 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
564 return numberOfLayers;
571 int numberOfChips = 0;
574 if (vdV ==
nullptr) {
579 TObjArray*
nodes = vdV->GetNodes();
580 int nNodes =
nodes->GetEntriesFast();
581 for (
int j = 0;
j < nNodes;
j++) {
583 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
584 const char*
name = nd->GetName();
589 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
593 return numberOfChips;
599 int numberOfStaves = 0;
602 TGeoVolume* layV = gGeoManager->GetVolume(layName.c_str());
604 if (layV ==
nullptr) {
609 TObjArray*
nodes = layV->GetNodes();
612 int nNodes =
nodes->GetEntriesFast();
614 for (
int j = 0;
j < nNodes;
j++) {
616 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
617 const char*
name = nd->GetName();
622 return numberOfStaves;
628 int numberOfHalfStaves = 0;
631 TGeoVolume* staveV = gGeoManager->GetVolume(staveName.c_str());
633 if (staveV ==
nullptr) {
638 TObjArray*
nodes = staveV->GetNodes();
641 int nNodes =
nodes->GetEntriesFast();
643 for (
int j = 0;
j < nNodes;
j++) {
644 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
645 const char*
name = nd->GetName();
647 numberOfHalfStaves++;
650 return numberOfHalfStaves;
656 std::cout <<
"\nindex = " <<
index << std::endl;
657 std::cout <<
"subDetID = " << subDetID << std::endl;
658 std::cout <<
"petalcase = " << petalcase << std::endl;
659 std::cout <<
"layer = " << lay << std::endl;
660 std::cout <<
"disk = " << disk << std::endl;
661 std::cout <<
"first chip index = " <<
getFirstChipIndex(lay, petalcase, subDetID) << std::endl;
662 std::cout <<
"stave = " << stave << std::endl;
663 std::cout <<
"halfstave = " << halfstave << std::endl;
670 LOGF(info,
"Geometry not built yet!");
673 std::cout <<
"Detector ID: " << sInstance.get()->getDetID() << std::endl;
675 LOGF(info,
"Summary of GeometryTGeo: %s",
getName());
681 LOGF(info,
"Number of chips per petal VD: ");
685 LOGF(info,
"Number of staves and half staves per layer MLOT: ");
687 std::string mlot =
"";
688 mlot = (
i < 4) ?
"ML" :
"OT";
693 std::cout <<
"mLastChipIndex = [";
700 std::cout <<
"]" << std::endl;
701 std::cout <<
"mLastChipIndexVD = [";
708 std::cout <<
"]" << std::endl;
Definition of the SegmentationChipclass.
Static class with identifiers, bitmasks and names for ALICE detectors.
const char * getName() const
int mSize
prebooked number of sensors
const MatrixCache< Mat3D > & getCacheL2G() const
static const char * getTRKPetalDiskPattern()
static const char * composeSymNameLayer(int d, int layer)
static const char * getTRKStavePattern()
int getPetalCase(int index) const
static const char * getTRKChipPattern()
std::vector< int > mNumberOfChipsPerLayerVD
number of chips per layer VD ( = number of petals)
static std::string sVolumeName
int getSubDetID(int index) const
std::array< char, MAXLAYERS > mLayerToWrapper
Layer to wrapper correspondence.
static std::string sPetalLayerName
static const char * getTRKSensorPattern()
static std::string sStaveName
std::vector< int > mNumberOfHalfStaves
Number Of Staves in each stave of the layer in ML/OT.
int extractNumberOfChipsPerPetalVD() const
int extractNumberOfHalfStavesMLOT(int lay) const
static const char * getTRKPetalLayerPattern()
int getChipIndex(int subDetID, int petalcase, int disk, int lay, int stave, int halfstave) const
int extractNumberOfLayersMLOT()
Determines the number of active parts in the Geometry.
std::vector< int > mNumbersOfChipPerDiskVD
numbersOfChipPerDiskVD
std::vector< int > mNumberOfStaves
Number Of Staves per layer in ML/OT.
Int_t mNumberOfPetalsVD
number of Petals = chip in each VD layer
std::vector< int > mLastChipIndexVD
max ID of the detctor in the layer for the VD
static std::string sPetalName
int extractNumberOfStavesMLOT(int lay) const
static const char * composeSymNameChip(int d, int lr)
static std::string sPetalDiskName
void Print(Option_t *opt="") const
void PrintChipID(int index, int subDetID, int petalcase, int disk, int lay, int stave, int halfstave) const
int getLayer(int index) const
static const char * getTRKWrapVolPattern()
TString getMatrixPath(int index) const
int getNumberOfChips() const
static const char * getTRKLayerPattern()
int getFirstChipIndex(int lay, int petalcase, int subDetID) const
o2::math_utils::Transform3D Mat3D
static std::string sWrapperVolumeName
Wrapper volume name.
int extractNumberOfLayersVD() const
std::vector< int > mNumberOfChipsPerPetalVD
numbersOfChipPerPetalVD
std::vector< int > mLastChipIndex
max ID of the detctor in the petal(VD) or layer(MLOT)
static std::string sChipName
static std::string sSensorName
bool getChipID(int index, int &subDetID, int &petalcase, int &disk, int &lay, int &stave, int &halfstave) const
std::vector< int > mLastChipIndexMLOT
max ID of the detctor in the layer for the MLOT
void fillMatrixCache(int mask)
static std::string sLayerName
int extractNumberOfActivePartsVD() const
static const char * composeSymNameSensor(int d, int layer)
int extractNumberOfDisksVD() const
static const char * getTRKPetalPattern()
Int_t mNumberOfActivePartsVD
number of layers
std::vector< int > mNumberOfChipsPerLayerMLOT
number of chips per layer MLOT ( = 1 for the moment)
Int_t mNumberOfDisksVD
number of Disks = 6
Int_t mNumberOfLayersMLOT
number of layers
int getStave(int index) const
static const char * getTRKVolPattern()
static const char * composeSymNameStave(int d, int layer)
int getDisk(int index) const
static const char * composeSymNameTRK(int d)
int extractNumberOfPetalsVD() const
int extractVolumeCopy(const char *name, const char *prefix) const
Extract number following the prefix in the name string.
void Build(int loadTrans)
Int_t mNumberOfLayersVD
number of layers
int getHalfStave(int index) const
GeometryTGeo(bool build=false, int loadTrans=0)
TGeoHMatrix * extractMatrixSensor(int index) const
GLuint const GLchar * name
GLsizei const GLchar *const * path
GLenum GLuint GLint GLint layer
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"