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