ZHAireSFile.h
Go to the documentation of this file.
1 #ifndef _io_ZHAireSFile_h_
2 #define _io_ZHAireSFile_h_
3 
4 #include <utl/Math.h>
5 #include <utl/AugerUnits.h>
6 #include <io/ZHAireSIOException.h>
7 #include <io/VEventFile.h>
8 #include <fstream>
9 #include <vector>
10 
11 
12 namespace evt {
13  class Event;
14  class ShowerSimData;
15 }
16 
17 namespace io {
18 
19 #ifdef HAVE_AIRES
20  class AiresShowerFile;
21 #endif
22 
23 
24  class ZHAireSFile : public VEventFile {
25 
26  public:
28  ZHAireSFile(const std::string& fileName, const Mode mode = eRead, utl::Branch* const b = nullptr);
29  virtual ~ZHAireSFile();
30 
31  void Open(const std::string& fileName, const Mode mode = eRead, utl::Branch* const b = nullptr) override;
32  void Close() override;
33  Status Read(evt::Event& event) override;
34  void Write(const evt::Event& event) override;
35  Status FindEvent(const unsigned int eventId) override;
36  Status GotoPosition(const unsigned int position) override;
37  int GetNEvents() override { return 1; } // there is currently one event in a ZHAireS file
38 
40  double
41  ZHAireSAzimuthToAuger(const double airesAzimuth)
42  {
43  //const double kMagneticFieldDeclination = 4.233*utl::deg;
45  return utl::NormalizeAngleMinusPiPi(airesAzimuth + 90*utl::deg - kMagneticFieldDeclination);
46  }
47 
48  static
49  void
50  Rotatez(const double theta, const double vi[], double vf[])
51  {
52  const double ct = cos(theta);
53  const double st = sin(theta);
54  vf[0] = vi[0]*ct - vi[1]*st;
55  vf[1] = vi[0]*st + vi[1]*ct;
56  vf[2] = vi[2];
57  }
58 
59  private:
60  ZHAireSFile(const ZHAireSFile&);
62 
63  unsigned int fCurrentPosition = 0;
64  double fBDeclination = 0;
65  std::vector<std::string> fBinFileList;
66  std::ifstream* fZHAireSin = nullptr;
67  std::ifstream* fsry = nullptr;
68  std::ifstream* fdef = nullptr;
69  //for "reas reader" path finder
70  std::string fOrigDirectory;
71  std::string fZHAireSDirectory;
72  // from REASFile.h
73  std::string fHostName;
74  unsigned long fProcessId;
75  //TEST LOG
76  std::ofstream logfile;
77 
78 #ifdef HAVE_AIRES
79  AiresShowerFile* fAiresShowerFile = nullptr;
80 #endif
81 
82  };
83 
84 }
85 
86 
87 #endif
double NormalizeAngleMinusPiPi(const double x)
Normalize angle to lie between -pi and pi (-180 and 180 deg)
virtual ~ZHAireSFile()
Definition: ZHAireSFile.cc:56
constexpr double rad
Definition: AugerUnits.h:137
Mode
Available open modes.
Definition: IoCodes.h:16
double ZHAireSAzimuthToAuger(const double airesAzimuth)
Returns the azimuth rotated from AIRES&#39;s system to Auger standard.
Definition: ZHAireSFile.h:41
std::ifstream * fsry
Definition: ZHAireSFile.h:67
constexpr double deg
Definition: AugerUnits.h:140
Class representing a document branch.
Definition: Branch.h:107
Status
Return code for seek operation.
Definition: IoCodes.h:24
std::string fOrigDirectory
Definition: ZHAireSFile.h:70
std::ofstream logfile
Definition: ZHAireSFile.h:76
static void Rotatez(const double theta, const double vi[], double vf[])
Definition: ZHAireSFile.h:50
std::vector< std::string > fBinFileList
Definition: ZHAireSFile.h:65
void Close() override
Definition: ZHAireSFile.cc:210
double fBDeclination
Definition: ZHAireSFile.h:64
unsigned long fProcessId
Definition: ZHAireSFile.h:74
std::ifstream * fdef
Definition: ZHAireSFile.h:68
std::string fZHAireSDirectory
Definition: ZHAireSFile.h:71
int GetNEvents() override
Definition: ZHAireSFile.h:37
std::string fHostName
Definition: ZHAireSFile.h:73
Status GotoPosition(const unsigned int position) override
goto by position in the file
Definition: ZHAireSFile.cc:851
Status FindEvent(const unsigned int eventId) override
seek Event id set cursor there
Definition: ZHAireSFile.cc:843
Status Read(evt::Event &event) override
read current event advance cursor by 1
Definition: ZHAireSFile.cc:231
void Write(const evt::Event &event) override
Definition: ZHAireSFile.cc:834
ZHAireSFile & operator=(const ZHAireSFile &)
static double kMagneticFieldDeclination
Utility to open an Aires generated shower file on disc.
void Open(const std::string &fileName, const Mode mode=eRead, utl::Branch *const b=nullptr) override
Definition: ZHAireSFile.cc:79
unsigned int fCurrentPosition
Definition: ZHAireSFile.h:63
std::ifstream * fZHAireSin
Definition: ZHAireSFile.h:66

, generated on Tue Sep 26 2023.