~mbogomilov/maus/devel3

« back to all changes in this revision

Viewing changes to src/output/OutputCppRoot/OutputCppRoot.cc

  • Committer: Durga Rajaram
  • Date: 2014-01-14 07:07:02 UTC
  • mfrom: (659.1.80 relcand)
  • Revision ID: durga@fnal.gov-20140114070702-2l1fuj1w6rraw7xe
Tags: MAUS-v0.7.6
MAUS-v0.7.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include <algorithm>
22
22
 
23
 
#include "src/legacy/Interface/Squeal.hh"
 
23
#include "Utils/Exception.hh"
24
24
 
25
25
#include "src/common_cpp/Utils/JsonWrapper.hh"
26
26
#include "src/common_cpp/JsonCppStreamer/ORStream.hh"
57
57
    _fname = JsonWrapper::GetProperty(datacards,
58
58
                  "output_root_file_name", JsonWrapper::stringValue).asString();
59
59
    if (_fname == "") {
60
 
        throw(Squeal(
61
 
          Squeal::recoverable,
 
60
        throw(Exception(
 
61
          Exception::recoverable,
62
62
          "output_root_file_name is empty",
63
63
          "OutputCppRoot::birth"
64
64
        ));
72
72
    } else if (mode == "end_of_run_file_per_run") {
73
73
        _mode = end_of_run_file_per_run;
74
74
    } else {
75
 
        throw(Squeal(
76
 
          Squeal::recoverable,
 
75
        throw(Exception(
 
76
          Exception::recoverable,
77
77
          "output_root_file_name '"+mode+"' is not valid; should be one of\n"+
78
78
          std::string("   one_big_file\n")+
79
79
          std::string("   one_file_per_run\n")+
103
103
    data_cpp = conv.convert(&data_json);
104
104
    check_file_exists(data_cpp);
105
105
    if (_outfile == NULL) {
106
 
        throw(Squeal(
107
 
          Squeal::recoverable,
 
106
        throw(Exception(
 
107
          Exception::recoverable,
108
108
          "OutputCppRoot was not initialised properly",
109
109
          "OutputCppRoot::write_event"
110
110
        ));
172
172
    } else if (type == "RunFooter") {
173
173
        return _run_footer_tp;
174
174
    } else {
175
 
        throw Squeal(Squeal::recoverable,
 
175
        throw MAUS::Exception(Exception::recoverable,
176
176
                     "Failed to recognise maus_event_type "+type,
177
177
                     "OutputCppRoot::get_event_type");
178
178
    }
241
241
    if (stat(dir.c_str(), &attributes) < 0 || !S_ISDIR(attributes.st_mode)) {
242
242
        // if stat fails, maybe the directory doesnt exists
243
243
        if (mkdir(dir.c_str(), ACCESSPERMS) == -1) {
244
 
            throw Squeal(Squeal::recoverable, "Failed to make directory "+dir,
 
244
            throw Exception(Exception::recoverable, "Failed to make directory "+dir,
245
245
                         "OutputCppRoot::check_file_exists");
246
246
        }
247
247
    }