ATLAS Offline Software
Static Public Member Functions | Friends | List of all members
StandaloneDataIO::EventInformation Struct Reference

#include <StandaloneDataIO.h>

Collaboration diagram for StandaloneDataIO::EventInformation:

Static Public Member Functions

static ErrorState read_cluster_info (const std::filesystem::path &file, CaloRecGPU::Helpers::CPU_object< CaloRecGPU::ClusterInfoArr > &clusters, const bool report=false)
 
static ErrorState read_cell_info (const std::filesystem::path &file, CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellInfoArr > &cell_info, const bool report=false)
 
static ErrorState read_cell_state (const std::filesystem::path &file, CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellStateArr > &cell_state, const bool report=false)
 
static ErrorState write_cluster_info (std::filesystem::path file, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::ClusterInfoArr > &clusters, const bool report=false)
 
static ErrorState write_cell_info (std::filesystem::path file, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellInfoArr > &cell_info, const bool report=false)
 
static ErrorState write_cell_state (std::filesystem::path file, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellStateArr > &cell_state, const bool report=false)
 

Friends

struct StandaloneDataIO
 

Detailed Description

Definition at line 110 of file StandaloneDataIO.h.

Member Function Documentation

◆ read_cell_info()

static ErrorState StandaloneDataIO::EventInformation::read_cell_info ( const std::filesystem::path &  file,
CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellInfoArr > &  cell_info,
const bool  report = false 
)
inlinestatic

Definition at line 149 of file StandaloneDataIO.h.

152  {
153  std::ifstream in(file.native(), std::ios_base::binary);
154  cell_info.binary_input(in);
155  if (in.fail())
156  {
157  report_error(file, "reading cell info", report);
158  return ErrorState::ReadError;
159  }
160  in.close();
161  return ErrorState::OK;
162  }

◆ read_cell_state()

static ErrorState StandaloneDataIO::EventInformation::read_cell_state ( const std::filesystem::path &  file,
CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellStateArr > &  cell_state,
const bool  report = false 
)
inlinestatic

Definition at line 164 of file StandaloneDataIO.h.

167  {
168  std::ifstream in(file.native(), std::ios_base::binary);
169  cell_state.binary_input(in);
170  if (in.fail())
171  {
172  report_error(file, "reading cell state", report);
173  return ErrorState::ReadError;
174  }
175  in.close();
176  return ErrorState::OK;
177  }

◆ read_cluster_info()

static ErrorState StandaloneDataIO::EventInformation::read_cluster_info ( const std::filesystem::path &  file,
CaloRecGPU::Helpers::CPU_object< CaloRecGPU::ClusterInfoArr > &  clusters,
const bool  report = false 
)
inlinestatic

Definition at line 115 of file StandaloneDataIO.h.

118  {
119  clusters.allocate();
120 
121  std::ifstream in(file.native(), std::ios_base::binary);
122 
123  in.read((char *) & (clusters->number), sizeof(int));
124 
125  if (in.fail() || clusters->number < 0 || clusters->number > CaloRecGPU::NMaxClusters)
126  {
127  report_error(file, "reading clusters", report);
128  return ErrorState::ReadError;
129  }
130 
131  in.read((char *) clusters->clusterEnergy, sizeof(float) * clusters->number);
132  in.read((char *) clusters->clusterEt, sizeof(float) * clusters->number);
133  in.read((char *) clusters->clusterEta, sizeof(float) * clusters->number);
134  in.read((char *) clusters->clusterPhi, sizeof(float) * clusters->number);
135  in.read((char *) clusters->seedCellID, sizeof(int) * clusters->number);
136 
137  if (in.fail())
138  {
139  report_error(file, "reading clusters", report);
140  return ErrorState::ReadError;
141  }
142 
143  in.close();
144 
145  return ErrorState::OK;
146 
147  }

◆ write_cell_info()

static ErrorState StandaloneDataIO::EventInformation::write_cell_info ( std::filesystem::path  file,
const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellInfoArr > &  cell_info,
const bool  report = false 
)
inlinestatic

Definition at line 202 of file StandaloneDataIO.h.

205  {
206  file.replace_extension(".cellinfo");
207  std::ofstream out(file, std::ios_base::binary);
208  cell_info.binary_output(out);
209  if (out.fail())
210  {
211  report_error(file, "writing cell info", report);
212  return ErrorState::WriteError;
213  }
214  out.close();
215  return ErrorState::OK;
216  }

◆ write_cell_state()

static ErrorState StandaloneDataIO::EventInformation::write_cell_state ( std::filesystem::path  file,
const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellStateArr > &  cell_state,
const bool  report = false 
)
inlinestatic

Definition at line 218 of file StandaloneDataIO.h.

221  {
222  file.replace_extension(".cellstate");
223  std::ofstream out(file, std::ios_base::binary);
224  cell_state.binary_output(out);
225  if (out.fail())
226  {
227  report_error(file, "writing cell state", report);
228  return ErrorState::WriteError;
229  }
230  out.close();
231  return ErrorState::OK;
232  }

◆ write_cluster_info()

static ErrorState StandaloneDataIO::EventInformation::write_cluster_info ( std::filesystem::path  file,
const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::ClusterInfoArr > &  clusters,
const bool  report = false 
)
inlinestatic

Definition at line 179 of file StandaloneDataIO.h.

182  {
183  file.replace_extension(".clusterinfo");
184  std::ofstream out(file, std::ios_base::binary);
185 
186  out.write((char *) & (clusters->number), sizeof(int));
187  out.write((char *) clusters->clusterEnergy, sizeof(float) * clusters->number);
188  out.write((char *) clusters->clusterEt, sizeof(float) * clusters->number);
189  out.write((char *) clusters->clusterEta, sizeof(float) * clusters->number);
190  out.write((char *) clusters->clusterPhi, sizeof(float) * clusters->number);
191  out.write((char *) clusters->seedCellID, sizeof(int) * clusters->number);
192 
193  if (out.fail())
194  {
195  report_error(file, "writing clusters", report);
196  return ErrorState::WriteError;
197  }
198  out.close();
199  return ErrorState::OK;
200  }

Friends And Related Function Documentation

◆ StandaloneDataIO

friend struct StandaloneDataIO
friend

Definition at line 112 of file StandaloneDataIO.h.


The documentation for this struct was generated from the following file:
StandaloneDataIO::ErrorState::WriteError
@ WriteError
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
checkTP.report
report
Definition: checkTP.py:127
StandaloneDataIO::ErrorState::OK
@ OK
file
TFile * file
Definition: tile_monitor.h:29
StandaloneDataIO::ErrorState::ReadError
@ ReadError
CaloRecGPU::NMaxClusters
constexpr int NMaxClusters
Definition: BaseDefinitions.h:28
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
StandaloneDataIO::report_error
static void report_error(const std::filesystem::path &file, const std::string &kind, const bool really_report=false)
Definition: StandaloneDataIO.h:31