Skip to content

Conversation

@jdbrice
Copy link
Contributor

@jdbrice jdbrice commented Jan 29, 2025

This PR removes or wraps debug logging etc. in constexpr flags to remove them from production running.
Various improvements for memory consumption.

@jdbrice jdbrice added the FWD Forward Upgrade label Jun 27, 2025
@jdbrice jdbrice force-pushed the FwdTrackingForRun22 branch from 39e63ee to d578543 Compare July 23, 2025 19:39
@jdbrice jdbrice marked this pull request as ready for review July 23, 2025 20:16
Copilot AI review requested due to automatic review settings August 20, 2025 15:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes the Forward Tracking upgrades for Run22 productions by reducing debug logging and improving memory consumption. It removes or wraps debug logging in constexpr flags to eliminate them from production running.

Key changes:

  • Wrapping debug output in compile-time constants to remove it from production builds
  • Memory consumption improvements and optimizations
  • Refactoring track fitting workflow with better organization and additional track types

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
TrackFitter.h Major refactoring with debug logging wrapped in constexpr flags, new track fitting methods, and memory optimizations
ObjExporter.h Disables verbose output by setting flag to false
GenfitTrackResult.h New file containing extracted classes for track results and event statistics
FwdTracker.h Extensive refactoring of track fitting workflow with new track types and better organization
FwdHit.h Code optimizations with default constructors and improved data structures
FwdGeomUtils.h New geometry utility methods for FST sensors and FTT quadrants
FwdDataSource.h Adds EPD hits support
FitterUtils.h Improvements to seed fitting algorithms and debug output
StFwdTrackMaker.h Interface improvements and hit loader refactoring

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

static const int sNFstLayers = 3;
FwdSystem(const int ndisks = FwdSystem::sNFwdLayers) : KiTrack::ISectorSystem(), mNDisks(ndisks){};
~FwdSystem(){/* */};
~FwdSystem() = default;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing all tests suggests that this works with the current compilers. Interesting. When I tried to use it last time compilations failed.

Copy link
Member

@nigmatkulov nigmatkulov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@jdbrice
Copy link
Contributor Author

jdbrice commented Aug 28, 2025

Follow @genevb comment on FWD PicoDst to wrap all LOG calls in a if (debug()) or similar

@plexoos plexoos requested a review from Copilot September 10, 2025 19:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.


#include <vector>
#include <memory>
#include "malloc.h"
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use <cstdlib> instead of malloc.h for better C++ standards compliance. The malloc.h header is not portable and is deprecated.

Suggested change
#include "malloc.h"
#include <cstdlib>

Copilot uses AI. Check for mistakes.

// these are the sector ids mapped to layers
int map[] = {0, 0, 0, 0, 0, 1, 2, 0, 0, 3, 4, 5, 6}; // ftsref6a
static const std::array<int,14> sector_map = {0, 0, 0, 0, 0, 1, 2, 0, 0, 3, 4, 5, 6, 7}; // ftsref6a
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Magic numbers in the array should be documented or replaced with named constants. Consider adding comments explaining what each index represents.

Copilot uses AI. Check for mistakes.
Comment on lines +126 to +130
// this disables logging at compile time
constexpr static int kLogVerbose = 10;
constexpr static int kLogInfo = 1;
constexpr static int kLogSilent = 0;
constexpr static int kLogLevel = kLogSilent;
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using an enum class instead of separate integer constants for better type safety and to avoid potential value conflicts.

Suggested change
// this disables logging at compile time
constexpr static int kLogVerbose = 10;
constexpr static int kLogInfo = 1;
constexpr static int kLogSilent = 0;
constexpr static int kLogLevel = kLogSilent;
// Use enum class for log levels for better type safety
enum class LogLevel : int {
Verbose = 10,
Info = 1,
Silent = 0
};
constexpr static LogLevel kLogLevel = LogLevel::Silent;

Copilot uses AI. Check for mistakes.
Copy link
Member

@plexoos plexoos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is a mix of many unrelated changes, which makes it hard to follow the logic. I went through the commits as best I could—aside from a few minor issues that aren’t worth blocking over, I’m giving up.

Since there’s an urgent need to get some of this into the next release and into production, we’ll merge it as is.

@plexoos plexoos merged commit 520bbbe into star-bnl:main Sep 11, 2025
148 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FWD Forward Upgrade

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants