8 {
9 ERS_DEBUG(1, "Configuring FileReaderWriter");
17 try{
18 auto of=
args.get_child(
"outputFileName");
21 }catch(boost::property_tree::ptree_bad_path &ex){
22 ERS_LOG("Failed to get outputFileName");
23 }
24 auto r(
args.get_child(
"fileList").equal_range(
"file"));
25 for (
auto it =
r.first; it !=
r.second; ++it) {
27 ERS_LOG(
" Adding file "+
it->second.get_value<std::string>());
28 }
30 ERS_LOG("No input files specified");
31 throw BadConfiguration();
32 }
33
34
35 const auto & run_params =
args.get_child(
"RunParams");
36 std::string detmask = run_params.get("det_mask", "");
37 uint64_t detmask_LS(0), detmask_MS(0);
38 if (detmask.size() == 32) {
39 detmask_LS = std::stoull(detmask.substr(16, 32), 0, 16);
40 detmask_MS = std::stoull(detmask.substr(0, 16), 0, 16);
41 }
43 std::unique_ptr<EventStorage::run_parameters_record> runParams;
44 runParams=std::make_unique<EventStorage::run_parameters_record>();
45 runParams->run_number = std::stoul(run_params.get("run_number", "0"));
46 runParams->max_events = 0;
47 runParams->rec_enable = 0;
48 runParams->trigger_type = std::stoul(run_params.get("trigger_type", "0"));
49 runParams->detector_mask_LS = detmask_LS;
50 runParams->detector_mask_MS = detmask_MS;
51 runParams->beam_type = std::stoul(run_params.get("beam_type", "0"));
52 runParams->beam_energy = std::stoul(run_params.get("beam_energy", "0"));
53 ERS_LOG(
"Opening outputfile with base name: " <<
m_outFileName);
54
55 std::string
path =
".";
56 std::string
project = run_params.get(
"T0_project_tag",
"");
59 std::string
stream = run_params.get(
"stream",
"");
60 unsigned int lumiBlockNumber = run_params.get("lumiblock", 0);;
61 std::string applicationName = std::string(
"DFEF_") +
m_outFileName;
62
63 std::vector<std::string> fmdStrings = {};
64
65 ERS_LOG("Going to open raw file");
66 auto rawfilename = boost::shared_ptr<daq::RawFileName>
67 (
new daq::RawFileName(
project, runParams->run_number,streamType, streamName, lumiBlockNumber, applicationName));
68
69
70 ERS_LOG("Raw file name: ");
71 rawfilename->print();
72
73 m_writer=std::make_unique<EventStorage::DataWriter>(path,
74 rawfilename,
75 *runParams,
77 streamType,
78 streamName,
79 stream,
80 lumiBlockNumber,
81 applicationName,
82 fmdStrings);
84 }
86
88 ERS_LOG("Events in file: " << eventsInFile);
89
91 ERS_LOG(
"Events to skip: " + std::to_string(
m_nSkip) +
", total events in file: " + std::to_string(eventsInFile));
92 throw BadConfiguration();
93 }
95 ERS_LOG(
"Skipping " <<
m_nSkip <<
" events");
97 }
98
100}
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
std::string m_outFileName
std::unique_ptr< EventStorage::DataWriter > m_writer
std::vector< std::string > m_fileNames
void print()
Print configuration of the FileReaderWriter.
std::unique_ptr< EventStorage::DataReader > m_currReader
void skipEvents(uint num)
path
python interpreter configuration --------------------------------------—