Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IterativeVertexFinderExample.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file IterativeVertexFinderExample.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 
20 
21 #include <memory>
22 
23 using namespace Acts::UnitLiterals;
24 using namespace ActsExamples;
25 
26 int main(int argc, char* argv[]) {
27  // setup and parse options
28  auto desc = Options::makeDefaultOptions();
35  Options::addOutputOptions(desc, OutputFormat::DirectoryOnly);
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 the magnetic field
50 
51  // setup event generator
53  evgen.outputParticles = "particles_generated";
54  evgen.randomNumbers = rnd;
55  sequencer.addReader(std::make_shared<EventGenerator>(evgen, logLevel));
56 
57  // pre-select particles
58  ParticleSelector::Config selectParticles =
60  selectParticles.inputParticles = evgen.outputParticles;
61  selectParticles.outputParticles = "particles_selected";
62  // smearing only works with charge particles for now
63  selectParticles.removeNeutral = true;
64  selectParticles.absEtaMax = vars["vertexing-eta-max"].as<double>();
65  selectParticles.rhoMax = vars["vertexing-rho-max"].as<double>() * 1_mm;
66  selectParticles.ptMin = vars["vertexing-pt-min"].as<double>() * 1_MeV;
67  sequencer.addAlgorithm(
68  std::make_shared<ParticleSelector>(selectParticles, logLevel));
69 
70  // Run the particle smearing
71  auto particleSmearingCfg = setupParticleSmearing(
72  vars, sequencer, rnd, selectParticles.outputParticles);
73 
74  // find vertices
76  findVertices.bField = magneticField;
77  findVertices.inputTrackParameters = particleSmearingCfg.outputTrackParameters;
78  findVertices.outputProtoVertices = "protovertices";
79  sequencer.addAlgorithm(
80  std::make_shared<IterativeVertexFinderAlgorithm>(findVertices, logLevel));
81 
82  return sequencer.run();
83 }