ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VertexFinderExample.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file VertexFinderExample.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 <boost/program_options.hpp>
10 #include <memory>
11 
25 
26 using namespace Acts::UnitLiterals;
27 using namespace FW;
28 
33 int main(int argc, char* argv[]) {
34  // setup and parse options
40  auto vm = Options::parse(desc, argc, argv);
41  if (vm.empty()) {
42  return EXIT_FAILURE;
43  }
44 
45  // basic setup
46  auto logLevel = Options::readLogLevel(vm);
47  auto rnd =
48  std::make_shared<RandomNumbers>(Options::readRandomNumbersConfig(vm));
50 
51  // Set up event generator
53  evgen.output = "event";
54  evgen.randomNumbers = rnd;
55  sequencer.addReader(std::make_shared<EventGenerator>(evgen, logLevel));
56 
57  ParticleSelector::Config ptcSelectorCfg;
58  ptcSelectorCfg.inputEvent = evgen.output;
59  ptcSelectorCfg.outputEvent = "event_selected";
60  ptcSelectorCfg.absEtaMax = 2.5;
61  ptcSelectorCfg.rhoMax = 4_mm;
62  ptcSelectorCfg.ptMin = 400_MeV;
63  ptcSelectorCfg.removeNeutral = true;
64  sequencer.addAlgorithm(
65  std::make_shared<ParticleSelector>(ptcSelectorCfg, logLevel));
66 
67  // Set up TruthVerticesToTracks converter algorithm
69  trkConvConfig.input = ptcSelectorCfg.outputEvent;
70  trkConvConfig.output = "tracks";
71  trkConvConfig.doSmearing = true;
72  trkConvConfig.randomNumberSvc = rnd;
73  trkConvConfig.bField = {0_T, 0_T, 1_T};
74  sequencer.addAlgorithm(std::make_shared<TruthVerticesToTracksAlgorithm>(
75  trkConvConfig, logLevel));
76 
77  // Set up track selector
78  TrackSelector::Config selectorConfig;
79  selectorConfig.input = trkConvConfig.output;
80  selectorConfig.output = "tracks_selected";
81  selectorConfig.absEtaMax = 2.5;
82  selectorConfig.rhoMax = 4_mm;
83  selectorConfig.ptMin = 400_MeV;
84  selectorConfig.keepNeutral = false;
85  sequencer.addAlgorithm(
86  std::make_shared<TrackSelector>(selectorConfig, logLevel));
87 
88  // Add the finding algorithm
89  FWE::VertexFindingAlgorithm::Config vertexFindingCfg;
90  vertexFindingCfg.trackCollection = selectorConfig.output;
91  vertexFindingCfg.bField = trkConvConfig.bField;
92  sequencer.addAlgorithm(std::make_shared<FWE::VertexFindingAlgorithm>(
93  vertexFindingCfg, logLevel));
94 
95  return sequencer.run();
96 }