This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AsciiDataIO_8cpp_source.html
131 lines (129 loc) · 39.4 KB
/
AsciiDataIO_8cpp_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ComPWA: Data/Ascii/AsciiDataIO.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="doxy-boot.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">ComPWA
</div>
<div id="projectbrief">Common Partial-Wave-Analysis Framework</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('AsciiDataIO_8cpp_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">AsciiDataIO.cpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="AsciiDataIO_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// This file is part of the ComPWA framework, check</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Copyright (c) 2013 The ComPWA Team.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// https://github.com/ComPWA/ComPWA/license.txt for details.</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> </div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include <fstream></span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include <sstream></span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include <utility></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> </div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include "<a class="code" href="Exceptions_8hpp.html">Core/Exceptions.hpp</a>"</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include "<a class="code" href="Logging_8hpp.html">Core/Logging.hpp</a>"</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include "<a class="code" href="AsciiDataIO_8hpp.html">Data/Ascii/AsciiDataIO.hpp</a>"</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include "<a class="code" href="AsciiHeaderIO_8hpp.html">Data/Ascii/AsciiHeaderIO.hpp</a>"</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="keyword">namespace </span><a class="code" href="namespaceComPWA.html">ComPWA</a> {</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="keyword">namespace </span>Data {</div><div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="namespaceComPWA_1_1Data_1_1Ascii.html"> 16</a></span> <span class="keyword">namespace </span>Ascii {</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> </div><div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="namespaceComPWA_1_1Data_1_1Ascii.html#a2393f6763218089de82c477f033376f5"> 18</a></span> <a class="code" href="structComPWA_1_1EventCollection.html">EventCollection</a> <a class="code" href="namespaceComPWA_1_1Data_1_1Ascii.html#a2393f6763218089de82c477f033376f5">readData</a>(<span class="keyword">const</span> std::string &InputFilePath,</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> NumberEventsToRead) {</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  std::ifstream InputStream(InputFilePath);</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="keywordflow">if</span> (!InputStream.good())</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="keywordflow">throw</span> <a class="code" href="classComPWA_1_1CorruptFile.html">ComPWA::CorruptFile</a>(<span class="stringliteral">"Cannot open file "</span> + InputFilePath);</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html">AsciiHeader</a> Header;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  Header.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#ab4f5176905696305c7da79a07b28e3fc">importYAML</a>(InputStream);</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keyword">auto</span> Position = InputStream.tellg();</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordflow">if</span> (!Header.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a7e3d76badb74ce2f3af454612e136bec">getFinalStatePIDs</a>().size())</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="keywordflow">throw</span> <a class="code" href="classComPWA_1_1BadConfig.html">ComPWA::BadConfig</a>(<span class="stringliteral">"Input data file "</span> + InputFilePath +</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="stringliteral">" misses a header with PIDs"</span>);</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> </div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordtype">bool</span> HasWeights = <span class="keyword">false</span>;</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keywordtype">double</span> weight, px, py, pz, e;</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  std::string Line;</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keywordflow">while</span> (std::getline(InputStream, Line)) {</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">if</span> (std::all_of(Line.begin(), Line.end(),</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  [](<span class="keywordtype">char</span> c) { <span class="keywordflow">return</span> std::isspace(c); }))</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  std::stringstream StringStream(Line);</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordflow">if</span> ((StringStream >> weight) && !(StringStream >> py))</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  HasWeights = <span class="keyword">true</span>;</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  }</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  InputStream.seekg(Position);</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> </div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordtype">size_t</span> NumberOfParticles = 0;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keywordflow">if</span> (HasWeights) {</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="keywordtype">double</span> weight, px, py, pz, e;</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  InputStream >> weight;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  std::string Line;</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordflow">while</span> (std::getline(InputStream, Line)) {</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordflow">if</span> (std::all_of(Line.begin(), Line.end(),</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  [](<span class="keywordtype">char</span> c) { <span class="keywordflow">return</span> std::isspace(c); }))</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  std::stringstream StringStream(Line);</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keywordflow">if</span> (!(StringStream >> e >> px >> py >> pz))</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  ++NumberOfParticles;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  }</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  InputStream.seekg(Position);</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordflow">if</span> (Header.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a7e3d76badb74ce2f3af454612e136bec">getFinalStatePIDs</a>().size() != NumberOfParticles)</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keywordflow">throw</span> <a class="code" href="classComPWA_1_1BadConfig.html">ComPWA::BadConfig</a>(<span class="stringliteral">"Number of particles in header is not same as "</span></div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="stringliteral">"number of tuple lines in file \""</span> +</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  InputFilePath + <span class="stringliteral">"\""</span>);</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  NumberOfParticles = Header.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a7e3d76badb74ce2f3af454612e136bec">getFinalStatePIDs</a>().size();</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  }</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> </div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordtype">bool</span> IsEnergyFirst = <span class="keyword">false</span>;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">if</span> (HasWeights)</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  InputStream >> weight;</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  InputStream >> e >> px >> py >> pz;</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordflow">if</span> (e * e - px * px - py * py - pz * pz > 0.)</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  IsEnergyFirst = <span class="keyword">true</span>;</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  InputStream.seekg(Position);</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">if</span> (Header.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a3efef6f20d529ef294680f1aa4c32a4d">isEnergyFirst</a>() != IsEnergyFirst)</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">throw</span> <a class="code" href="classComPWA_1_1BadConfig.html">ComPWA::BadConfig</a>(</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="stringliteral">"Energy-momentum order is not same as stated in header for file \""</span> +</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  InputFilePath + <span class="stringliteral">"\""</span>);</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span> </div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <a class="code" href="structComPWA_1_1EventCollection.html">EventCollection</a> ImportedData{Header.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a7e3d76badb74ce2f3af454612e136bec">getFinalStatePIDs</a>()};</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> </div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  weight = 1.;</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">while</span> (InputStream.good()) {</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keywordflow">if</span> (HasWeights)</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  InputStream >> weight;</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  std::vector<FourMomentum> FourVectors;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  FourVectors.reserve(NumberOfParticles);</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < NumberOfParticles; ++i) {</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keywordflow">if</span> (IsEnergyFirst)</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  InputStream >> e >> px >> py >> pz;</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  InputStream >> px >> py >> pz >> e;</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  FourVectors.push_back(<a class="code" href="classComPWA_1_1FourMomentum.html">ComPWA::FourMomentum</a>(px, py, pz, e));</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  }</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordflow">if</span> (!InputStream.fail())</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  ImportedData.Events.push_back(<a class="code" href="structComPWA_1_1Event.html">Event</a>{FourVectors, weight});</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="keywordflow">if</span> (NumberEventsToRead > 0 &&</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  ImportedData.Events.size() == (std::size_t)NumberEventsToRead)</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  }</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  InputStream.close();</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span> </div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordflow">return</span> ImportedData;</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> }</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div><div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="namespaceComPWA_1_1Data_1_1Ascii.html#a6afbc89714b2fa813987b82a21acc366"> 114</a></span> <span class="keywordtype">void</span> <a class="code" href="namespaceComPWA_1_1Data_1_1Ascii.html#a6afbc89714b2fa813987b82a21acc366">writeData</a>(<span class="keyword">const</span> <a class="code" href="structComPWA_1_1EventCollection.html">EventCollection</a> &DataSample,</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="keyword">const</span> std::string &OutputFilePath, <span class="keywordtype">bool</span> OverwriteFile) {</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordflow">if</span> (!DataSample.<a class="code" href="structComPWA_1_1EventCollection.html#ae046211ede6817d51d769b372aab67dc">Events</a>.size())</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordflow">throw</span> <a class="code" href="classComPWA_1_1BadParameter.html">ComPWA::BadParameter</a>(<span class="stringliteral">"Cannot write empty event vector"</span>);</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <a class="code" href="classComPWA_1_1Logging.html">ComPWA::Logging</a> log(<span class="stringliteral">"warning"</span>);</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span> </div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="keyword">auto</span> OpenMode = std::ofstream::out;</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <span class="keywordflow">if</span> (!OverwriteFile) {</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  std::ifstream InputStream(OutputFilePath);</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="keyword">auto</span> HeaderContent = <a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a54a47af3ff1f25f7c6ec46183d108129">AsciiHeader::extractHeaderContent</a>(InputStream);</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="keywordflow">if</span> (HeaderContent != <span class="stringliteral">""</span>) { <span class="comment">// if there is a header, check consistency</span></div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html">AsciiHeader</a> HeaderIn;</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  HeaderIn.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#ab4f5176905696305c7da79a07b28e3fc">importYAML</a>(HeaderContent);</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html">AsciiHeader</a> HeaderOut(DataSample.<a class="code" href="structComPWA_1_1EventCollection.html#afe881181ec29b066e5f49d769a9da1bc">Pids</a>);</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordflow">if</span> (HeaderOut.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a7e3d76badb74ce2f3af454612e136bec">getFinalStatePIDs</a>() != HeaderIn.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a7e3d76badb74ce2f3af454612e136bec">getFinalStatePIDs</a>())</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keywordflow">throw</span> <a class="code" href="classComPWA_1_1BadConfig.html">ComPWA::BadConfig</a>(<span class="stringliteral">"Cannot append to file \""</span> + OutputFilePath +</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="stringliteral">"\", because its PIDs are not the same as the "</span></div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="stringliteral">"event list you try to write"</span>);</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordflow">if</span> (HeaderOut.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a2ad5d82b8d1dbecbd6496804cff8f692">getUnit</a>() != HeaderIn.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a2ad5d82b8d1dbecbd6496804cff8f692">getUnit</a>())</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="keywordflow">throw</span> <a class="code" href="classComPWA_1_1BadConfig.html">ComPWA::BadConfig</a>(<span class="stringliteral">"Cannot append to file \""</span> + OutputFilePath +</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="stringliteral">"\", because there is a mismatch in units"</span>);</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="keywordflow">if</span> (HeaderOut.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a3efef6f20d529ef294680f1aa4c32a4d">isEnergyFirst</a>() != HeaderIn.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a3efef6f20d529ef294680f1aa4c32a4d">isEnergyFirst</a>())</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="keywordflow">throw</span> <a class="code" href="classComPWA_1_1BadConfig.html">ComPWA::BadConfig</a>(</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="stringliteral">"Cannot append to file \""</span> + OutputFilePath +</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="stringliteral">"\", because the momentum-energy order is not the same"</span>);</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  }</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  OpenMode |= std::ofstream::app;</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  }</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span> </div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  std::ofstream OutputStream;</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  OutputStream.open(OutputFilePath, OpenMode);</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span> </div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keywordflow">if</span> (OverwriteFile) {</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html">AsciiHeader</a> HeaderOut(DataSample.<a class="code" href="structComPWA_1_1EventCollection.html#afe881181ec29b066e5f49d769a9da1bc">Pids</a>);</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  HeaderOut.<a class="code" href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a37d72d007e099ecdf24940cc7301acd0">dumpToYAML</a>(OutputStream);</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  OutputStream << std::endl;</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  }</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span> </div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span> &<a class="code" href="structComPWA_1_1Event.html">Event</a> : DataSample.<a class="code" href="structComPWA_1_1EventCollection.html#ae046211ede6817d51d769b372aab67dc">Events</a>) {</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  OutputStream << <a class="code" href="structComPWA_1_1Event.html">Event</a>.<a class="code" href="structComPWA_1_1Event.html#a8a130412ee6d2c531a7aed66c70cb166">Weight</a> << std::endl;</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span> &FourMom : <a class="code" href="structComPWA_1_1Event.html">Event</a>.<a class="code" href="structComPWA_1_1Event.html#a7f1ca23b0f89ac07f1aeb16a88ca545a">FourMomenta</a>) {</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  OutputStream << FourMom.px() << <span class="stringliteral">"\t"</span>;</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  OutputStream << FourMom.py() << <span class="stringliteral">"\t"</span>;</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  OutputStream << FourMom.pz() << <span class="stringliteral">"\t"</span>;</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  OutputStream << FourMom.e() << std::endl;</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  }</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  }</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span> }</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span> </div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span> } <span class="comment">// namespace Ascii</span></div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span> } <span class="comment">// namespace Data</span></div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> } <span class="comment">// namespace ComPWA</span></div><div class="ttc" id="classComPWA_1_1FourMomentum_html"><div class="ttname"><a href="classComPWA_1_1FourMomentum.html">ComPWA::FourMomentum</a></div><div class="ttdoc">ComPWA four momentum class. </div><div class="ttdef"><b>Definition:</b> <a href="FourMomentum_8hpp_source.html#l00021">FourMomentum.hpp:21</a></div></div>
<div class="ttc" id="classComPWA_1_1BadParameter_html"><div class="ttname"><a href="classComPWA_1_1BadParameter.html">ComPWA::BadParameter</a></div><div class="ttdoc">Parameter not existing. </div><div class="ttdef"><b>Definition:</b> <a href="Exceptions_8hpp_source.html#l00062">Exceptions.hpp:62</a></div></div>
<div class="ttc" id="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader_html_ab4f5176905696305c7da79a07b28e3fc"><div class="ttname"><a href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#ab4f5176905696305c7da79a07b28e3fc">ComPWA::Data::Ascii::AsciiHeader::importYAML</a></div><div class="ttdeci">void importYAML(const std::string &HeaderContent)</div><div class="ttdoc">Set data members by reading a YAML-like string (including newlines). </div><div class="ttdef"><b>Definition:</b> <a href="AsciiHeaderIO_8cpp_source.html#l00085">AsciiHeaderIO.cpp:85</a></div></div>
<div class="ttc" id="AsciiDataIO_8hpp_html"><div class="ttname"><a href="AsciiDataIO_8hpp.html">AsciiDataIO.hpp</a></div></div>
<div class="ttc" id="classComPWA_1_1CorruptFile_html"><div class="ttname"><a href="classComPWA_1_1CorruptFile.html">ComPWA::CorruptFile</a></div><div class="ttdoc">Input data file is corrupt or incomplete. </div><div class="ttdef"><b>Definition:</b> <a href="Exceptions_8hpp_source.html#l00086">Exceptions.hpp:86</a></div></div>
<div class="ttc" id="AsciiHeaderIO_8hpp_html"><div class="ttname"><a href="AsciiHeaderIO_8hpp.html">AsciiHeaderIO.hpp</a></div></div>
<div class="ttc" id="namespaceComPWA_html"><div class="ttname"><a href="namespaceComPWA.html">ComPWA</a></div><div class="ttdef"><b>Definition:</b> <a href="Efficiency_8cpp_source.html#l00007">Efficiency.cpp:7</a></div></div>
<div class="ttc" id="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader_html_a3efef6f20d529ef294680f1aa4c32a4d"><div class="ttname"><a href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a3efef6f20d529ef294680f1aa4c32a4d">ComPWA::Data::Ascii::AsciiHeader::isEnergyFirst</a></div><div class="ttdeci">bool isEnergyFirst() const</div><div class="ttdef"><b>Definition:</b> <a href="AsciiHeaderIO_8hpp_source.html#l00051">AsciiHeaderIO.hpp:51</a></div></div>
<div class="ttc" id="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader_html"><div class="ttname"><a href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html">ComPWA::Data::Ascii::AsciiHeader</a></div><div class="ttdoc">Representation of data contained in an ASCII header. </div><div class="ttdef"><b>Definition:</b> <a href="AsciiHeaderIO_8hpp_source.html#l00021">AsciiHeaderIO.hpp:21</a></div></div>
<div class="ttc" id="Exceptions_8hpp_html"><div class="ttname"><a href="Exceptions_8hpp.html">Exceptions.hpp</a></div><div class="ttdoc">ComPWA exceptions. </div></div>
<div class="ttc" id="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader_html_a37d72d007e099ecdf24940cc7301acd0"><div class="ttname"><a href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a37d72d007e099ecdf24940cc7301acd0">ComPWA::Data::Ascii::AsciiHeader::dumpToYAML</a></div><div class="ttdeci">void dumpToYAML(std::ostream &os) const</div><div class="ttdoc">Serialise data members to YAML format, embedded in XML header tags. </div><div class="ttdef"><b>Definition:</b> <a href="AsciiHeaderIO_8cpp_source.html#l00118">AsciiHeaderIO.cpp:118</a></div></div>
<div class="ttc" id="namespaceComPWA_1_1Data_1_1Ascii_html_a2393f6763218089de82c477f033376f5"><div class="ttname"><a href="namespaceComPWA_1_1Data_1_1Ascii.html#a2393f6763218089de82c477f033376f5">ComPWA::Data::Ascii::readData</a></div><div class="ttdeci">EventCollection readData(const std::string &InputFilePath, long long NumberEventsToRead)</div><div class="ttdoc">Read momentum tuples from an ASCII file. </div><div class="ttdef"><b>Definition:</b> <a href="AsciiDataIO_8cpp_source.html#l00018">AsciiDataIO.cpp:18</a></div></div>
<div class="ttc" id="Logging_8hpp_html"><div class="ttname"><a href="Logging_8hpp.html">Logging.hpp</a></div></div>
<div class="ttc" id="structComPWA_1_1EventCollection_html"><div class="ttname"><a href="structComPWA_1_1EventCollection.html">ComPWA::EventCollection</a></div><div class="ttdef"><b>Definition:</b> <a href="Event_8hpp_source.html#l00025">Event.hpp:25</a></div></div>
<div class="ttc" id="structComPWA_1_1EventCollection_html_ae046211ede6817d51d769b372aab67dc"><div class="ttname"><a href="structComPWA_1_1EventCollection.html#ae046211ede6817d51d769b372aab67dc">ComPWA::EventCollection::Events</a></div><div class="ttdeci">std::vector< Event > Events</div><div class="ttdef"><b>Definition:</b> <a href="Event_8hpp_source.html#l00034">Event.hpp:34</a></div></div>
<div class="ttc" id="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader_html_a2ad5d82b8d1dbecbd6496804cff8f692"><div class="ttname"><a href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a2ad5d82b8d1dbecbd6496804cff8f692">ComPWA::Data::Ascii::AsciiHeader::getUnit</a></div><div class="ttdeci">const std::string & getUnit() const</div><div class="ttdef"><b>Definition:</b> <a href="AsciiHeaderIO_8hpp_source.html#l00052">AsciiHeaderIO.hpp:52</a></div></div>
<div class="ttc" id="classComPWA_1_1BadConfig_html"><div class="ttname"><a href="classComPWA_1_1BadConfig.html">ComPWA::BadConfig</a></div><div class="ttdoc">Config is not complete. </div><div class="ttdef"><b>Definition:</b> <a href="Exceptions_8hpp_source.html#l00050">Exceptions.hpp:50</a></div></div>
<div class="ttc" id="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader_html_a7e3d76badb74ce2f3af454612e136bec"><div class="ttname"><a href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a7e3d76badb74ce2f3af454612e136bec">ComPWA::Data::Ascii::AsciiHeader::getFinalStatePIDs</a></div><div class="ttdeci">const std::vector< int > getFinalStatePIDs() const</div><div class="ttdef"><b>Definition:</b> <a href="AsciiHeaderIO_8hpp_source.html#l00050">AsciiHeaderIO.hpp:50</a></div></div>
<div class="ttc" id="structComPWA_1_1Event_html_a8a130412ee6d2c531a7aed66c70cb166"><div class="ttname"><a href="structComPWA_1_1Event.html#a8a130412ee6d2c531a7aed66c70cb166">ComPWA::Event::Weight</a></div><div class="ttdeci">double Weight</div><div class="ttdef"><b>Definition:</b> <a href="Event_8hpp_source.html#l00022">Event.hpp:22</a></div></div>
<div class="ttc" id="structComPWA_1_1Event_html_a7f1ca23b0f89ac07f1aeb16a88ca545a"><div class="ttname"><a href="structComPWA_1_1Event.html#a7f1ca23b0f89ac07f1aeb16a88ca545a">ComPWA::Event::FourMomenta</a></div><div class="ttdeci">std::vector< FourMomentum > FourMomenta</div><div class="ttdef"><b>Definition:</b> <a href="Event_8hpp_source.html#l00021">Event.hpp:21</a></div></div>
<div class="ttc" id="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader_html_a54a47af3ff1f25f7c6ec46183d108129"><div class="ttname"><a href="classComPWA_1_1Data_1_1Ascii_1_1AsciiHeader.html#a54a47af3ff1f25f7c6ec46183d108129">ComPWA::Data::Ascii::AsciiHeader::extractHeaderContent</a></div><div class="ttdeci">static std::string extractHeaderContent(std::istream &InputStream)</div><div class="ttdoc">Extract the part that is between the XML/HTML tags <header>...</header> including newlines...</div><div class="ttdef"><b>Definition:</b> <a href="AsciiHeaderIO_8cpp_source.html#l00036">AsciiHeaderIO.cpp:36</a></div></div>
<div class="ttc" id="namespaceComPWA_1_1Data_1_1Ascii_html_a6afbc89714b2fa813987b82a21acc366"><div class="ttname"><a href="namespaceComPWA_1_1Data_1_1Ascii.html#a6afbc89714b2fa813987b82a21acc366">ComPWA::Data::Ascii::writeData</a></div><div class="ttdeci">void writeData(const EventCollection &DataSample, const std::string &OutputFilePath, bool OverwriteFile)</div><div class="ttdef"><b>Definition:</b> <a href="AsciiDataIO_8cpp_source.html#l00114">AsciiDataIO.cpp:114</a></div></div>
<div class="ttc" id="structComPWA_1_1Event_html"><div class="ttname"><a href="structComPWA_1_1Event.html">ComPWA::Event</a></div><div class="ttdoc">Data structure containing all kinematic information of a physics event. </div><div class="ttdef"><b>Definition:</b> <a href="Event_8hpp_source.html#l00020">Event.hpp:20</a></div></div>
<div class="ttc" id="structComPWA_1_1EventCollection_html_afe881181ec29b066e5f49d769a9da1bc"><div class="ttname"><a href="structComPWA_1_1EventCollection.html#afe881181ec29b066e5f49d769a9da1bc">ComPWA::EventCollection::Pids</a></div><div class="ttdeci">std::vector< pid > Pids</div><div class="ttdef"><b>Definition:</b> <a href="Event_8hpp_source.html#l00033">Event.hpp:33</a></div></div>
<div class="ttc" id="classComPWA_1_1Logging_html"><div class="ttname"><a href="classComPWA_1_1Logging.html">ComPWA::Logging</a></div><div class="ttdoc">Logging class provides an interface for logging all over the framework. </div><div class="ttdef"><b>Definition:</b> <a href="Logging_8hpp_source.html#l00019">Logging.hpp:19</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.13-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_e3d743d0ec9b4013b28b5d69101bc7fb.html">Data</a></li><li class="navelem"><a class="el" href="dir_aa484c1228064a85f9f0c4e09a7e4220.html">Ascii</a></li><li class="navelem"><a class="el" href="AsciiDataIO_8cpp.html">AsciiDataIO.cpp</a></li>
<li class="footer">Generated on Mon Jun 22 2020 13:03:33 for ComPWA by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
</ul>
</div>
</body>
</html>