Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimParticleTranslation.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SimParticleTranslation.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2021 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 
9 #pragma once
10 
13 
14 #include <memory>
15 #include <optional>
16 #include <string>
17 
18 #include <G4VUserPrimaryGeneratorAction.hh>
19 #include <globals.hh>
20 
21 class G4Event;
22 
23 namespace ActsExamples {
24 
33 class SimParticleTranslation final : public G4VUserPrimaryGeneratorAction {
34  public:
37  struct Config {
38  std::shared_ptr<EventStore> eventStore;
39 
42  std::optional<G4int> forcedPdgCode;
43  std::optional<G4double> forcedCharge; // e.g. 1 for charged geantino
44  std::optional<G4double> forcedMass; // e.g. 0 for geantino
45 
48  unsigned int reserveHitsPerParticle = 20;
49  };
50 
56  std::unique_ptr<const Acts::Logger> logger =
57  Acts::getDefaultLogger("SimParticleTranslation",
59 
60  ~SimParticleTranslation() override;
61 
65  void GeneratePrimaries(G4Event* anEvent) override;
66 
67  protected:
69 
70  private:
72  unsigned int m_eventNr = 0;
73 
75  const Acts::Logger& logger() const { return *m_logger; }
76 
78  EventStore& eventStore() const { return *m_cfg.eventStore; }
79 
81  std::unique_ptr<const Acts::Logger> m_logger;
82 };
83 
84 } // namespace ActsExamples