PandaRoot
PndHistoCombiner Class Reference

Combines histograms with the same name from different files in one overlay histogram. More...

#include <PndHistoCombiner.h>

Inheritance diagram for PndHistoCombiner:

Classes

struct  fileData
 

Public Member Functions

 PndHistoCombiner ()
 
virtual ~PndHistoCombiner ()
 
void AddFileNamesAndShortName (TString fileName, TString shortName)
 Adds the file which contain the histos to be plotted together. First file is the one comparisons are made to. More...
 
int GenerateHistos ()
 Main method to generate histograms. More...
 
int GenerateBranches ()
 Main method to generate histograms from branches. More...
 
void AddHistoSelector (TString histoName)
 Only those histograms are combined with part of their matching the histoName. More...
 
void AddBranchSelector (TString branchName)
 Only those branches are combined with part of their matching the branchName. More...
 
void SetPicPerCan (int val)
 pictures per canvas. They will be organized in a quadratic way More...
 
void SetCanvasPrefix (TString val)
 
void SetCanvasOutputDir (TString val)
 
void SetCanvasOutputFormat (TString val)
 
void SetPulls (bool dopulls=true)
 
void SetDimensions (int x=400, int y=300)
 
void DoTest (int val=0, double threshold=0.03)
 perform Kolmogorov or chi2 test between histograms of first file and all others. More...
 
void SetCDashOutput (bool val=true)
 Select to generate output string automatically to upload data to CDASH server. More...
 
void CreateCDashOutput ()
 Generate output string to upload data to CDASH server This can be called automatically or by hand. More...
 

Protected Member Functions

void InitFiles ()
 
bool CheckHistoName (TString histoName)
 
bool CheckBranchName (TString branchName)
 
bool CheckBranchType (TString branchType)
 
void DrawAndTestHistoStack (std::vector< TH1 *> &histos)
 
std::pair< TPad *, TPad * > SplitPadForPulls ()
 
void DrawPulls (std::vector< TH1 *> &histos)
 
void CreateLegend (std::vector< TH1 *> &histos)
 
double PerformTest (TH1 *h1, TH1 *h2)
 
bool TestPassed (double result, double threshold)
 
void AddCDashOutput (TString prefix, TString histoName, double value)
 Add to output string to upload data to CDASH server. More...
 
TString RemoveSpecialCharacters (TString input)
 

Detailed Description

Combines histograms with the same name from different files in one overlay histogram.

The class runs through all histograms or brnaches of the first file given and checks if histograms/branches with the same name exist in the other files. If this is the case they are plotted into a common histogram via the option "same". The legend of the histogram is filled with the short name given by the user. The histograms are saved in a canvas as jpg files. The number of histograms per canvas can be set. In addition it is possible to perform a Kolmogorov or Chisquare test between the first and all other histograms in one stack. If the test fail the word "FAILED" will be added to the title of the histogram. Furthermore, a cdash output can be created which uploads the probability of the test to the cdash server.

Author
Tobias Stockmanns t.sto.nosp@m.ckma.nosp@m.nns@f.nosp@m.z-ju.nosp@m.elich.nosp@m..de
Date
2021-06-01

Definition at line 30 of file PndHistoCombiner.h.

Constructor & Destructor Documentation

◆ PndHistoCombiner()

PndHistoCombiner::PndHistoCombiner ( )

◆ ~PndHistoCombiner()

virtual PndHistoCombiner::~PndHistoCombiner ( )
virtual

Member Function Documentation

◆ AddBranchSelector()

void PndHistoCombiner::AddBranchSelector ( TString  branchName)
inline

Only those branches are combined with part of their matching the branchName.

Parameters
branchNamepart of the histo name to be compared

Definition at line 76 of file PndHistoCombiner.h.

76 { fBranchSelector.push_back(branchName); }

◆ AddCDashOutput()

void PndHistoCombiner::AddCDashOutput ( TString  prefix,
TString  histoName,
double  value 
)
protected

Add to output string to upload data to CDASH server.

Referenced by TestPassed().

◆ AddFileNamesAndShortName()

void PndHistoCombiner::AddFileNamesAndShortName ( TString  fileName,
TString  shortName 
)
inline

Adds the file which contain the histos to be plotted together. First file is the one comparisons are made to.

Parameters
fileNamefull path to file
shortNamename displayed in histogram legend

Definition at line 50 of file PndHistoCombiner.h.

References GenerateBranches(), and GenerateHistos().

51  {
52  fileData myData(fileName, shortName);
53  fFileData.push_back(myData);
54  }

◆ AddHistoSelector()

void PndHistoCombiner::AddHistoSelector ( TString  histoName)
inline

Only those histograms are combined with part of their matching the histoName.

Parameters
histoNamepart of the histo name to be compared

Definition at line 70 of file PndHistoCombiner.h.

70 { fHistoSelector.push_back(histoName); }

◆ CheckBranchName()

bool PndHistoCombiner::CheckBranchName ( TString  branchName)
protected

Referenced by SetCDashOutput().

◆ CheckBranchType()

bool PndHistoCombiner::CheckBranchType ( TString  branchType)
protected

Referenced by SetCDashOutput().

◆ CheckHistoName()

bool PndHistoCombiner::CheckHistoName ( TString  histoName)
protected

Referenced by SetCDashOutput().

◆ CreateCDashOutput()

void PndHistoCombiner::CreateCDashOutput ( )

Generate output string to upload data to CDASH server This can be called automatically or by hand.

Referenced by SetCDashOutput().

◆ CreateLegend()

void PndHistoCombiner::CreateLegend ( std::vector< TH1 *> &  histos)
protected

Referenced by SetCDashOutput().

◆ DoTest()

void PndHistoCombiner::DoTest ( int  val = 0,
double  threshold = 0.03 
)
inline

perform Kolmogorov or chi2 test between histograms of first file and all others.

Parameters
valtest type. 0: none, 1: Kolmogorov test, 2: chisquare test
thresholdfor the probability of the test. Every p larger than threshold will be counted as passed

Definition at line 104 of file PndHistoCombiner.h.

105  {
106  fTestType = val;
107  fThreshold = threshold;
108  }

◆ DrawAndTestHistoStack()

void PndHistoCombiner::DrawAndTestHistoStack ( std::vector< TH1 *> &  histos)
protected

Referenced by SetCDashOutput().

◆ DrawPulls()

void PndHistoCombiner::DrawPulls ( std::vector< TH1 *> &  histos)
protected

Referenced by SetCDashOutput().

◆ GenerateBranches()

int PndHistoCombiner::GenerateBranches ( )

Main method to generate histograms from branches.

Referenced by AddFileNamesAndShortName().

◆ GenerateHistos()

int PndHistoCombiner::GenerateHistos ( )

Main method to generate histograms.

Referenced by AddFileNamesAndShortName().

◆ InitFiles()

void PndHistoCombiner::InitFiles ( )
protected

Referenced by SetCDashOutput().

◆ PerformTest()

double PndHistoCombiner::PerformTest ( TH1 *  h1,
TH1 *  h2 
)
protected

Referenced by SetCDashOutput().

◆ RemoveSpecialCharacters()

TString PndHistoCombiner::RemoveSpecialCharacters ( TString  input)
protected

Referenced by TestPassed().

◆ SetCanvasOutputDir()

void PndHistoCombiner::SetCanvasOutputDir ( TString  val)
inline

Definition at line 87 of file PndHistoCombiner.h.

87 { fCanCreator.SetOutputDir(val); }
void SetOutputDir(TString val)

◆ SetCanvasOutputFormat()

void PndHistoCombiner::SetCanvasOutputFormat ( TString  val)
inline

Definition at line 89 of file PndHistoCombiner.h.

89 { fCanCreator.SetOutputFormat(val); }
void SetOutputFormat(TString val)

◆ SetCanvasPrefix()

void PndHistoCombiner::SetCanvasPrefix ( TString  val)
inline

Definition at line 85 of file PndHistoCombiner.h.

85 { fCanCreator.SetPrefix(val); }
void SetPrefix(TString val)

◆ SetCDashOutput()

void PndHistoCombiner::SetCDashOutput ( bool  val = true)
inline

Select to generate output string automatically to upload data to CDASH server.

Definition at line 113 of file PndHistoCombiner.h.

References CheckBranchName(), CheckBranchType(), CheckHistoName(), CreateCDashOutput(), CreateLegend(), DrawAndTestHistoStack(), DrawPulls(), InitFiles(), PerformTest(), and SplitPadForPulls().

113 { fCreateCDashOutput = val; }

◆ SetDimensions()

void PndHistoCombiner::SetDimensions ( int  x = 400,
int  y = 300 
)
inline

Definition at line 97 of file PndHistoCombiner.h.

Referenced by SetPulls().

97 { fCanCreator.SetDimensions(x, y); }
void SetDimensions(int x=800, int y=600)

◆ SetPicPerCan()

void PndHistoCombiner::SetPicPerCan ( int  val)
inline

pictures per canvas. They will be organized in a quadratic way

Parameters
valnumber of pictures/pads

Definition at line 83 of file PndHistoCombiner.h.

83 { fCanCreator.SetPicPerCan(val); }

◆ SetPulls()

void PndHistoCombiner::SetPulls ( bool  dopulls = true)
inline

Definition at line 91 of file PndHistoCombiner.h.

References SetDimensions().

92  {
93  fDoPulls = dopulls;
94  SetDimensions(400, 400);
95  }
void SetDimensions(int x=400, int y=300)

◆ SplitPadForPulls()

std::pair<TPad *, TPad *> PndHistoCombiner::SplitPadForPulls ( )
protected

Referenced by SetCDashOutput().

◆ TestPassed()

bool PndHistoCombiner::TestPassed ( double  result,
double  threshold 
)
inlineprotected

Definition at line 130 of file PndHistoCombiner.h.

References AddCDashOutput(), and RemoveSpecialCharacters().

131  {
132  if (result > threshold)
133  return true;
134  return false;
135  }

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