Logo ROOT   6.10/09
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 
14 #include <string>
15 #include <fstream>
16 #include <iostream>
17 
18 
22 
23 namespace RooStats{
24 namespace HistFactory {
25 
26 class Channel {
27 
28 
29 public:
30  friend class Measurement;
31 
32  Channel();
33  Channel(const Channel& other);
34  Channel(std::string Name, std::string InputFile="");
35 
36  // set name of channel
37  void SetName( const std::string& Name ) { fName = Name; }
38  // get name of channel
39  std::string GetName() { return fName; }
40  // set name of input file containing histograms
41  void SetInputFile( const std::string& file ) { fInputFile = file; }
42  // get name of input file
43  std::string GetInputFile() { return fInputFile; }
44  // set path for histograms in input file
45  void SetHistoPath( const std::string& file ) { fHistoPath = file; }
46  // get path to histograms in input file
47  std::string GetHistoPath() { return fHistoPath; }
48 
49  // set data object
51  void SetData( std::string HistoName, std::string InputFile, std::string HistoPath="" );
52  void SetData( double Val );
53  void SetData( TH1* hData );
54  // get data object
56 
57  // add additional data object
59  // retrieve vector of additional data objects
60  std::vector<RooStats::HistFactory::Data>& GetAdditionalData() { return fAdditionalData; }
61 
62  void SetStatErrorConfig( double RelErrorThreshold, Constraint::Type ConstraintType );
63  void SetStatErrorConfig( double RelErrorThreshold, std::string ConstraintType );
64  // define treatment of statistical uncertainties
66  // get information about threshold for statistical uncertainties and constraint term
68 
70  // get vector of samples for this channel
71  std::vector< RooStats::HistFactory::Sample >& GetSamples() { return fSamples; }
72 
73  void Print(std::ostream& = std::cout);
74  void PrintXML( std::string Directory, std::string Prefix="" );
75 
76  void CollectHistograms();
77  bool CheckHistograms();
78 
79 protected:
80 
81  std::string fName;
82  std::string fInputFile;
83  std::string fHistoPath;
84 
86 
87  // One can add additional datasets
88  // These are simply added to the xml under a different name
89  std::vector<RooStats::HistFactory::Data> fAdditionalData;
90 
92 
93  std::vector< RooStats::HistFactory::Sample > fSamples;
94 
95  // Open a file and copy a histogram
96  TH1* GetHistogram( std::string InputFile, std::string HistoPath, std::string HistoName );
97 
98 
99 };
100 
101  extern Channel BadChannel;
102 
103 } // namespace HistFactory
104 } // namespace RooStats
105 
106 #endif
void SetData(const RooStats::HistFactory::Data &data)
Definition: Channel.h:50
void AddAdditionalData(const RooStats::HistFactory::Data &data)
Definition: Channel.h:58
void SetStatErrorConfig(double RelErrorThreshold, Constraint::Type ConstraintType)
Definition: Channel.cxx:206
void SetInputFile(const std::string &file)
Definition: Channel.h:41
std::string GetInputFile()
Definition: Channel.h:43
void Print(std::ostream &=std::cout)
Definition: Channel.cxx:78
const char * Name
Definition: TXMLSetup.cxx:67
static int Prefix[TSIZE]
Definition: gifdecode.c:12
void PrintXML(std::string Directory, std::string Prefix="")
Definition: Channel.cxx:108
void SetStatErrorConfig(RooStats::HistFactory::StatErrorConfig Config)
Definition: Channel.h:65
std::vector< RooStats::HistFactory::Data > fAdditionalData
Definition: Channel.h:89
HistFactory::StatErrorConfig fStatErrorConfig
Definition: Channel.h:91
void SetHistoPath(const std::string &file)
Definition: Channel.h:45
std::string GetHistoPath()
Definition: Channel.h:47
void AddSample(RooStats::HistFactory::Sample sample)
Definition: Channel.cxx:70
Namespace for the RooStats classes.
Definition: Asimov.h:20
HistFactory::StatErrorConfig & GetStatErrorConfig()
Definition: Channel.h:67
The TH1 histogram class.
Definition: TH1.h:56
std::vector< RooStats::HistFactory::Sample > & GetSamples()
Definition: Channel.h:71
TH1 * GetHistogram(std::string InputFile, std::string HistoPath, std::string HistoName)
Definition: Channel.cxx:454
std::vector< RooStats::HistFactory::Data > & GetAdditionalData()
Definition: Channel.h:60
void SetName(const std::string &Name)
Definition: Channel.h:37
Definition: file.py:1
std::vector< RooStats::HistFactory::Sample > fSamples
Definition: Channel.h:93
HistFactory::Data fData
Definition: Channel.h:85
RooStats::HistFactory::Data & GetData()
Definition: Channel.h:55