PulseInfoWriter.cc
Go to the documentation of this file.
1 /*
2  * PulseInfoWriter.cpp
3  *
4  * Created on: Jul 24, 2015
5  * Author: leven
6  */
7 
8 #include "PulseInfoWriter.h"
9 
10 #include <limits> // setprecision
11 #include <iomanip> // setprecision
12 
13 using namespace std;
14 namespace fs = boost::filesystem;
15 using namespace rdet;
16 using namespace evt;
17 using namespace utl;
18 using namespace revt;
19 
20 using namespace RdAirplane;
21 
22 const char* PulseInfoWriter::pulseInfoFileName = "pulseInfo.dat";
23 
24 PulseInfoWriter::PulseInfoWriter(
25  DataWriter* pDataWriter,
26  const fs::path& pOutputDirectory,
27  Event& pEvent) :
28  _dataWriter_(pDataWriter),
29  _outputFile_(fs::path(pOutputDirectory)),
30  _event_(pEvent) {
31  _outputFile_+="/";
33  ofstream pulseInfoFileHandle;
34  pulseInfoFileHandle.open(_outputFile_.c_str());
35  try {
36  if(!pulseInfoFileHandle.is_open()) {
37  throw runtime_error("Could not write data for event.");
38  }
39  pulseInfoFileHandle << setprecision(numeric_limits<long double>::digits10 + 1)
40 
41  << "Station Id| "
42 
43  << "Signal To Noise Ratio| "
44 
45  << "Measured Pulse Peak Time EW (ns)| "
46  << "Measured Pulse Peak Time NS (ns)| "
47  << "Measured E-Vector Peak Time (ns)| "
48  << endl;
49  } catch(...) {
50  pulseInfoFileHandle.close();
51  throw;
52  }
53  pulseInfoFileHandle.close();
54 }
55 
57  const revt::Station& pStation,
58  const rdet::Station& pRadioStation) {
59  string stationIdAsString = boost::lexical_cast<string>(pRadioStation.GetId());
60  const CoordinateSystemPtr stationCS = pRadioStation.GetLocalCoordinateSystem();
61  const StationRecData& recData = pStation.GetRecData();
62  ofstream pulseInfoFileHandle;
63  pulseInfoFileHandle.open(_outputFile_.c_str(), ios_base::app);
64  try {
65  if(!pulseInfoFileHandle.is_open()) {
66  throw runtime_error("Could not write data for event.");
67  }
68  pulseInfoFileHandle << setprecision(numeric_limits<long double>::digits10 + 1)
69 
70  << stationIdAsString << " "
71 
72  << recData.GetParameter(eSignalToNoise) << " "
73 
74  << recData.GetParameter(ePeakTimeEW) << " "
75  << recData.GetParameter(ePeakTimeNS) << " "
76  << recData.GetParameter(ePeakTimeMag) << " "
77 
78  << endl;
79  } catch(...) {
80  pulseInfoFileHandle.close();
81  throw;
82  }
83  pulseInfoFileHandle.close();
84  return true;
85 }
86 
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger reference system centered on the station.
Class to access station level reconstructed data.
Detector description interface for Station-related data.
StationRecData & GetRecData()
Get station level reconstructed data.
static const char * pulseInfoFileName
boost::filesystem::path _outputFile_
bool writePulseInfo(const revt::Station &pStation, const rdet::Station &pRadioStation)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
class to hold data at the radio Station level.
int GetId() const
Station ID.
double GetParameter(const Parameter i) const

, generated on Tue Sep 26 2023.