Project
Loading...
Searching...
No Matches
TestConfig.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
12#include <SimConfig/SimConfig.h>
13#include <iostream>
14#include <TFile.h>
15#include <TClass.h>
16
17int main(int argc, char* argv[])
18{
19 auto& conf = o2::conf::SimConfig::Instance();
20 conf.resetFromArguments(argc, argv);
21
22 std::cout << "Selected VMC engine " << conf.getMCEngine() << "\n";
23 std::cout << "Selected Modules:\n";
24
25 auto v = conf.getActiveModules();
26 for (auto& m : v) {
27 std::cout << "@ " << m << "\n";
28 }
29
30 std::cout << "Selected Generator " << conf.getGenerator() << "\n";
31
32 // serialize simconfig and read it back
33 TFile outfile("simconfigout_test.root", "RECREATE");
34 auto& configdata = conf.getConfigData();
35 auto cl = TClass::GetClass(typeid(configdata));
36 outfile.WriteObjectAny(&configdata, cl, "SimConfigData");
37 outfile.Close();
38
39 o2::conf::SimConfigData* inconfigdata = nullptr;
40 TFile file("simconfigout_test.root", "OPEN");
41 file.GetObject("SimConfigData", inconfigdata);
42 file.Close();
43
44 if (inconfigdata) {
45 conf.resetFromConfigData(*inconfigdata);
46 auto v2 = conf.getActiveModules();
47 for (auto& m : v2) {
48 std::cout << "@ " << m << "\n";
49 }
50 return 0;
51 } else {
52 return 1;
53 }
54 return 0;
55}
static SimConfig & Instance()
Definition SimConfig.h:111
const GLfloat * m
Definition glcorearb.h:4066
const GLdouble * v
Definition glcorearb.h:832
GLfloat GLfloat GLfloat v2
Definition glcorearb.h:813
#define main