Logo ROOT  
Reference Guide
Channel.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: George Lewis, Kyle Cranmer
3 /*************************************************************************
4  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef HISTFACTORY_CHANNEL_H
12 #define HISTFACTORY_CHANNEL_H
13 
17 
18 #include <string>
19 #include <fstream>
20 #include <iostream>
21 #include <map>
22 #include <memory>
23 #include <vector>
24 
25 class TFile;
26 
27 namespace RooStats{
28 namespace HistFactory {
29 
30 class Channel {
31 
32 
33 public:
34  friend class Measurement;
35 
36  Channel();
37  Channel(const Channel& other);
38  Channel(std::string Name, std::string InputFile="");
39 
40  /// set name of channel
41  void SetName( const std::string& Name ) { fName = Name; }
42  /// get name of channel
43  std::string GetName() const { return fName; }
44  /// set name of input file containing histograms
45  void SetInputFile( const std::string& file ) { fInputFile = file; }
46  /// get name of input file
47  std::string GetInputFile() const { return fInputFile; }
48  /// set path for histograms in input file
49  void SetHistoPath( const std::string& file ) { fHistoPath = file; }
50  /// get path to histograms in input file
51  std::string GetHistoPath() const { return fHistoPath; }
52 
53  /// set data object
54  void SetData( const RooStats::HistFactory::Data& data ) { fData = data; }
55  void SetData( std::string HistoName, std::string InputFile, std::string HistoPath="" );
56  void SetData( double Val );
57  void SetData( TH1* hData );
58  /// get data object
60 
61  /// add additional data object
62  void AddAdditionalData( const RooStats::HistFactory::Data& data ) { fAdditionalData.push_back(data); }
63  /// retrieve vector of additional data objects
64  std::vector<RooStats::HistFactory::Data>& GetAdditionalData() { return fAdditionalData; }
65 
66  void SetStatErrorConfig( double RelErrorThreshold, Constraint::Type ConstraintType );
67  void SetStatErrorConfig( double RelErrorThreshold, std::string ConstraintType );
68  /// define treatment of statistical uncertainties
70  /// get information about threshold for statistical uncertainties and constraint term
73 
75  /// get vector of samples for this channel
76  std::vector< RooStats::HistFactory::Sample >& GetSamples() { return fSamples; }
77  const std::vector< RooStats::HistFactory::Sample >& GetSamples() const { return fSamples; }
78 
79  void Print(std::ostream& = std::cout);
80  void PrintXML( std::string Directory, std::string Prefix="" );
81 
82  void CollectHistograms();
83  bool CheckHistograms() const;
84 
85 protected:
86 
87  std::string fName;
88  std::string fInputFile;
89  std::string fHistoPath;
90 
92 
93  /// One can add additional datasets
94  /// These are simply added to the xml under a different name
95  std::vector<RooStats::HistFactory::Data> fAdditionalData;
96 
98 
99  std::vector< RooStats::HistFactory::Sample > fSamples;
100 
101  TH1* GetHistogram( std::string InputFile, std::string HistoPath, std::string HistoName, std::map<std::string, std::unique_ptr<TFile>>& lsof);
102 };
103 
104  extern Channel BadChannel;
105 
106 } // namespace HistFactory
107 } // namespace RooStats
108 
109 #endif
RooStats::HistFactory::Channel::SetData
void SetData(const RooStats::HistFactory::Data &data)
set data object
Definition: Channel.h:54
RooStats::HistFactory::Sample
Definition: Sample.h:27
RooStats::HistFactory::Channel::GetAdditionalData
std::vector< RooStats::HistFactory::Data > & GetAdditionalData()
retrieve vector of additional data objects
Definition: Channel.h:64
RooStats::HistFactory::Channel::GetSamples
std::vector< RooStats::HistFactory::Sample > & GetSamples()
get vector of samples for this channel
Definition: Channel.h:76
Prefix
static int Prefix[TSIZE]
Definition: gifdecode.c:12
RooStats::HistFactory::Channel::SetName
void SetName(const std::string &Name)
set name of channel
Definition: Channel.h:41
RooStats::HistFactory::Channel::fStatErrorConfig
HistFactory::StatErrorConfig fStatErrorConfig
Definition: Channel.h:97
RooStats::HistFactory::Channel::PrintXML
void PrintXML(std::string Directory, std::string Prefix="")
Definition: Channel.cxx:105
RooStats::HistFactory::Channel::SetInputFile
void SetInputFile(const std::string &file)
set name of input file containing histograms
Definition: Channel.h:45
RooStats::HistFactory::Channel::GetStatErrorConfig
const HistFactory::StatErrorConfig & GetStatErrorConfig() const
Definition: Channel.h:72
RooStats::HistFactory::Channel::SetStatErrorConfig
void SetStatErrorConfig(RooStats::HistFactory::StatErrorConfig Config)
define treatment of statistical uncertainties
Definition: Channel.h:69
RooStats::HistFactory::Channel::SetHistoPath
void SetHistoPath(const std::string &file)
set path for histograms in input file
Definition: Channel.h:49
RooStats::HistFactory::Channel::CollectHistograms
void CollectHistograms()
Definition: Channel.cxx:218
RooFit::HistFactory
@ HistFactory
Definition: RooGlobalFunc.h:69
RooStats::HistFactory::Channel::fAdditionalData
std::vector< RooStats::HistFactory::Data > fAdditionalData
One can add additional datasets These are simply added to the xml under a different name.
Definition: Channel.h:95
RooStats::HistFactory::Channel::AddAdditionalData
void AddAdditionalData(const RooStats::HistFactory::Data &data)
add additional data object
Definition: Channel.h:62
RooStats::HistFactory::Channel::GetInputFile
std::string GetInputFile() const
get name of input file
Definition: Channel.h:47
RooStats::HistFactory::Channel
This class encapsulates all information for the statistical interpretation of one experiment.
Definition: Channel.h:30
RooStats::HistFactory::Measurement
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
Definition: Measurement.h:30
RooStats::HistFactory::BadChannel
Channel BadChannel
Definition: Channel.cxx:61
RooStats::HistFactory::Channel::fName
std::string fName
Definition: Channel.h:87
RooStats::HistFactory::Constraint::Type
Type
Definition: Systematics.h:25
RooStats::HistFactory::StatErrorConfig
Configuration to automatically assign nuisance parameters for the statistical error of the Monte Carl...
Definition: Systematics.h:376
RooStats::HistFactory::Channel::GetName
std::string GetName() const
get name of channel
Definition: Channel.h:43
TFile
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
RooStats::HistFactory::Channel::SetStatErrorConfig
void SetStatErrorConfig(double RelErrorThreshold, Constraint::Type ConstraintType)
Definition: Channel.cxx:202
RooStats::HistFactory::Channel::GetHistoPath
std::string GetHistoPath() const
get path to histograms in input file
Definition: Channel.h:51
xmlio::Name
const char * Name
Definition: TXMLSetup.cxx:67
RooStats::HistFactory::Channel::GetSamples
const std::vector< RooStats::HistFactory::Sample > & GetSamples() const
Definition: Channel.h:77
RooStats::HistFactory::Channel::Channel
Channel()
Definition: Channel.cxx:35
RooStats::HistFactory::Channel::fInputFile
std::string fInputFile
Definition: Channel.h:88
RooStats
Namespace for the RooStats classes.
Definition: Asimov.h:19
file
Definition: file.py:1
RooStats::HistFactory::Channel::AddSample
void AddSample(RooStats::HistFactory::Sample sample)
Definition: Channel.cxx:67
TH1
TH1 is the base class of all histogramm classes in ROOT.
Definition: TH1.h:58
RooStats::HistFactory::Channel::GetHistogram
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.
Definition: Channel.cxx:462
RooStats::HistFactory::Channel::fHistoPath
std::string fHistoPath
Definition: Channel.h:89
Data.h
RooStats::HistFactory::Channel::Print
void Print(std::ostream &=std::cout)
Definition: Channel.cxx:75
RooStats::HistFactory::Channel::fSamples
std::vector< RooStats::HistFactory::Sample > fSamples
Definition: Channel.h:99
Systematics.h
RooStats::HistFactory::Data
Definition: Data.h:24
RooStats::HistFactory::Channel::fData
HistFactory::Data fData
Definition: Channel.h:91
RooStats::HistFactory::Channel::GetData
RooStats::HistFactory::Data & GetData()
get data object
Definition: Channel.h:59
Sample.h
RooStats::HistFactory::Channel::GetStatErrorConfig
HistFactory::StatErrorConfig & GetStatErrorConfig()
get information about threshold for statistical uncertainties and constraint term
Definition: Channel.h:71
RooStats::HistFactory::Channel::CheckHistograms
bool CheckHistograms() const
Definition: Channel.cxx:332