EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FatrasMain.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FatrasMain.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include "FatrasMain.hpp"
10 
24 
25 #include <memory>
26 
27 #include <boost/program_options.hpp>
28 
30 #include "FatrasEvgenBase.hpp"
31 #include "FatrasSimulationBase.hpp"
32 
34  int argc, char* argv[],
35  std::shared_ptr<ActsExamples::IBaseDetector> detector) {
37 
38  // setup and parse options
50  desc.add_options()("evg-input-type",
51  value<std::string>()->default_value("pythia8"),
52  "Type of evgen input 'gun', 'pythia8'");
53  // Add specific options for this geometry
54  detector->addOptions(desc);
55  auto vm = ActsExamples::Options::parse(desc, argc, argv);
56  if (vm.empty()) {
57  return EXIT_FAILURE;
58  }
59 
60  ActsExamples::Sequencer sequencer(
62 
63  // auto logLevel = ActsExamples::Options::readLogLevel(vm);
64 
65  // Create the random number engine
66  auto randomNumberSvcCfg = ActsExamples::Options::readRandomNumbersConfig(vm);
67  auto randomNumberSvc =
68  std::make_shared<ActsExamples::RandomNumbers>(randomNumberSvcCfg);
69 
70  // The geometry, material and decoration
71  auto geometry = ActsExamples::Geometry::build(vm, *detector);
72  auto tGeometry = geometry.first;
73  auto contextDecorators = geometry.second;
74  // Add the decorator to the sequencer
75  for (auto cdr : contextDecorators) {
76  sequencer.addContextDecorator(cdr);
77  }
78 
79  // make sure the output directory exists
80  ActsExamples::ensureWritableDirectory(vm["output-dir"].as<std::string>());
81 
82  // (A) EVGEN
83  // Setup the evgen input to the simulation
84  setupEvgenInput(vm, sequencer, randomNumberSvc);
85 
86  // (B) SIMULATION
87  // Setup the simulation
88  setupSimulation(vm, sequencer, randomNumberSvc, tGeometry);
89 
90  // (C) DIGITIZATION
91  // Setup the digitization
92  setupDigitization(vm, sequencer, randomNumberSvc, tGeometry);
93 
94  return sequencer.run();
95 }