RAPIDO
Repeatable Analysis Programming for Interpretability, Durability, and Organization
Loading...
Searching...
No Matches
Cutflow Class Reference

#include <cutflow.h>

Inheritance diagram for Cutflow:
Histflow

Public Member Functions

 Cutflow ()
 
 Cutflow (std::string new_name)
 
 Cutflow (std::string new_name, Cut *new_root)
 
 ~Cutflow ()
 
void setRoot (Cut *new_root)
 
void insert (std::string target_cut_name, Cut *new_cut, Direction direction)
 
void insert (Cut *target_cut, Cut *new_cut, Direction direction)
 
void replace (std::string target_cut_name, Cut *new_cut)
 
void replace (Cut *target_cut, Cut *new_cut)
 
void remove (std::string target_cut_name)
 
void remove (Cut *target_cut)
 
virtual bool run ()
 
bool run (Cut *target_cut)
 
bool run (std::string target_cut_name)
 
std::vector< bool > run (std::vector< Cut * > target_cuts)
 
std::vector< bool > run (std::vector< std::string > target_cuts)
 
bool isProgeny (std::string parent_cut_name, std::string target_cut_name, Direction direction)
 
bool isProgeny (Cut *parent_cut, Cut *target_cut, Direction direction)
 
CutfindTerminus (std::string starting_cut_name)
 
CutfindTerminus (Cut *starting_cut)
 
void print (bool show_timing=false)
 
void write (std::string output_dir="")
 
void writeCSV (std::string output_dir="")
 
void writeMermaid (std::string output_dir="", std::string orientation="TD")
 
void setDebugLambda (std::function< void(Cut *)> new_debugger)
 

Public Attributes

std::string name
 
Utilities::Variables globals
 

Protected Member Functions

CutgetCut (std::string cut_name)
 
bool recursiveSearchProgeny (Cut *cut, Cut *target_cut)
 
CutrecursiveFindTerminus (Cut *cut)
 
void recursivePrint (std::string tabs, Cut *cut, Direction direction, bool show_timing=false)
 
void recursiveWrite (Cut *cut, std::ofstream &ofstream, std::string output_cflow)
 
void recursiveWriteCSV (std::string output_dir, Cut *cut, Direction direction, int csv_idx, Utilities::CSVFiles csv_files)
 
void recursiveWriteMermaid (Cut *cut, std::ofstream &ofstream, std::string output_mmd)
 
virtual bool recursiveEvaluate (Cut *cut)
 
void recursiveDelete (Cut *cut)
 

Protected Attributes

Cutroot
 
std::map< std::string, Cut * > cut_record
 
std::function< void(Cut *)> debugger
 
bool debugger_is_set
 

Detailed Description

An analysis represented as a binary search tree (i.e. analysis = tree, cut = node)

Constructor & Destructor Documentation

◆ Cutflow() [1/3]

Cutflow::Cutflow ( )

Cutflow object default constructor

Returns
none

◆ Cutflow() [2/3]

Cutflow::Cutflow ( std::string new_name)

Cutflow object overload constructor

Parameters
new_namename of cutflow
Returns
none

◆ Cutflow() [3/3]

Cutflow::Cutflow ( std::string new_name,
Cut * new_root )

Cutflow object overload constructor

Parameters
new_namename of cutflow
new_rootpointer to cut object to use as root node
Returns
none

◆ ~Cutflow()

Cutflow::~Cutflow ( )

Cutflow object destructor

Returns
none

Member Function Documentation

◆ findTerminus() [1/2]

Cut * Cutflow::findTerminus ( Cut * starting_cut)

Find the rightmost terminal leaf from a given node

Parameters
starting_cutcut from which to start search
Returns
terminal cut

◆ findTerminus() [2/2]

Cut * Cutflow::findTerminus ( std::string starting_cut_name)

Find the rightmost terminal leaf from a given node

Parameters
starting_cut_namecut from which to start search
Returns
terminal cut

◆ getCut()

Cut * Cutflow::getCut ( std::string cut_name)
protected

(PROTECTED) Retrieve cut object from cut record

Parameters
cut_namecut name
Returns
pointer to cut

◆ insert() [1/2]

void Cutflow::insert ( Cut * target_cut,
Cut * new_cut,
Direction direction )

Insert a new node AFTER a given node

Parameters
target_cutpointer to target node
new_cutpointer to new node
directiondirection (Left/false, Right/true)
Returns
none

◆ insert() [2/2]

void Cutflow::insert ( std::string target_cut_name,
Cut * new_cut,
Direction direction )

Insert a new node AFTER a given node

Parameters
target_cut_nametarget node name
new_cutpointer to new node
directiondirection (Left/false, Right/true)
Returns
none

◆ isProgeny() [1/2]

bool Cutflow::isProgeny ( Cut * parent_cut,
Cut * target_cut,
Direction direction )

Check if a given cut is amongst the progeny of another cut on a certain side of its family tree

Parameters
parent_cutpointer to cut whose progeny will be searched
target_cutpointer to target descendant cut to look for
directionside of the family tree to search (Left/false, Right/true)
Returns
whether or not (true/false) the target cut was found

◆ isProgeny() [2/2]

bool Cutflow::isProgeny ( std::string parent_cut_name,
std::string target_cut_name,
Direction direction )

Check if a given cut is amongst the progeny of another cut on a certain side of its family tree

Parameters
parent_cut_namename of cut whose progeny will be searched
target_cut_namename of target descendant cut to look for
directionside of the family tree to search (Left/false, Right/true)
Returns
whether or not (true/false) the target cut was found

◆ print()

void Cutflow::print ( bool show_timing = false)

Print cutflow

Parameters
show_timingtoggle timing information in printout
Returns
none

◆ recursiveDelete()

void Cutflow::recursiveDelete ( Cut * cut)
protected

(PROTECTED) Recursively delete cuts in the cutflow

Parameters
cutpointer to current cut
Returns
none

◆ recursiveEvaluate()

bool Cutflow::recursiveEvaluate ( Cut * cut)
protectedvirtual

(PROTECTED) Recursively evaulate cuts in the cutflow

Parameters
cutpointer to current cut
Returns
return whether final terminus passed

Reimplemented in Histflow.

◆ recursiveFindTerminus()

Cut * Cutflow::recursiveFindTerminus ( Cut * cut)
protected

(PROTECTED) Recursively search for the rightmost terminal leaf from a given node

Parameters
cutpointer to current cut
Returns
terminal cut

◆ recursivePrint()

void Cutflow::recursivePrint ( std::string tabs,
Cut * cut,
Direction direction,
bool show_timing = false )
protected

(PROTECTED) Recursively print cuts

Parameters
tabsstring with the prefix tabs for current cut
cutpointer to current cut
directiondirection of cut relative to parent
show_timingtoggle timing information in printout
Returns
none

◆ recursiveSearchProgeny()

bool Cutflow::recursiveSearchProgeny ( Cut * cut,
Cut * target_cut )
protected

(PROTECTED) Recursively search for the target cut amongst a given cut's descendants

Parameters
cutpointer to current cut
target_cutpointer to target cut
Returns
whether or not the target cut was found amongst the current cut's descendants

◆ recursiveWrite()

void Cutflow::recursiveWrite ( Cut * cut,
std::ofstream & ofstream,
std::string output_cflow )
protected

(PROTECTED) Recursively write RAPIDO cutflow file

Parameters
cutpointer to current cut
ofstreamstd::ofsteam object for RAPIDO .cflow file
output_cflowname of .cflow file
Returns
none

◆ recursiveWriteCSV()

void Cutflow::recursiveWriteCSV ( std::string output_dir,
Cut * cut,
Direction direction,
int csv_idx,
Utilities::CSVFiles csv_files )
protected

(PROTECTED) Recursively write cutflow level to CSV file(s)

Parameters
output_dirtarget directory for output CSV files
cutpointer to current cut
directiondirection of cut relative to parent
csv_idxindex of target CSV file
csv_filesUtilities::CSVFile object containing for all currently opened CSV files
Returns
none

◆ recursiveWriteMermaid()

void Cutflow::recursiveWriteMermaid ( Cut * cut,
std::ofstream & ofstream,
std::string output_mmd )
protected

(PROTECTED) Recursively write cutflow to a Mermaid (.mmd) file

Parameters
cutpointer to current cut
ofstreamstd::ofstream object for .mmd file
output_mmdname of .mmd file
Returns
none

◆ remove() [1/2]

void Cutflow::remove ( Cut * target_cut)

Remove a given node from the cutflow; will not work with the root node if it has both a left and right child

Parameters
target_cutpointer to target node
Returns
none

◆ remove() [2/2]

void Cutflow::remove ( std::string target_cut_name)

Remove a given node from the cutflow; will not work with the root node if it has both a left and right child

Parameters
target_cut_nametarget node name
Returns
none

◆ replace() [1/2]

void Cutflow::replace ( Cut * target_cut,
Cut * new_cut )

Replace a given node with a new node

Parameters
target_cutpointer to target node
new_cutpointer to new node
Returns
none

◆ replace() [2/2]

void Cutflow::replace ( std::string target_cut_name,
Cut * new_cut )

Replace a given node with a new node

Parameters
target_cut_nametarget node name
new_cutpointer to new node
Returns
none

◆ run() [1/5]

bool Cutflow::run ( )
virtual

Run cutflow until any terminus

Returns
whether or not (true/false) the final terminus passed

◆ run() [2/5]

bool Cutflow::run ( Cut * target_cut)

Run cutflow until a target terminal cut

See also
Cutflow::run
Parameters
target_cutpointer to target cut
Returns
whether or not (true/false) the target cut was reached and passed

◆ run() [3/5]

bool Cutflow::run ( std::string target_cut_name)

Run cutflow and check if a target terminal cut has passed

See also
Cutflow::run
Parameters
target_cut_namename of target cut
Returns
whether or not (true/false) the target cut was reached and passed

◆ run() [4/5]

std::vector< bool > Cutflow::run ( std::vector< Cut * > target_cuts)

Run cutflow and check if any target terminal cut in a given set has passed

See also
Cutflow::run
Parameters
target_cutsstd::vector of pointers to target cuts
Returns
whether or not (true/false) each of the target cuts were reached and passed

◆ run() [5/5]

std::vector< bool > Cutflow::run ( std::vector< std::string > target_cuts)

Run cutflow and check if any target terminal cut in a given set has passed

See also
Cutflow::run
Parameters
target_cutsstd::vector of target cut names
Returns
whether or not (true/false) each of the target cuts were reached and passed

◆ setDebugLambda()

void Cutflow::setDebugLambda ( std::function< void(Cut *)> new_debugger)

Set debug function

Parameters
new_debuggerlambda function that will be run before every cut
Returns
none

◆ setRoot()

void Cutflow::setRoot ( Cut * new_root)

Set root node of cutflow object

Parameters
new_rootpointer to cut object to use as new root node
Returns
none

◆ write()

void Cutflow::write ( std::string output_dir = "")

Write RAPIDO cutflow file

Parameters
output_dirtarget directory for output cutflow files (optional)
Returns
none

◆ writeCSV()

void Cutflow::writeCSV ( std::string output_dir = "")

Print all cutflow paths to separate CSV files {output_dir}/{name}_{terminal_cut}.csv

Parameters
output_dirtarget directory for output CSV files (optional)
Returns
none

◆ writeMermaid()

void Cutflow::writeMermaid ( std::string output_dir = "",
std::string orientation = "TD" )

Print cutflow to a Mermaid flowchart

Parameters
output_dirtarget directory for output .mmd file (optional)
orientationdesired orientation of graph: TD or LR (optional)
Returns
none

Member Data Documentation

◆ cut_record

std::map<std::string, Cut*> Cutflow::cut_record
protected

(PROTECTED) Map ("record") of all cuts in cutflow

◆ debugger

std::function<void(Cut*)> Cutflow::debugger
protected

(PROTECTED) Lambda function that runs before every cut for debugging purposes

◆ debugger_is_set

bool Cutflow::debugger_is_set
protected

(PROTECTED) Flag indicating that a debugger lambda function has been set

◆ globals

Utilities::Variables Cutflow::globals

Dynamic list of variables to track across object scope (i.e. psuedo-members)

◆ name

std::string Cutflow::name

Name of cutflow

◆ root

Cut* Cutflow::root
protected

(PROTECTED) Pointer to cut that is used as the root node


The documentation for this class was generated from the following files: