EIC 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 
16 
17 #include <memory>
18 
19 using namespace Acts::UnitLiterals;
20 using namespace ActsExamples;
21 
22 int main(int argc, char* argv[]) {
23  // setup and parse options
24  auto desc = Options::makeDefaultOptions();
28  ParticleSelector::addOptions(desc);
30  auto vars = Options::parse(desc, argc, argv);
31  if (vars.empty()) {
32  return EXIT_FAILURE;
33  }
34 
35  // basic setup
36  auto logLevel = Options::readLogLevel(vars);
37  auto rnd =
38  std::make_shared<RandomNumbers>(Options::readRandomNumbersConfig(vars));
39  Sequencer sequencer(Options::readSequencerConfig(vars));
40 
41  // setup event generator
43  evgen.outputParticles = "particles_generated";
44  evgen.randomNumbers = rnd;
45  sequencer.addReader(std::make_shared<EventGenerator>(evgen, logLevel));
46 
47  // pre-select particles
48  ParticleSelector::Config selectParticles = ParticleSelector::readConfig(vars);
49  selectParticles.inputParticles = evgen.outputParticles;
50  selectParticles.outputParticles = "particles_selected";
51  // smearing only works with charge particles for now
52  selectParticles.removeNeutral = true;
53  sequencer.addAlgorithm(
54  std::make_shared<ParticleSelector>(selectParticles, logLevel));
55 
56  // simulate track reconstruction by smearing truth track parameters
57  ParticleSmearing::Config smearParticles;
58  smearParticles.inputParticles = selectParticles.outputParticles;
59  smearParticles.outputTrackParameters = "trackparameters";
60  smearParticles.randomNumbers = rnd;
61  sequencer.addAlgorithm(
62  std::make_shared<ParticleSmearing>(smearParticles, logLevel));
63 
64  // find vertices
66  findVertices.inputTrackParameters = smearParticles.outputTrackParameters;
67  findVertices.outputProtoVertices = "protovertices";
68  findVertices.bField = Acts::Vector3D(0_T, 0_T, 2_T);
69  sequencer.addAlgorithm(std::make_shared<AdaptiveMultiVertexFinderAlgorithm>(
70  findVertices, logLevel));
71 
72  return sequencer.run();
73 }