Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions roofit/histfactory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,31 @@ endif()

ROOT_STANDARD_LIBRARY_PACKAGE(HistFactory
HEADERS
RooStats/HistFactory/Asimov.h
RooStats/HistFactory/Channel.h
RooStats/HistFactory/Data.h
RooStats/HistFactory/Detail/HistFactoryImpl.h
RooStats/HistFactory/FlexibleInterpVar.h
RooStats/HistFactory/HistFactoryException.h
RooStats/HistFactory/HistFactoryModelUtils.h
RooStats/HistFactory/HistFactoryNavigation.h
RooStats/HistFactory/HistoToWorkspaceFactoryFast.h
RooStats/HistFactory/HistRef.h
RooStats/HistFactory/LinInterpVar.h
RooStats/HistFactory/MakeModelAndMeasurementsFast.h
RooStats/HistFactory/Measurement.h
RooStats/HistFactory/ParamHistFunc.h
RooStats/HistFactory/PiecewiseInterpolation.h
RooStats/HistFactory/PreprocessFunction.h
RooStats/HistFactory/RooBarlowBeestonLL.h
RooStats/HistFactory/Sample.h
RooStats/HistFactory/Systematics.h
${HISTFACTORY_XML_HEADERS}
SOURCES
src/Asimov.cxx
src/Channel.cxx
src/Data.cxx
src/FlexibleInterpVar.cxx
src/HistFactoryImpl.cxx
src/HistFactoryModelUtils.cxx
src/HistFactoryNavigation.cxx
src/HistRef.cxx
src/HistoToWorkspaceFactoryFast.cxx
src/LinInterpVar.cxx
src/MakeModelAndMeasurementsFast.cxx
src/Measurement.cxx
src/ParamHistFunc.cxx
src/PiecewiseInterpolation.cxx
src/PreprocessFunction.cxx
src/RooBarlowBeestonLL.cxx
src/Sample.cxx
src/Systematics.cxx
${HISTFACTORY_XML_SOURCES}
DICTIONARY_OPTIONS
"-writeEmptyRootPCM"
Expand Down
54 changes: 1 addition & 53 deletions roofit/histfactory/inc/RooStats/HistFactory/Asimov.h
Original file line number Diff line number Diff line change
@@ -1,53 +1 @@
// @(#)root/roostats:$Id$
// Author: George Lewis, Kyle Cranmer
/*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef HISTFACTORY_ASIMOV_H
#define HISTFACTORY_ASIMOV_H

#include <string>
#include <map>

#include "RooWorkspace.h"

namespace RooStats{
namespace HistFactory {

class Asimov {

public:

Asimov() {;}
Asimov(std::string Name) : fName(Name) {;}

void ConfigureWorkspace( RooWorkspace* );

std::string GetName() { return fName; }
void SetName(const std::string& name) { fName = name; }

void SetFixedParam(const std::string& param, bool constant=true) { fParamsToFix[param] = constant; }
void SetParamValue(const std::string& param, double value) { fParamValsToSet[param] = value; }

std::map< std::string, bool >& GetParamsToFix() { return fParamsToFix; }
std::map< std::string, double >& GetParamsToSet() { return fParamValsToSet; }

protected:

std::string fName;

std::map<std::string, bool> fParamsToFix;
std::map< std::string, double > fParamValsToSet;

};


} // namespace HistFactory
} // namespace RooStats

#endif
#warning "Header is deprecated and will be removed in ROOT 7. Just include RooStats/HistFactory/Measurement.h"
110 changes: 1 addition & 109 deletions roofit/histfactory/inc/RooStats/HistFactory/Channel.h
Original file line number Diff line number Diff line change
@@ -1,109 +1 @@
// @(#)root/roostats:$Id$
// Author: George Lewis, Kyle Cranmer
/*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef HISTFACTORY_CHANNEL_H
#define HISTFACTORY_CHANNEL_H

#include "RooStats/HistFactory/Data.h"
#include "RooStats/HistFactory/Sample.h"
#include "RooStats/HistFactory/Systematics.h"

#include <string>
#include <fstream>
#include <iostream>
#include <map>
#include <memory>
#include <vector>

class TFile;

namespace RooStats{
namespace HistFactory {

class Channel {


public:
friend class Measurement;

Channel() = default;
Channel(std::string Name, std::string InputFile="");

/// set name of channel
void SetName( const std::string& Name ) { fName = Name; }
/// get name of channel
std::string GetName() const { return fName; }
/// set name of input file containing histograms
void SetInputFile( const std::string& file ) { fInputFile = file; }
/// get name of input file
std::string GetInputFile() const { return fInputFile; }
/// set path for histograms in input file
void SetHistoPath( const std::string& file ) { fHistoPath = file; }
/// get path to histograms in input file
std::string GetHistoPath() const { return fHistoPath; }

/// set data object
void SetData( const RooStats::HistFactory::Data& data ) { fData = data; }
void SetData( std::string HistoName, std::string InputFile, std::string HistoPath="" );
void SetData( double Val );
void SetData( TH1* hData );
/// get data object
RooStats::HistFactory::Data& GetData() { return fData; }
const RooStats::HistFactory::Data& GetData() const { return fData; }

/// add additional data object
void AddAdditionalData( const RooStats::HistFactory::Data& data ) { fAdditionalData.push_back(data); }
/// retrieve vector of additional data objects
std::vector<RooStats::HistFactory::Data>& GetAdditionalData() { return fAdditionalData; }

void SetStatErrorConfig( double RelErrorThreshold, Constraint::Type ConstraintType );
void SetStatErrorConfig( double RelErrorThreshold, std::string ConstraintType );
/// define treatment of statistical uncertainties
void SetStatErrorConfig( RooStats::HistFactory::StatErrorConfig Config ) { fStatErrorConfig = Config; }
/// get information about threshold for statistical uncertainties and constraint term
HistFactory::StatErrorConfig& GetStatErrorConfig() { return fStatErrorConfig; }
const HistFactory::StatErrorConfig& GetStatErrorConfig() const { return fStatErrorConfig; }

void AddSample( RooStats::HistFactory::Sample sample );
/// get vector of samples for this channel
std::vector< RooStats::HistFactory::Sample >& GetSamples() { return fSamples; }
const std::vector< RooStats::HistFactory::Sample >& GetSamples() const { return fSamples; }

void Print(std::ostream& = std::cout);
void PrintXML( std::string const& directory, std::string const& prefix="" ) const;

void CollectHistograms();
bool CheckHistograms() const;

protected:

std::string fName;
std::string fInputFile;
std::string fHistoPath;

HistFactory::Data fData;

/// One can add additional datasets
/// These are simply added to the xml under a different name
std::vector<RooStats::HistFactory::Data> fAdditionalData;

HistFactory::StatErrorConfig fStatErrorConfig;

std::vector< RooStats::HistFactory::Sample > fSamples;

TH1* GetHistogram( std::string InputFile, std::string HistoPath, std::string HistoName, std::map<std::string, std::unique_ptr<TFile>>& lsof);
};

extern Channel BadChannel;

} // namespace HistFactory
} // namespace RooStats

#endif
#warning "Header is deprecated and will be removed in ROOT 7. Just include RooStats/HistFactory/Measurement.h"
2 changes: 0 additions & 2 deletions roofit/histfactory/inc/RooStats/HistFactory/ConfigParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
#ifndef ROOSTATS_CONFIGPARSER_h
#define ROOSTATS_CONFIGPARSER_h

#include "RooStats/HistFactory/Channel.h"
#include "RooStats/HistFactory/Measurement.h"
#include "RooStats/HistFactory/Sample.h"

#include <cstdlib>
#include <string>
Expand Down
73 changes: 1 addition & 72 deletions roofit/histfactory/inc/RooStats/HistFactory/Data.h
Original file line number Diff line number Diff line change
@@ -1,72 +1 @@
// @(#)root/roostats:$Id$
// Author: George Lewis, Kyle Cranmer
/*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef HISTFACTORY_DATA_H
#define HISTFACTORY_DATA_H

#include <string>
#include <fstream>
#include <iostream>

//#include "RooStats/HistFactory/HistCollector.h"
#include "RooStats/HistFactory/Sample.h"

namespace RooStats{
namespace HistFactory {

class Data {

public:
//friend class Channel;

Data() {}
/// constructor from name, file and path. Name of the histogram should not include the path
Data( std::string HistoName, std::string InputFile, std::string HistoPath="" );

std::string const& GetName() const { return fName; }
void SetName(const std::string& name) { fName=name; }

void SetInputFile(const std::string& InputFile) { fInputFile = InputFile; }
std::string const& GetInputFile() const { return fInputFile; }

void SetHistoName(const std::string& HistoName) { fHistoName = HistoName; }
std::string const& GetHistoName() const { return fHistoName; }

void SetHistoPath(const std::string& HistoPath) { fHistoPath = HistoPath; }
std::string const& GetHistoPath() const { return fHistoPath; }

void Print(std::ostream& = std::cout);
void PrintXML( std::ostream& ) const;
void writeToFile( std::string FileName, std::string DirName );

TH1* GetHisto();
const TH1* GetHisto() const;
void SetHisto(TH1* Hist) { fhData = Hist; fHistoName=Hist->GetName(); }

protected:

std::string fName;

std::string fInputFile;
std::string fHistoName;
std::string fHistoPath;


// The Data Histogram
HistRef fhData;


};

}
}


#endif
#warning "Header is deprecated and will be removed in ROOT 7. Just include RooStats/HistFactory/Measurement.h"
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef HistFactoryImplHelpers_h
#define HistFactoryImplHelpers_h

#include <RooStats/HistFactory/Systematics.h>
#include <RooStats/HistFactory/Measurement.h>

#include <RooGlobalFunc.h>
#include <RooWorkspace.h>
Expand Down
81 changes: 1 addition & 80 deletions roofit/histfactory/inc/RooStats/HistFactory/HistRef.h
Original file line number Diff line number Diff line change
@@ -1,80 +1 @@
// @(#)root/roostats:$Id$
// Author: L. Moneta
/*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef HISTFACTORY_HISTREF_H
#define HISTFACTORY_HISTREF_H

#include <memory>
#include <TH1.h>

namespace RooStats{
namespace HistFactory {


// Internal class wrapping an histogram and managing its content.
// conveninet for dealing with histogram pointers in the
// HistFactory class
class HistRef {

public:


/// constructor - use gives away ownerhip of the given pointer
HistRef(TH1 * h = nullptr) : fHist(h) {}

HistRef( const HistRef& other )
{
if (other.fHist) fHist.reset(CopyObject(other.fHist.get()));
}

HistRef(HistRef&& other) :
fHist(std::move(other.fHist)) {}

~HistRef() {}

/// assignment operator (delete previous contained histogram)
HistRef & operator= (const HistRef & other) {
if (this == &other) return *this;

fHist.reset(CopyObject(other.fHist.get()));
return *this;
}

HistRef& operator=(HistRef&& other) {
fHist = std::move(other.fHist);
return *this;
}

TH1 * GetObject() const { return fHist.get(); }

/// set the object - user gives away the ownerhisp
void SetObject(TH1 *h) {
fHist.reset(h);
}

/// operator= passing an object pointer : user gives away its ownerhisp
void operator= (TH1 * h) { SetObject(h); }

/// Release ownership of object.
TH1* ReleaseObject() {
return fHist.release();
}



private:
static TH1 * CopyObject(const TH1 * h);
std::unique_ptr<TH1> fHist; ///< pointer to contained histogram
};

}
}

#endif
#warning "Header is deprecated and will be removed in ROOT 7. Just include RooStats/HistFactory/Measurement.h"
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef ROOSTATS_HISTOTOWORKSPACEFACTORYFAST
#define ROOSTATS_HISTOTOWORKSPACEFACTORYFAST

#include <RooStats/HistFactory/Systematics.h>
#include <RooStats/HistFactory/Measurement.h>

#include <RooArgSet.h>
#include <RooDataSet.h>
Expand Down
Loading
Loading