Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
make modules data pointers const
Browse files Browse the repository at this point in the history
  • Loading branch information
slava77devel committed Nov 14, 2023
1 parent 53419e2 commit 729b6d9
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion SDL/Hit.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ namespace SDL
};

ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE int binary_search(
unsigned int *data, // Array that we are searching over
const unsigned int *data, // Array that we are searching over
unsigned int search_val, // Value we want to find in data array
unsigned int ndata) // Number of elements in data array
{
Expand Down
4 changes: 2 additions & 2 deletions SDL/MiniDoublet.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,11 @@ namespace SDL
float drprime; // The radial shift size in x-y plane projection
float drprime_x; // x-component of drprime
float drprime_y; // y-component of drprime
float& slope = modulesInGPU.slopes[lowerModuleIndex]; // The slope of the possible strip hits for a given module in x-y plane
const float& slope = modulesInGPU.slopes[lowerModuleIndex]; // The slope of the possible strip hits for a given module in x-y plane
float absArctanSlope;
float angleM; // the angle M is the angle of rotation of the module in x-y plane if the possible strip hits are along the x-axis, then angleM = 0, and if the possible strip hits are along y-axis angleM = 90 degrees
float absdzprime; // The distance between the two points after shifting
float& drdz_ = modulesInGPU.drdzs[lowerModuleIndex];
const float& drdz_ = modulesInGPU.drdzs[lowerModuleIndex];
// Assign hit pointers based on their hit type
if (modulesInGPU.moduleType[lowerModuleIndex] == PS)
{
Expand Down
56 changes: 28 additions & 28 deletions SDL/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,33 +185,33 @@ namespace SDL

struct modules
{
unsigned int* detIds;
uint16_t* moduleMap;
unsigned int* mapdetId;
uint16_t* mapIdx;
uint16_t* nConnectedModules;
float* drdzs;
float* slopes;
uint16_t *nModules;
uint16_t *nLowerModules;
uint16_t* partnerModuleIndices;

short* layers;
short* rings;
short* modules;
short* rods;
short* subdets;
short* sides;
float* eta;
float* r;
bool* isInverted;
bool* isLower;
bool* isAnchor;
ModuleType* moduleType;
ModuleLayerType* moduleLayerType;
int* sdlLayers;

unsigned int* connectedPixels;
const unsigned int* detIds;
const uint16_t* moduleMap;
const unsigned int* mapdetId;
const uint16_t* mapIdx;
const uint16_t* nConnectedModules;
const float* drdzs;
const float* slopes;
const uint16_t *nModules;
const uint16_t *nLowerModules;
const uint16_t* partnerModuleIndices;

const short* layers;
const short* rings;
const short* modules;
const short* rods;
const short* subdets;
const short* sides;
const float* eta;
const float* r;
const bool* isInverted;
const bool* isLower;
const bool* isAnchor;
const ModuleType* moduleType;
const ModuleLayerType* moduleLayerType;
const int* sdlLayers;

const unsigned int* connectedPixels;

static bool parseIsInverted(short subdet, short side, short module, short layer)
{
Expand Down Expand Up @@ -284,7 +284,7 @@ namespace SDL
};

template<typename TBuff>
void setData(TBuff& modulesbuf)
void setData(const TBuff& modulesbuf)
{
detIds = alpaka::getPtrNative(modulesbuf.detIds_buf);
moduleMap = alpaka::getPtrNative(modulesbuf.moduleMap_buf);
Expand Down
4 changes: 2 additions & 2 deletions SDL/PixelTriplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,7 @@ namespace SDL
moduleType = modulesInGPU.moduleType[lowerModuleIndices[i]];
moduleSubdet = modulesInGPU.subdets[lowerModuleIndices[i]];
moduleSide = modulesInGPU.sides[lowerModuleIndices[i]];
float& drdz = modulesInGPU.drdzs[lowerModuleIndices[i]];
const float& drdz = modulesInGPU.drdzs[lowerModuleIndices[i]];
slopes[i] = modulesInGPU.slopes[lowerModuleIndices[i]];
//category 1 - barrel PS flat
if(moduleSubdet == Barrel and moduleType == PS and moduleSide == Center)
Expand Down Expand Up @@ -2220,7 +2220,7 @@ namespace SDL
const int moduleSubdet = modulesInGPU.subdets[lowerModuleIndex];

residual = (moduleSubdet == SDL::Barrel) ? (zs[i] - zPix[0]) - slope * (rts[i] - rtPix[0]) : (rts[i] - rtPix[0]) - (zs[i] - zPix[0])/slope;
float& drdz = modulesInGPU.drdzs[lowerModuleIndex];
const float& drdz = modulesInGPU.drdzs[lowerModuleIndex];
//PS Modules
if(moduleType == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion SDL/Quintuplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ namespace SDL
moduleType = modulesInGPU.moduleType[lowerModuleIndices[i]];
moduleSubdet = modulesInGPU.subdets[lowerModuleIndices[i]];
moduleSide = modulesInGPU.sides[lowerModuleIndices[i]];
float& drdz = modulesInGPU.drdzs[lowerModuleIndices[i]];
const float& drdz = modulesInGPU.drdzs[lowerModuleIndices[i]];
slopes[i] = modulesInGPU.slopes[lowerModuleIndices[i]];
//category 1 - barrel PS flat
if(moduleSubdet == Barrel and moduleType == PS and moduleSide == Center)
Expand Down
4 changes: 2 additions & 2 deletions SDL/Segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ namespace SDL
bool isInnerTilted = modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel and modulesInGPU.sides[innerLowerModuleIndex] != SDL::Center;
bool isOuterTilted = modulesInGPU.subdets[outerLowerModuleIndex] == SDL::Barrel and modulesInGPU.sides[outerLowerModuleIndex] != SDL::Center;

float& drdzInner = modulesInGPU.drdzs[innerLowerModuleIndex];
float& drdzOuter = modulesInGPU.drdzs[outerLowerModuleIndex];
const float& drdzInner = modulesInGPU.drdzs[innerLowerModuleIndex];
const float& drdzOuter = modulesInGPU.drdzs[outerLowerModuleIndex];
float innerModuleGapSize = SDL::moduleGapSize_seg(modulesInGPU, innerLowerModuleIndex);
float outerModuleGapSize = SDL::moduleGapSize_seg(modulesInGPU, outerLowerModuleIndex);
const float innerminiTilt = isInnerTilted ? (0.5f * pixelPSZpitch * drdzInner / alpaka::math::sqrt(acc, 1.f + drdzInner * drdzInner) / innerModuleGapSize) : 0;
Expand Down

0 comments on commit 729b6d9

Please sign in to comment.