42  namespace HistFactory{
 
   54  sample.SetChannelName( GetName() );
 
   55  fSamples.push_back( 
sample );
 
 
   61  stream << 
"\t Channel Name: " << fName
 
   62    << 
"\t InputFile: " << fInputFile
 
   65  stream << 
"\t Data:" << std::endl;
 
   66  fData.Print( stream );
 
   69  stream << 
"\t statErrorConfig:" << std::endl;
 
   70  fStatErrorConfig.Print( stream );
 
   73  if( !fSamples.empty() ) {
 
   75    stream << 
"\t Samples: " << std::endl;
 
   76    for( 
unsigned int i = 0; i < fSamples.size(); ++i ) {
 
   77      fSamples.at(i).Print( stream );
 
   82  stream << 
"\t End of Channel " << fName <<  std::endl;
 
 
   91  cxcoutPHF << 
"Printing XML Files for channel: " << GetName() << std::endl;
 
   93  std::string 
XMLName = prefix + fName + 
".xml";
 
   99  xml << 
"<!--" << std::endl;
 
  100  xml << 
"This xml file created automatically on: " << std::endl;
 
  111  xml << 
"-->" << std::endl;
 
  114  xml << 
"<!DOCTYPE Channel  SYSTEM 'HistFactorySchema.dtd'>  " << std::endl << std::endl;
 
  117  xml << 
"  <Channel Name=\"" << fName << 
"\" InputFile=\"" << fInputFile << 
"\" >" << std::endl << std::endl;
 
  119  fData.PrintXML( 
xml );
 
  120  for(
auto const& 
data : fAdditionalData) {
 
  124  fStatErrorConfig.PrintXML( 
xml );
 
  131  for(
auto const& 
sample : fSamples) {
 
  133    xml << std::endl << std::endl;
 
  137  xml << 
"  </Channel>  " << std::endl;
 
  140  cxcoutPHF << 
"Finished printing XML files" << std::endl;
 
 
  159  fData.SetHisto( 
hData );
 
 
  173  hData->SetBinContent( 1, val );
 
 
  204  std::map<std::string,std::unique_ptr<TFile>> 
fileHandles;
 
  208  if( !fData.GetInputFile().empty() ) {
 
  209    fData.SetHisto( GetHistogram(fData.GetInputFile(),
 
  210             fData.GetHistoPath(),
 
  211             fData.GetHistoName(),
 
  216  for(
auto& 
data : fAdditionalData) {
 
  217    if( !
data.GetInputFile().empty() ) {
 
  229    cxcoutDHF << 
"Collecting Nominal Histogram" << std::endl;
 
  239    if( 
sample.GetStatError().GetUseHisto() ) {
 
  240      sample.GetStatError().SetErrorHist( GetHistogram(
sample.GetStatError().GetInputFile(),
 
  241                         sample.GetStatError().GetHistoPath(),
 
  242                         sample.GetStatError().GetHistoName(),
 
 
  316    if( fData.GetHisto() == 
nullptr && !fData.GetInputFile().empty() ) {
 
  317      cxcoutEHF << 
"Error: Data Histogram for channel " << GetName() << 
" is nullptr." << std::endl;
 
  327      if( 
sample.GetHisto() == 
nullptr ) {
 
  328   cxcoutEHF << 
"Error: Nominal Histogram for sample " << 
sample.GetName() << 
" is nullptr." << std::endl;
 
  345          << 
" in Channel = " << GetName() << 
" has negative entries in bin numbers = ";
 
  348       if(
ibin>0) std::cout << 
" , " ;
 
  351     std::cout << std::endl;
 
  357      if( 
sample.GetStatError().GetUseHisto() ) {
 
  358   if( 
sample.GetStatError().GetErrorHist() == 
nullptr ) {
 
  359     cxcoutEHF << 
"Error: Statistical Error Histogram for sample " << 
sample.GetName() << 
" is nullptr." << std::endl;
 
  370   if( 
histoSys.GetHistoLow() == 
nullptr ) {
 
  372          << 
" in sample " << 
sample.GetName() << 
" is nullptr." << std::endl;
 
  375   if( 
histoSys.GetHistoHigh() == 
nullptr ) {
 
  377          << 
" in sample " << 
sample.GetName() << 
" is nullptr." << std::endl;
 
  391          << 
" in sample " << 
sample.GetName() << 
" is nullptr." << std::endl;
 
  396          << 
" in sample " << 
sample.GetName() << 
" is nullptr." << std::endl;
 
  408   if( 
shapeSys.GetErrorHist() == 
nullptr ) {
 
  410          << 
" in sample " << 
sample.GetName() << 
" is nullptr." << std::endl;
 
 
  443  if (dir == 
nullptr) {
 
  445        << 
"' wasn't found in file '" << 
InputFile << 
"'." << std::endl;
 
  452  if (key == 
nullptr) {
 
  454        << 
"' wasn't found in file '" << 
InputFile 
  455        << 
"' in directory '" << 
HistoPath << 
"'." << std::endl;
 
  459  auto hist = key->ReadObject<
TH1>();
 
  462        << 
"' wasn't found in file '" << 
InputFile 
  463        << 
"' in directory '" << 
HistoPath << 
"'." << std::endl;
 
  468  TH1 * ptr = 
static_cast<TH1 *
>(hist->Clone());
 
  471    std::cerr << 
"Not all necessary info are set to access the input file. Check your config" << std::endl;
 
  482  std::cout << 
"Found Histogram: " << 
HistoName " at address: " << ptr
 
  483       << 
" with integral "   << ptr->
Integral() << 
" and mean " << ptr->
GetMean()
 
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
This class encapsulates all information for the statistical interpretation of one experiment.
void Print(std::ostream &=std::cout)
void SetData(const RooStats::HistFactory::Data &data)
set data object
void AddSample(RooStats::HistFactory::Sample sample)
bool CheckHistograms() const
TH1 * GetHistogram(std::string InputFile, std::string HistoPath, std::string HistoName, std::map< std::string, std::unique_ptr< TFile > > &lsof)
Open a file and copy a histogram.
void SetStatErrorConfig(double RelErrorThreshold, Constraint::Type ConstraintType)
void PrintXML(std::string const &directory, std::string const &prefix="") const
Configuration for an *un*constrained, coherent shape variation of affected samples.
Configuration for a constrained, coherent shape variation of affected samples.
*Un*constrained bin-by-bin variation of affected histogram.
Constrained bin-by-bin variation of affected histogram.
Describe directory structure in memory.
virtual TKey * GetKey(const char *, Short_t=9999) const
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
The TTimeStamp encapsulates seconds and ns since EPOCH.
UInt_t GetDate(Bool_t inUTC=kTRUE, Int_t secOffset=0, UInt_t *year=nullptr, UInt_t *month=nullptr, UInt_t *day=nullptr) const
Return date in form of 19971224 (i.e.
Type GetType(const std::string &Name)
Namespace for the RooStats classes.