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

#include <histflow.h>

Inheritance diagram for Histflow:
Cutflow

Public Member Functions

 Histflow (std::string new_name)
 
 Histflow (std::string new_name, Cut *new_root)
 
 ~Histflow ()
 
template<typename THist1D >
void bookHist1D (std::string target_cut_name, THist1D *hist, std::function< bool()> eval_lambda, std::function< double()> fill_lambda)
 
template<typename THist1D >
void bookHist1D (Cut *target_cut, THist1D *hist, std::function< bool()> eval_lambda, std::function< double()> fill_lambda)
 
template<typename THist1D >
void bookHist1D (std::string target_cut_name, THist1D *hist, std::function< double()> fill_lambda)
 
template<typename THist1D >
void bookHist1D (Cut *target_cut, THist1D *hist, std::function< double()> fill_lambda)
 
template<typename THist2D >
void bookHist2D (std::string target_cut_name, THist2D *hist, std::function< bool()> eval_lambda, std::function< std::pair< double, double >()> fill_lambda)
 
template<typename THist2D >
void bookHist2D (Cut *target_cut, THist2D *hist, std::function< bool()> eval_lambda, std::function< std::pair< double, double >()> fill_lambda)
 
template<typename THist2D >
void bookHist2D (std::string target_cut_name, THist2D *hist, std::function< std::pair< double, double >()> fill_lambda)
 
template<typename THist2D >
void bookHist2D (Cut *target_cut, THist2D *hist, std::function< std::pair< double, double >()> fill_lambda)
 
template<typename THist3D >
void bookHist3D (std::string target_cut_name, THist3D *hist, std::function< bool()> eval_lambda, std::function< std::tuple< double, double, double >()> fill_lambda)
 
template<typename THist3D >
void bookHist3D (Cut *target_cut, THist3D *hist, std::function< bool()> eval_lambda, std::function< std::tuple< double, double, double >()> fill_lambda)
 
template<typename THist3D >
void bookHist3D (std::string target_cut_name, THist3D *hist, std::function< std::tuple< double, double, double >()> fill_lambda)
 
template<typename THist3D >
void bookHist3D (Cut *target_cut, THist3D *hist, std::function< std::tuple< double, double, double >()> fill_lambda)
 
void writeHists (TFile *tfile)
 
- Public Member Functions inherited from Cutflow
 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)
 

Protected Member Functions

bool recursiveEvaluate (Cut *cut) override
 
template<typename THist >
THist * bookHist (std::string target_cut_name, THist *hist)
 
- Protected Member Functions inherited from Cutflow
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)
 
void recursiveDelete (Cut *cut)
 

Protected Attributes

std::map< std::string, std::vector< std::function< void(double)> > > fill_schedule
 
std::map< TString, std::function< void()> > hist_writers
 
- Protected Attributes inherited from Cutflow
Cutroot
 
std::map< std::string, Cut * > cut_record
 
std::function< void(Cut *)> debugger
 
bool debugger_is_set
 

Additional Inherited Members

- Public Attributes inherited from Cutflow
std::string name
 
Utilities::Variables globals
 

Detailed Description

Modified Cutflow object that fills booked histograms after passing a given set of cuts

Constructor & Destructor Documentation

◆ Histflow() [1/2]

Histflow::Histflow ( std::string new_name)

Histflow overload constructor

Parameters
new_namename of histflow
Returns
none

◆ Histflow() [2/2]

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

Histflow overload constructor

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

◆ ~Histflow()

Histflow::~Histflow ( )

Histflow destructor

Returns
none

Member Function Documentation

◆ bookHist()

template<typename THist >
THist * Histflow::bookHist ( std::string target_cut_name,
THist * hist )
protected

(PROTECTED) Handle internal scheduling for Histflow::bookHist1D and Histflow::bookHist2D

Parameters
target_cut_nametarget node name
histpointer to 1D ROOT histogram to schedule
Returns
pointer to new copy of input histogram

◆ bookHist1D() [1/4]

template<typename THist1D >
void Histflow::bookHist1D ( Cut * target_cut,
THist1D * hist,
std::function< bool()> eval_lambda,
std::function< double()> fill_lambda )

Schedule a ROOT 1D histogram for a given cut

Parameters
target_cutpointer to target node
histpointer to 1D ROOT histogram to schedule
eval_lambdalambda function that computes whether histogram should be filled
fill_lambdalambda function that computes the value used to fill the histogram
Returns
none

◆ bookHist1D() [2/4]

template<typename THist1D >
void Histflow::bookHist1D ( Cut * target_cut,
THist1D * hist,
std::function< double()> fill_lambda )

Schedule a ROOT 1D histogram for a given cut

Parameters
target_cutpointer to target node
histpointer to 1D ROOT histogram to schedule
fill_lambdalambda function that computes the value used to fill the histogram
Returns
none

◆ bookHist1D() [3/4]

template<typename THist1D >
void Histflow::bookHist1D ( std::string target_cut_name,
THist1D * hist,
std::function< bool()> eval_lambda,
std::function< double()> fill_lambda )

Schedule a ROOT 1D histogram for a given cut

Parameters
target_cut_nametarget node name
histpointer to 1D ROOT histogram to schedule
eval_lambdalambda function that computes whether histogram should be filled
fill_lambdalambda function that computes the value used to fill the histogram
Returns
none

◆ bookHist1D() [4/4]

template<typename THist1D >
void Histflow::bookHist1D ( std::string target_cut_name,
THist1D * hist,
std::function< double()> fill_lambda )

Schedule a ROOT 1D histogram for a given cut

Parameters
target_cut_nametarget node name
histpointer to 1D ROOT histogram to schedule
fill_lambdalambda function that computes the value used to fill the histogram
Returns
none

◆ bookHist2D() [1/4]

template<typename THist2D >
void Histflow::bookHist2D ( Cut * target_cut,
THist2D * hist,
std::function< bool()> eval_lambda,
std::function< std::pair< double, double >()> fill_lambda )

Schedule a ROOT 2D histogram for a given cut

Parameters
target_cutpointer to target node
histpointer to 2D ROOT histogram to schedule
eval_lambdalambda function that computes whether histogram should be filled
fill_lambdalambda function that computes the values used to fill the histogram
Returns
none

◆ bookHist2D() [2/4]

template<typename THist2D >
void Histflow::bookHist2D ( Cut * target_cut,
THist2D * hist,
std::function< std::pair< double, double >()> fill_lambda )

Schedule a ROOT 2D histogram for a given cut

Parameters
target_cutpointer to target node
histpointer to ROOT 2D histogram to schedule
fill_lambdalambda function that computes the values used to fill the histogram
Returns
none

◆ bookHist2D() [3/4]

template<typename THist2D >
void Histflow::bookHist2D ( std::string target_cut_name,
THist2D * hist,
std::function< bool()> eval_lambda,
std::function< std::pair< double, double >()> fill_lambda )

Schedule a ROOT 2D histogram for a given cut

Parameters
target_cut_nametarget node name
histpointer to 2D ROOT histogram to schedule
eval_lambdalambda function that computes whether histogram should be filled
fill_lambdalambda function that computes the values used to fill the histogram
Returns
none

◆ bookHist2D() [4/4]

template<typename THist2D >
void Histflow::bookHist2D ( std::string target_cut_name,
THist2D * hist,
std::function< std::pair< double, double >()> fill_lambda )

Schedule a ROOT 2D histogram for a given cut

Parameters
target_cut_nametarget node name
histpointer to ROOT 2D histogram to schedule
fill_lambdalambda function that computes the values used to fill the histogram
Returns
none

◆ bookHist3D() [1/4]

template<typename THist3D >
void Histflow::bookHist3D ( Cut * target_cut,
THist3D * hist,
std::function< bool()> eval_lambda,
std::function< std::tuple< double, double, double >()> fill_lambda )

Schedule a ROOT 3D histogram for a given cut

Parameters
target_cutpointer to target node
histpointer to 3D ROOT histogram to schedule
eval_lambdalambda function that computes whether histogram should be filled
fill_lambdalambda function that computes the values used to fill the histogram
Returns
none

◆ bookHist3D() [2/4]

template<typename THist3D >
void Histflow::bookHist3D ( Cut * target_cut,
THist3D * hist,
std::function< std::tuple< double, double, double >()> fill_lambda )

Schedule a ROOT 3D histogram for a given cut

Parameters
target_cutpointer to target node
histpointer to ROOT 3D histogram to schedule
fill_lambdalambda function that computes the values used to fill the histogram
Returns
none

◆ bookHist3D() [3/4]

template<typename THist3D >
void Histflow::bookHist3D ( std::string target_cut_name,
THist3D * hist,
std::function< bool()> eval_lambda,
std::function< std::tuple< double, double, double >()> fill_lambda )

Schedule a ROOT 3D histogram for a given cut

Parameters
target_cut_nametarget node name
histpointer to 3D ROOT histogram to schedule
eval_lambdalambda function that computes whether histogram should be filled
fill_lambdalambda function that computes the values used to fill the histogram
Returns
none

◆ bookHist3D() [4/4]

template<typename THist3D >
void Histflow::bookHist3D ( std::string target_cut_name,
THist3D * hist,
std::function< std::tuple< double, double, double >()> fill_lambda )

Schedule a ROOT 3D histogram for a given cut

Parameters
target_cut_nametarget node name
histpointer to ROOT 3D histogram to schedule
fill_lambdalambda function that computes the values used to fill the histogram
Returns
none

◆ recursiveEvaluate()

bool Histflow::recursiveEvaluate ( Cut * cut)
overrideprotectedvirtual

(PROTECTED) Additional definition that recursively evaluates cuts in cutflow and fills scheduled histograms when appropriate cuts are passed

Parameters
cutpointer to current cut
Returns
return whether final terminus passed

Reimplemented from Cutflow.

◆ writeHists()

void Histflow::writeHists ( TFile * tfile)

Write all histograms to a given TFile

Parameters
tfilepointer to ROOT TFile to write histograms to
Returns
none

Member Data Documentation

◆ fill_schedule

std::map<std::string, std::vector<std::function<void(double)> > > Histflow::fill_schedule
protected

"Schedule" dictating when to fill certain histograms

◆ hist_writers

std::map<TString, std::function<void()> > Histflow::hist_writers
protected

Collection of functions that write histograms to opened TFile


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