Skip to content

Commit b7b517a

Browse files
alibuildnjacazio
authored andcommitted
Please consider the following formatting changes (#46)
1 parent a596912 commit b7b517a

5 files changed

Lines changed: 88 additions & 64 deletions

File tree

‎Detectors/ACTS/interface/src/SurfaceIndexMap.cxx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ SensorPlacement sensorPlacementOf(const o2::detectors::DetMatrixCache& cache, in
206206
double rot[9] = {0.};
207207
double tra[3] = {0.};
208208
cache.getMatrixL2G(sensorID).GetComponents(rot[0], rot[1], rot[2], tra[0],
209-
rot[3], rot[4], rot[5], tra[1],
210-
rot[6], rot[7], rot[8], tra[2]);
209+
rot[3], rot[4], rot[5], tra[1],
210+
rot[6], rot[7], rot[8], tra[2]);
211211
SensorPlacement out;
212212
out.position = Acts::Vector3{tra[0] * Acts::UnitConstants::cm, tra[1] * Acts::UnitConstants::cm,
213213
tra[2] * Acts::UnitConstants::cm};

‎Detectors/ACTS/workflow/src/ActsGeometryService.cxx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ ServiceSpec actsGeometryServiceSpec()
6565
.configure = CommonServices::noConfiguration(),
6666
.exit = [](ServiceRegistryRef, void* service) {
6767
TrackingGeometryManager::instance().clear();
68-
delete reinterpret_cast<ActsGeometryService*>(service);
69-
},
68+
delete reinterpret_cast<ActsGeometryService*>(service); },
7069
.kind = ServiceKind::DeviceGlobal};
7170
}
7271

‎Detectors/Upgrades/ALICE3/ACTS/include/ALICE3ACTS/Gen3GeometryConfig.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ struct Gen3GeometryConfig {
6767
// Sensor / end-of-stave TGeo volume-name globs.
6868
std::vector<std::string> sensitiveMatches;
6969
std::vector<std::string> endOfStaveMatches;
70-
double endOfStaveRTol = 0.; // mm, radial match window
70+
double endOfStaveRTol = 0.; // mm, radial match window
7171

7272
// Planar-sensor axis strings (parsed into TGeoAxes at runtime).
73-
std::string axesThinZ; // e.g. "XYZ" (thin in Z)
74-
std::string axesThinY; // e.g. "ZXY" (thin in Y)
73+
std::string axesThinZ; // e.g. "XYZ" (thin in Z)
74+
std::string axesThinY; // e.g. "ZXY" (thin in Y)
7575

7676
// Blueprint region boundaries (mm).
7777
double rInnerCoreMax = 0.;

‎Detectors/Upgrades/ALICE3/ACTS/src/Gen3BlueprintBuilder.cxx‎

Lines changed: 69 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct BuildState {
132132
constexpr double kUnitScalor = 10.0; // TGeo cm -> ACTS mm
133133

134134
const ExtentEnvelope kLayerEnvelope =
135-
ExtentEnvelope{{.z = {2. * 1_mm, 2. * 1_mm}, .r = {2. * 1_mm, 2. * 1_mm}}};
135+
ExtentEnvelope{{.z = {2. * 1_mm, 2. * 1_mm}, .r = {2. * 1_mm, 2. * 1_mm}}};
136136

137137
// binning of the proto-material (material receiver) on the layer faces is
138138
// geometry-config data: see cfg.matBinsPhi / matBinsZ / matBinsR.
@@ -147,9 +147,9 @@ using ElementPtr = std::shared_ptr<ActsPlugins::TGeoDetectorElement>;
147147
/// One reconstruction layer: surfaces at a common radius (cylinder) or z (disc)
148148
struct LayerGroup {
149149
bool isDisc = false;
150-
double key = 0.; // radius (cylinder) or z (disc), in mm
150+
double key = 0.; // radius (cylinder) or z (disc), in mm
151151
std::vector<std::shared_ptr<Surface>> surfaces;
152-
std::string name; // set for passive layers; sensitive ones are auto-named
152+
std::string name; // set for passive layers; sensitive ones are auto-named
153153
bool isPassive = false;
154154
// Extra material z-extent from attached End-of-Stave cards;
155155
// sentinels (max < min) mean "none". Used by assignProtoMaterial to stretch
@@ -159,12 +159,13 @@ struct LayerGroup {
159159
};
160160

161161
/// Build the passive cylinder layers from the hardcoded table above.
162-
std::vector<LayerGroup> makePassiveLayers(BuildState& st) {
162+
std::vector<LayerGroup> makePassiveLayers(BuildState& st)
163+
{
163164
std::vector<LayerGroup> out;
164165
for (const auto& pc : st.cfg.passiveCylinders) {
165166
auto surface = Surface::makeShared<CylinderSurface>(
166-
Transform3{Translation3{Vector3{0., 0., pc.zCentre * 1_mm}}},
167-
pc.r * 1_mm, pc.halfZ * 1_mm);
167+
Transform3{Translation3{Vector3{0., 0., pc.zCentre * 1_mm}}},
168+
pc.r * 1_mm, pc.halfZ * 1_mm);
168169
st.passiveSurfaces.push_back(surface);
169170
LayerGroup g;
170171
g.isDisc = false;
@@ -178,14 +179,15 @@ std::vector<LayerGroup> makePassiveLayers(BuildState& st) {
178179
}
179180

180181
/// Build the forward service shells for one side (negative or positive z).
181-
std::vector<LayerGroup> makeForwardShells(BuildState& st, bool negative) {
182+
std::vector<LayerGroup> makeForwardShells(BuildState& st, bool negative)
183+
{
182184
std::vector<LayerGroup> out;
183185
for (const auto& fc : st.cfg.forwardCylinders) {
184186
const double halfZ = 0.5 * (fc.zMax - fc.zMin);
185187
const double zc = (negative ? -1.0 : 1.0) * 0.5 * (fc.zMax + fc.zMin);
186188
auto surface = Surface::makeShared<CylinderSurface>(
187-
Transform3{Translation3{Vector3{0., 0., zc * 1_mm}}}, fc.r * 1_mm,
188-
halfZ * 1_mm);
189+
Transform3{Translation3{Vector3{0., 0., zc * 1_mm}}}, fc.r * 1_mm,
190+
halfZ * 1_mm);
189191
st.passiveSurfaces.push_back(surface);
190192
LayerGroup g;
191193
g.isDisc = false;
@@ -199,12 +201,13 @@ std::vector<LayerGroup> makeForwardShells(BuildState& st, bool negative) {
199201
}
200202

201203
/// Build the passive service-disc layers from the hardcoded table above.
202-
std::vector<LayerGroup> makePassiveDiscs(BuildState& st) {
204+
std::vector<LayerGroup> makePassiveDiscs(BuildState& st)
205+
{
203206
std::vector<LayerGroup> out;
204207
for (const auto& pd : st.cfg.passiveDiscs) {
205208
auto surface = Surface::makeShared<DiscSurface>(
206-
Transform3{Translation3{Vector3{0., 0., pd.z * 1_mm}}}, pd.rMin * 1_mm,
207-
pd.rMax * 1_mm);
209+
Transform3{Translation3{Vector3{0., 0., pd.z * 1_mm}}}, pd.rMin * 1_mm,
210+
pd.rMax * 1_mm);
208211
st.passiveSurfaces.push_back(surface);
209212
LayerGroup g;
210213
g.isDisc = true;
@@ -223,12 +226,17 @@ std::vector<LayerGroup> makePassiveDiscs(BuildState& st) {
223226
/// the staggered TRK rows (188.62/200.30, 11.68 mm apart) needs a tolerance
224227
/// that would swallow ITOF (only 10.38 mm outside) and merge the vertex-detector
225228
/// cylinders (7.00 mm apart). Each subsystem gets its own tolerance instead.
226-
enum class Subsystem { VertexDetector, TrkBarrel, Itof, Otof, Ft3Disc };
229+
enum class Subsystem { VertexDetector,
230+
TrkBarrel,
231+
Itof,
232+
Otof,
233+
Ft3Disc };
227234

228235
/// Classify from the TGeo *volume* name (what TGeoParser matched against).
229-
Subsystem classify(std::string_view volumeName) {
236+
Subsystem classify(std::string_view volumeName)
237+
{
230238
if (volumeName.find("PETALCASE") != std::string_view::npos) {
231-
return Subsystem::VertexDetector; // the 3 VD cylinders
239+
return Subsystem::VertexDetector; // the 3 VD cylinders
232240
}
233241
if (volumeName.find("ITOFSensor") != std::string_view::npos) {
234242
return Subsystem::Itof;
@@ -239,13 +247,14 @@ Subsystem classify(std::string_view volumeName) {
239247
if (volumeName.find("FT3Sensor") != std::string_view::npos) {
240248
return Subsystem::Ft3Disc;
241249
}
242-
return Subsystem::TrkBarrel; // TRKSensor0 chips
250+
return Subsystem::TrkBarrel; // TRKSensor0 chips
243251
}
244252

245253
/// Radial (barrel) or longitudinal (disc) clustering tolerance per subsystem.
246254
/// The values are geometry-specific and live in the config header (kTol*); the
247255
/// mapping from Subsystem to value is behaviour and stays here.
248-
double clusterTolerance(const BuildState& st, Subsystem s) {
256+
double clusterTolerance(const BuildState& st, Subsystem s)
257+
{
249258
switch (s) {
250259
case Subsystem::VertexDetector:
251260
return st.cfg.tolVertexDetector * 1_mm;
@@ -270,7 +279,8 @@ struct SensitiveElement {
270279
/// Parse the TGeo file and convert all sensitive nodes into ACTS surfaces.
271280
/// (No logging here: the ACTS_* macros need a local `logger()` accessor, which
272281
/// is set up via ACTS_LOCAL_LOGGER in the entry point below.)
273-
std::vector<SensitiveElement> loadSensitiveElements(TGeoManager& tgeo, const BuildState& st) {
282+
std::vector<SensitiveElement> loadSensitiveElements(TGeoManager& tgeo, const BuildState& st)
283+
{
274284
std::vector<SensitiveElement> elements;
275285

276286
// NOTE (O2 port): the standalone actsO2 builder called TGeoManager::Import()
@@ -306,19 +316,19 @@ std::vector<SensitiveElement> loadSensitiveElements(TGeoManager& tgeo, const Bui
306316
// are handled by the default "XYZ" - see the axes* comment above
307317
const auto axes = (sub == Subsystem::TrkBarrel || sub == Subsystem::Itof ||
308318
sub == Subsystem::Otof)
309-
? axesThinY
310-
: axesThinZ;
319+
? axesThinY
320+
: axesThinZ;
311321
elements.push_back(SensitiveElement{
312-
ActsPlugins::TGeoLayerBuilder::defaultElementFactory(
313-
identifier, *snode.node, *snode.transform, axes, kUnitScalor,
314-
nullptr),
315-
sub});
322+
ActsPlugins::TGeoLayerBuilder::defaultElementFactory(
323+
identifier, *snode.node, *snode.transform, axes, kUnitScalor,
324+
nullptr),
325+
sub});
316326
}
317327

318328
if (elements.empty()) {
319329
throw std::runtime_error(
320-
"ALICE3 Gen3: no sensitive elements found in the TGeo geometry. Check "
321-
"'sensitiveMatches' in the Gen3 geometry config.");
330+
"ALICE3 Gen3: no sensitive elements found in the TGeo geometry. Check "
331+
"'sensitiveMatches' in the Gen3 geometry config.");
322332
}
323333
return elements;
324334
}
@@ -330,7 +340,8 @@ std::vector<SensitiveElement> loadSensitiveElements(TGeoManager& tgeo, const Bui
330340
/// cluster may be wider than `tol` - needed for OTOF, whose four staggered radii
331341
/// span 6.36 mm but are only 1.5-2.8 mm apart consecutively.
332342
std::vector<std::pair<double, std::vector<std::shared_ptr<Surface>>>> clusterBy(
333-
std::vector<std::pair<double, std::shared_ptr<Surface>>> items, double tol) {
343+
std::vector<std::pair<double, std::shared_ptr<Surface>>> items, double tol)
344+
{
334345
std::vector<std::pair<double, std::vector<std::shared_ptr<Surface>>>> out;
335346
if (items.empty()) {
336347
return out;
@@ -366,7 +377,8 @@ std::vector<std::pair<double, std::vector<std::shared_ptr<Surface>>>> clusterBy(
366377
void groupSurfaces(const BuildState& st, const std::vector<SensitiveElement>& elements,
367378
const GeometryContext& gctx,
368379
std::vector<LayerGroup>& cylinders,
369-
std::vector<LayerGroup>& discs) {
380+
std::vector<LayerGroup>& discs)
381+
{
370382
using Keyed = std::vector<std::pair<double, std::shared_ptr<Surface>>>;
371383
std::map<Subsystem, Keyed> cylByR, discByZ;
372384

@@ -422,7 +434,8 @@ struct EndOfStaveBox {
422434
/// surfaces - only their extent is needed to stretch a barrel layer's material
423435
/// representative in z. Empty match list -> no-op. Reuses the TGeoManager
424436
/// already imported by loadSensitiveElements.
425-
std::vector<EndOfStaveBox> loadEndOfStaveExtents(TGeoManager& tgeo, const BuildState& st) {
437+
std::vector<EndOfStaveBox> loadEndOfStaveExtents(TGeoManager& tgeo, const BuildState& st)
438+
{
426439
std::vector<EndOfStaveBox> out;
427440
if (st.cfg.endOfStaveMatches.empty()) {
428441
return out;
@@ -445,7 +458,7 @@ std::vector<EndOfStaveBox> loadEndOfStaveExtents(TGeoManager& tgeo, const BuildS
445458
// bounding box in the volume's local frame (cm), transformed to global
446459
auto* bb = dynamic_cast<TGeoBBox*>(snode.node->GetVolume()->GetShape());
447460
if (bb == nullptr) {
448-
continue; // non-box shapes (e.g. composites) skipped
461+
continue; // non-box shapes (e.g. composites) skipped
449462
}
450463
const double dx = bb->GetDX(), dy = bb->GetDY(), dz = bb->GetDZ();
451464
const double* o = bb->GetOrigin();
@@ -474,7 +487,8 @@ std::vector<EndOfStaveBox> loadEndOfStaveExtents(TGeoManager& tgeo, const BuildS
474487
/// radius lies within kEndOfStaveRTol of the card's radial span, recording the
475488
/// card's z-extent as a material-extent hint on that layer.
476489
void attachEndOfStave(const BuildState& st, std::vector<LayerGroup>& cylinders,
477-
const std::vector<EndOfStaveBox>& boxes) {
490+
const std::vector<EndOfStaveBox>& boxes)
491+
{
478492
for (const auto& b : boxes) {
479493
LayerGroup* best = nullptr;
480494
double bestD = st.cfg.endOfStaveRTol;
@@ -501,7 +515,8 @@ void attachEndOfStave(const BuildState& st, std::vector<LayerGroup>& cylinders,
501515
// blueprint assembly
502516
// --------------------------------------------------------------------------
503517

504-
void configureContainer(ContainerBlueprintNode& node) {
518+
void configureContainer(ContainerBlueprintNode& node)
519+
{
505520
node.setAttachmentStrategy(VolumeAttachmentStrategy::Gap);
506521
node.setResizeStrategies(VolumeResizeStrategy::Gap,
507522
VolumeResizeStrategy::Gap);
@@ -516,7 +531,8 @@ void configureContainer(ContainerBlueprintNode& node) {
516531
/// gap between the two service shells dragged the inner edge from 1428 to 858 mm,
517532
/// into Central -> "Volumes overlap in z". `Midpoint` expands the two neighbours
518533
/// until they touch instead of inserting a volume, so no spurious child exists.
519-
void configureUnalignedRContainer(ContainerBlueprintNode& node) {
534+
void configureUnalignedRContainer(ContainerBlueprintNode& node)
535+
{
520536
node.setAttachmentStrategy(VolumeAttachmentStrategy::Midpoint);
521537
node.setResizeStrategies(VolumeResizeStrategy::Gap,
522538
VolumeResizeStrategy::Gap);
@@ -527,17 +543,18 @@ void configureUnalignedRContainer(ContainerBlueprintNode& node) {
527543
/// land exactly on top of the existing surface. See assignProtoMaterial().
528544
std::shared_ptr<Surface> makeRepresentativeSurface(bool isDisc, double rmin,
529545
double rmax, double zmin,
530-
double zmax) {
546+
double zmax)
547+
{
531548
if (isDisc) {
532549
const double z = 0.5 * (zmin + zmax);
533550
return Surface::makeShared<DiscSurface>(
534-
Transform3{Translation3{Vector3{0., 0., z}}}, rmin, rmax);
551+
Transform3{Translation3{Vector3{0., 0., z}}}, rmin, rmax);
535552
}
536553
const double r = 0.5 * (rmin + rmax);
537554
const double zc = 0.5 * (zmin + zmax);
538555
const double hz = 0.5 * (zmax - zmin);
539556
return Surface::makeShared<CylinderSurface>(
540-
Transform3{Translation3{Vector3{0., 0., zc}}}, r, hz);
557+
Transform3{Translation3{Vector3{0., 0., zc}}}, r, hz);
541558
}
542559

543560
/// Mark a layer's surfaces as binned material receivers (proto material).
@@ -549,7 +566,8 @@ std::shared_ptr<Surface> makeRepresentativeSurface(bool isDisc, double rmin,
549566
/// rejects), so a planar layer gets a synthetic cylinder/disc receiver instead
550567
/// - see the needsRepresentative branch. These receivers, plus the passive
551568
/// cylinders/discs, are what extractMaterialSurfaces() returns for mapping.
552-
void assignProtoMaterial(BuildState& st, LayerGroup& group, const GeometryContext& gctx) {
569+
void assignProtoMaterial(BuildState& st, LayerGroup& group, const GeometryContext& gctx)
570+
{
553571
constexpr float kPi = std::numbers::pi_v<float>;
554572

555573
double rmin = 1e9, rmax = -1e9, zmin = 1e9, zmax = -1e9;
@@ -621,11 +639,11 @@ void assignProtoMaterial(BuildState& st, LayerGroup& group, const GeometryContex
621639
// the navigator can't disambiguate, and the layer would drop out of the
622640
// propagated material tracks.
623641
const bool needsRepresentative =
624-
!group.isPassive &&
625-
std::ranges::any_of(group.surfaces, [](const auto& s) {
626-
return s->type() != Surface::SurfaceType::Cylinder &&
627-
s->type() != Surface::SurfaceType::Disc;
628-
});
642+
!group.isPassive &&
643+
std::ranges::any_of(group.surfaces, [](const auto& s) {
644+
return s->type() != Surface::SurfaceType::Cylinder &&
645+
s->type() != Surface::SurfaceType::Disc;
646+
});
629647

630648
if (!needsRepresentative) {
631649
// passive layers, and sensitive layers already made of cylinders / discs
@@ -638,14 +656,15 @@ void assignProtoMaterial(BuildState& st, LayerGroup& group, const GeometryContex
638656
// Planar-sensor layer: the material goes on a synthetic cylinder / disc
639657
// spanning the layer, NOT on the sensors. See the note above.
640658
auto representative =
641-
makeRepresentativeSurface(group.isDisc, rmin, rmax, zmin, zmax);
659+
makeRepresentativeSurface(group.isDisc, rmin, rmax, zmin, zmax);
642660
representative->assignSurfaceMaterial(material);
643661
st.passiveSurfaces.push_back(representative);
644662
group.surfaces.push_back(representative);
645663
}
646664

647665
void addLayer(BlueprintNode& parent, const std::string& nameIn,
648-
const LayerGroup& group) {
666+
const LayerGroup& group)
667+
{
649668
const std::string name = group.name.empty() ? nameIn : group.name;
650669
parent.addLayer(name, [&group](LayerBlueprintNode& layer) {
651670
layer.setSurfaces(group.surfaces);
@@ -712,8 +731,8 @@ o2::acts::TrackingGeometryOutput Gen3BlueprintBuilder::build(TGeoManager& tgeo,
712731
// geometry-specific parameters.
713732
if (mConfig.geometryConfigFile.empty()) {
714733
throw std::runtime_error(
715-
"ALICE3 Gen3: no geometry config file given. Point Config::geometryConfigFile at the "
716-
"gen3_geometry_config.json shipped with the geometry.");
734+
"ALICE3 Gen3: no geometry config file given. Point Config::geometryConfigFile at the "
735+
"gen3_geometry_config.json shipped with the geometry.");
717736
}
718737
ACTS_INFO("ALICE3 Gen3: loading geometry config from " << mConfig.geometryConfigFile);
719738
const Gen3GeometryConfig cfg = loadGen3GeometryConfig(mConfig.geometryConfigFile);
@@ -910,23 +929,23 @@ o2::acts::TrackingGeometryOutput Gen3BlueprintBuilder::build(TGeoManager& tgeo,
910929
// no new geometry (the discs are contiguous in z).
911930
if (!ft3InnerNeg.empty()) {
912931
auto& ft3NegNode =
913-
pinIds(innerCore, cfg.volFt3InnerNeg, byZ).addCylinderContainer("MiddleDisksNeg", AxisZ);
932+
pinIds(innerCore, cfg.volFt3InnerNeg, byZ).addCylinderContainer("MiddleDisksNeg", AxisZ);
914933
configureContainer(ft3NegNode);
915934
for (std::size_t i = 0; i < ft3InnerNeg.size(); ++i) {
916935
addLayer(ft3NegNode, layerName("MiddleDisksNeg", i), ft3InnerNeg[i]);
917936
}
918937
}
919938

920939
auto& innerBarrelNode =
921-
pinIds(innerCore, cfg.volInnerBarrel, byMidRadius).addCylinderContainer("InnerBarrel", AxisR);
940+
pinIds(innerCore, cfg.volInnerBarrel, byMidRadius).addCylinderContainer("InnerBarrel", AxisR);
922941
configureContainer(innerBarrelNode);
923942
for (std::size_t i = 0; i < innerBarrel.size(); ++i) {
924943
addLayer(innerBarrelNode, layerName("InnerBarrel", i), innerBarrel[i]);
925944
}
926945

927946
if (!ft3InnerPos.empty()) {
928947
auto& ft3PosNode =
929-
pinIds(innerCore, cfg.volFt3InnerPos, byZ).addCylinderContainer("MiddleDisksPos", AxisZ);
948+
pinIds(innerCore, cfg.volFt3InnerPos, byZ).addCylinderContainer("MiddleDisksPos", AxisZ);
930949
configureContainer(ft3PosNode);
931950
for (std::size_t i = 0; i < ft3InnerPos.size(); ++i) {
932951
addLayer(ft3PosNode, layerName("MiddleDisksPos", i), ft3InnerPos[i]);
@@ -935,7 +954,7 @@ o2::acts::TrackingGeometryOutput Gen3BlueprintBuilder::build(TGeoManager& tgeo,
935954

936955
if (!midBarrel.empty()) {
937956
auto& midNode = pinIds(central, cfg.volOuterTrackerBarrel, byMidRadius)
938-
.addCylinderContainer("OuterTrackerBarrel", AxisR);
957+
.addCylinderContainer("OuterTrackerBarrel", AxisR);
939958
configureContainer(midNode);
940959
for (std::size_t i = 0; i < midBarrel.size(); ++i) {
941960
addLayer(midNode, layerName("OuterTrackerBarrel", i), midBarrel[i]);

0 commit comments

Comments
 (0)