Project
Loading...
Searching...
No Matches
readRawData.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17#include <boost/program_options.hpp>
18#include <iostream>
19#include <iomanip>
20#include <fstream>
21
22#include <memory>
23#include <bitset>
24#include <vector>
25
28#include "TPCBase/PadPos.h"
29#include <fairlogger/Logger.h>
30
31namespace bpo = boost::program_options;
32using namespace o2::tpc;
33
34int main(int argc, char* argv[])
35{
36
37 // Arguments parsing
38 std::vector<std::string> infile(1, "NOFILE");
39 std::vector<unsigned> region(1, 0);
40 std::vector<unsigned> link(1, 0);
41 std::vector<int> sampaVersion(1, -1);
42 int readEvents = -1;
43 bool useRawInMode3 = true;
44 std::string verbLevel = "LOW";
45 std::string logLevel = "ERROR";
46
47 bpo::variables_map vm;
48 bpo::options_description desc("Allowed options");
49 desc.add_options()("help,h", "Produce help message.")("infile,i", bpo::value<std::vector<std::string>>(&infile),
50 "Input data files")(
51 "vl,", bpo::value<std::string>(&verbLevel), "Fairlogger verbosity level (LOW, MED, HIGH)")(
52 "ll,", bpo::value<std::string>(&logLevel),
53 "Fairlogger screen log level (FATAL, ERROR, WARNING, INFO, DEBUG, DEBUG1, DEBUG2, DEBUG3, DEBUG4)")(
54 "region,r", bpo::value<std::vector<unsigned>>(&region), "Region for mapping")(
55 "link,l", bpo::value<std::vector<unsigned>>(&link), "Link for mapping")(
56 "sVersion,s", bpo::value<std::vector<int>>(&sampaVersion), "SAMPA version for decoding")(
57 "rawInMode3", bpo::value<bool>(&useRawInMode3), "Use Raw data in mode 3 instead of decoded one")(
58 ",n", bpo::value<int>(&readEvents), "Events to read");
59
60 bpo::store(parse_command_line(argc, argv, desc), vm);
61 bpo::notify(vm);
62
63 // help
64 if (vm.count("help")) {
65 std::cout << desc << std::endl;
66 return EXIT_SUCCESS;
67 }
68
69 if (infile[0] == "NOFILE") {
70 return EXIT_SUCCESS;
71 }
72
73 // Initialize logger
74 fair::Logger::SetVerbosity(verbLevel.c_str());
75 fair::Logger::SetConsoleSeverity(logLevel.c_str());
76 fair::Logger::SetConsoleColor(false);
77
78 std::vector<RawReader> readers;
79 std::shared_ptr<RawReaderEventSync> eventSync = std::make_shared<RawReaderEventSync>();
80
81 for (int i = 0; i < infile.size(); ++i) {
82 readers.emplace_back();
83 readers[i].addEventSynchronizer(eventSync);
84 if (region.size() != infile.size() && link.size() == infile.size()) {
85 readers[i].addInputFile(region[0], link[i], sampaVersion[i], infile[i]);
86 } else if (region.size() == infile.size() && link.size() != infile.size()) {
87 readers[i].addInputFile(region[i], link[0], sampaVersion[i], infile[i]);
88 } else {
89 readers[i].addInputFile(region[i], link[i], sampaVersion[i], infile[i]);
90 }
91 readers[i].setUseRawInMode3(useRawInMode3);
92 readers[i].setCheckAdcClock(false);
93 }
94
95 PadPos padPos;
96 int j = 0;
97 while ((j < readers[0].getNumberOfEvents()) & ((readEvents >= 0) ? j <= readEvents : true)) {
98 for (auto& rr : readers) {
99 rr.loadEvent(j);
100 }
101 ++j;
102 }
103
104 return EXIT_SUCCESS;
105}
int32_t i
uint32_t j
Definition RawData.h:0
Global TPC definitions and constants.
Definition SimTraits.h:167
#define main