Skip to content

Commit

Permalink
Geometry and Data source updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Nov 15, 2024
1 parent 95895a1 commit 0c44541
Show file tree
Hide file tree
Showing 16 changed files with 1,123 additions and 106 deletions.
4 changes: 2 additions & 2 deletions docker/tdis-pre/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ARG BUILD_THREADS=8
# Software versions

ARG VERSION_CERN_ROOT=v6-32-06
ARG VERSION_ACTS=v37.2.0
ARG VERSION_ACTS=v37.4.0
ARG VERSION_PODIO=v01-01
ARG VERSION_JANA2=v2.3.2

Expand Down Expand Up @@ -93,7 +93,7 @@ RUN edpm config root branch=${VERSION_CERN_ROOT} &&\


RUN edpm config acts branch=${VERSION_ACTS} &&\
edpm config acts cmake_flags='-DACTS_BUILD_PLUGIN_TGEO=ON -DACTS_BUILD_PLUGIN_DD4HEP=OFF -DACTS_BUILD_PLUGIN_JSON=ON -DACTS_BUILD_PLUGIN_ACTSVG=OFF' &&\
edpm config acts cmake_flags='-DACTS_BUILD_EXAMPLES_PYTHON_BINDINGS=ON -DACTS_BUILD_PLUGIN_TGEO=ON -DACTS_BUILD_PLUGIN_DD4HEP=OFF -DACTS_BUILD_PLUGIN_JSON=ON -DACTS_BUILD_PLUGIN_ACTSVG=OFF' &&\
edpm install acts

RUN edpm config podio branch=${VERSION_PODIO} &&\
Expand Down
8 changes: 1 addition & 7 deletions source/tdis/CKFTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ namespace eicrecon {

class CKFTracking: public WithPodConfig<eicrecon::CKFTrackingConfig> {
public:
/// Track finder function that takes input measurements, initial trackstate
/// and track finder options and returns some track-finder-specific result.
using TrackFinderOptions =
Acts::CombinatorialKalmanFilterOptions<ActsExamples::IndexSourceLinkAccessor::Iterator,
Acts::VectorMultiTrajectory>;
using TrackFinderResult =
Acts::Result<std::vector<ActsExamples::TrackContainer::TrackProxy>>;


/// Find function that takes the above parameters
/// @note This is separated into a virtual interface to keep compilation units
Expand Down
40 changes: 40 additions & 0 deletions source/tdis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ add_executable(tdis
tracking/ActsGeometryService.cc
tracking/ActsGeometryService.h
tracking/ReconstructedHitFactory.h

tracking/BuildTelescopeDetector.cpp
tracking/BuildTelescopeDetector.hpp
tracking/TelescopeDetector.cpp
tracking/TelescopeDetector.hpp
tracking/TelescopeDetectorElement.cpp
tracking/TelescopeDetectorElement.hpp
# tracking/CKFTrackingFunction.cc
# tracking/DD4hepBField.h
# /tracking/DD4hepBField.cc
)
Expand Down Expand Up @@ -73,7 +81,39 @@ set_target_properties(tdis PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
target_include_directories(tdis PRIVATE "podio_model")
target_include_directories(tdis SYSTEM PUBLIC ${JANA_INCLUDE_DIR} ${ROOT_INCLUDE_DIRS})

# ----------- Configure ACTS ExamplesLibrary --------
# ExamplesLibrary actually creates ACTS event model
# Get ActsExamples base
get_target_property(ActsCore_LOCATION ActsCore LOCATION)
get_filename_component(ActsCore_PATH ${ActsCore_LOCATION} DIRECTORY)
set(ActsExamples_LIB ${ActsCore_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}ActsExamplesFramework${CMAKE_SHARED_LIBRARY_SUFFIX})

# If acts is installed to / we are good but if acts is installed in some directory with structure /bin /include /lib
# we need to get this directory and try to include include
get_filename_component(Acts_HOME "${ActsCore_PATH}" DIRECTORY)
set(Acts_HOME_INCLUDE "${Acts_HOME}/include")

# List all ACTS variables
message(STATUS "ACTS List all variables : ${ActsExample_LIB}")
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
if (_variableName MATCHES "^Acts")
message(STATUS " ${_variableName} = ${${_variableName}}")
endif()
endforeach()

# Add examples library and includes

# Check if the directory exists and is accessible on the disk
if(EXISTS "${Acts_HOME_INCLUDE}")
# Add the directory to the target's include directories only if it exists
target_include_directories(tdis PUBLIC SYSTEM "${Acts_HOME_INCLUDE}")
message(STATUS "Added include directory: ${Acts_HOME_INCLUDE}")
else()
message(STATUS "Directory does not exist or is not accessible: ${Acts_HOME_INCLUDE}. It is OK if ACTS is installed in /")
endif()

target_include_directories(tdis PUBLIC ${CMAKE_CURRENT_LIST_DIR} "${CMAKE_CURRENT_LIST_DIR}/..")

# ----------- install destination -------------------
install(TARGETS tdis DESTINATION bin)
Expand Down
46 changes: 34 additions & 12 deletions source/tdis/io/DigitizedDataEventSource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ namespace tdis::io {

/** POD structure for readout hits **/
struct DigitizedReadoutHit {
double time; // - Time of arrival at Pad (ns)
double adc; // - Amplitude (ADC bin of sample)
int ring; // - Ring (id of rin, 0 is innermost).
int pad; // - Pad (id of pad, 0 is at or closest to phi=0 and numbering is clockwise).
int plane; // - Plane(id of z plane from 0 upstream to 9 downstream)
double zToGem; // - ZtoGEM (m)
double time; // - Time of arrival at Pad (ns)
double adc; // - Amplitude (ADC bin of sample)
int ring; // - Ring (id of rin, 0 is innermost).
int pad; // - Pad (id of pad, 0 is at or closest to phi=0 and numbering is clockwise).
int plane; // - Plane(id of z plane from 0 upstream to 9 downstream)
double zToGem; // - ZtoGEM (m)
double true_x; // - True hit x info (quiet_NaN() if not provided)
double true_y; // - True hit y info (quiet_NaN() if not provided)
double true_z; // - True hit z info (quiet_NaN() if not provided)
};

/** POD structure for readout track **/
Expand Down Expand Up @@ -240,12 +243,31 @@ namespace tdis::io {
return false;
}

result.time = std::stod(tokens[0]); // - Time of arrival at Pad (ns)
result.adc = std::stod(tokens[1]); // - Amplitude (ADC bin of sample)
result.ring = std::stoi(tokens[2]); // - Ring (id of rin, 0 is innermost).
result.pad = std::stoi(tokens[3]); // - Pad (id of pad, 0 is at or closest to phi=0 and numbering is clockwise).
result.plane = std::stoi(tokens[4]); // - Plane(id of z plane from 0 upstream to 9 downstream)
result.zToGem = std::stod(tokens[5]); // - ZtoGEM (m)
if(tokens.size() == 6) {
// Files with no true X Y Z hit info
result.time = std::stod(tokens[0]); // - Time of arrival at Pad (ns)
result.adc = std::stod(tokens[1]); // - Amplitude (ADC bin of sample)
result.ring = std::stoi(tokens[2]); // - Ring (id of rin, 0 is innermost).
result.pad = std::stoi(tokens[3]); // - Pad (id of pad, 0 is at or closest to phi=0 and numbering is clockwise).
result.plane = std::stoi(tokens[4]); // - Plane(id of z plane from 0 upstream to 9 downstream)
result.zToGem = std::stod(tokens[5]); // - ZtoGEM (m)

// True hit information is not set
result.true_x = std::numeric_limits<double>::quiet_NaN();
result.true_y = std::numeric_limits<double>::quiet_NaN();
result.true_z = std::numeric_limits<double>::quiet_NaN();
} else {
result.time = std::stod(tokens[0]); // - Time of arrival at Pad (ns)
result.adc = std::stod(tokens[1]); // - Amplitude (ADC bin of sample)
result.true_x = std::stod(tokens[2]); // True X Y Z of hit
result.true_y = std::stod(tokens[3]);
result.true_z = std::stod(tokens[4]);
result.ring = std::stoi(tokens[5]); // - Ring (id of rin, 0 is innermost).
result.pad = std::stoi(tokens[6]); // - Pad (id of pad, 0 is at or closest to phi=0 and numbering is clockwise).
result.plane = std::stoi(tokens[7]); // - Plane(id of z plane from 0 upstream to 9 downstream)
result.zToGem = std::stod(tokens[8]); // - ZtoGEM (m)
}

return true;
}

Expand Down
3 changes: 3 additions & 0 deletions source/tdis/layout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ datatypes :
- int pad // - Pad (id of pad, 0 is at or closest to phi=0 and numbering is clockwise).
- int plane // - Plane(id of z plane from 0 upstream to 9 downstream)
- double zToGem // - ZtoGEM (m)
- double true_x // - True hit x info (quiet_NaN() if not provided)
- double true_y // - True hit y info (quiet_NaN() if not provided)
- double true_z // - True hit z info (quiet_NaN() if not provided)

edm4eic::TrackerHit:
Description: "Tracker hit (reconstructed from Raw)"
Expand Down
11 changes: 8 additions & 3 deletions source/tdis/tdis_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
#include <utility>

#include "CLI/CLI.hpp"
#include "io/PodioWriteProcessor.hpp"
#include "io/DigitizedDataEventSource.hpp"
#include "io/PodioWriteProcessor.hpp"
#include "services/LogService.hpp"
#include "tracking/ActsGeometryService.h"
#include "tracking/ReconstructedHitFactory.h"

struct ProgramArguments {
std::map<std::string, std::string> params;
Expand Down Expand Up @@ -106,12 +108,15 @@ int main(int argc, char* argv[]) {
parameterManager->SetParameter(name, value);
}

JApplication app(parameterManager);

// Register services:
app.ProvideService(std::make_shared<tdis::services::LogService>(&app));
app.ProvideService(std::make_shared<tdis::tracking::ActsGeometryService>());

JApplication app(parameterManager);
app.Add(new JEventSourceGeneratorT<tdis::io::DigitizedDataEventSource>);
app.Add(new tdis::io::PodioWriteProcessor(&app));
app.ProvideService(std::make_shared<tdis::services::LogService>(&app));
app.Add(new JFactoryGeneratorT<tdis::tracking::ReconstructedHitFactory>);
// app.Add(new JEventProcessorPodio);
// app.Add(new JFactoryGeneratorT<ExampleClusterFactory>());
// app.Add(new JFactoryGeneratorT<ExampleMultifactory>());
Expand Down
Loading

0 comments on commit 0c44541

Please sign in to comment.