EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VertexFinderReaderExample.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file VertexFinderReaderExample.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 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 
14 
15 #include "Acts/Utilities/Units.hpp"
23 
24 #include <memory>
25 
26 using namespace Acts::UnitLiterals;
27 using namespace ActsExamples;
28 
29 int main(int argc, char* argv[]) {
30  // setup and parse options
31  auto desc = Options::makeDefaultOptions();
34  ParticleSelector::addOptions(desc);
37  auto vars = Options::parse(desc, argc, argv);
38  if (vars.empty()) {
39  return EXIT_FAILURE;
40  }
41 
42  // basic setup
43  auto logLevel = Options::readLogLevel(vars);
44  auto rnd =
45  std::make_shared<RandomNumbers>(Options::readRandomNumbersConfig(vars));
46  Sequencer sequencer(Options::readSequencerConfig(vars));
47 
48  // setup particle reader generator
49  CsvParticleReader::Config readParticles =
51  readParticles.outputParticles = "particles";
52  sequencer.addReader(
53  std::make_shared<CsvParticleReader>(readParticles, logLevel));
54 
55  // pre-select particles
56  ParticleSelector::Config selectParticles = ParticleSelector::readConfig(vars);
57  selectParticles.inputParticles = readParticles.outputParticles;
58  selectParticles.outputParticles = "particles_selected";
59  // smearing only works with charge particles for now
60  selectParticles.removeNeutral = true;
61  sequencer.addAlgorithm(
62  std::make_shared<ParticleSelector>(selectParticles, logLevel));
63 
64  // simulate track reconstruction by smearing truth track parameters
65  ParticleSmearing::Config smearParticles;
66  smearParticles.inputParticles = selectParticles.outputParticles;
67  smearParticles.outputTrackParameters = "trackparameters";
68  smearParticles.randomNumbers = rnd;
69  sequencer.addAlgorithm(
70  std::make_shared<ParticleSmearing>(smearParticles, logLevel));
71 
72  // find vertices
74  findVertices.inputTrackParameters = smearParticles.outputTrackParameters;
75  findVertices.outputProtoVertices = "protovertices";
76  findVertices.bField = Acts::Vector3D(0_T, 0_T, 2_T);
77  sequencer.addAlgorithm(
78  std::make_shared<IterativeVertexFinderAlgorithm>(findVertices, logLevel));
79 
80  return sequencer.run();
81 }