AiresShowerFile.h
Go to the documentation of this file.
1 
7 #ifndef _io_AiresShowerFile_h_
8 #define _io_AiresShowerFile_h_
9 
10 #include <io/VEventFile.h>
11 //#include <io/AiresShowerFileParticleIterator.h>
12 
13 #include <algorithm>
14 #include <map>
15 
16 
17 namespace io {
18 
20 
21 
31  class AiresShowerFile : public VEventFile {
32 
33  public:
35  AiresShowerFile(const std::string& theFileName,
36  const Mode theMode = eRead,
37  const utl::Branch* const b = nullptr);
38  virtual ~AiresShowerFile();
39 
40  void Open(const std::string& theFileName, const Mode theMode = eRead, const utl::Branch* b = nullptr);
41  void Close();
42 
43  Status Read(evt::Event& event);
44  void Write(const evt::Event& event);
45  Status FindEvent(const unsigned int n);
46  Status GotoPosition(const unsigned int n);
47  int GetNEvents();
48 
49  private:
50  bool fIsOpen;
52 
53  int fChannel, fVerbosity, fReturnCode; // Channel, Verbosity and file info
54  int fInitLevel, fCodsys, fIrc; // Used for initialisation of AIRES
55  int fSkipHeader, fLogBase; // Used when opening the AIRES file
56  bool fAltType;
57 
58  // Indices into the AIRES data file
59 
60  // Particle record
66 
67  // Header record
75 
76  // Trailer record
82 
83  // Data associated with the shower file header
84 
92 
96  double fMinZenith;
97  double fMaxZenith;
98  double fMinAzimuth;
99  double fMaxAzimuth;
104  double fGroundDepth;
113 
114  // Do not change the dimensions of these arrays! The AIRES manual claims
115  // fIntData and fDoubleData (when passed to getcrorecord()) need to have
116  // a dimension of 30, but this can cause a segmentation violation. Changing
117  // the size to 99 appears to fix this problem.
118 
119  // TAP - 09/02/2006 moved fIntData and fDoubleData to be local to functions
120  // that use them. This will easily enable the resolution of bug #242 as
121  // well as cleanup of the code
122 
123  int fNumRecords[5];//, fIntData[99];
124  //double fDoubleData[99];
126 
128  std::string fGammaTableAppendix;
130  std::string fMuonTableAppendix;
131  typedef std::map<int, std::pair<int, int> > DataLocationsType;
133  DataLocationsType::iterator fCurrentShowerLocation;
134 
135  // Private methods
136 
137  void Init();
138  void SetRecordIndices();
139  void SetRecordInformation();
140 
142 
143  };
144 
145 }
146 
147 
148 #endif
Status FindEvent(const unsigned int n)
seek Event id set cursor there
std::string fChargeTableAppendix
std::string fElectronTableAppendix
double fGeomagneticFieldDeclination
std::string fGammaTableAppendix
Mode
Available open modes.
Definition: IoCodes.h:16
DataLocationsType::iterator fCurrentShowerLocation
std::string fMuonTableAppendix
std::string fdEdXTableAppendix
Class representing a document branch.
Definition: Branch.h:107
Status
Return code for seek operation.
Definition: IoCodes.h:24
void Write(const evt::Event &event)
Status Read(evt::Event &event)
read current event advance cursor by 1
Status GotoPosition(const unsigned int n)
goto by position in the file
Implementation of the VShowerFileParticleIterator for an Aires generated shower file.
AiresShowerFileParticleIterator * fParticleIterator
DataLocationsType fDataLocations
Utility to open an Aires generated shower file on disc.
std::map< int, std::pair< int, int > > DataLocationsType
double fGeomagneticFieldInclination
void Open(const std::string &theFileName, const Mode theMode=eRead, const utl::Branch *b=nullptr)

, generated on Tue Sep 26 2023.