Modules

The modules directory contains core framework functionality that powers AnalysisG.

Overview

This module provides essential building blocks including:

  • Analysis: Main analysis compiler for defining action chains

  • Container: Data container classes for managing physics objects

  • DataLoader: Efficient data loading and batching

  • Event: Event template system

  • Graph: Graph template for neural networks

  • I/O: ROOT file interface

  • Loss Functions: Training loss implementations

  • Meta: Metadata and introspection utilities

  • Metrics: Performance metrics

  • Model: Machine learning model templates

  • Notification: User notification system

  • Optimizer: Training optimizers

  • Particle: Particle template system

  • Plotting: Visualization utilities

  • SampleTracer: Data provenance tracking

  • Selection: Event selection framework

  • Structs: Core data structures

  • Tools: Utility functions

  • TypeCasting: Type conversion utilities

Key Template Classes

The modules directory provides the following key template classes that users inherit from:

Analysis Module

The analysis class is the main entry point for defining analysis workflows. It orchestrates:

  • Event loading from ROOT files

  • Applying selections

  • Training models

  • Generating outputs

Event Template

The event_template base class defines the interface for physics events:

  • Property system for event attributes

  • Tree/branch/leaf mapping to ROOT

  • Virtual methods: clone(), build(), CompileEvent()

Particle Template

The particle_template represents individual physics objects:

  • 4-momentum representation

  • Parent-child relationships for decay chains

  • Truth matching capabilities

Graph Template

The graph_template is used for GNN applications:

  • Node features from particles

  • Edge features from particle pairs

  • Global graph features from events

Model Template

The model_template standardizes ML models:

  • Training/validation loops

  • Optimizer and loss configuration

  • Metric tracking and logging

Selection Template

The selection_template enables cut-based analyses:

  • Event selection logic

  • Histogram management

  • Cutflow tracking

API Reference

The complete API documentation for module classes is automatically generated from source code using Doxygen and displayed below.

Analysis Class

class analysis : public notification, public tools

Public Functions

analysis()
~analysis()
void add_samples(std::string path, std::string label)
void add_selection_template(selection_template *sel)
void add_event_template(event_template *ev, std::string label)
void add_graph_template(graph_template *gr, std::string label)
void add_metric_template(metric_template *mx, model_template *mdl)
void add_model(model_template *model, optimizer_params_t *op, std::string run_name)
void add_model(model_template *model, std::string run_name)
void attach_threads()
void start()
std::map<std::string, std::vector<float>> progress()
std::map<std::string, std::string> progress_mode()
std::map<std::string, std::string> progress_report()
std::map<std::string, bool> is_complete()

Public Members

settings_t m_settings
std::map<std::string, meta*> meta_data = {}

Container Class

class container : public tools

Public Functions

container()
~container()
void add_meta_data(meta*, std::string)
meta *get_meta_data()
bool add_selection_template(selection_template*)
bool add_event_template(event_template*, std::string label)
bool add_graph_template(graph_template*, std::string label)
void fill_selections(std::map<std::string, selection_template*> *inpt)
void get_events(std::vector<event_template*>*, std::string label)
void populate_dataloader(dataloader *dl)
void compile(size_t *len, int threadIdx)
size_t len()
entry_t *add_entry(std::string hash)

Public Members

meta *meta_data = nullptr
std::string *filename = nullptr
std::string *output_path = nullptr
std::string label = ""
std::map<std::string, entry_t> random_access
std::map<std::string, selection_template*> *merged = nullptr

DataLoader Class

class dataloader : public notification, public tools

Public Functions

dataloader()
~dataloader()
std::vector<graph_t*> *get_k_train_set(int k)
std::vector<graph_t*> *get_k_validation_set(int k)
std::vector<graph_t*> *get_test_set()
std::vector<graph_t*> *build_batch(std::vector<graph_t*> *data, model_template *mdl, model_report *rep)
std::map<std::string, std::vector<graph_t*>> *get_inference()
void generate_test_set(float percentage = 50)
void generate_kfold_set(int k)
void dump_dataset(std::string path)
bool restore_dataset(std::string path)
std::vector<graph_t*> get_random(int num = 5)
void extract_data(graph_t *gr)
void datatransfer(torch::TensorOptions *op, size_t *num_events = nullptr, size_t *prg_events = nullptr)
void datatransfer(std::map<int, torch::TensorOptions*> *ops)
bool dump_graphs(std::string path = "./", int threads = 10)
void restore_graphs(std::vector<std::string> paths, int threads)
void restore_graphs(std::string paths, int threads)
void start_cuda_server()

Public Static Functions

static void safe_delete(std::vector<graph_t*> *data)