### Example: Using PidONNXInterface in Analysis Task Source: https://github.com/aliceo2group/o2physics/blob/master/Tools/PIDML/README.md A simple C++ example demonstrating the usage of PidONNXInterface within an analysis task. It shows how to initialize the interface with multiple models and apply it to tracks for particle identification. Configuration parameters like PID vector and certainty limits are important. ```C++ #include "PidONNXInterface.h" // Inside your analysis task's process() function: // Assume pidInterface is an initialized PidONNXInterface instance // Assume track is a valid track object float certainty = pidInterface.applyModel(track); bool accepted = pidInterface.applyModelBoolean(track); ``` -------------------------------- ### Example: Using PidONNXModel in Analysis Task Source: https://github.com/aliceo2group/o2physics/blob/master/Tools/PIDML/README.md A simple C++ example demonstrating how to use the PidONNXModel within an analysis task's process function. It shows how to instantiate the model and apply it to tracks. Requires configuration of CCDB, timestamp, and model path. ```C++ #include "PidONNXModel.h" // Inside your analysis task's process() function: // Assume pidModel is an initialized PidONNXModel instance // Assume track is a valid track object float certainty = pidModel.applyModel(track); bool accepted = pidModel.applyModelBoolean(track); ``` -------------------------------- ### Build O2Physics Task using Ninja Source: https://github.com/aliceo2group/o2physics/blob/master/PWGCF/Tutorial/README.md This advanced method allows for direct compilation of tasks using the ninja build system within the O2Physics environment. It requires loading specific environments and then building the task. Dependencies on CMakeLists.txt modifications are noted, and copying the built executable to the AOD directory is explained, with alternatives like 'ninja install' or alibuild. ```bash cd ~/alice/sw/BUILD/O2Physics-latest-master/O2Physics alienv load ninja/latest O2Physics/latest ninja stage/bin/ # If CMakeLists.txt is modified: cmake . # Copy builded file to AOD directory (optional if using ninja install or alibuild): cp stage/bin/ ../../path/to/AOD/directory/ ``` -------------------------------- ### Install rootcling Wrapper Script with CMake Source: https://github.com/aliceo2group/o2physics/blob/master/packaging/CMakeLists.txt This CMake command installs the rootcling_wrapper.sh script, which is essential for the rootcling build process. It sets specific file permissions (OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ, GROUP_EXECUTE, WORLD_READ, WORLD_EXECUTE) to ensure proper execution and access control. ```cmake install(FILES ../cmake/rootcling_wrapper.sh.in DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2Physics PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Initialize Track Track Task Configuration (C++) Source: https://github.com/aliceo2group/o2physics/blob/master/PWGCF/Tutorial/README.md Initializes the femtoDreamPairTaskTrackTrack with configurable parameters for particle selection, including cut tables and PID information. This setup is essential for the task to process and analyze particle data. ```C++ Configurable> cfgCutTable{"cfgCutTable", {cutsTable[0], nPart, nCuts, partNames, cutNames}, "Particle selections"}; Configurable cfgNspecies{"ccfgNspecies", 2, "Number of particle spieces with PID info"}; Configurable ConfCutPartOne{"ConfCutPartOne", 168072266, "Particle 1 - Selection bit from cutCulator"}; Configurable> ConfPIDPartOne{"ConfPIDPartOne", std::vector{1}, "Particle 1 - Read from cutCulator"}; ``` -------------------------------- ### Build O2Physics Framework with CMake Source: https://context7.com/aliceo2group/o2physics/llms.txt Instructions for cloning, configuring, building, and installing the O2Physics framework using CMake. It specifies C++20 standard and build type, and demonstrates parallel compilation and installation. ```bash # Clone the repository git clone https://github.com/AliceO2Group/O2Physics.git cd O2Physics # Create build directory and configure mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_STANDARD=20 \ .. # Build the project (parallel compilation limited by available memory) cmake --build . -j $(nproc) # Install to target directory cmake --install . --prefix /path/to/install # The framework automatically calculates optimal parallel compilation jobs # based on system memory: (total_memory_MB - 2048) / 2048 ``` -------------------------------- ### Chain multiple analysis tasks in a workflow Source: https://context7.com/aliceo2group/o2physics/llms.txt This demonstrates chaining several O2Physics analysis tasks sequentially using pipes. The workflow starts with timestamping, followed by event selection, track selection, HF candidate creation for 2-prong decays, and finally a D0 analysis task. ```bash o2-analysis-timestamp | \ o2-analysis-event-selection | \ o2-analysis-trackselection | \ o2-analysis-hf-candidate-creator-2prong | \ o2-analysis-hf-task-d0 ``` -------------------------------- ### Run Analysis Workflows (Bash) Source: https://context7.com/aliceo2group/o2physics/llms.txt This bash script provides an example of how to execute analysis tasks using workflow specifications. The actual commands for running the workflows are not provided in the input text, but the presence of a bash code block indicates that command-line execution is a method for managing analysis tasks within the O2Physics project. This typically involves specifying input data, configuration files, and output destinations. ```bash ``` -------------------------------- ### CMake Subdirectory Setup Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/CMakeLists.txt Configures the build system by adding subdirectories to the CMake project. This is a standard CMake practice to manage modular components of a larger project. Each subdirectory typically represents a distinct module or functional area. ```cmake add_subdirectory(Skimming) add_subdirectory(OpenData) add_subdirectory(ML) add_subdirectory(PWGEM) add_subdirectory(PWGUD) add_subdirectory(PWGLF) add_subdirectory(PWGCF) add_subdirectory(PWGMM) add_subdirectory(PWGHF) ``` -------------------------------- ### Create Track Filter with Configurables Source: https://github.com/aliceo2group/o2physics/blob/master/PWGCF/Tutorial/README.md Creates a filter to select tracks based on eta, minimum pt, and maximum pt. Filters are used to select rows from a table that meet specific requirements. This example shows how configurables can be incorporated into filter definitions. ```cpp Filter trackFilter = (nabs(aod::track::eta) < ConfEtaCut) && (aod::track::pt > ConfMinPtCut) && (aod::track::pt < ConfMaxPtCut); ``` -------------------------------- ### Install O2Physics Configuration Files with CMake Source: https://github.com/aliceo2group/o2physics/blob/master/packaging/CMakeLists.txt This CMake command installs essential configuration files for O2Physics, including O2PhysicsConfig.cmake and AddRootDictionary.cmake. These files are placed in the designated CMake installation directory, aiding in the configuration and setup of projects that depend on O2Physics. ```cmake install(FILES O2PhysicsConfig.cmake ../cmake/AddRootDictionary.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2Physics) ``` -------------------------------- ### Running a Simple Analysis Tutorial Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md This command executes a simple analysis tutorial provided by O2Physics. It takes an AOD file as input and generates `.root` and `.json` output files containing the analysis results. ```bash ./o2-analysistutorial-simple-analysis --aod-file -b ``` -------------------------------- ### Configure PID and Species Information Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md Sets up configuration for the number of species with PID information and specific particle selections based on cutCulator output. This involves using `Configurable` for integers and vectors. ```cpp Configurable cfgNspecies{"ccfgNspecies", 2, "Number of particle spieces with PID info"}; Configurable ConfCutPartOne{"ConfCutPartOne", 168072266, "Particle 1 - Selection bit from cutCulator"}; Configurable> ConfPIDPartOne{"ConfPIDPartOne", std::vector{1}, "Particle 1 - Read from cutCulator"}; ``` -------------------------------- ### Install O2Physics Dependencies Directory with CMake Source: https://github.com/aliceo2group/o2physics/blob/master/packaging/CMakeLists.txt This CMake command installs the entire dependencies directory for O2Physics. It copies the contents of the ../dependencies/ directory to the specified installation path, making all dependency-related files available for use by the installed O2Physics library. ```cmake install(DIRECTORY ../dependencies/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2Physics) ``` -------------------------------- ### Build Task with Ninja in O2Physics Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md This snippet demonstrates the advanced method to build a task using the ninja build system within the O2Physics environment. It requires loading specific environments and then building the desired executable. Modifications to CMakeLists.txt require re-running cmake. ```bash cd ~/alice/sw/BUILD/O2Physics-latest-master/O2Physics alienv load ninja/latest O2Physics/latest cmake . ninja stage/bin/ cp stage/bin/ ../../ # or ninja install ``` -------------------------------- ### C++ Joining Data Tables in O2Physics Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md Illustrates how to join different data tables in O2Physics using `soa::Join` to create custom iterators for accessing combined information. This allows for more complex data analysis by linking related data from disparate sources. ```c++ namespace o2::aod { using MyCollision = soa::Join::iterator; using MyTracks = soa::Join; } // namespace o2::aod ``` -------------------------------- ### Run O2Physics Task with Parameters Source: https://github.com/aliceo2group/o2physics/blob/master/PWGCF/Tutorial/README.md Shows how to run an O2Physics task with command-line parameters, including specific named parameters. For tasks with numerous parameters, it recommends using a JSON configuration file for better management and readability. ```bash # With named parameters: o2-analysis-mytask --aod-file [-- ] # With JSON configuration file: o2-analysis-mytask --configuration json:// ``` -------------------------------- ### Export O2Physics Targets with CMake Source: https://github.com/aliceo2group/o2physics/blob/master/packaging/CMakeLists.txt This CMake command exports the O2Physics targets for external use. It specifies the installation destination and the namespace for the exported targets, creating a CMake configuration file to facilitate inter-project dependencies. ```cmake install(EXPORT O2PhysicsTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2Physics NAMESPACE O2Physics:: FILE O2PhysicsTargets.cmake) ``` -------------------------------- ### Install Python Scripts for ALICE O2 Physics Project Source: https://github.com/aliceo2group/o2physics/blob/master/Scripts/CMakeLists.txt Installs the `find_dependencies.py` and `update_ccdb.py` Python scripts into the `share/scripts/` directory. The scripts are granted read and execute permissions for the group and world, along with owner read, write, and execute permissions. This ensures proper execution and access for necessary project operations. ```cmake install(FILES find_dependencies.py update_ccdb.py PERMISSIONS GROUP_READ GROUP_EXECUTE OWNER_EXECUTE OWNER_WRITE OWNER_READ WORLD_EXECUTE WORLD_READ DESTINATION share/scripts/) ``` -------------------------------- ### Pass Task Parameters via JSON Configuration in O2Physics Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md This snippet illustrates the method of providing task parameters using a JSON configuration file. This approach is recommended when dealing with a large number of parameters, improving readability and manageability. ```bash o2-analysis-mytask --configuration json:// ``` -------------------------------- ### C++ Histogram Initialization for O2Physics Analysis Task Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md Demonstrates the initialization of histograms within an O2Physics analysis task using AxisSpec for defining binning strategies (constant and variable width). Histograms are added to a histogram manager for subsequent filling. ```c++ void init(o2::framework::InitContext&) { // Define your axes // Constant bin width axis AxisSpec vtxZAxis = {100, -20, 20}; // Variable bin width axis std::vector ptBinning = {0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4.}; AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; // Add histograms to histogram manager (as in the output object in AliPhysics) histos.add("hZvtx_before_sel", ";Z (cm)", kTH1F, {vtxZAxis}); histos.add("hZvtx_after_sel", ";Z (cm)", kTH1F, {vtxZAxis}); histos.add("hP", ";#it{p} (GeV/#it{c})", kTH1F, {{35, 0.5, 4.}}); histos.add("hPt", ";#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis}); } ``` -------------------------------- ### Initialize Histograms in O2 Analysis Task Source: https://github.com/aliceo2group/o2physics/blob/master/PWGCF/Tutorial/README.md Demonstrates the initialization of histograms within the 'init' method of an O2 analysis task. It shows how to define histogram axes with constant and variable bin widths and add them to the histogram manager for later use. ```c++ void init(o2::framework::InitContext&) { // Define your axes // Constant bin width axis AxisSpec vtxZAxis = {100, -20, 20}; // Variable bin width axis std::vector ptBinning = {0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4.}; AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; // Add histograms to histogram manager (as in the output object in AliPhysics) histos.add("hZvtx_before_sel", ";Z (cm)", kTH1F, {vtxZAxis}); histos.add("hZvtx_after_sel", ";Z (cm)", kTH1F, {vtxZAxis}); histos.add("hP", ";#it{p} (GeV/#it{c})", kTH1F, {{35, 0.5, 4.}}); histos.add("hPt", ";#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis}); } ``` -------------------------------- ### Add EventFilteringUtils Library Source: https://github.com/aliceo2group/o2physics/blob/master/Common/Core/CMakeLists.txt Adds the EventFilteringUtils library with Zorro.cxx and ZorroSummary.cxx as sources and installs ZorroHelper.h and ZorroSummary.h as public headers. It links against O2::Framework, O2::CCDB, ROOT::EG, ROOT::Physics, and Arrow::arrow_shared. ```cmake o2physics_add_library(EventFilteringUtils SOURCES Zorro.cxx ZorroSummary.cxx INSTALL_HEADERS ZorroHelper.h ZorroSummary.h PUBLIC_LINK_LIBRARIES O2::Framework O2::CCDB ROOT::EG O2::CCDB ROOT::Physics Arrow::arrow_shared) ``` -------------------------------- ### Create Event Partitions Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md Defines two partitions for particles based on track type and selection bits obtained from `ConfCutPartOne` and `ConfCutPartTwo`. These partitions are used for analyzing same-event and mixed-event distributions. ```cpp Partition partsOne = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartOne) == ConfCutPartOne); Partition partsTwo = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartOne) == ConfCutPartTwo); ``` -------------------------------- ### Run Dependent Analysis Tasks in O2Physics Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md This snippet illustrates how to run a series of dependent analysis tasks, often referred to as 'helper tasks', before executing the main analysis task. This ensures all necessary prerequisites are met. It uses shell piping for sequential execution. ```bash o2-analysis-timestamp | \ o2-analysis-track-propagation | \ o2-analysis-cf-cf-tutorial-0 --aod-file AO2D.root ``` -------------------------------- ### Define DPL Workflow for spvector using o2physics Source: https://github.com/aliceo2group/o2physics/blob/master/PWGLF/TableProducer/Common/CMakeLists.txt Defines a DPL workflow for processing spvectors. It links against O2Physics::AnalysisCore and O2::DetectorsVertexing libraries and names the component 'Analysis'. This setup is typical for detector-specific analysis modules. ```cmake o2physics_add_dpl_workflow(spvector SOURCES spvector.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing COMPONENT_NAME Analysis) ``` -------------------------------- ### Chaining O2 Analysis Tasks with CCDB Entry Options Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md This command demonstrates a pipeline of O2 analysis tasks, including solutions for potential fatal errors related to non-existing CCDB entries. Options like `--isMC` and `--isRun2MC` are used to configure tasks for Monte Carlo simulations. ```bash o2-analysis-mm-dndeta --aod-file AODmc2.root --aod-memory-rate-limit 100000000000000 -b | \ o2-analysis-pid-tpc -b | \ o2-analysis-pid-tof -b | \ o2-analysis-trackselection -b | \ o2-analysis-trackextension -b | \ o2-analysis-event-selection --isMC -b | \ o2-analysis-timestamp --isRun2MC -b ``` -------------------------------- ### Conditional Packaging and Testing Setup (CMake) Source: https://github.com/aliceo2group/o2physics/blob/master/CMakeLists.txt Adds the 'packaging' subdirectory to the build process only when the current CMake source directory is the top-level directory of the project. This typically enables packaging and testing related build targets at the project root. ```cmake # Testing and packaging only needed if we are the top level directory if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) add_subdirectory(packaging) endif() ``` -------------------------------- ### Add DPL Workflow for V0 Selector Source: https://github.com/aliceo2group/o2physics/blob/master/PWGDQ/Tasks/CMakeLists.txt Sets up a DPL workflow for selecting V0 particles. It uses 'v0selector.cxx' and links libraries for framework, analysis core, DCAFitter, and quality control. ```c++ o2physics_add_dpl_workflow(v0-selector SOURCES v0selector.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DCAFitter O2Physics::AnalysisCore O2Physics::PWGDQCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Add DPL Workflow for Cascade Analysis (MC) Source: https://github.com/aliceo2group/o2physics/blob/master/PWGLF/Tasks/Strangeness/CMakeLists.txt Sets up a DPL workflow for cascade analysis using Monte Carlo simulations. It requires the O2Physics::AnalysisCore library. ```cmake o2physics_add_dpl_workflow(cascadeanalysismc SOURCES cascadeanalysisMC.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Add DPL Workflow for EMCAL Analysis Components Source: https://github.com/aliceo2group/o2physics/blob/master/PWGJE/Tasks/CMakeLists.txt Defines data processing workflows for various EMCAL (Electromagnetic Calorimeter) analysis components. These workflows link source files and public libraries necessary for analysis. Examples include cell monitors, cluster monitors, and calibration tasks. ```cmake o2physics_add_dpl_workflow(emc-cellmonitor SOURCES emcCellMonitor.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emc-clustermonitor SOURCES emcClusterMonitor.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emc-eventselection-qa SOURCES emcEventSelectionQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emc-vertexselection-qa SOURCES emcVertexSelectionQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emcal-gamma-gamma-bc-wise SOURCES emcalGammaGammaBcWise.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emc-pi0-energyscale-calib SOURCES emcalPi0EnergyScaleCalib.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emc-tmmonitor SOURCES emcTmMonitor.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(mc-generator-studies SOURCES mcGeneratorStudies.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(photon-isolation-qa SOURCES photonIsolationQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(photon-charged-trigger-correlation SOURCES photonChargedTriggerCorrelation.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-emc-extensive-mc-qa SOURCES taskEmcExtensiveMcQa.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(photon-charged-trigger-producer SOURCES photonChargedTriggerProducer.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Add Source Directory to CMake Build Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FlowGenericFramework/CMakeLists.txt This CMake command integrates the 'src' directory into the project's build system. It assumes that the 'src' directory contains CMakeLists.txt files that define targets and build rules for the source code within it. No specific inputs or outputs are defined at this level; it's a configuration directive. ```cmake add_subdirectory(src) ``` -------------------------------- ### Add DPL Workflow for Efficiency Calculation Source: https://github.com/aliceo2group/o2physics/blob/master/PWGDQ/Tasks/CMakeLists.txt Sets up a DPL workflow for calculating efficiency. It relies on 'dqEfficiency.cxx' and links core analysis and quality control libraries. ```c++ o2physics_add_dpl_workflow(efficiency SOURCES dqEfficiency.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Pass Task Parameters via Command Line in O2Physics Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md This snippet demonstrates how to pass parameters to an analysis task directly from the command line. It shows the basic structure for including task-specific parameters with their values. ```bash o2-analysis-mytask --aod-file [-- ] ``` -------------------------------- ### Define Custom Data Model Tables (C++) Source: https://context7.com/aliceo2group/o2physics/llms.txt This C++ code defines custom data model tables using the ALICE O2 framework's SOA (Structure of Arrays) pattern. It includes definitions for secondary vertex information and particle identification (PID) using TPC and TOF detectors. The example demonstrates how to declare columns, create tables, and use them in analysis code for track processing with PID information. Dependencies include the O2 analysis framework's SOA and data model headers. ```cpp // Data model definitions from PWGHF/DataModel/CandidateReconstructionTables.h namespace o2::aod { namespace hf_cand { DECLARE_SOA_INDEX_COLUMN(Collision, collision); DECLARE_SOA_COLUMN(XSecondaryVertex, xSecondaryVertex, float); DECLARE_SOA_COLUMN(YSecondaryVertex, ySecondaryVertex, float); DECLARE_SOA_COLUMN(ZSecondaryVertex, zSecondaryVertex, float); DECLARE_SOA_COLUMN(Chi2PCA, chi2PCA, float); DECLARE_SOA_DYNAMIC_COLUMN(RSecondaryVertex, rSecondaryVertex, [](float xVtxS, float yVtxS) -> float { return RecoDecay::sqrtSumOfSquares(xVtxS, yVtxS); }); } // Particle identification tables namespace pid_tpc_tof_full { DECLARE_SOA_COLUMN(TpcTofNSigmaPi, tpcTofNSigmaPi, float); DECLARE_SOA_COLUMN(TpcTofNSigmaKa, tpcTofNSigmaKa, float); DECLARE_SOA_COLUMN(TpcTofNSigmaPr, tpcTofNSigmaPr, float); } DECLARE_SOA_TABLE(PidTpcTofFullPi, "AOD", "PIDTPCTOFFULLPI", pid_tpc_tof_full::TpcTofNSigmaPi); DECLARE_SOA_TABLE(PidTpcTofFullKa, "AOD", "PIDTPCTOFFULLKA", pid_tpc_tof_full::TpcTofNSigmaKa); // Usage in analysis code using TracksWithPID = soa::Join; void process(TracksWithPID const& tracks) { for (const auto& track : tracks) { float nSigmaPion = track.tpcTofNSigmaPi(); float nSigmaKaon = track.tpcTofNSigmaKa(); if (std::abs(nSigmaPion) < 3.0) { // Track identified as pion } } } } // namespace o2::aod ``` -------------------------------- ### Add DPL Workflow for Lambda Polarization Source: https://github.com/aliceo2group/o2physics/blob/master/PWGLF/Tasks/Strangeness/CMakeLists.txt Sets up a DPL workflow for lambda polarization measurements. It requires the O2Physics::AnalysisCore library. ```cmake o2physics_add_dpl_workflow(lambdapolarization SOURCES lambdapolarization.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Join Data Tables in O2 Physics Source: https://github.com/aliceo2group/o2physics/blob/master/PWGCF/Tutorial/README.md Demonstrates how to join different data tables in O2Physics using 'soa::Join'. This allows combining related information from disparate sources, such as collisions with event selections and multiplicity data, or tracks with various PID information. ```c++ namespace o2::aod { using MyCollision = soa::Join::iterator; using MyTracks = soa::Join; } // namespace o2::aod ``` -------------------------------- ### Add DPL Workflow with o2physics_add_dpl_workflow Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGMM/CMakeLists.txt This snippet shows how to add a Data Processing Library (DPL) workflow to the O2 Physics project. It specifies the task name, the source C++ file containing the task implementation, the public link libraries required by the task, and the name of the component. ```bash o2physics_add_dpl_workflow(my-example-task SOURCES myExampleTask.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME AnalysisTutorial) ``` -------------------------------- ### Add DPL Workflow for Flow Analysis Source: https://github.com/aliceo2group/o2physics/blob/master/PWGDQ/Tasks/CMakeLists.txt Sets up a DPL workflow for flow analysis in heavy-ion collisions. It uses 'dqFlow.cxx' and links libraries for framework, analysis core, quality control, and the GFWCore. ```c++ o2physics_add_dpl_workflow(flow SOURCES dqFlow.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore O2Physics::GFWCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Run Skim Production Script (Bash) Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGHF/README.md This bash script executes the mini skim creator workflow. It processes input files specified in `input_skim.txt`, uses `dpl-config_skim.json` for configuration, and generates `AnalysisResults_trees.root` and `AnalysisResults.root` files. The script assumes it's run from the working directory. ```bash #!/bin/bash # Define the executable name EXECUTABLE=o2-analysistutorial-hf-skim-creator-mini # Define configuration files CONFIG_SKIM="dpl-config_skim.json" INPUT_SKIM="input_skim.txt" # Construct the command CMD="$EXECUTABLE --skip-digits -b -m" CMD="$CMD --skipEvents 0 -n 1000000000" CMD="$CMD --configuration $CONFIG_SKIM" CMD="$CMD --inputFileList $INPUT_SKIM" # Print and execute the command echo "Running skim creator:" echo $CMD $CMD echo "Skim production finished." ``` -------------------------------- ### Add DPL Workflow for FemtoKinkQa Source: https://github.com/aliceo2group/o2physics/blob/master/PWGCF/Femto/Tasks/CMakeLists.txt Sets up the 'femto-kink-qa' DPL workflow. The workflow uses 'femtoKinkQa.cxx' as its source file and requires linking against 'O2::Framework' and 'O2Physics::AnalysisCore'. It's registered as an 'Analysis' component. ```cmake o2physics_add_dpl_workflow(femto-kink-qa SOURCES femtoKinkQa.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Prepare Samples using Python Script Source: https://github.com/aliceo2group/o2physics/blob/master/PWGHF/D2H/Macros/ML/README.md This script prepares labeled data samples for ML training. It takes a YAML configuration file as input, which specifies parameters for data preparation. The script generates .root files containing the prepared data. ```python python3 prepare_samples.py config_preparation_DplusToPiKPi.yml ``` -------------------------------- ### Add DPL Workflow for Strangeness Analysis (O2Physics) Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGLF/Strangeness/Original/CMakeLists.txt This code snippet demonstrates how to add a Data Processing Language (DPL) workflow for the strangeness analysis tutorial using the `o2physics_add_dpl_workflow` function. It specifies the source files and the necessary libraries for each step of the analysis. ```O2Physics o2physics_add_dpl_workflow(strangeness-skeleton SOURCES strangeness_skeleton.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME AnalysisTutorial) ``` ```O2Physics o2physics_add_dpl_workflow(strangeness-step0 SOURCES strangeness_step0.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME AnalysisTutorial) ``` ```O2Physics o2physics_add_dpl_workflow(strangeness-step1 SOURCES strangeness_step1.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME AnalysisTutorial) ``` ```O2Physics o2physics_add_dpl_workflow(strangeness-step2 SOURCES strangeness_step2.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME AnalysisTutorial) ``` ```O2Physics o2physics_add_dpl_workflow(strangeness-step3 SOURCES strangeness_step3.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME AnalysisTutorial) ``` ```O2Physics o2physics_add_dpl_workflow(strangeness-step4 SOURCES strangeness_step4.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME AnalysisTutorial) ``` -------------------------------- ### Add DPL Workflow for Candidate Creator Source: https://github.com/aliceo2group/o2physics/blob/master/PWGHF/ALICE3/TableProducer/CMakeLists.txt Defines a Direct Programming Language (DPL) workflow for a candidate creator component. It requires source files and links to necessary libraries like O2Physics::AnalysisCore and O2::DCAFitter. ```cmake o2physics_add_dpl_workflow(candidate-creator-chic SOURCES candidateCreatorChic.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter COMPONENT_NAME Analysis) ``` ```cmake o2physics_add_dpl_workflow(candidate-creator-x SOURCES candidateCreatorX.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter COMPONENT_NAME Analysis) ``` -------------------------------- ### Run Dependent O2Physics Tasks Source: https://github.com/aliceo2group/o2physics/blob/master/PWGCF/Tutorial/README.md Demonstrates how to run a task that has dependencies on other 'helper tasks'. These tasks are executed sequentially, often using pipes, before the main analysis task. This ensures all necessary intermediate data or configurations are processed. ```bash o2-analysis-timestamp | \ o2-analysis-track-propagation | \ o2-analysis-cf-cf-tutorial-0 --aod-file AO2D.root ``` -------------------------------- ### Add Library for PWGDQCore Source: https://github.com/aliceo2group/o2physics/blob/master/PWGDQ/Core/CMakeLists.txt Defines a new library named 'PWGDQCore' using the 'o2physics_add_library' macro. It lists the source files (.cxx) and public link libraries required for this library. Dependencies include O2::Framework, O2::DCAFitter, O2::GlobalTracking, O2Physics::AnalysisCore, KFParticle::KFParticle, and O2Physics::MLCore. ```cmake o2physics_add_library(PWGDQCore SOURCES VarManager.cxx HistogramManager.cxx HistogramsLibrary.cxx CutsLibrary.cxx MixingLibrary.cxx MCSignalLibrary.cxx MixingHandler.cxx AnalysisCut.cxx AnalysisCompositeCut.cxx MCProng.cxx MCSignal.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2::GlobalTracking O2Physics::AnalysisCore KFParticle::KFParticle O2Physics::MLCore) ``` -------------------------------- ### Initialize Correlation Event Containers (C++) Source: https://github.com/aliceo2group/o2physics/blob/master/PWGCF/Tutorial/README.md Initializes containers for storing same-event and mixed-event $k^{*}$ distributions. These containers will be populated with particle pairs to facilitate the calculation of correlation functions. ```C++ FemtoDreamContainer sameEventCont; FemtoDreamContainer mixedEventCont; ``` -------------------------------- ### Run Mini Task Script (Bash) Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGHF/README.md This bash script executes the mini task workflow for D0 analysis. It processes input files defined in `input_task.txt`, uses `dpl-config_task.json` for configuration, and generates analysis histograms in `AnalysisResults.root`. The script also handles potential overrides for the AOD parent file path. ```bash #!/bin/bash # Define the executable name EXECUTABLE=o2-analysistutorial-hf-task-mini # Define configuration files CONFIG_TASK="dpl-config_task.json" INPUT_TASK="input_task.txt" # Define optional AOD parent path replacement # Example: Replace "old-path" with "new-path" AOD_PARENT_PATH_REPLACEMENT="" # Construct the command CMD="$EXECUTABLE -b -m" CMD="$CMD --skipEvents 0 -n 1000000000" CMD="$CMD --configuration $CONFIG_TASK" CMD="$CMD --inputFileList $INPUT_TASK" # Add AOD parent path replacement if provided if [ -n "$AOD_PARENT_PATH_REPLACEMENT" ]; then CMD="$CMD --aod-parent-base-path-replacement \"$AOD_PARENT_PATH_REPLACEMENT\"" fi # Print and execute the command echo "Running mini task:" echo $CMD $CMD echo "Mini task finished." ``` -------------------------------- ### Add DPL Workflow: photon-conversion-builder Source: https://github.com/aliceo2group/o2physics/blob/master/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt Defines a DPL workflow for building photon conversions. It depends on O2::Framework, O2::DCAFitter, O2Physics::AnalysisCore, KFParticle::KFParticle, and O2Physics::TPCDriftManager. The source is photonconversionbuilder.cxx and the component is Analysis. ```cxx o2physics_add_dpl_workflow(photon-conversion-builder SOURCES photonconversionbuilder.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2Physics::AnalysisCore KFParticle::KFParticle O2Physics::TPCDriftManager COMPONENT_NAME Analysis) ``` -------------------------------- ### Add DPL Workflow for SJet Tree Creator (with FastJet) Source: https://github.com/aliceo2group/o2physics/blob/master/PWGLF/Tasks/Strangeness/CMakeLists.txt Configures a DPL workflow to create trees for SJet analysis, incorporating FastJet. Libraries needed are O2Physics::AnalysisCore, O2Physics::PWGJECore, and FastJet libraries. ```cmake o2physics_add_dpl_workflow(sjet-tree-creator SOURCES sjetTreeCreator.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib COMPONENT_NAME Analysis) endif() ``` -------------------------------- ### Configure Particle Selection Table Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md Configures the cut table for particle selections using the `Configurable` class. It takes the static cut table, number of parts, number of cuts, particle names, and cut names as input. ```cpp Configurable> cfgCutTable{"cfgCutTable", {cutsTable[0], nPart, nCuts, partNames, cutNames}, "Particle selections"}; ``` -------------------------------- ### Generate Tutorial Data with DQFitter Source: https://github.com/aliceo2group/o2physics/blob/master/PWGDQ/Macros/README.md Generates a tutorial data sample for dilepton invariant mass distributions using the DQFitter class. This function is typically called via the tutorial.py script with a specified configuration file. ```python python tutorial.py configFit.json --gen_tutorial ``` -------------------------------- ### Define DPL Workflow for Dstar Output Jet Substructure Analysis Source: https://github.com/aliceo2group/o2physics/blob/master/PWGJE/Tasks/CMakeLists.txt Sets up a DPL workflow for the Dstar output jet substructure analysis. It details the source file and the libraries to be linked. ```cmake o2physics_add_dpl_workflow(jet-substructure-dstar-output SOURCES jetSubstructureDstarOutput.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Add DPL Workflow for V0 Cascade Absorption Source: https://github.com/aliceo2group/o2physics/blob/master/PWGLF/Tasks/Strangeness/CMakeLists.txt Sets up a DPL workflow for analyzing V0 cascade absorption. The workflow depends on O2Physics::AnalysisCore. ```cmake o2physics_add_dpl_workflow(vzero-cascade-absorption SOURCES vzero_cascade_absorption.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) ``` -------------------------------- ### C++ Data Processing and Event Selection in O2Physics Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md Shows how to process data tables (collisions and tracks) and perform basic event selection based on collision position. It fills histograms before and after the selection, and iterates through tracks to fill momentum-related histograms. ```c++ void process(aod::Collision const& coll, aod::Tracks const& inputTracks) { // Performing the event selection histos.fill(HIST("hZvtx_before_sel"), coll.posZ()); if (fabs(coll.posZ()) > 10.f) { return; } histos.fill(HIST("hZvtx_after_sel"), coll.posZ()); for (auto track : inputTracks) { // Loop over tracks histos.fill(HIST("hP"), track.p()); histos.fill(HIST("hPt"), track.pt()); } } ``` -------------------------------- ### Add DPL Workflow for Lambda Polarization SP Source: https://github.com/aliceo2group/o2physics/blob/master/PWGLF/Tasks/Strangeness/CMakeLists.txt Configures a DPL workflow for lambda polarization measurements using a specific method (SP). It depends on O2Physics::AnalysisCore. ```cmake o2physics_add_dpl_workflow(lambdapolsp SOURCES lambdapolsp.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Add DPL Workflow for Correlation Analysis Source: https://github.com/aliceo2group/o2physics/blob/master/PWGDQ/Tasks/CMakeLists.txt Sets up a DPL workflow for correlation analysis. It uses 'dqCorrelation.cxx' and links libraries for framework, analysis core, quality control, and the GFWCore. ```c++ o2physics_add_dpl_workflow(correlation SOURCES dqCorrelation.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore O2Physics::GFWCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Searching for Missing TTree in O2Physics Source Code Source: https://github.com/aliceo2group/o2physics/blob/master/Tutorials/PWGCF/FemtoFramework/doc/README.md This snippet demonstrates how to use `grep` to search for a missing TTree name within the O2Physics source code. This helps in identifying the C++ file responsible for producing the table and subsequently finding the associated task name in CMakeLists.txt. ```shell grep -rnw . -e "PIDTOFKA" grep -rnw . -e "PIDTOFKa" grep -rnw . -e "pidTOFKa" ``` -------------------------------- ### Define DPL Workflow for Bplus Output Jet Substructure Analysis Source: https://github.com/aliceo2group/o2physics/blob/master/PWGJE/Tasks/CMakeLists.txt Sets up a DPL workflow for the Bplus output jet substructure analysis. It includes the source file and the libraries to link. ```cmake o2physics_add_dpl_workflow(jet-substructure-bplus-output SOURCES jetSubstructureBplusOutput.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Add DPL Workflow for K0 Mixed Events Source: https://github.com/aliceo2group/o2physics/blob/master/PWGLF/Tasks/Strangeness/CMakeLists.txt Configures a DPL workflow to analyze mixed events for K0 particles. It requires the O2Physics::AnalysisCore library. ```cmake o2physics_add_dpl_workflow(k0mixedevents SOURCES k0_mixed_events.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Add DPL Workflow for Strangeness in Jets (Ions, with FastJet) Source: https://github.com/aliceo2group/o2physics/blob/master/PWGLF/Tasks/Strangeness/CMakeLists.txt Sets up a DPL workflow for analyzing strangeness in jets for ion collisions, using FastJet. Dependencies include O2Physics::AnalysisCore, O2Physics::PWGJECore, FastJet libraries, and O2Physics::EventFilteringUtils. ```cmake o2physics_add_dpl_workflow(strangeness-in-jets-ions SOURCES strangenessInJetsIons.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) ``` -------------------------------- ### Add DPL Workflow for Cascade Polarization SP Source: https://github.com/aliceo2group/o2physics/blob/master/PWGLF/Tasks/Strangeness/CMakeLists.txt Configures a DPL workflow for cascade polarization measurements using a specific method (SP). It depends on O2Physics::AnalysisCore. ```cmake o2physics_add_dpl_workflow(cascpolsp SOURCES cascpolsp.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) ``` -------------------------------- ### Define DPL Workflow - QA Impact Parameter Source: https://github.com/aliceo2group/o2physics/blob/master/DPG/Tasks/AOTTrack/CMakeLists.txt Defines a DPL workflow for QA impact parameter analysis. It uses qaImpPar.cxx and links to O2Physics::AnalysisCore, O2::ReconstructionDataFormats, O2::DetectorsCommonDataFormats, and O2::DetectorsVertexing, as an 'Analysis' component. ```cmake o2physics_add_dpl_workflow(qa-impact-parameter SOURCES qaImpPar.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2::DetectorsVertexing COMPONENT_NAME Analysis) ``` -------------------------------- ### Add DPL Workflow for Strange Correlation Analysis Source: https://github.com/aliceo2group/o2physics/blob/master/PWGLF/Tasks/Strangeness/CMakeLists.txt Sets up a DPL workflow for analyzing strange correlations. This workflow requires O2::Framework, O2::DetectorsBase, O2Physics::AnalysisCore, and O2Physics::EventFilteringUtils. ```cmake o2physics_add_dpl_workflow(hstrangecorrelation SOURCES hStrangeCorrelation.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) ``` -------------------------------- ### Add DPL Workflow for mc-simple-qc Source: https://github.com/aliceo2group/o2physics/blob/master/DPG/Tasks/Monitor/MC/CMakeLists.txt This snippet demonstrates adding a DPL workflow for the 'task-mc-simple-qc' task. It specifies the source file 'taskMcSimpleQC.cxx' and links to the 'O2::Framework' and 'O2Physics::AnalysisCore' libraries. The component is named 'Analysis'. ```shell o2physics_add_dpl_workflow(task-mc-simple-qc SOURCES taskMcSimpleQC.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) ```