Skip to content

Commit

Permalink
Please consider the following formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alibuild committed Oct 3, 2023
1 parent bde9730 commit f19d12f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
7 changes: 2 additions & 5 deletions Detectors/Base/include/DetectorsBase/MatLayerCylSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,16 @@ class MatLayerCylSet : public o2::gpu::FlatObject
static constexpr size_t getBufferAlignmentBytes() { return 8; }
#endif // !GPUCA_GPUCODE

static constexpr float LayerRMax = 500; // maximum value of R lookup (corresponds to last layer of MatLUT)
static constexpr float LayerRMax = 500; // maximum value of R lookup (corresponds to last layer of MatLUT)
static constexpr float VoxelRDelta = 0.05; // voxel spacing for layer lookup; seems a natural choice - corresponding ~ to smallest spacing
static constexpr float InvVoxelRDelta = 1.f / VoxelRDelta;

std::vector<std::pair<uint16_t, uint16_t>> mLayerVoxelLU{}; //! helper structure to lookup a layer based on radius
bool mLayerVoxelLUInitialized = false; //! if layer helper structure is initialized
bool mLayerVoxelLUInitialized = false; //! if layer helper structure is initialized

ClassDefNV(MatLayerCylSet, 1);
};




} // namespace base
} // namespace o2

Expand Down
2 changes: 1 addition & 1 deletion Detectors/Base/src/GRPGeomHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ bool GRPGeomHelper::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
if (mRequest->askMatLUT && matcher == ConcreteDataMatcher("GLO", "MATLUT", 0)) {
LOG(info) << "material LUT updated";
mMatLUT = o2::base::MatLayerCylSet::rectifyPtrFromFile((o2::base::MatLayerCylSet*)obj);
if (getenv("ALICEO2_MATBUT_VOXEL")) {
if (getenv("ALICEO2_MATBUT_VOXEL")) {
// the object is already const here ... so need to const_cast to finish initialization
const_cast<o2::base::MatLayerCylSet*>(mMatLUT)->initLayerVoxelLU();
}
Expand Down
23 changes: 12 additions & 11 deletions Detectors/Base/src/MatLayerCylSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ void MatLayerCylSet::writeToFile(const std::string& outFName)
outf.Close();
}

GPUd() int MatLayerCylSet::searchLayerFast(float r2, int low, int high) const {
GPUd() int MatLayerCylSet::searchLayerFast(float r2, int low, int high) const
{
// we can avoid the sqrt .. at the cost of more memory in the lookup
const auto index = int(std::sqrt(r2) * InvVoxelRDelta);
if (index >= mLayerVoxelLU.size()) {
Expand All @@ -190,7 +191,8 @@ GPUd() int MatLayerCylSet::searchLayerFast(float r2, int low, int high) const {
return layers.first;
}

void MatLayerCylSet::initLayerVoxelLU() {
void MatLayerCylSet::initLayerVoxelLU()
{
if (mLayerVoxelLUInitialized) {
LOG(info) << "Layer voxel already initialized; Aborting";
return;
Expand All @@ -201,10 +203,10 @@ void MatLayerCylSet::initLayerVoxelLU() {
mLayerVoxelLU.reserve(numVoxels);
for (int voxel = 0; voxel < numVoxels; ++voxel) {
// check the 2 extremes of this voxel "covering"
const auto lowerR = voxel*VoxelRDelta;
const auto lowerR = voxel * VoxelRDelta;
const auto upperR = lowerR + VoxelRDelta;
const auto lowerSegment = searchSegment(lowerR*lowerR);
const auto upperSegment = searchSegment(upperR*upperR);
const auto lowerSegment = searchSegment(lowerR * lowerR);
const auto upperSegment = searchSegment(upperR * upperR);
mLayerVoxelLU.push_back(std::pair<uint16_t, u_int16_t>(lowerSegment, upperSegment));
}
mLayerVoxelLUInitialized = true;
Expand Down Expand Up @@ -301,11 +303,11 @@ GPUd() MatBudget MatLayerCylSet::getMatBudget(float x0, float y0, float z0, floa
while (lrID >= lmin) { // go from outside to inside
const auto& lr = getLayer(lrID);
int nphiSlices = lr.getNPhiSlices();
int nc = ray.crossLayer(lr); // determines how many crossings this ray has with this tubular layer
int nc = ray.crossLayer(lr); // determines how many crossings this ray has with this tubular layer
for (int ic = nc; ic--;) {
float cross1, cross2;
ray.getCrossParams(ic, cross1, cross2); // tmax,tmin of crossing the layer

auto phi0 = ray.getPhi(cross1), phi1 = ray.getPhi(cross2), dPhi = phi0 - phi1;
auto phiID = lr.getPhiSliceID(phi0), phiIDLast = lr.getPhiSliceID(phi1);
// account for eventual wrapping around 0
Expand All @@ -318,7 +320,7 @@ GPUd() MatBudget MatLayerCylSet::getMatBudget(float x0, float y0, float z0, floa
phiID += nphiSlices;
}
}

int stepPhiID = phiID > phiIDLast ? -1 : 1;
bool checkMorePhi = true;
auto tStartPhi = cross1, tEndPhi = 0.f;
Expand Down Expand Up @@ -429,12 +431,11 @@ GPUd() bool MatLayerCylSet::getLayersRange(const Ray& ray, short& lmin, short& l
if (!mLayerVoxelLUInitialized) {
lmxInt = rmax2 < getRMax2() ? searchSegment(rmax2, 0) : get()->mNRIntervals - 2;
lmnInt = rmin2 >= getRMin2() ? searchSegment(rmin2, 0, lmxInt + 1) : 0;
}
else {
} else {
lmxInt = rmax2 < getRMax2() ? searchLayerFast(rmax2, 0) : get()->mNRIntervals - 2;
lmnInt = rmin2 >= getRMin2() ? searchLayerFast(rmin2, 0, lmxInt + 1) : 0;
}

const auto* interval2LrID = get()->mInterval2LrID;
lmax = interval2LrID[lmxInt];
lmin = interval2LrID[lmnInt];
Expand Down

0 comments on commit f19d12f

Please sign in to comment.