ATLAS Offline Software
Functions
DecodeSCT.cxx File Reference
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <utility>
#include <cstdint>
#include <filesystem>

Go to the source code of this file.

Functions

std::string str (const char *word)
 
void helpMessage ()
 
int main (int argc, char **argv)
 

Function Documentation

◆ helpMessage()

void helpMessage ( )

Definition at line 48 of file DecodeSCT.cxx.

48  {
49  std::cout<< "'DecodeSCT' takes exactly one argument, the bytestream filename." <<std::endl;
50 }

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 53 of file DecodeSCT.cxx.

53  {
54  if (argc < 2){
55  helpMessage();
56  return 1;
57  }
58  fs::path input_file = getFilename(argv[1]);
59  if (input_file.empty()) {
60  std::cerr << argv[1] <<" does not exist."<<std::endl;
61  return 2;
62  }
63  auto length = fs::file_size(input_file);
64  printf("Length: %lu\n", length);
65  auto fd = open(input_file.c_str(), O_RDONLY);
66  if(fd<0) {
67  perror("File open failed");
68  return 3;
69  }
70  uint32_t *buffer = (uint32_t *) mmap(0, length, PROT_READ, MAP_PRIVATE, fd, 0);
71  if(buffer == MAP_FAILED) {
72  close(fd);
73  perror("mmap failed");
74  return 4;
75  }
76  uint32_t *endBuffer = &buffer[length/4];
78  uint32_t *end{};
79  while(findNextEvent(begin, end, endBuffer, 0xee1234ee)) {
80  //cppcheck-suppress invalidPrintfArgType_sint
81  printf("Event from %li to %li\n", begin-buffer, end-buffer);
82  int length = static_cast<int>(end - 1l - begin);
83  decodeEvent(begin, length);
84  }
85  munmap(buffer, length);
86  close(fd);
87 }

◆ str()

std::string str ( const char *  word)
inline

Definition at line 43 of file DecodeSCT.cxx.

43  {
44  return word ? word : "";
45 }
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
python.resample_meson.input_file
input_file
Definition: resample_meson.py:164
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
helpMessage
void helpMessage()
Definition: DecodeSCT.cxx:48
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
ReadFromCoolCompare.fd
fd
Definition: ReadFromCoolCompare.py:196
Trk::open
@ open
Definition: BinningType.h:40
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26