SELFASFile.h
Go to the documentation of this file.
1 #ifndef _io_SELFASFile_h_
2 #define _io_SELFASFile_h_
3 
4 #include <io/SELFASIOException.h>
5 #include <io/VEventFile.h>
6 #include <dirent.h>
7 #include <fstream>
8 #include <vector>
9 #include <utl/Vector.h>
10 #include <revt/Station.h>
11 #include <utl/VParticleProperties.h>
12 #include <cmath>
13 #include <iostream>
14 #include <iomanip>
15 #include <sstream>
16 #include <string>
17 #include <boost/tokenizer.hpp>
18 #include <boost/filesystem/path.hpp>
19 
20 
21 namespace evt {
22  class Event;
23  class ShowerSimData;
24 }
25 
26 namespace io {
27 
38  class SELFASFile : public VEventFile {
39 
40  public:
41  SELFASFile() { }
42  SELFASFile(const std::string& filename, const Mode mode = eRead, utl::Branch* const b = nullptr);
43  virtual ~SELFASFile() { }
44 
45  void Write(const evt::Event& theEvent) override;
46  Status Read(evt::Event& theEvent) override;
47  Status FindEvent(const unsigned int eventId) override;
48  int GetNEvents() override { return 1; }
49  void Close() override;
50  void Open(const std::string& fileName, const Mode mode, utl::Branch* const b = nullptr) override;
51  Status GotoPosition(const unsigned int pos) override;
52 
53  private:
54  template<class T> bool from_string(T& t, const std::string& s, std::ios_base &(*f)(std::ios_base&));
55  std::vector<std::string> StringSplitter(const std::string& line, const std::string& sep);
56 
57  // logistics for reading the file
58  unsigned int fCurrentPosition = 0;
59  std::string FileName;
60  std::string FileType;
61  std::string name;
62  std::string path_name;
63  std::string version_string;
64  std::string file_extension;
65  std::ifstream finput_file;
66  bool file_open = false;
67  unsigned int events_remaining = 1;
68 
69  // This is all data that is read from the .selfas file.
70  //utl::Vector3D core_position; // unused. LN.
71  //utl::Vector3D refcoord; // unused. LN.
72  std::string fprimary_particle;
74  std::string fparticle_id;
75  //bool fhas_magnetic_field = false; // unused. LN.
76  double fzenith_angle;
82  double ftime_step;
84  bool fhas_charge_excess = false;
86  double charge_excess;
87  double de_dx;
89  double Cerenkov;
90  bool fhas_dE_dx = false;
95  double fxefield;
96  double fyefield;
97  double fzefield;
98  double fB0;
99  double fBx;
100  double fBy;
101  double fBz;
104  double fxmax;
105  double fxinflexion;
107 
108  };
109 
110 }
111 
112 
113 #endif
int GetNEvents() override
Definition: SELFASFile.h:48
std::ifstream finput_file
Definition: SELFASFile.h:65
double ffirst_interaction_lenght
Definition: SELFASFile.h:81
double fxinflexion
Definition: SELFASFile.h:105
double fzenith_angle
Definition: SELFASFile.h:76
double fSiteGround_gcm2
Definition: SELFASFile.h:103
double fxefield
Definition: SELFASFile.h:95
double ftime_step
Definition: SELFASFile.h:82
double fz_core_relative_position
Definition: SELFASFile.h:94
void Close() override
Definition: SELFASFile.cc:360
double fazimuth_angle
Definition: SELFASFile.h:77
std::string version_string
Definition: SELFASFile.h:63
Mode
Available open modes.
Definition: IoCodes.h:16
double de_dx
Definition: SELFASFile.h:87
Status FindEvent(const unsigned int eventId) override
seek Event id set cursor there
Definition: SELFASFile.cc:377
std::string name
Definition: SELFASFile.h:61
double fyefield
Definition: SELFASFile.h:96
std::string fprimary_particle
Definition: SELFASFile.h:72
double charge_excess
Definition: SELFASFile.h:86
std::vector< std::string > StringSplitter(const std::string &line, const std::string &sep)
Definition: SELFASFile.cc:74
void Open(const std::string &fileName, const Mode mode, utl::Branch *const b=nullptr) override
Definition: SELFASFile.cc:54
Class representing a document branch.
Definition: Branch.h:107
Status
Return code for seek operation.
Definition: IoCodes.h:24
constexpr double s
Definition: AugerUnits.h:163
double fzefield
Definition: SELFASFile.h:97
int fantennas_number
Definition: SELFASFile.h:91
unsigned int events_remaining
Definition: SELFASFile.h:67
double fsimulated_particles
Definition: SELFASFile.h:83
double Cerenkov
Definition: SELFASFile.h:89
bool from_string(T &t, const std::string &s, std::ios_base &(*f)(std::ios_base &))
Definition: SELFASFile.cc:89
double fSiteGround_m
Definition: SELFASFile.h:102
std::string fparticle_id
Definition: SELFASFile.h:74
std::string FileType
Definition: SELFASFile.h:60
bool fhas_multiple_scattering
Definition: SELFASFile.h:85
Status Read(evt::Event &theEvent) override
read current event advance cursor by 1
Definition: SELFASFile.cc:97
double fprimary_energy
Definition: SELFASFile.h:73
Status GotoPosition(const unsigned int pos) override
goto by position in the file
Definition: SELFASFile.cc:384
std::string FileName
Definition: SELFASFile.h:59
double fx_core_position
Definition: SELFASFile.h:78
double multiple_scattering
Definition: SELFASFile.h:88
bool fhas_charge_excess
Definition: SELFASFile.h:84
double fy_core_relative_position
Definition: SELFASFile.h:93
bool fhas_Cerenkov
Definition: SELFASFile.h:106
unsigned int fCurrentPosition
Definition: SELFASFile.h:58
char * filename
Definition: dump1090.h:266
double fy_core_position
Definition: SELFASFile.h:79
virtual ~SELFASFile()
Definition: SELFASFile.h:43
std::string path_name
Definition: SELFASFile.h:62
Read SELFAS simulation output.
Definition: SELFASFile.h:38
double fx_core_relative_position
Definition: SELFASFile.h:92
double fz_core_position
Definition: SELFASFile.h:80
void Write(const evt::Event &theEvent) override
Definition: SELFASFile.cc:368
std::string file_extension
Definition: SELFASFile.h:64

, generated on Tue Sep 26 2023.