ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VertexFitterExample.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file VertexFitterExample.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-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 
10 #include <boost/program_options.hpp>
11 #include <memory>
12 
25 
26 using namespace FW;
27 
32 int main(int argc, char* argv[]) {
33  // setup and parse options
39  auto vm = Options::parse(desc, argc, argv);
40  if (vm.empty()) {
41  return EXIT_FAILURE;
42  }
43 
44  // basic setup
45  auto logLevel = Options::readLogLevel(vm);
46  auto rnd =
47  std::make_shared<RandomNumbers>(Options::readRandomNumbersConfig(vm));
49 
50  // Set up event generator
52  evgen.output = "generated_event";
53  evgen.randomNumbers = rnd;
54  sequencer.addReader(std::make_shared<EventGenerator>(evgen, logLevel));
55 
56  // Set up TruthVerticesToTracks converter algorithm
58  trkConvConfig.input = evgen.output;
59  trkConvConfig.output = "all_tracks";
60  trkConvConfig.randomNumberSvc = rnd;
61  trkConvConfig.bField = {0_T, 0_T, 2_T};
62  sequencer.addAlgorithm(std::make_shared<TruthVerticesToTracksAlgorithm>(
63  trkConvConfig, logLevel));
64 
65  // Set up track selector
66  TrackSelector::Config selectorConfig;
67  selectorConfig.input = trkConvConfig.output;
68  selectorConfig.output = "selected_tracks";
69  selectorConfig.absEtaMax = 2.5;
70  selectorConfig.rhoMax = 4_mm;
71  selectorConfig.ptMin = 400_MeV;
72  selectorConfig.keepNeutral = false;
73  sequencer.addAlgorithm(
74  std::make_shared<TrackSelector>(selectorConfig, logLevel));
75 
76  // Add the fit algorithm with Billoir fitter
78  vertexFitCfg.trackCollection = selectorConfig.output;
79  vertexFitCfg.bField = trkConvConfig.bField;
80  sequencer.addAlgorithm(
81  std::make_shared<FWE::VertexFitAlgorithm>(vertexFitCfg, logLevel));
82 
83  return sequencer.run();
84 }