ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FatrasDigitizationBase.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FatrasDigitizationBase.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 
10 
11 #include <boost/program_options.hpp>
12 
21 
23  FW::Options::Variables& vars, FW::Sequencer& sequencer,
24  std::shared_ptr<const FW::RandomNumbers> randomNumbers,
25  std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry) {
26  // Read the standard options
27  auto logLevel = FW::Options::readLogLevel(vars);
28 
29  // Configure the digitizer
31  digi.inputSimulatedHits = "hits";
32  digi.outputClusters = "clusters";
33  digi.planarModuleStepper = std::make_shared<Acts::PlanarModuleStepper>(
34  Acts::getDefaultLogger("PlanarModuleStepper", logLevel));
35  digi.randomNumbers = randomNumbers;
37  sequencer.addAlgorithm(
38  std::make_shared<FW::DigitizationAlgorithm>(digi, logLevel));
39 
40  // Output directory
41  std::string outputDir = vars["output-dir"].template as<std::string>();
42 
43  // Write digitisation output as Csv files
44  if (vars["output-csv"].template as<bool>()) {
45  // clusters as root
46  FW::CsvPlanarClusterWriter::Config clusterWriterCsv;
47  clusterWriterCsv.inputClusters = digi.outputClusters;
48  clusterWriterCsv.inputSimulatedHits = digi.inputSimulatedHits;
49  clusterWriterCsv.outputDir = outputDir;
50  sequencer.addWriter(std::make_shared<FW::CsvPlanarClusterWriter>(
51  clusterWriterCsv, logLevel));
52  }
53 
54  // Write digitsation output as ROOT files
55  if (vars["output-root"].template as<bool>()) {
56  // clusters as root
57  FW::RootPlanarClusterWriter::Config clusterWriterRoot;
58  clusterWriterRoot.inputClusters = digi.outputClusters;
59  clusterWriterRoot.inputSimulatedHits = digi.inputSimulatedHits;
60  clusterWriterRoot.filePath =
61  FW::joinPaths(outputDir, digi.outputClusters + ".root");
62  sequencer.addWriter(std::make_shared<FW::RootPlanarClusterWriter>(
63  clusterWriterRoot, logLevel));
64  }
65 }