Project
Loading...
Searching...
No Matches
AlpideResponse.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.
12
13#include <boost/program_options.hpp>
15#include <TFile.h>
16#include <TSystem.h>
17#include <cstdio>
18#include <cstddef>
19#include <fstream>
20#include <iostream>
21#include <string>
22
23void alpideResponse(const std::string& inpath = "./",
24 const std::string& outpath = "./",
25 const std::string& response_file = "AlpideResponseData.root")
26{
27
29
30 resp0.initData(0, inpath.data());
31 resp1.initData(1, inpath.data());
32
33 auto file = TFile::Open((outpath + response_file).data(), "recreate");
34 file->WriteObjectAny(&resp0, "o2::itsmft::AlpideSimResponse", "response0");
35 file->WriteObjectAny(&resp1, "o2::itsmft::AlpideSimResponse", "response1");
36 file->Close();
37}
38
39int main(int argc, const char* argv[])
40{
41 namespace bpo = boost::program_options;
42 bpo::variables_map vm;
43 bpo::options_description options("Alpide reponse generator options");
44 options.add_options()(
45 "inputdir,i", bpo::value<std::string>()->default_value("./"), "Path where Vbb-0.0V and Vbb-3.0V are located.")(
46 "outputdir,o", bpo::value<std::string>()->default_value("./"), "Path where to store the output.")(
47 "name,n", bpo::value<std::string>()->default_value("AlpideResponseData.root"), "Output file name.");
48
49 try {
50 bpo::store(parse_command_line(argc, argv, options), vm);
51 if (vm.count("help")) {
52 std::cout << options << std::endl;
53 return 1;
54 }
55 bpo::notify(vm);
56 } catch (const bpo::error& e) {
57 std::cerr << e.what() << "\n\n";
58 std::cerr << "Error parsing command line arguments. Available options:\n";
59
60 std::cerr << options << std::endl;
61 return 2;
62 }
63
64 std::cout << "Generating " << vm["inputdir"].as<std::string>() + vm["name"].as<std::string>() << std::endl;
65 alpideResponse(vm["inputdir"].as<std::string>(), vm["outputdir"].as<std::string>(), vm["name"].as<std::string>());
66
67 return 0;
68}
void alpideResponse(const std::string &inpath="./", const std::string &outpath="./", const std::string &response_file="AlpideResponseData.root")
Definition of the ITSMFT Alpide simulated response parametrization.
void initData(int tableNumber, std::string dataPath, const bool quiet=true)
GLboolean * data
Definition glcorearb.h:298
#define main