Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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
50  void SetData( const RooStats::HistFactory::Data& data ) { fData = data; }
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
55  RooStats::HistFactory::Data& GetData() { return fData; }
56 
57  /// add additional data object
58  void AddAdditionalData( const RooStats::HistFactory::Data& data ) { fAdditionalData.push_back(data); }
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
65  void SetStatErrorConfig( RooStats::HistFactory::StatErrorConfig Config ) { fStatErrorConfig = Config; }
66  /// get information about threshold for statistical uncertainties and constraint term
67  HistFactory::StatErrorConfig& GetStatErrorConfig() { return fStatErrorConfig; }
68 
69  void AddSample( RooStats::HistFactory::Sample sample );
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 
85  HistFactory::Data fData;
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 
91  HistFactory::StatErrorConfig fStatErrorConfig;
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