EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GenericReadCsvExample.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GenericReadCsvExample.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 int main(int argc, char* argv[]) {
24  GenericDetector detector;
25 
26  // setup and parse options
32  detector.addOptions(desc);
33 
34  auto vm = ActsExamples::Options::parse(desc, argc, argv);
35  if (vm.empty()) {
36  return EXIT_FAILURE;
37  }
38 
39  ActsExamples::Sequencer sequencer(
41 
42  // Read some standard options
43  auto logLevel = ActsExamples::Options::readLogLevel(vm);
44  auto inputDir = vm["input-dir"].as<std::string>();
45 
46  // Setup detector geometry
47  auto geometry = ActsExamples::Geometry::build(vm, detector);
48  auto trackingGeometry = geometry.first;
49  // Add context decorators
50  for (auto cdr : geometry.second) {
51  sequencer.addContextDecorator(cdr);
52  }
53 
54  // Read particles from CSV files
55  auto particleReaderCfg =
57  particleReaderCfg.outputParticles = "particles";
58  sequencer.addReader(std::make_shared<ActsExamples::CsvParticleReader>(
59  particleReaderCfg, logLevel));
60 
61  // Read clusters from CSV files
62  auto clusterReaderCfg =
64  clusterReaderCfg.trackingGeometry = trackingGeometry;
65  clusterReaderCfg.outputClusters = "clusters";
66  clusterReaderCfg.outputHitParticlesMap = "hit_particle_map";
67  clusterReaderCfg.outputHitIds = "hit_ids";
68  sequencer.addReader(std::make_shared<ActsExamples::CsvPlanarClusterReader>(
69  clusterReaderCfg, logLevel));
70 
71  // Print some information as crosscheck
73  printCfg.inputClusters = clusterReaderCfg.outputClusters;
74  printCfg.inputHitParticlesMap = clusterReaderCfg.outputHitParticlesMap;
75  printCfg.inputHitIds = clusterReaderCfg.outputHitIds;
76  // the following print selections work for the original author.
77  // you probably need to adapt them to your data.
78  printCfg.hitIdStart = 10224;
79  printCfg.hitIdLength = 8;
80  printCfg.volumeId = 13;
81  printCfg.layerId = 4;
82  printCfg.moduleId = 116;
83  sequencer.addAlgorithm(
84  std::make_shared<ActsExamples::PrintHits>(printCfg, logLevel));
85 
86  return sequencer.run();
87 }