Logo ROOT   6.08/07
Reference Guide
hist2workspace.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 
13 /*
14 BEGIN_HTML
15 <p>
16 </p>
17 END_HTML
18 */
19 //
20 
21 #include <string>
22 #include <exception>
23 #include <vector>
24 
25 //void topDriver(string input); // in MakeModelAndMeasurements
26 //void fastDriver(string input); // in MakeModelAndMeasurementsFast
27 
28 //#include "RooStats/HistFactory/MakeModelAndMeasurements.h"
31 
32 //_____________________________batch only_____________________
33 #ifndef __CINT__
34 
35 namespace RooStats {
36  namespace HistFactory {
37  void fastDriver(std::string input) {
38 
39  // Create the initial list of measurements and channels
40  std::vector< HistFactory::Measurement > measurement_list;
41  // std::vector< HistFactory::Channel > channel_list;
42 
43  // Fill them using the XML parser
44  HistFactory::ConfigParser xmlParser;
45  measurement_list = xmlParser.GetMeasurementsFromXML( input );
46 
47  // At this point, we have all the information we need
48  // from the xml files.
49 
50  // We will make the measurements 1-by-1
51  for(unsigned int i = 0; i < measurement_list.size(); ++i) {
52  HistFactory::Measurement measurement = measurement_list.at(i);
53  measurement.CollectHistograms();
54  MakeModelAndMeasurementFast( measurement );
55  }
56 
57  return;
58 
59  }
60  } // namespace RooStats
61 } // namespace HistFactory
62 
63 
64 int main(int argc, char** argv) {
65 
66  if( !(argc > 1) ) {
67  std::cerr << "need input file" << std::endl;
68  exit(1);
69  }
70 
71  if(argc==2){
72  std::string input(argv[1]);
73  try {
75  }
76  catch(std::string str) {
77  std::cerr << "hist2workspace - Caught exception: " << str << std::endl ;
78  exit(1);
79  }
80  catch( const std::exception& e ) {
81  std::cerr << "hist2workspace - Caught Exception: " << e.what() << std::endl;
82  exit(1);
83  }
84  catch(...) {
85  exit(1);
86  }
87  }
88 
89  if(argc==3){
90  std::string flag(argv[1]);
91  std::string input(argv[2]);
92 
93  if(flag=="-standard_form") {
94  try {
96  }
97  catch(std::string str) {
98  std::cerr << "hist2workspace - Caught exception: " << str << std::endl ;
99  exit(1);
100  }
101  catch( const std::exception& e ) {
102  std::cerr << "hist2workspace - Caught Exception: " << e.what() << std::endl;
103  exit(1);
104  }
105  catch(...) {
106  std::cerr << "hist2workspace - Caught Exception" << std::endl;
107  exit(1);
108  }
109  }
110 
111  else if(flag=="-number_counting_form") {
112  std::cout << "ERROR: 'number_counting_form' is now depricated." << std::endl;
113  /*
114  try {
115  //topDriver(input);
116  }
117  catch (std::string str) {
118  std::cerr << "caught exception: " << str << std::endl ;
119  }
120  catch( const std::exception& e ) {
121  std::cerr << "Caught Exception: " << e.what() << std::endl;
122  }
123  */
124  return 255;
125  }
126 
127  else {
128  std::cerr << "Unrecognized flag. " << std::endl;
129  return 255;
130  }
131  }
132 
133  return 0;
134 
135 }
136 
137 #endif
void fastDriver(std::string input)
RooWorkspace * MakeModelAndMeasurementFast(RooStats::HistFactory::Measurement &measurement)
std::vector< RooStats::HistFactory::Measurement > GetMeasurementsFromXML(std::string input)
Namespace for the RooStats classes.
Definition: Asimov.h:20
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
int main(int argc, char **argv)