Skip to content

Commit e8620a6

Browse files
rpezzisawenzel
authored andcommitted
MFT XML segmentation (#1446)
* MFT Ladder segmentation on Detectors/ITSMFT/MFT/data/Geometry.xml * First MFT chips placed independently * New origin for ladders in disk0 * Fixed correction for MFT sensor positions
1 parent 606f2ec commit e8620a6

File tree

5 files changed

+1571
-317
lines changed

5 files changed

+1571
-317
lines changed

Detectors/ITSMFT/MFT/base/include/MFTBase/LadderSegmentation.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define ALICEO2_MFT_LADDERSEGMENTATION_H_
1818

1919
#include "TClonesArray.h"
20+
#include "TXMLEngine.h"
2021

2122
#include "MFTBase/VSegmentation.h"
2223
#include "MFTBase/ChipSegmentation.h"
@@ -52,7 +53,7 @@ class LadderSegmentation : public VSegmentation
5253

5354
ChipSegmentation* getSensor(Int_t sensor) const;
5455

55-
void createSensors();
56+
void createSensors(TXMLEngine* xml, XMLNodePointer_t node);
5657

5758
/// \brief Returns number of Sensor on the ladder
5859
Int_t getNSensors() const { return mNSensors; };

Detectors/ITSMFT/MFT/base/src/ChipSegmentation.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ ChipSegmentation::ChipSegmentation(UInt_t uniqueID) : VSegmentation()
4242
mftGeom->getDiskID(GetUniqueID()), mftGeom->getLadderID(GetUniqueID()),
4343
mftGeom->getSensorID(GetUniqueID())));
4444

45-
Double_t pos[3];
46-
pos[0] = mftGeom->getSensorID(GetUniqueID()) * (SegmentationAlpide::SensorSizeCols + Geometry::sSensorInterspace) +
47-
Geometry::sSensorSideOffset;
48-
pos[1] = Geometry::sSensorTopOffset;
49-
pos[2] = Geometry::sFlexThickness;
50-
setPosition(pos);
45+
// Double_t pos[3];
46+
// pos[0] = mftGeom->getSensorID(GetUniqueID())*
47+
// (SegmentationAlpide::SensorSizeCols + Geometry::sSensorInterspace) + Geometry::sSensorSideOffset;
48+
// pos[1] = Geometry::sSensorTopOffset;
49+
// pos[2] = Geometry::sFlexThickness;
50+
// setPosition(pos);
5151
}
5252

5353
/// \brief Print out Sensor information (Name, ID, position, orientation)

Detectors/ITSMFT/MFT/base/src/HalfDiskSegmentation.cxx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,7 @@ void HalfDiskSegmentation::createLadders(TXMLEngine* xml, XMLNodePointer_t node)
142142
ladder->setPosition(pos);
143143
ladder->setRotationAngles(ang);
144144

145-
/// @todo : In the XML geometry file, the position of the top-left corner of the chip closest to the pipe is given
146-
/// in the Halfdisk coordinate system.
147-
/// Need to put in the XML file the position of the ladder coordinate center
148-
// Find the position of the corner of the flex which is the ladder corrdinate system center.
149-
150-
pos[0] = -Geometry::sSensorSideOffset;
151-
pos[1] = -Geometry::sSensorTopOffset - SegmentationAlpide::SensorSizeRows;
152-
pos[2] = -Geometry::sFlexThickness - Geometry::sChipThickness;
153-
Double_t master[3];
154-
ladder->getTransformation()->LocalToMaster(pos, master);
155-
ladder->setPosition(master);
156-
157-
ladder->createSensors();
145+
ladder->createSensors(xml, node);
158146

159147
new ((*mLadders)[iladder]) LadderSegmentation(*ladder);
160148
delete ladder;

Detectors/ITSMFT/MFT/base/src/LadderSegmentation.cxx

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,75 @@ LadderSegmentation::LadderSegmentation(const LadderSegmentation& ladder)
6464
/// Creates the Sensors Segmentation array on the Ladder
6565

6666
//_____________________________________________________________________________
67-
void LadderSegmentation::createSensors()
67+
void LadderSegmentation::createSensors(TXMLEngine* xml, XMLNodePointer_t node)
6868
{
6969

7070
if (!mChips) {
7171
mChips = new TClonesArray("o2::MFT::ChipSegmentation", mNSensors);
7272
mChips->SetOwner(kTRUE);
7373
}
7474

75-
Geometry* mftGeom = Geometry::instance();
76-
77-
for (Int_t iSensor = 0; iSensor < mNSensors; iSensor++) {
78-
UInt_t sensorUniqueID =
79-
mftGeom->getObjectID(Geometry::SensorType, mftGeom->getHalfID(GetUniqueID()), mftGeom->getDiskID(GetUniqueID()),
80-
mftGeom->getPlaneID(GetUniqueID()), mftGeom->getLadderID(GetUniqueID()), iSensor);
75+
Int_t ichip;
76+
Double_t pos[3];
77+
Double_t ang[3] = { 0., 0., 0. };
8178

82-
auto* chip = new ChipSegmentation(sensorUniqueID);
79+
Geometry* mftGeom = Geometry::instance();
8380

84-
new ((*mChips)[iSensor]) ChipSegmentation(*chip);
81+
TString nodeName = xml->GetNodeName(node);
82+
if (!nodeName.CompareTo("chip")) {
83+
XMLAttrPointer_t attr = xml->GetFirstAttr(node);
84+
while (attr != nullptr) {
85+
TString attrName = xml->GetAttrName(attr);
86+
TString attrVal = xml->GetAttrValue(attr);
87+
if (!attrName.CompareTo("ichip")) {
88+
ichip = attrVal.Atoi();
89+
if (ichip >= getNSensors() || ichip < 0) {
90+
LOG(FATAL) << "Wrong chip number : " << ichip << FairLogger::endl;
91+
}
92+
} else if (!attrName.CompareTo("xpos")) {
93+
pos[0] = attrVal.Atof();
94+
} else if (!attrName.CompareTo("ypos")) {
95+
pos[1] = attrVal.Atof();
96+
} else if (!attrName.CompareTo("zpos")) {
97+
pos[2] = attrVal.Atof();
98+
} else if (!attrName.CompareTo("phi")) {
99+
ang[0] = attrVal.Atof();
100+
} else if (!attrName.CompareTo("theta")) {
101+
ang[1] = attrVal.Atof();
102+
} else if (!attrName.CompareTo("psi")) {
103+
ang[2] = attrVal.Atof();
104+
} else {
105+
LOG(ERROR) << "Unknwon Attribute name " << xml->GetAttrName(attr) << FairLogger::endl;
106+
}
107+
attr = xml->GetNextAttr(attr);
108+
}
109+
110+
UInt_t chipUniqueID =
111+
mftGeom->getObjectID(Geometry::SensorType,
112+
mftGeom->getHalfID(GetUniqueID()),
113+
mftGeom->getDiskID(GetUniqueID()),
114+
mftGeom->getPlaneID(GetUniqueID()),
115+
mftGeom->getLadderID(GetUniqueID()),
116+
ichip);
117+
118+
auto* chip = new ChipSegmentation(chipUniqueID);
119+
// pos[0] = mftGeom->getSensorID(GetUniqueID())*
120+
// (SegmentationAlpide::SensorSizeCols + Geometry::sSensorInterspace) + Geometry::sSensorSideOffset;
121+
// pos[1] = Geometry::sSensorTopOffset;
122+
// pos[2] = Geometry::sFlexThickness;
123+
chip->setPosition(pos);
124+
chip->setRotationAngles(ang);
125+
126+
new ((*mChips)[ichip]) ChipSegmentation(*chip);
85127
delete chip;
86128
}
129+
130+
// display all child nodes
131+
XMLNodePointer_t child = xml->GetChild(node);
132+
while (child != nullptr) {
133+
createSensors(xml, child);
134+
child = xml->GetNext(child);
135+
}
87136
}
88137

89138
/// Returns pointer to a sensor segmentation

0 commit comments

Comments
 (0)