9 #include <io/CONEXFile.h>
10 #include <io/CONEXStructures.h>
11 #include <io/CONEXIOException.h>
13 #include <evt/Event.h>
14 #include <evt/ShowerSimData.h>
15 #include <evt/DefaultShowerGeometryProducer.h>
17 #include <utl/ErrorLogger.h>
18 #include <utl/AugerUnits.h>
19 #include <utl/SaveCurrentTDirectory.h>
50 Open(fileName, mode, b);
78 msg <<
"Cannot open file " << fileName <<
" - CONEX files are read-only";
84 fFile = TFile::Open(fileName.c_str());
88 msg <<
"Cannot open file " << fileName <<
" - ERROR";
93 if (!
fFile->IsOpen()) {
95 msg <<
"Cannot open file " << fileName <<
" - ERROR";
105 msg <<
"Cannot open trees in file " << fileName <<
" - ERROR";
112 fHeaderTree->SetBranchAddress(
"Version", &version);
118 TBranch* rVbranch =
fHeaderTree->GetBranch(
"OutputVersion");
121 rVbranch->GetEntry(0);
125 ostringstream infoVersion;
126 infoVersion <<
" CONEX version " << version <<
" Output version " <<
fROOTVersion;
130 if (version > 0 && fROOTVersion < 2.0) {
133 const string msg =
"Cannot read from merged CONEXFile with different grammage binnings !!!!! Check your CONEX input.";
139 for (
int iHeader = 0; iHeader <
fHeaderTree->GetEntries(); ++iHeader) {
146 "Cannot read from merged CONEXFile with incompatible shower content !!!!! "
147 "Check your CONEX merging or don't use merged CONEX files !!!";
173 ERROR(
"Event not cleared - has SimShower. Cannot read CONEX.");
204 ostringstream runIdentifier;
212 "\t ----------- CONEX -------------\n"
213 "\t event: " << entry <<
"\n"
217 "\t ----------- CONEX -------------";
230 const string msg =
"Cannot write to CONEXFile - read-only file";
270 const string msg =
"Cannot request number of events from NULL tree";
Wrapper for CONEX header shower profile data.
const evt::VGaisserHillasParameter & GetGHParameters() const
Get the Gaisser-Hillas parameters of the shower.
Status GotoPosition(const unsigned int position) override
goto by position in the file
bool HasSimShower() const
void Write(const evt::Event &event) override
void Open(const std::string &fileName, const Mode mode=eRead, utl::Branch *const b=nullptr) override
Mode
Available open modes.
#define INFO(message)
Macro for logging informational messages.
Status FindEvent(const unsigned int eventId) override
seek Event id set cursor there
Interface class to access Shower Simulated parameters.
Class representing a document branch.
void MapHeader(const float version)
Status
Return code for seek operation.
void MapShower(const float version)
double GetEnergy() const
Get the energy of the shower primary particle.
Base for exceptions in the CORSIKA reader.
void FillShowerSimDataFromConex(const CONEXHeader &conexHeader, const CONEXShower &conexShower, evt::ShowerSimData &)
void SetShowerNumber(const int sid)
unsigned int fCurrentPosition
Status Read(evt::Event &event) override
read current event advance cursor by 1
void FillShowerProfileDataFromConex(const CONEXHeader &conexHeader, const CONEXShower &conexShower, const std::vector< io::CONEXLeadingParticles > conexLPvector, const float conexFileVersion, evt::ShowerSimData &, const double xShift=0)
void SetVectorLength(const int n)
void SetShowerRunId(const std::string srid)
#define ERROR(message)
Macro for logging error messages.
int GetNEvents() override
std::vector< io::CONEXLeadingParticles > fLPvector