Logo ROOT  
Reference Guide
Data.cxx
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Kyle Cranmer, George Lewis
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 ////////////////////////////////////////////////////////////////////////////////
12 /** \class RooStats::HistFactory::Data
13  * \ingroup HistFactory
14 */
15 
16 
18 
19 
21  ;
22 }
23 
24 RooStats::HistFactory::Data::Data( std::string HistoName, std::string InputFile,
25  std::string HistoPath ) :
26  fInputFile( InputFile ), fHistoName( HistoName ), fHistoPath( HistoPath ) {;}
27 
29  return (TH1*) fhData.GetObject();
30 }
31 
33  return (TH1*) fhData.GetObject();
34 }
35 
36 
37 void RooStats::HistFactory::Data::Print( std::ostream& stream ) {
38 
39 
40  stream << "\t \t InputFile: " << fInputFile
41  << "\t HistoName: " << fHistoName
42  << "\t HistoPath: " << fHistoPath
43  << "\t HistoAddress: " << GetHisto()
44  << std::endl;
45 
46 }
47 
48 void RooStats::HistFactory::Data::writeToFile( std::string OutputFileName, std::string DirName ) {
49 
50  TH1* histData = GetHisto();
51 
52  if( histData != NULL) {
53 
54  histData->Write();
55 
56  // Set the location of the data
57  // in the output measurement
58 
59  fInputFile = OutputFileName;
60  fHistoName = histData->GetName();
61  fHistoPath = DirName;
62 
63  }
64 
65 }
66 
67 
68 void RooStats::HistFactory::Data::PrintXML( std::ostream& xml ) {
69 
70  xml << " <Data HistoName=\"" << GetHistoName() << "\" "
71  << "InputFile=\"" << GetInputFile() << "\" "
72  << "HistoPath=\"" << GetHistoPath() << "\" "
73  << " /> " << std::endl << std::endl;
74 
75 }
RooStats::HistFactory::Data::PrintXML
void PrintXML(std::ostream &)
Definition: Data.cxx:68
RooStats::HistFactory::Data::writeToFile
void writeToFile(std::string FileName, std::string DirName)
Definition: Data.cxx:48
RooStats::HistFactory::Data::Print
void Print(std::ostream &=std::cout)
Definition: Data.cxx:37
RooStats::HistFactory::Data::GetHisto
TH1 * GetHisto()
Definition: Data.cxx:28
RooStats::HistFactory::Data::Data
Data()
Definition: Data.cxx:20
TObject::Write
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:798
TH1
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
Data.h
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
RooStats::HistFactory::GetHisto
TH1 * GetHisto(TFile *inFile, const std::string name)
Definition: Helper.cxx:115