Skip to content

Commit

Permalink
IT3: Fix most code warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
  • Loading branch information
f3sch committed May 22, 2024
1 parent 57728b6 commit af745c0
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ class SegmentationSuperAlpide
// | | |
// x----------------------x
public:
virtual ~SegmentationSuperAlpide() = default;
SegmentationSuperAlpide(const SegmentationSuperAlpide&) = default;
SegmentationSuperAlpide(SegmentationSuperAlpide&&) = delete;
SegmentationSuperAlpide& operator=(const SegmentationSuperAlpide&) = delete;
SegmentationSuperAlpide& operator=(SegmentationSuperAlpide&&) = delete;
constexpr SegmentationSuperAlpide(int layer) : mLayer{layer} {}

static constexpr int mNCols{constants::pixelarray::nCols};
Expand Down Expand Up @@ -185,8 +190,8 @@ class SegmentationSuperAlpide
template <typename T>
[[nodiscard]] bool isValid(T const row, T const col) const noexcept
{
namespace cp = constants::pixelarray;
if constexpr (std::is_floating_point_v<T>) { // compares in local coord.
namespace cp = constants::pixelarray;
return !static_cast<bool>(row <= -cp::width / 2. || cp::width / 2. <= row || col <= -cp::length / 2. || cp::length / 2. <= col);
} else { // compares in rows/cols
return !static_cast<bool>(row < 0 || row >= static_cast<int>(mNRows) || col < 0 || col >= static_cast<int>(mNCols));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ namespace o2::its3
{

const std::array<SegmentationSuperAlpide, constants::nLayers> SuperSegmentations{0, 1, 2};

}
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ class Clusterer
};

struct ClustererThread {
int id = -1;
Clusterer* parent = nullptr; // parent clusterer
int id = -1;
// buffers for entries in preClusterIndices in 2 columns, to avoid boundary checks, we reserve
// extra elements in the beginning and the end
int* column1 = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ void BuildTopologyDictionary::accountTopology(const itsmft::ClusterTopology& clu
//___________________DEFINING_TOPOLOGY_CHARACTERISTICS__________________
itsmft::TopologyInfo topInf;
topInf.mPattern.setPattern(cluster.getPattern().data());
int& rs = topInf.mSizeX = cluster.getRowSpan();
int& cs = topInf.mSizeZ = cluster.getColumnSpan();
//__________________COG_Determination_____________
topInf.mNpixels = cluster.getClusterPattern().getCOG(topInf.mCOGx, topInf.mCOGz);
if (useDf) {
Expand Down Expand Up @@ -153,7 +151,7 @@ void BuildTopologyDictionary::groupRareTopologies()
LOG(info) << "Number of clusters: " << mTotClusters;

double totFreq = 0.;
for (int j = 0; j < mNCommonTopologies; j++) {
for (unsigned int j = 0; j < mNCommonTopologies; j++) {
itsmft::GroupStruct gr;
gr.mHash = mTopologyFrequency[j].second;
gr.mFrequency = ((double)(mTopologyFrequency[j].first)) / mTotClusters;
Expand Down Expand Up @@ -272,7 +270,7 @@ void BuildTopologyDictionary::groupRareTopologies()

std::ostream& operator<<(std::ostream& os, const BuildTopologyDictionary& DB)
{
for (int i = 0; i < DB.mNCommonTopologies; i++) {
for (unsigned int i = 0; i < DB.mNCommonTopologies; i++) {
const unsigned long& hash = DB.mTopologyFrequency[i].second;
os << "Hash: " << hash << '\n';
os << "counts: " << DB.mTopologyMap.find(hash)->second.countsTotal;
Expand Down
13 changes: 5 additions & 8 deletions Detectors/Upgrades/ITS3/reconstruction/src/Clusterer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ void Clusterer::process(int nThreads, PixelReader& reader, CompClusCont* compClu
nThreads = 1;
}
auto autoDecode = reader.getDecodeNextAuto();
int rofcount{0};
do {
if (autoDecode) {
reader.setDecodeNextAuto(false); // internally do not autodecode
Expand Down Expand Up @@ -79,7 +78,7 @@ void Clusterer::process(int nThreads, PixelReader& reader, CompClusCont* compClu
if (nThreads > mThreads.size()) {
int oldSz = mThreads.size();
mThreads.resize(nThreads);
for (int i = oldSz; i < nThreads; i++) {
for (size_t i = oldSz; i < nThreads; i++) {
mThreads[i] = std::make_unique<ClustererThread>(this, i);
}
}
Expand Down Expand Up @@ -108,10 +107,10 @@ void Clusterer::process(int nThreads, PixelReader& reader, CompClusCont* compClu
mTimerMerge.Start(false);
#endif
size_t nClTot = 0, nPattTot = 0;
int chid = 0, thrStatIdx[nThreads];
int chid = 0;
std::vector<size_t> thrStatIdx(nThreads, 0);
for (int ith = 0; ith < nThreads; ith++) {
std::sort(mThreads[ith]->stats.begin(), mThreads[ith]->stats.end(), [](const ThreadStat& a, const ThreadStat& b) { return a.firstChip < b.firstChip; });
thrStatIdx[ith] = 0;
nClTot += mThreads[ith]->compClusters.size();
nPattTot += mThreads[ith]->patterns.size();
}
Expand All @@ -129,7 +128,6 @@ void Clusterer::process(int nThreads, PixelReader& reader, CompClusCont* compClu
thrStatIdx[ith]++;
chid += stat.nChips; // next chip to look
const auto clbeg = mThreads[ith]->compClusters.begin() + stat.firstClus;
auto szold = compClus->size();
compClus->insert(compClus->end(), clbeg, clbeg + stat.nClus);
if (patterns) {
const auto ptbeg = mThreads[ith]->patterns.begin() + stat.firstPatt;
Expand Down Expand Up @@ -177,7 +175,6 @@ void Clusterer::ClustererThread::process(uint16_t chip, uint16_t nChips, CompClu
parent->mMaxRowColDiffToMask != 0 ? curChipData->maskFiredInSample(parent->mChipsOld[chipID], parent->mMaxRowColDiffToMask) : curChipData->maskFiredInSample(parent->mChipsOld[chipID]);
}
}
auto nclus0 = compClusPtr->size();
auto validPixID = curChipData->getFirstUnmasked();
auto npix = curChipData->getData().size();
LOGP(debug, "ClustererThread: Chip={} npix={} validPixID={} -> valid={} -> singleHit={}", chipID, npix, validPixID, validPixID < npix, validPixID + 1 == npix);
Expand Down Expand Up @@ -210,7 +207,7 @@ void Clusterer::ClustererThread::finishChip(ChipPixelData* curChipData, CompClus
PatternCont* patternsPtr, const ConstMCTruth* labelsDigPtr, MCTruth* labelsClusPtr)
{
const auto& pixData = curChipData->getData();
for (int i1 = 0; i1 < preClusterHeads.size(); ++i1) {
for (size_t i1 = 0; i1 < preClusterHeads.size(); ++i1) {
auto ci = preClusterIndices[i1];
if (ci < 0) {
continue;
Expand All @@ -234,7 +231,7 @@ void Clusterer::ClustererThread::finishChip(ChipPixelData* curChipData, CompClus
next = pixEntry.first;
}
preClusterIndices[i1] = -1;
for (int i2 = i1 + 1; i2 < preClusterHeads.size(); ++i2) {
for (size_t i2 = i1 + 1; i2 < preClusterHeads.size(); ++i2) {
if (preClusterIndices[i2] != ci) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void Digitizer::fillOutputContainer(uint32_t frameLast)
rcROF.setFirstEntry(mDigits->size()); // start of current ROF in digits

auto& extra = *(mExtraBuff.front().get());
for (int iChip{0}; iChip < mChips.size(); ++iChip) {
for (size_t iChip{0}; iChip < mChips.size(); ++iChip) {
auto& chip = mChips[iChip];
if (constants::detID::isDetITS3(iChip)) { // Check if this is a chip of ITS3
chip.addNoise(mROFrameMin, mROFrameMin, &mParams, SuperSegmentation::mNRows, SuperSegmentation::mNCols);
Expand Down
10 changes: 5 additions & 5 deletions Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void ITS3Layer::createSegment()
mSegment = new TGeoVolumeAssembly(its3TGeo::getITS3SegmentPattern(mNLayer));
mSegment->VisibleDaughters();

for (int i{0}; i < nRSUs; ++i) {
for (size_t i{0}; i < nRSUs; ++i) {
auto zMove = new TGeoTranslation(0, 0, +i * constants::rsu::length + constants::rsu::databackbone::length + constants::pixelarray::length / 2.);
mSegment->AddNode(mRSU, i, zMove);
}
Expand Down Expand Up @@ -249,7 +249,7 @@ void ITS3Layer::createChip()
mChip = new TGeoVolumeAssembly(its3TGeo::getITS3ChipPattern(mNLayer));
mChip->VisibleDaughters();

for (int i{0}; i < constants::nSegments[mNLayer]; ++i) {
for (unsigned int i{0}; i < constants::nSegments[mNLayer]; ++i) {
double phiOffset = constants::segment::width / mR * o2m::Rad2Deg;
auto rot = new TGeoRotation("", 0, 0, phiOffset * i);
mChip->AddNode(mSegment, i, rot);
Expand Down Expand Up @@ -285,8 +285,8 @@ void ITS3Layer::createCarbonForm()
auto zMoveHringA = new TGeoTranslation(0, 0, -constants::segment::lec::length + HringLength / 2. + constants::segment::length - HringLength);

// Longerons are made by same material
auto longeronR = new TGeoTubeSeg(Form("longeronR%d", mNLayer), mRmax, mRmax + dRadius, longeronsLength / 2, phiSta, phiSta + phiLongeronsCover);
auto longeronL = new TGeoTubeSeg(Form("longeronL%d", mNLayer), mRmax, mRmax + dRadius, longeronsLength / 2, phiEnd - phiLongeronsCover, phiEnd);
[[maybe_unused]] auto longeronR = new TGeoTubeSeg(Form("longeronR%d", mNLayer), mRmax, mRmax + dRadius, longeronsLength / 2, phiSta, phiSta + phiLongeronsCover);
[[maybe_unused]] auto longeronL = new TGeoTubeSeg(Form("longeronL%d", mNLayer), mRmax, mRmax + dRadius, longeronsLength / 2, phiEnd - phiLongeronsCover, phiEnd);
TString nameLongerons = Form("longeronR%d + longeronL%d", mNLayer, mNLayer);
auto longerons = new TGeoCompositeShape(nameLongerons);
auto longeronsVol = new TGeoVolume(Form("longerons%d", mNLayer), longerons, mCarbon);
Expand All @@ -311,7 +311,7 @@ TGeoCompositeShape* ITS3Layer::getHringShape(TGeoTubeSeg* Hring)
for (int iHoles = 0; iHoles < nHoles[mNLayer]; iHoles++) {
double phiHole = phiHolesSta + stepPhiHoles * iHoles;
TString nameHole = Form("hole_%d_%d", iHoles, mNLayer);
auto hole = new TGeoTube(nameHole, 0, radiusHoles[mNLayer], 3 * Hring->GetDz());
[[maybe_unused]] auto hole = new TGeoTube(nameHole, 0, radiusHoles[mNLayer], 3 * Hring->GetDz());
// move hole to the hring radius
auto zMoveHole = new TGeoTranslation(Form("zMoveHole_%d_%d", iHoles, mNLayer), radiusHring * cos(phiHole * o2m::Deg2Rad), radiusHring * sin(phiHole * o2m::Deg2Rad), 0);
zMoveHole->RegisterYourself();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class ClustererDPL : public Task
private:
void updateTimeDependentParams(ProcessingContext& pc);

int mState = 0;
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
bool mUseMC = true;
int mState = 0;
int mNThreads = 1;
bool mUseClusterDictionary = true;
std::unique_ptr<o2::its3::Clusterer> mClusterer = nullptr;
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
};

/// create a processor spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ class TrackerDPL : public framework::Task
private:
void updateTimeDependentParams(framework::ProcessingContext& pc);

std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest{};
bool mIsMC{false};
bool mRunVertexer{true};
bool mCosmicsProcessing{false};
int mUseTriggers{0};
std::string mMode{"sync"};
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest{};
o2::its3::TopologyDictionary* mDict{};
std::unique_ptr<o2::gpu::GPUReconstruction> mRecChain{};
bool mRunVertexer{true};
bool mCosmicsProcessing{false};
o2::its3::TopologyDictionary* mDict{};
std::unique_ptr<o2::gpu::GPUChainITS> mChainITS{};
std::unique_ptr<its::Tracker> mTracker{};
std::unique_ptr<its::Vertexer> mVertexer{};
Expand Down
12 changes: 6 additions & 6 deletions Detectors/Upgrades/ITS3/workflow/src/TrackerSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ namespace its3
{
using Vertex = o2::dataformats::Vertex<o2::dataformats::TimeStamp<int>>;

TrackerDPL::TrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr, bool isMC, int trgType, const std::string& trModeS, o2::gpu::GPUDataTypes::DeviceType dType) : mGGCCDBRequest(gr), mIsMC{isMC}, mUseTriggers{trgType}, mMode{trModeS}, mRecChain{o2::gpu::GPUReconstruction::CreateInstance(dType, true)}
TrackerDPL::TrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr, bool isMC, int trgType, const std::string& trModeS, o2::gpu::GPUDataTypes::DeviceType dType) :
mGGCCDBRequest(gr), mIsMC{isMC}, mUseTriggers{trgType}, mMode{trModeS}, mRecChain{o2::gpu::GPUReconstruction::CreateInstance(dType, true)}
{
std::transform(mMode.begin(), mMode.end(), mMode.begin(), [](unsigned char c) { return std::tolower(c); });
}
Expand Down Expand Up @@ -212,15 +213,15 @@ void TrackerDPL::run(ProcessingContext& pc)
vertexerElapsedTime = mVertexer->clustersToVertices(logger);
}
const auto& multEstConf = FastMultEstConfig::Instance(); // parameters for mult estimation and cuts
for (auto iRof{0}; iRof < rofspan.size(); ++iRof) {
for (size_t iRof{0}; iRof < rofspan.size(); ++iRof) {
std::vector<Vertex> vtxVecLoc;
auto& vtxROF = vertROFvec.emplace_back(rofspan[iRof]);
vtxROF.setFirstEntry(vertices.size());
if (mRunVertexer) {
auto vtxSpan = timeFrame->getPrimaryVertices(iRof);
vtxROF.setNEntries(vtxSpan.size());
bool selROF = vtxSpan.size() == 0;
for (auto iV{0}; iV < vtxSpan.size(); ++iV) {
for (size_t iV{0}; iV < vtxSpan.size(); ++iV) {
auto& v = vtxSpan[iV];
if (multEstConf.isVtxMultCutRequested() && !multEstConf.isPassingVtxMultCut(v.getNContributors())) {
continue; // skip vertex of unwanted multiplicity
Expand Down Expand Up @@ -271,7 +272,6 @@ void TrackerDPL::run(ProcessingContext& pc)
trackLabels = timeFrame->getTracksLabel(iROF);
auto number{tracks.size()};
auto first{allTracks.size()};
int offset = -rof.getFirstEntry(); // cluster entry!!!
rof.setFirstEntry(first);
rof.setNEntries(number);
if (processingMask[iROF]) {
Expand All @@ -283,8 +283,8 @@ void TrackerDPL::run(ProcessingContext& pc)
for (unsigned int iTrk{0}; iTrk < tracks.size(); ++iTrk) {
auto& trc{tracks[iTrk]};
trc.setFirstClusterEntry(allClusIdx.size()); // before adding tracks, create final cluster indices
int ncl = trc.getNumberOfClusters(), nclf = 0;
for (int ic = TrackITSExt::MaxClusters; ic--;) { // track internally keeps in->out cluster indices, but we want to store the references as out->in!!!
int nclf = 0;
for (int ic = TrackITSExt::MaxClusters; (ic--) != 0;) { // track internally keeps in->out cluster indices, but we want to store the references as out->in!!!
auto clid = trc.getClusterIndex(ic);
if (clid >= 0) {
allClusIdx.push_back(clid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
// write the configuration used for the reco workflow
o2::conf::ConfigurableParam::writeINI("o2its3recoflow_configuration.ini");

return std::move(wf);
return wf;
}
7 changes: 3 additions & 4 deletions Steer/DigitizerWorkflow/src/ITS3DigitizerSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class ITS3DPLDigitizerTask : BaseDPLDigitizer
if (mDigits.empty()) {
return; // no digits were flushed, nothing to accumulate
}
static int fixMC2ROF = 0; // 1st entry in mc2rofRecordsAccum to be fixed for ROFRecordID
auto ndigAcc = digitsAccum.size();
std::copy(mDigits.begin(), mDigits.end(), std::back_inserter(digitsAccum));

Expand Down Expand Up @@ -140,9 +139,9 @@ class ITS3DPLDigitizerTask : BaseDPLDigitizer

auto& eventParts = context->getEventParts(withQED);
// loop over all composite collisions given from context (aka loop over all the interaction records)
int bcShift = mDigitizer.getParams().getROFrameBiasInBC();
const int bcShift = mDigitizer.getParams().getROFrameBiasInBC();
// loop over all composite collisions given from context (aka loop over all the interaction records)
for (int collID = 0; collID < timesview.size(); ++collID) {
for (size_t collID = 0; collID < timesview.size(); ++collID) {
auto irt = timesview[collID];
if (irt.toLong() < bcShift) { // due to the ROF misalignment the collision would go to negative ROF ID, discard
continue;
Expand All @@ -159,7 +158,7 @@ class ITS3DPLDigitizerTask : BaseDPLDigitizer
mHits.clear();
context->retrieveHits(mSimChains, o2::detectors::SimTraits::DETECTORBRANCHNAMES[mID][0].c_str(), part.sourceID, part.entryID, &mHits);

if (mHits.size() > 0) {
if (!mHits.empty()) {
LOG(debug) << "For collision " << collID << " eventID " << part.entryID
<< " found " << mHits.size() << " hits ";
mDigitizer.process(&mHits, part.entryID, part.sourceID); // call actual digitization procedure
Expand Down

0 comments on commit af745c0

Please sign in to comment.