Skip to content

Commit

Permalink
Concurrent track finding
Browse files Browse the repository at this point in the history
  • Loading branch information
pandreetto committed Sep 19, 2024
1 parent 9eb70f8 commit f89d410
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 29 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ FIND_PACKAGE( ROOT REQUIRED)

FIND_PACKAGE( Acts REQUIRED COMPONENTS Core PluginJson PluginTGeo )

FIND_PACKAGE(OpenMP)
OPTION(OpenMP_ACTIVE "Activate OpenMP parallel compilation" ON)
IF(OPENMP_FOUND AND OpenMP_ACTIVE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
ENDIF()


INCLUDE(GNUInstallDirs)

### DOCUMENTATION ###########################################################
Expand Down
39 changes: 10 additions & 29 deletions src/ACTSSeededCKFTrackingProc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,11 @@ void ACTSSeededCKFTrackingProc::processEvent(LCEvent *evt) {
// Convert to Acts hit
const Acts::Surface *surface = trackingGeometry()->findSurface(hit.first);

std::cout << "hit: " << hit.first.volume() << " " << hit.first.boundary() << " " << hit.first.layer() << " " << hit.first.approach() << " " << hit.first.sensitive() << std::endl;

if (surface == nullptr) throw std::runtime_error("Surface not found");

const double *lcioglobalpos = hit.second->getPosition();
Acts::Vector3 globalPos = {lcioglobalpos[0], lcioglobalpos[1],
lcioglobalpos[2]};
//debug
//std::cout << "globalPos: " << globalPos[0] << " " << globalPos[1] << " " << globalPos[2] << std::endl;

Acts::Result<Acts::Vector2> lpResult =
surface->globalToLocal(geometryContext(), globalPos, {0, 0, 0}, 0.5_um);
Expand Down Expand Up @@ -321,9 +317,6 @@ void ACTSSeededCKFTrackingProc::processEvent(LCEvent *evt) {
measurements.push_back(meas);
sourceLinks.emplace_hint(sourceLinks.end(), sourceLink);

std::cout << surface->geometryId() << std::endl;
std::cout << _seedGeometrySelection.check(surface->geometryId()) << std::endl;

//
// Seed selection and conversion to useful coordinates
if (_seedGeometrySelection.check(surface->geometryId())) {
Expand Down Expand Up @@ -669,41 +662,29 @@ void ACTSSeededCKFTrackingProc::processEvent(LCEvent *evt) {
using TrackContainer = Acts::TrackContainer<Acts::VectorTrackContainer,
Acts::VectorMultiTrajectory,
std::shared_ptr>;
auto trackContainer = std::make_shared<Acts::VectorTrackContainer>();
auto trackStateContainer = std::make_shared<Acts::VectorMultiTrajectory>();
TrackContainer tracks(trackContainer, trackStateContainer);

#pragma omp parallel for
for (std::size_t iseed = 0; iseed < paramseeds.size(); ++iseed) {

tracks.clear();
auto trackContainer = std::make_shared<Acts::VectorTrackContainer>();
auto trackStateContainer = std::make_shared<Acts::VectorMultiTrajectory>();
TrackContainer tracks(trackContainer, trackStateContainer);

auto result = trackFinder.findTracks(paramseeds.at(iseed), ckfOptions, tracks);
if (result.ok()) {
const auto& fitOutput = result.value();
for (const TrackContainer::TrackProxy& trackTip : fitOutput)
{
//
// Helpful debug output
streamlog_out(DEBUG) << "Trajectory Summary" << std::endl;
streamlog_out(DEBUG)
<< "\tchi2Sum " << trackTip.chi2() << std::endl;
streamlog_out(DEBUG)
<< "\tNDF " << trackTip.nDoF() << std::endl;
streamlog_out(DEBUG)
<< "\tnHoles " << trackTip.nHoles() << std::endl;
streamlog_out(DEBUG)
<< "\tnMeasurements " << trackTip.nMeasurements() << std::endl;
streamlog_out(DEBUG)
<< "\tnOutliers " << trackTip.nOutliers() << std::endl;
streamlog_out(DEBUG)
<< "\tnStates " << trackTip.nTrackStates() << std::endl;

// Make track object
EVENT::Track *track = ACTSTracking::ACTS2Marlin_track(
trackTip, magneticField(), magCache, _caloFaceR, _caloFaceZ, geometryContext(), magneticFieldContext(), trackingGeometry());
trackTip, magneticField(), magCache, _caloFaceR, _caloFaceZ,
geometryContext(), magneticFieldContext(), trackingGeometry());

// Save results
trackCollection->addElement(track);
#pragma omp critical
{
trackCollection->addElement(track);
}
}
} else {
streamlog_out(WARNING)
Expand Down

0 comments on commit f89d410

Please sign in to comment.