Skip to content

Commit 8902070

Browse files
Merge formatting changes
Please consider the following formatting changes to #15665
2 parents 04af68c + 209af7e commit 8902070

3 files changed

Lines changed: 91 additions & 79 deletions

File tree

Detectors/Upgrades/ALICE3/TRKFT3/FT3/base/include/FT3Base/GeometryTGeo.h

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#include <memory>
2222
#include "DetectorsCommonDataFormats/DetMatrixCache.h"
2323
#include "DetectorsCommonDataFormats/DetID.h"
24-
//#include "MathUtils/Utils.h"
25-
//#include "Rtypes.h" // for Int_t, Double_t, Bool_t, UInt_t, etc
24+
// #include "MathUtils/Utils.h"
25+
// #include "Rtypes.h" // for Int_t, Double_t, Bool_t, UInt_t, etc
2626

2727
namespace o2
2828
{
@@ -58,21 +58,21 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
5858
int extractNumberOfDiscs(int dir);
5959
int extractNumberOfChips(int dir, int layer);
6060
int extractChipId(std::string const volName);
61-
void extractStaveChipId(std::string const volName, int &stave, int&chip);
62-
void extractChipIds(std::string const volName, int &direction, int &layer, int &stave, int&chip);
63-
61+
void extractStaveChipId(std::string const volName, int& stave, int& chip);
62+
void extractChipIds(std::string const volName, int& direction, int& layer, int& stave, int& chip);
63+
6464
int getChipIndex(int dir, int disc, int stave, int chip) const;
65-
//int getDisk(int index) const {return -1;} // TODO: implement this
65+
// int getDisk(int index) const {return -1;} // TODO: implement this
6666
int getLayer(int chipIdx) const;
6767
std::string getMatrixPath(int direction, int layer, int stave, int chip) const;
68-
int getNumberOfChips() const { return mSize;}
68+
int getNumberOfChips() const { return mSize; }
6969
int getNumberOfLayers() const { return mNumberOfDiscs[0] + mNumberOfDiscs[1]; }
70-
int getNumberOfStaves(int absDisc) const {return mNumberOfStavesPerDisc[absDisc]; }
71-
int getSubDetID(int) const { return 2;}
70+
int getNumberOfStaves(int absDisc) const { return mNumberOfStavesPerDisc[absDisc]; }
71+
int getSubDetID(int) const { return 2; }
7272
int getStave(int chipIdx) const;
7373
int getChipOnStave(int chipIdx) const;
74-
int getStaveIdxDisc(int absDisc) const { return mStaveIdxDisc[absDisc];}
75-
int getChipIdxStave(int absStave) const { return mChipIdxStave[absStave];}
74+
int getStaveIdxDisc(int absDisc) const { return mStaveIdxDisc[absDisc]; }
75+
int getChipIdxStave(int absStave) const { return mChipIdxStave[absStave]; }
7676
/// Exract FT3 parameters from TGeo
7777

7878
bool isOwner() const { return mOwner; }
@@ -85,13 +85,12 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
8585
static const char* getFT3ChipPattern() { return sChipName.c_str(); }
8686
static const char* getFT3SensorPattern() { return sSensorName.c_str(); }
8787
static const char* getFT3PassivePattern() { return sPassiveName.c_str(); }
88-
88+
8989
static const char* composeSymNameFT3(Int_t d) { return Form("%s_%d", o2::detectors::DetID(o2::detectors::DetID::FT3).getName(), d); }
9090
static const char* composeSymNameLayer(Int_t d, Int_t lr);
9191
static const char* composeSymNameChip(Int_t d, Int_t lr);
9292
static const char* composeSymNameSensor(Int_t d, Int_t lr);
9393

94-
9594
protected:
9695
static std::string sInnerVolumeName; ///< Mother inner volume name
9796
static std::string sVolumeName; ///< Mother volume name
@@ -100,19 +99,19 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
10099
static std::string sSensorName; ///< Sensor name
101100
static std::string sPassiveName; ///< Passive material name
102101

103-
std::vector<float> mCacheRefXDiscs; /// cache for X of ML and OT
104-
std::vector<float> mCacheRefAlphaDiscs; /// cache for sensor ref alpha ML and OT
105-
std::vector<int> mNumberOfDiscs; ///< Number Discs per direction
106-
std::vector<int> mNumberOfStavesPerDisc; /// TODO; in principle redundant?
107-
std::vector<int> mStaveIdxDisc; /// Index of first global stave Id for each disc
108-
std::vector<int> mChipIdxStave; /// Index of first chup for each global stave
109-
std::vector<int> mNumberOfChipsPerDisc; ///
110-
//std::vector<unsigned int> mChipIndexLayer; ///< ID of first chip in the layer
111-
//std::vector<int> mChipStaveIds;
102+
std::vector<float> mCacheRefXDiscs; /// cache for X of ML and OT
103+
std::vector<float> mCacheRefAlphaDiscs; /// cache for sensor ref alpha ML and OT
104+
std::vector<int> mNumberOfDiscs; ///< Number Discs per direction
105+
std::vector<int> mNumberOfStavesPerDisc; /// TODO; in principle redundant?
106+
std::vector<int> mStaveIdxDisc; /// Index of first global stave Id for each disc
107+
std::vector<int> mChipIdxStave; /// Index of first chup for each global stave
108+
std::vector<int> mNumberOfChipsPerDisc; ///
109+
// std::vector<unsigned int> mChipIndexLayer; ///< ID of first chip in the layer
110+
// std::vector<int> mChipStaveIds;
112111

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

115-
private:
114+
private:
116115
static std::unique_ptr<o2::ft3::GeometryTGeo> sInstance; ///< singleton instance
117116
};
118117

Detectors/Upgrades/ALICE3/TRKFT3/FT3/base/src/GeometryTGeo.cxx

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ std::string GeometryTGeo::sInnerVolumeName = "FT3Inner"; ///< Mother inner volum
4747
std::string GeometryTGeo::sLayerName = "FT3Layer"; ///< Layer name
4848
std::string GeometryTGeo::sChipName = "FT3Chip"; ///< Chip name
4949
// TODO: this is now only used for the not-segmented version; synchronise?
50-
std::string GeometryTGeo::sSensorName = "FT3Sensor"; ///< Sensor name
51-
std::string GeometryTGeo::sPassiveName = "Passive"; ///< Passive material name
50+
std::string GeometryTGeo::sSensorName = "FT3Sensor"; ///< Sensor name
51+
std::string GeometryTGeo::sPassiveName = "Passive"; ///< Passive material name
5252

5353
GeometryTGeo::~GeometryTGeo()
5454
{
@@ -86,33 +86,33 @@ void GeometryTGeo::Build(int loadTrans)
8686
}
8787

8888
// Forward discs part
89-
//int sensIdx = 0;
89+
// int sensIdx = 0;
9090
int totDiscs = 0;
9191
int absStaveIdx = 0;
9292
mSize = 0;
9393
// TODO: clean up initialisation
94-
if (mChipIdxStave.size() == 0)
95-
{
94+
if (mChipIdxStave.size() == 0) {
9695
mChipIdxStave.push_back(0);
9796
}
98-
if (mStaveIdxDisc.size() == 0)
99-
{
97+
if (mStaveIdxDisc.size() == 0) {
10098
mStaveIdxDisc.push_back(0);
10199
}
102100
for (int iDir = 0; iDir < 2; iDir++) {
103101
mNumberOfDiscs.push_back(extractNumberOfDiscs(iDir));
104102
LOG(info) << "direction " << iDir << " has " << mNumberOfDiscs[iDir] << " discs";
105103
totDiscs += mNumberOfDiscs[iDir];
106-
104+
107105
for (int iDisc = 0; iDisc < mNumberOfDiscs[iDir]; iDisc++) {
108106
TGeoVolume* ft3V = gGeoManager->GetVolume(getFT3VolPattern());
109107
if (ft3V == nullptr) {
110108
LOG(fatal) << getName() << " volume " << getFT3VolPattern() << " is not in the geometry";
111109
}
112-
auto layerNode = ft3V->GetNode(Form("%s_1", composeSymNameLayer(iDir,iDisc)));
113-
if (layerNode == nullptr) LOG(fatal) << "Could not find layer node " << Form("%s_1", composeSymNameLayer(iDir,iDisc));
110+
auto layerNode = ft3V->GetNode(Form("%s_1", composeSymNameLayer(iDir, iDisc)));
111+
if (layerNode == nullptr)
112+
LOG(fatal) << "Could not find layer node " << Form("%s_1", composeSymNameLayer(iDir, iDisc));
114113
auto layerVol = layerNode->GetVolume();
115-
if (layerVol == nullptr) LOG(fatal) << "Could not find layer volume " << Form("%s_1",composeSymNameLayer(iDir,iDisc));
114+
if (layerVol == nullptr)
115+
LOG(fatal) << "Could not find layer volume " << Form("%s_1", composeSymNameLayer(iDir, iDisc));
116116
TObjArray* nodes = layerVol->GetNodes();
117117
int nNodes = nodes->GetEntriesFast();
118118
int nStaves = 0;
@@ -142,21 +142,23 @@ void GeometryTGeo::Build(int loadTrans)
142142
mChipIdxStave.resize(absStaveIdx + chipsPerStave.size() + 1);
143143
mNumberOfStavesPerDisc.push_back(chipsPerStave.size()); // TODO: remove this? Or remove StaveIdxDisc
144144
int totSensor = 0;
145-
for (int nChips: chipsPerStave) {
145+
for (int nChips : chipsPerStave) {
146146
LOG(debug) << "Absolute Stave ID " << absStaveIdx << " : " << nChips << " sensors";
147147
totSensor += nChips;
148-
if (absStaveIdx) mChipIdxStave[absStaveIdx + 1] = mChipIdxStave[absStaveIdx] + nChips;
148+
if (absStaveIdx)
149+
mChipIdxStave[absStaveIdx + 1] = mChipIdxStave[absStaveIdx] + nChips;
149150
absStaveIdx++;
150151
}
151-
if (totSensor != nSensor) LOG(info) << "Inconsistency in sensor count " << nSensor << " " << totSensor;
152+
if (totSensor != nSensor)
153+
LOG(info) << "Inconsistency in sensor count " << nSensor << " " << totSensor;
152154
LOG(debug) << " adding stave Idx " << absStaveIdx << " to disc array; element " << mStaveIdxDisc.size();
153155
mStaveIdxDisc.push_back(absStaveIdx);
154156
mNumberOfChipsPerDisc.push_back(totSensor);
155157
mSize += totSensor;
156158
LOG(info) << "Total sensors so far " << mSize;
157159
}
158160
}
159-
//mSize = mChipStaveIds.size();
161+
// mSize = mChipStaveIds.size();
160162
LOG(info) << "Total sensors " << mSize;
161163
LOG(info) << "Length of stave-disc array " << mStaveIdxDisc.size();
162164
fillMatrixCache(loadTrans); // Check whether this causes trouble
@@ -165,7 +167,7 @@ void GeometryTGeo::Build(int loadTrans)
165167
//__________________________________________________________________________
166168
const char* GeometryTGeo::composeSymNameLayer(int direction, int layerNumber)
167169
{
168-
return Form("%s%d_%d",GeometryTGeo::getFT3LayerPattern(), direction, layerNumber);
170+
return Form("%s%d_%d", GeometryTGeo::getFT3LayerPattern(), direction, layerNumber);
169171
}
170172

171173
//__________________________________________________________________________
@@ -181,19 +183,23 @@ const char* GeometryTGeo::composeSymNameSensor(Int_t d, Int_t lr)
181183
}
182184

183185
//__________________________________________________________________________
184-
int GeometryTGeo::extractNumberOfDiscs(int dir) {
186+
int GeometryTGeo::extractNumberOfDiscs(int dir)
187+
{
185188
int numDiscs = 0;
186-
while (gGeoManager->GetVolume(composeSymNameLayer(dir,numDiscs))) {numDiscs++;} // Check maybe subvolume?
189+
while (gGeoManager->GetVolume(composeSymNameLayer(dir, numDiscs))) {
190+
numDiscs++;
191+
} // Check maybe subvolume?
187192
return numDiscs; // Assume same # layers on both sides
188193
}
189194
//__________________________________________________________________________
190-
int GeometryTGeo::extractNumberOfChips(int dir, int layer) {
195+
int GeometryTGeo::extractNumberOfChips(int dir, int layer)
196+
{
191197
int numSensors = 0;
192198
TGeoVolume* ft3V = gGeoManager->GetVolume(getFT3VolPattern());
193199
if (ft3V == nullptr) {
194200
LOG(fatal) << getName() << " volume " << getFT3VolPattern() << " is not in the geometry";
195201
}
196-
auto layerVol = ft3V->GetNode(Form("%s_1",composeSymNameLayer(dir,layer)))->GetVolume();
202+
auto layerVol = ft3V->GetNode(Form("%s_1", composeSymNameLayer(dir, layer)))->GetVolume();
197203
TObjArray* nodes = layerVol->GetNodes();
198204
int nNodes = nodes->GetEntriesFast();
199205
int nSensor = 0;
@@ -208,27 +214,30 @@ int GeometryTGeo::extractNumberOfChips(int dir, int layer) {
208214
return nSensor;
209215
}
210216
//__________________________________________________________________________
211-
int GeometryTGeo::extractChipId(std::string const volName) {
212-
if (volName.find("FT3Sensor_Active")==0) {
213-
return std::stoi(volName.substr(volName.rfind('_')+1));
217+
int GeometryTGeo::extractChipId(std::string const volName)
218+
{
219+
if (volName.find("FT3Sensor_Active") == 0) {
220+
return std::stoi(volName.substr(volName.rfind('_') + 1));
214221
}
215222
LOG(error) << "Not a sensor volume " << volName;
216223
return -1;
217224
}
218-
void GeometryTGeo::extractStaveChipId(std::string const volName, int &stave, int &chip) {
219-
if (volName.find("FT3Sensor_Active")==0) {
225+
void GeometryTGeo::extractStaveChipId(std::string const volName, int& stave, int& chip)
226+
{
227+
if (volName.find("FT3Sensor_Active") == 0) {
220228
int idx = volName.rfind('_');
221-
chip = std::stoi(volName.substr(idx+1));
222-
idx = volName.rfind('_',idx);
223-
stave = std::stoi(volName.substr(idx+1));
224-
}
225-
else {
229+
chip = std::stoi(volName.substr(idx + 1));
230+
idx = volName.rfind('_', idx);
231+
stave = std::stoi(volName.substr(idx + 1));
232+
} else {
226233
LOG(error) << "Not a sensor volume " << volName;
227-
stave = -1; chip = -1;
234+
stave = -1;
235+
chip = -1;
228236
}
229237
}
230-
void GeometryTGeo::extractChipIds(std::string const volName, int &direction, int &layer, int &stave, int &chip) {
231-
if (volName.find("FT3Sensor_Active")==0) {
238+
void GeometryTGeo::extractChipIds(std::string const volName, int& direction, int& layer, int& stave, int& chip)
239+
{
240+
if (volName.find("FT3Sensor_Active") == 0) {
232241
int idx = volName.find('_') + 1;
233242
idx = volName.find('_', idx) + 1;
234243
direction = std::stoi(volName.substr(idx));
@@ -238,30 +247,32 @@ void GeometryTGeo::extractChipIds(std::string const volName, int &direction, int
238247
stave = std::stoi(volName.substr(idx));
239248
idx = volName.find('_', idx) + 1;
240249
chip = std::stoi(volName.substr(idx));
241-
}
242-
else {
250+
} else {
243251
LOG(error) << "Not a sensor volume " << volName;
244252
direction = -1;
245253
}
246254
}
247255

248-
int GeometryTGeo::getChipIndex(int dir, int layer, int stave, int chip) const {
256+
int GeometryTGeo::getChipIndex(int dir, int layer, int stave, int chip) const
257+
{
249258
int absDisc = layer;
250-
if (dir == 1) absDisc += mNumberOfDiscs[0];
259+
if (dir == 1)
260+
absDisc += mNumberOfDiscs[0];
251261
return mChipIdxStave[mStaveIdxDisc[absDisc] + stave] + chip;
252262
}
253263

254-
int GeometryTGeo::getLayer(int chipIdx) const {
264+
int GeometryTGeo::getLayer(int chipIdx) const
265+
{
255266
int lay = mNumberOfDiscs[0] + mNumberOfDiscs[1] - 1;
256267
while (chipIdx < mChipIdxStave[mStaveIdxDisc[lay]] && lay > 0) {
257-
lay--;
268+
lay--;
258269
}
259270
return lay;
260271
}
261-
262272

263273
// retrieve local stave number from chip ID
264-
int GeometryTGeo::getStave(int chipIdx) const {
274+
int GeometryTGeo::getStave(int chipIdx) const
275+
{
265276
int lay = getLayer(chipIdx);
266277
int absStave = mStaveIdxDisc[lay];
267278
while (chipIdx >= mChipIdxStave[absStave] && absStave < mStaveIdxDisc[lay + 1]) {
@@ -271,15 +282,16 @@ int GeometryTGeo::getStave(int chipIdx) const {
271282
}
272283

273284
// retrieve local chip number on stave from chip ID
274-
int GeometryTGeo::getChipOnStave(int chipIdx) const {
285+
int GeometryTGeo::getChipOnStave(int chipIdx) const
286+
{
275287
int lay = getLayer(chipIdx);
276288
int stave = getStave(chipIdx);
277289
return chipIdx - mChipIdxStave[mStaveIdxDisc[lay] + stave];
278290
}
279291

280292
std::string GeometryTGeo::getMatrixPath(int direction, int layer, int stave, int chip) const
281293
{
282-
294+
283295
// PrintChipID(index, subDetID, petalcase, disk, layer, stave, halfstave, mod, chip);
284296

285297
std::string path = Form("/cave_1/barrel_1/%s_2/", GeometryTGeo::getFT3VolPattern());
@@ -290,14 +302,14 @@ std::string GeometryTGeo::getMatrixPath(int direction, int layer, int stave, int
290302
// Sensors directly placed in layer volume?
291303

292304
path += Form("%s%d_%d_1/", getFT3LayerPattern(), direction, layer); // TRKLayerx_1
293-
//std::string sensorName = std::string("FT3Sensor_") + std::to_string(layer) + "_" + std::to_string(direction) + "_" + std::to_string(mChipStaveIds[index]) + "_" + index;
305+
// std::string sensorName = std::string("FT3Sensor_") + std::to_string(layer) + "_" + std::to_string(direction) + "_" + std::to_string(mChipStaveIds[index]) + "_" + index;
294306
path += Form("FT3Sensor_Active_%d_%d_%d_%d_%d", direction, layer, stave, chip, chip);
295307
/*
296308
if (mLayoutMLOT == FT3Layout::kCylindrical) {
297309
// TODO: fix this caser?
298310
path += Form("%s%d_1/", getTRKSensorPattern(), layer); // TRKSensorx_1
299311
} else {
300-
path += Form("%s%d_%d/", getFT3StavePattern(), layer, stave);
312+
path += Form("%s%d_%d/", getFT3StavePattern(), layer, stave);
301313
path += Form("%s%d_%d/", getFT3ModulePattern(), layer, mod);
302314
path += Form("%s%d_%d_1", getFT3ChipPattern(), layer, chipID);
303315
}
@@ -340,20 +352,21 @@ void GeometryTGeo::fillMatrixCache(int mask)
340352
layer = absDisc - mNumberOfDiscs[0];
341353
}
342354
LOG(info) << "Direction " << direction << " layer " << layer;
343-
if (absDisc >= mNumberOfStavesPerDisc.size()) LOG(fatal) << "Not enough entries in mNumberOfStavesPerDisc " << absDisc << " " << mNumberOfStavesPerDisc.size();
344-
for (int stave = 0; stave < mNumberOfStavesPerDisc[absDisc]; stave++ ) {
355+
if (absDisc >= mNumberOfStavesPerDisc.size())
356+
LOG(fatal) << "Not enough entries in mNumberOfStavesPerDisc " << absDisc << " " << mNumberOfStavesPerDisc.size();
357+
for (int stave = 0; stave < mNumberOfStavesPerDisc[absDisc]; stave++) {
345358
int absStave = mStaveIdxDisc[absDisc] + stave;
346359
if (absStave + 1 >= mChipIdxStave.size())
347-
LOG(fatal) << "Attempting to get absStave + 1 from index array size " << mChipIdxStave.size();
360+
LOG(fatal) << "Attempting to get absStave + 1 from index array size " << mChipIdxStave.size();
348361
int nChip = mChipIdxStave[absStave + 1] - mChipIdxStave[absStave]; // TODO: this is too often == 0
349362
LOG(debug) << "Getting matrices for direction " << direction << " layer " << layer << " stave " << stave << " : " << nChip << " chips";
350-
for (int chip = 0; chip < nChip; chip++ ) {
351-
int chipIdx = getChipIndex(direction, layer, stave, chip);
363+
for (int chip = 0; chip < nChip; chip++) {
364+
int chipIdx = getChipIndex(direction, layer, stave, chip);
352365
if (!gGeoManager->cd(getMatrixPath(direction, layer, stave, chip).c_str()))
353366
LOG(fatal) << "Geometry path not found " << getMatrixPath(direction, layer, stave, chip);
354367
const TGeoHMatrix* matL2G = gGeoManager->GetCurrentMatrix();
355368
if (chipIdx >= mSize)
356-
LOG(fatal) << "ChipIdx " << chipIdx << " out of range " << mSize;
369+
LOG(fatal) << "ChipIdx " << chipIdx << " out of range " << mSize;
357370
cacheL2G.setMatrix(Mat3D(*matL2G), chipIdx);
358371

359372
matL2G->LocalToMaster(locA, gloA);
@@ -369,10 +382,10 @@ void GeometryTGeo::fillMatrixCache(int mask)
369382

370383
static TGeoHMatrix t2l;
371384
t2l.Clear();
372-
t2l.RotateZ(mCacheRefAlphaDiscs[chipIdx] * TMath::RadToDeg()); // TODO: do we need this cache?
385+
t2l.RotateZ(mCacheRefAlphaDiscs[chipIdx] * TMath::RadToDeg()); // TODO: do we need this cache?
373386
const TGeoHMatrix& matL2Gi = matL2G->Inverse();
374387
t2l.MultiplyLeft(&matL2Gi);
375-
cacheT2L.setMatrix(Mat3D(t2l),chipIdx); // TODO: may need deref with *
388+
cacheT2L.setMatrix(Mat3D(t2l), chipIdx); // TODO: may need deref with *
376389
}
377390
}
378391
}
@@ -394,5 +407,5 @@ void GeometryTGeo::Print(Option_t*) const
394407
LOGF(info, "Total number of sensors: %d", mSize);
395408
}
396409

397-
}
398-
}
410+
} // namespace ft3
411+
} // namespace o2

Detectors/Upgrades/ALICE3/TRKFT3/TRK/base/include/TRKBase/TRKBaseParam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct TRKBaseParam : public o2::conf::ConfigurableParamHelper<TRKBaseParam> {
5959

6060
eVDLayout layoutVD = kIRIS4; // VD detector layout design
6161
eMLOTLayout layoutMLOT = kSegmented; // ML and OT detector layout design
62-
eSrvLayout layoutSRV = kPeacockv1; // Layout of services
62+
eSrvLayout layoutSRV = kPeacockv1; // Layout of services
6363

6464
eVDLayout getLayoutVD() const { return layoutVD; }
6565
eMLOTLayout getLayoutMLOT() const { return layoutMLOT; }

0 commit comments

Comments
 (0)