Skip to content

Commit 037580e

Browse files
committed
Add functionality for the user to enforce a strict cut on module placement to remain within nominal radii. Also remove initial placement of sensor stack before calling fill_stave, moving to using y_start instead.
1 parent e0c38f5 commit 037580e

4 files changed

Lines changed: 40 additions & 22 deletions

File tree

Detectors/Upgrades/ALICE3/FT3/base/include/FT3Base/FT3BaseParam.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ struct FT3BaseParam : public o2::conf::ConfigurableParamHelper<FT3BaseParam> {
4040
Float_t etaOut = 1.5;
4141
Float_t Layerx2X0 = 0.01;
4242

43+
// override values from FT3ModuleConstants
44+
bool cutStavesOnNominalRadius = false;
45+
4346
O2ParamDef(FT3BaseParam, "FT3Base");
4447
};
4548

Detectors/Upgrades/ALICE3/FT3/simulation/include/FT3Simulation/FT3Module.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ class FT3Module
6666

6767
// Helper functions
6868
void fill_stave(PosNegPositionTypes& y_positions, double Rout,
69-
double Rin, double x_left,
70-
unsigned kSensorStack, double tolerance,
69+
double x_left, unsigned kSensorStack, double tolerance,
7170
std::pair<double, double> y_start);
7271
void addDetectorVolume(
7372
TGeoVolume* motherVolume, std::string volumeName, int color, unsigned* sensor_count,

Detectors/Upgrades/ALICE3/FT3/simulation/include/FT3Simulation/FT3ModuleConstants.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ namespace o2::ft3::ModuleConstants
5252
const double sensor2x1_width = 2 * single_sensor_width;
5353
const double sensor2x1_active_width = 2 * active_width;
5454
const double sensor2x1_height = single_sensor_height;
55+
const unsigned kSensorsPerStack = 1;
56+
const double sensor_stack_height = kSensorsPerStack * sensor2x1_height +
57+
(kSensorsPerStack - 1) * sensor2x1_gap;
5558

5659
const double carbonFiberThickness = 0.01;
5760
const double foamSpacingThickness = 1.0;
@@ -66,6 +69,7 @@ namespace o2::ft3::ModuleConstants
6669
// First define midpoints of staves that would overlap with inner disc
6770
// EXCEPTION: Assumed mirrored around x-axis
6871
// map from Stave ID (1-indexed from other documents) to midpoint
72+
// Do NOT add any zero midpoints, this is taken off separately
6973
const std::map<int, double> staveID_to_y_midpoint = {
7074
{-2, 39.0},
7175
{-1, 41.4},
@@ -101,8 +105,6 @@ namespace o2::ft3::ModuleConstants
101105
return staveIdx - nStavesOneSide + isRight;
102106
}
103107

104-
const unsigned kSensorsPerStack = 1;
105-
106108
// material properties
107109
const double siliconThickness = 0.01;
108110
const double copperThickness = 0.006;

Detectors/Upgrades/ALICE3/FT3/simulation/src/FT3Module.cxx

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/// \brief Implementation of the FT3Module class
1414

1515
#include "FT3Simulation/FT3Module.h"
16+
#include "FT3Base/FT3BaseParam.h"
1617
#include <TGeoManager.h>
1718
#include <TGeoMaterial.h>
1819
#include <TGeoMedium.h>
@@ -102,8 +103,7 @@ double calculate_y_circle(double x, double radius)
102103
* for positive and negative y respectively
103104
*/
104105
void FT3Module::fill_stave(PosNegPositionTypes& y_positions, double Rout,
105-
double Rin, double x_left,
106-
unsigned kSensorStack, double tolerance,
106+
double x_left, unsigned kSensorStack, double tolerance,
107107
std::pair<double, double> y_start={0, 0})
108108
{
109109
// start with upper half of the stave, then mirror to the bottom half
@@ -314,6 +314,7 @@ void FT3Module::create_layout_scopingV3(double mZ, int layerNumber, int directio
314314
<< layerNumber << ", Direction " << direction;
315315

316316
FT3Module::initialize_materials();
317+
auto& ft3Params = o2::ft3::FT3BaseParam::Instance();
317318

318319
// initialise all y_positions, vector over all staves
319320
std::vector<PosNegPositionTypes> y_positionsPosNeg;
@@ -322,28 +323,41 @@ void FT3Module::create_layout_scopingV3(double mZ, int layerNumber, int directio
322323
y_positionsPosNeg.emplace_back(PosNegPositionTypes{PositionTypes{}, PositionTypes{}});
323324

324325
double y_midpoint = 0.;
326+
// default positive and negative starting points has a gap around x-axis
327+
std::pair<double, double> y_start{0., Constants::sensor2x1_gap};
325328
const int staveID = Constants::staveIdxToID(i_stave);
326329
auto y_midpoint_it = Constants::staveID_to_y_midpoint.find(staveID);
327-
if ( y_midpoint_it != Constants::staveID_to_y_midpoint.end() ) { // there is a defined midpoint for this stave
330+
if ( y_midpoint_it != Constants::staveID_to_y_midpoint.end() ) {
331+
// there is a defined midpoint for this stave, use this for starting points
328332
y_midpoint = y_midpoint_it->second; // avoid double map lookup
329333
double y_start_pos = y_midpoint - Constants::y_lengths[i_stave] / 2;
330-
// currently we have the same positions on positive and negative x
331-
// place the first sensor tile, assume it fits
332-
y_positionsPosNeg.back().first.emplace_back(y_start_pos, Constants::kSensorsPerStack); // positive
333-
y_positionsPosNeg.back().second.emplace_back(-y_start_pos, Constants::kSensorsPerStack); // negative
334-
} else {
335-
// midpoint is zero, i.e., the start point for x>0 & y>0 is y=0
336-
// while y_start for x>0, y<0 is -Constants::sensor2x1_gap
337-
y_positionsPosNeg.back().first.emplace_back(0, Constants::kSensorsPerStack); // positive
338-
y_positionsPosNeg.back().second.emplace_back(-Constants::sensor2x1_gap, Constants::kSensorsPerStack); // negative
339334
}
335+
340336
double x_left = Constants::x_midpoints[i_stave] - Constants::sensor2x1_width / 2;
341-
// fill_stave(y_positionsPosNeg, Rout, Rin, x_left, Constants::kSensorsPerStack, -3);
342-
LOG(info) << "FT3Module: Filling Stave " << staveID << " (x = " << Constants::x_midpoints[i_stave]
343-
<< ") with sensors. Starting y positions: "
344-
<< y_positionsPosNeg.back().first.front().first << " (positive), "
345-
<< y_positionsPosNeg.back().second.front().first << " (negative).";
346-
fill_stave(y_positionsPosNeg.back(), Rout, Rin, x_left, 1, -1); // easiest: just do with 2x1 for now
337+
double x_right = x_left + Constants::sensor2x1_width;
338+
double tolerance = -Constants::sensor_stack_height; // allow one sensor placement beyond
339+
// cut staves on nominal inner radius if specified
340+
if (ft3Params.cutStavesOnNominalRadius) {
341+
double min_y_at_x;
342+
if (x_left * x_right < 0) {
343+
// stave crosses y-axis, so we start at y=Rin
344+
min_y_at_x = Rin;
345+
} else if (x_left > 0) {
346+
// stave is on the right side, so minimum y is at x_left
347+
min_y_at_x = calculate_y_circle(x_left, Rin);
348+
} else {
349+
// stave is on the left side, so minimum y is at x_right
350+
min_y_at_x = calculate_y_circle(x_right, Rin);
351+
}
352+
y_start = {min_y_at_x, -min_y_at_x};
353+
tolerance = 0.; // no tolerance in case of cutting at nominal radius
354+
}
355+
// fill_stave(y_positionsPosNeg, Rout, x_left, Constants::kSensorsPerStack, -3);
356+
LOG(info) << "FT3Module: Filling Stave " << staveID << " (x = "
357+
<< Constants::x_midpoints[i_stave] << ") with sensors. Starting y positions: "
358+
<< y_start.first << " (positive), " << y_start.second << " (negative).";
359+
fill_stave(y_positionsPosNeg.back(), Rout, x_left, Constants::kSensorsPerStack,
360+
tolerance, y_start);
347361
}
348362

349363
unsigned sensor_count = 0;

0 commit comments

Comments
 (0)