Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/GeometryTGeo.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
int extractNumberOfLayersMLOT();
int extractNumberOfLayersVD() const;
int extractNumberOfPetalsVD() const;
int extractNumberOfActivePartsVD() const;
int extractNumberOfActivePartsVD() const;
int extractNumberOfDisksVD() const;
int extractNumberOfChipsPerPetalVD() const;
int extractNumberOfStavesMLOT(int lay) const;
Expand All @@ -85,20 +85,20 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
int getPetalCase(int index) const;
int getDisk(int index) const;

void defineMLOTSensors();
void defineMLOTSensors();
int getBarrelLayer(int) const;

//sensor ref X and alpha for ML & OT
void extractSensorXAlphaMLOT(int, float&, float&);
// sensor ref X and alpha for ML & OT
void extractSensorXAlphaMLOT(int, float&, float&);

//cache for tracking frames (ML & OT)
bool isTrackingFrameCachedMLOT() const {return !mCacheRefXMLOT.empty();}
// cache for tracking frames (ML & OT)
bool isTrackingFrameCachedMLOT() const { return !mCacheRefXMLOT.empty(); }
void fillTrackingFramesCacheMLOT();

float getSensorRefAlphaMLOT(int index) const {return mCacheRefAlphaMLOT[index];}
float getSensorXMLOT(int index) const {return mCacheRefXMLOT[index];}
float getSensorRefAlphaMLOT(int index) const { return mCacheRefAlphaMLOT[index]; }
float getSensorXMLOT(int index) const { return mCacheRefXMLOT[index]; }

//create matrix for tracking to local frame for MLOT
// create matrix for tracking to local frame for MLOT
TGeoHMatrix& createT2LMatrixMLOT(int);

/// This routine computes the chip index number from the subDetID, petal, disk, layer, stave /// TODO: retrieve also from chip when chips will be available
Expand Down Expand Up @@ -190,9 +190,9 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache

bool mOwner = true; //! is it owned by the singleton?

std::vector<int> sensorsMLOT;
std::vector<float> mCacheRefXMLOT; ///cache for X of ML and OT
std::vector<float> mCacheRefAlphaMLOT; ///cache for sensor ref alpha ML and OT
std::vector<int> sensorsMLOT;
std::vector<float> mCacheRefXMLOT; /// cache for X of ML and OT
std::vector<float> mCacheRefAlphaMLOT; /// cache for sensor ref alpha ML and OT

private:
static std::unique_ptr<o2::trk::GeometryTGeo> sInstance;
Expand Down
69 changes: 34 additions & 35 deletions Detectors/Upgrades/ALICE3/TRK/base/src/GeometryTGeo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void GeometryTGeo::Build(int loadTrans)
int numberOfChipsTotal = 0;

/// filling the information for the VD
for (int i = 0; i < mNumberOfPetalsVD; i++) {
for (int i = 0; i < mNumberOfPetalsVD; i++) {
mNumberOfChipsPerPetalVD[i] = extractNumberOfChipsPerPetalVD();
numberOfChipsTotal += mNumberOfChipsPerPetalVD[i];
mLastChipIndex[i] = numberOfChipsTotal - 1;
Expand Down Expand Up @@ -348,7 +348,7 @@ TGeoHMatrix* GeometryTGeo::extractMatrixSensor(int index) const
//__________________________________________________________________________
void GeometryTGeo::defineMLOTSensors()
{
for(int i=0; i<mSize; i++){
for (int i = 0; i < mSize; i++) {
if (getSubDetID(i) == 0) {
continue;
}
Expand All @@ -359,12 +359,12 @@ void GeometryTGeo::defineMLOTSensors()
//__________________________________________________________________________
void GeometryTGeo::fillTrackingFramesCacheMLOT()
{
//fill for every sensor of ML & OT its tracking frame parameters
if(!isTrackingFrameCachedMLOT() && !sensorsMLOT.empty()){
// fill for every sensor of ML & OT its tracking frame parameters
if (!isTrackingFrameCachedMLOT() && !sensorsMLOT.empty()) {
size_t newSize = sensorsMLOT.size();
mCacheRefXMLOT.resize(newSize);
mCacheRefAlphaMLOT.resize(newSize);
for(int i=0; i< newSize; i++){
for (int i = 0; i < newSize; i++) {
int sensorId = sensorsMLOT[i];
extractSensorXAlphaMLOT(sensorId, mCacheRefXMLOT[i], mCacheRefAlphaMLOT[i]);
}
Expand Down Expand Up @@ -393,18 +393,18 @@ void GeometryTGeo::fillMatrixCache(int mask)
}
}

//build T2L matrices for ML & OT !! VD is yet to be implemented once its geometry will be more refined
// build T2L matrices for ML & OT !! VD is yet to be implemented once its geometry will be more refined
if ((mask & o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L)) && !getCacheT2L().isFilled()) {
LOGP(info, "Loading {} T2L matrices from TGeo for ML & OT", getName());
if(sensorsMLOT.size()){
if (sensorsMLOT.size()) {
int m_Size = sensorsMLOT.size();
auto& cacheT2L = getCacheT2L();
cacheT2L.setSize(m_Size);
for(int i=0; i<m_Size; i++) {
for (int i = 0; i < m_Size; i++) {
int sensorID = sensorsMLOT[i];
TGeoHMatrix& hm = createT2LMatrixMLOT(sensorID);
cacheT2L.setMatrix(Mat3D(hm), i); //here, sensorIDs from 0 to 374, sensorIDs shifted to 36 !
}
cacheT2L.setMatrix(Mat3D(hm), i); // here, sensorIDs from 0 to 374, sensorIDs shifted to 36 !
}
}
}

Expand Down Expand Up @@ -957,45 +957,44 @@ void GeometryTGeo::Print(Option_t*) const
//__________________________________________________________________________
int GeometryTGeo::getBarrelLayer(int chipID) const
{
//for barrel layers only,
//so it would be consistent with number of layers i.e. from 0 to 10,
//starting from VD0 to OT10;
//skip the disks;
// for barrel layers only,
// so it would be consistent with number of layers i.e. from 0 to 10,
// starting from VD0 to OT10;
// skip the disks;

int subDetID = getSubDetID(chipID);
int subLayerID = getLayer(chipID);

if (subDetID < 0 || subDetID > 1) {
LOG(error) << "getBarrelLayer(): Invalid subDetID for barrel: " << subDetID
LOG(error) << "getBarrelLayer(): Invalid subDetID for barrel: " << subDetID
<< ". Expected values are 0 or 1.";
return -1;
return -1;
}

if (subLayerID < 0 || subLayerID > 7) {
LOG(error) << "getBarrelLayer(): Invalid subLayerID for barrel: " << subDetID
LOG(error) << "getBarrelLayer(): Invalid subLayerID for barrel: " << subDetID
<< ". Expected values are between 0 and 7.";
return -1;
return -1;
}

const int baseOffsets[] = {0, 3};

return baseOffsets[subDetID] + subLayerID;

return baseOffsets[subDetID] + subLayerID;
}

//__________________________________________________________________________
void GeometryTGeo::extractSensorXAlphaMLOT(int chipID, float& x, float& alp)
void GeometryTGeo::extractSensorXAlphaMLOT(int chipID, float& x, float& alp)
{
//works for ML and OT only, a.k.a flat sensors !!!
// works for ML and OT only, a.k.a flat sensors !!!
double locA[3] = {-100., 0., 0.}, locB[3] = {100., 0., 0.}, gloA[3], gloB[3];
double xp{0}, yp{0};

if(getSubDetID(chipID) == 0){
if (getSubDetID(chipID) == 0) {

LOG(error) << "extractSensorXAlphaMLOT(): VD layers are not supported yet! chipID = " << chipID;
return;

} else { //flat sensors, ML and OT
} else { // flat sensors, ML and OT
const TGeoHMatrix* matL2G = extractMatrixSensor(chipID);
matL2G->LocalToMaster(locA, gloA);
matL2G->LocalToMaster(locB, gloB);
Expand All @@ -1006,20 +1005,20 @@ void GeometryTGeo::extractSensorXAlphaMLOT(int chipID, float& x, float& alp)
}

alp = std::atan2(yp, xp);
x = std::hypot(xp, yp);
x = std::hypot(xp, yp);
o2::math_utils::bringTo02Pi(alp);

///TODO:
//once the VD segmentation is done, VD should be added
/// TODO:
// once the VD segmentation is done, VD should be added
}

//__________________________________________________________________________
TGeoHMatrix& GeometryTGeo::createT2LMatrixMLOT(int chipID)
{
//works only for ML & OT
//for VD is yet to be implemented once we have more refined geometry
if(getSubDetID(chipID) == 0){
// works only for ML & OT
// for VD is yet to be implemented once we have more refined geometry
if (getSubDetID(chipID) == 0) {

LOG(error) << "createT2LMatrixMLOT(): VD layers are not supported yet! chipID = " << chipID
<< "returning dummy values! ";
static TGeoHMatrix dummy;
Expand All @@ -1029,13 +1028,13 @@ TGeoHMatrix& GeometryTGeo::createT2LMatrixMLOT(int chipID)
static TGeoHMatrix t2l;
t2l.Clear();
float alpha = getSensorRefAlphaMLOT(chipID);
t2l.RotateZ(alpha * TMath::RadToDeg());
t2l.RotateZ(alpha * TMath::RadToDeg());
const TGeoHMatrix* matL2G = extractMatrixSensor(chipID);
const TGeoHMatrix& matL2Gi = matL2G->Inverse();
t2l.MultiplyLeft(&matL2Gi);
return t2l;
}
}

} // namespace trk
} // namespace o2