Skip to content

Commit 5a5750c

Browse files
Fix whitespace and formatting in geometry implementation
1 parent f696f3f commit 5a5750c

File tree

2 files changed

+46
-47
lines changed

2 files changed

+46
-47
lines changed

Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/GeometryTGeo.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
5959
int extractNumberOfLayersMLOT();
6060
int extractNumberOfLayersVD() const;
6161
int extractNumberOfPetalsVD() const;
62-
int extractNumberOfActivePartsVD() const;
62+
int extractNumberOfActivePartsVD() const;
6363
int extractNumberOfDisksVD() const;
6464
int extractNumberOfChipsPerPetalVD() const;
6565
int extractNumberOfStavesMLOT(int lay) const;
@@ -85,20 +85,20 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
8585
int getPetalCase(int index) const;
8686
int getDisk(int index) const;
8787

88-
void defineMLOTSensors();
88+
void defineMLOTSensors();
8989
int getBarrelLayer(int) const;
9090

91-
//sensor ref X and alpha for ML & OT
92-
void extractSensorXAlphaMLOT(int, float&, float&);
91+
// sensor ref X and alpha for ML & OT
92+
void extractSensorXAlphaMLOT(int, float&, float&);
9393

94-
//cache for tracking frames (ML & OT)
95-
bool isTrackingFrameCachedMLOT() const {return !mCacheRefXMLOT.empty();}
94+
// cache for tracking frames (ML & OT)
95+
bool isTrackingFrameCachedMLOT() const { return !mCacheRefXMLOT.empty(); }
9696
void fillTrackingFramesCacheMLOT();
9797

98-
float getSensorRefAlphaMLOT(int index) const {return mCacheRefAlphaMLOT[index];}
99-
float getSensorXMLOT(int index) const {return mCacheRefXMLOT[index];}
98+
float getSensorRefAlphaMLOT(int index) const { return mCacheRefAlphaMLOT[index]; }
99+
float getSensorXMLOT(int index) const { return mCacheRefXMLOT[index]; }
100100

101-
//create matrix for tracking to local frame for MLOT
101+
// create matrix for tracking to local frame for MLOT
102102
TGeoHMatrix& createT2LMatrixMLOT(int);
103103

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

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

193-
std::vector<int> sensorsMLOT;
194-
std::vector<float> mCacheRefXMLOT; ///cache for X of ML and OT
195-
std::vector<float> mCacheRefAlphaMLOT; ///cache for sensor ref alpha ML and OT
193+
std::vector<int> sensorsMLOT;
194+
std::vector<float> mCacheRefXMLOT; /// cache for X of ML and OT
195+
std::vector<float> mCacheRefAlphaMLOT; /// cache for sensor ref alpha ML and OT
196196

197197
private:
198198
static std::unique_ptr<o2::trk::GeometryTGeo> sInstance;

Detectors/Upgrades/ALICE3/TRK/base/src/GeometryTGeo.cxx

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void GeometryTGeo::Build(int loadTrans)
9595
int numberOfChipsTotal = 0;
9696

9797
/// filling the information for the VD
98-
for (int i = 0; i < mNumberOfPetalsVD; i++) {
98+
for (int i = 0; i < mNumberOfPetalsVD; i++) {
9999
mNumberOfChipsPerPetalVD[i] = extractNumberOfChipsPerPetalVD();
100100
numberOfChipsTotal += mNumberOfChipsPerPetalVD[i];
101101
mLastChipIndex[i] = numberOfChipsTotal - 1;
@@ -348,7 +348,7 @@ TGeoHMatrix* GeometryTGeo::extractMatrixSensor(int index) const
348348
//__________________________________________________________________________
349349
void GeometryTGeo::defineMLOTSensors()
350350
{
351-
for(int i=0; i<mSize; i++){
351+
for (int i = 0; i < mSize; i++) {
352352
if (getSubDetID(i) == 0) {
353353
continue;
354354
}
@@ -359,12 +359,12 @@ void GeometryTGeo::defineMLOTSensors()
359359
//__________________________________________________________________________
360360
void GeometryTGeo::fillTrackingFramesCacheMLOT()
361361
{
362-
//fill for every sensor of ML & OT its tracking frame parameters
363-
if(!isTrackingFrameCachedMLOT() && !sensorsMLOT.empty()){
362+
// fill for every sensor of ML & OT its tracking frame parameters
363+
if (!isTrackingFrameCachedMLOT() && !sensorsMLOT.empty()) {
364364
size_t newSize = sensorsMLOT.size();
365365
mCacheRefXMLOT.resize(newSize);
366366
mCacheRefAlphaMLOT.resize(newSize);
367-
for(int i=0; i< newSize; i++){
367+
for (int i = 0; i < newSize; i++) {
368368
int sensorId = sensorsMLOT[i];
369369
extractSensorXAlphaMLOT(sensorId, mCacheRefXMLOT[i], mCacheRefAlphaMLOT[i]);
370370
}
@@ -393,18 +393,18 @@ void GeometryTGeo::fillMatrixCache(int mask)
393393
}
394394
}
395395

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

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

965965
int subDetID = getSubDetID(chipID);
966966
int subLayerID = getLayer(chipID);
967-
967+
968968
if (subDetID < 0 || subDetID > 1) {
969-
LOG(error) << "getBarrelLayer(): Invalid subDetID for barrel: " << subDetID
969+
LOG(error) << "getBarrelLayer(): Invalid subDetID for barrel: " << subDetID
970970
<< ". Expected values are 0 or 1.";
971-
return -1;
971+
return -1;
972972
}
973973

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

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

982-
return baseOffsets[subDetID] + subLayerID;
983-
982+
return baseOffsets[subDetID] + subLayerID;
984983
}
985984

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

993-
if(getSubDetID(chipID) == 0){
994-
992+
if (getSubDetID(chipID) == 0) {
993+
995994
LOG(error) << "extractSensorXAlphaMLOT(): VD layers are not supported yet! chipID = " << chipID;
996995
return;
997996

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

10081007
alp = std::atan2(yp, xp);
1009-
x = std::hypot(xp, yp);
1008+
x = std::hypot(xp, yp);
10101009
o2::math_utils::bringTo02Pi(alp);
10111010

1012-
///TODO:
1013-
//once the VD segmentation is done, VD should be added
1011+
/// TODO:
1012+
// once the VD segmentation is done, VD should be added
10141013
}
10151014

10161015
//__________________________________________________________________________
10171016
TGeoHMatrix& GeometryTGeo::createT2LMatrixMLOT(int chipID)
10181017
{
1019-
//works only for ML & OT
1020-
//for VD is yet to be implemented once we have more refined geometry
1021-
if(getSubDetID(chipID) == 0){
1022-
1018+
// works only for ML & OT
1019+
// for VD is yet to be implemented once we have more refined geometry
1020+
if (getSubDetID(chipID) == 0) {
1021+
10231022
LOG(error) << "createT2LMatrixMLOT(): VD layers are not supported yet! chipID = " << chipID
10241023
<< "returning dummy values! ";
10251024
static TGeoHMatrix dummy;
@@ -1029,13 +1028,13 @@ TGeoHMatrix& GeometryTGeo::createT2LMatrixMLOT(int chipID)
10291028
static TGeoHMatrix t2l;
10301029
t2l.Clear();
10311030
float alpha = getSensorRefAlphaMLOT(chipID);
1032-
t2l.RotateZ(alpha * TMath::RadToDeg());
1031+
t2l.RotateZ(alpha * TMath::RadToDeg());
10331032
const TGeoHMatrix* matL2G = extractMatrixSensor(chipID);
10341033
const TGeoHMatrix& matL2Gi = matL2G->Inverse();
10351034
t2l.MultiplyLeft(&matL2Gi);
10361035
return t2l;
10371036
}
10381037
}
1039-
1038+
10401039
} // namespace trk
10411040
} // namespace o2

0 commit comments

Comments
 (0)