Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParticleTrackingAction.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ParticleTrackingAction.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 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 
15 
16 #include <memory>
17 #include <optional>
18 #include <string>
19 
20 #include <G4Track.hh>
21 #include <G4UserTrackingAction.hh>
22 
23 class G4Track;
24 
25 namespace ActsExamples {
26 
31 class ParticleTrackingAction : public G4UserTrackingAction {
32  public:
33  struct Config {
34  std::shared_ptr<EventStore> eventStore;
35 
37  };
38 
44  std::unique_ptr<const Acts::Logger> logger =
45  Acts::getDefaultLogger("ParticleTrackingAction",
47  ~ParticleTrackingAction() override = default;
48 
53  void PreUserTrackingAction(const G4Track* aTrack) final;
54 
59  void PostUserTrackingAction(const G4Track* aTrack) final;
60 
61  protected:
63 
64  private:
69  SimParticle convert(const G4Track& aTrack, SimBarcode particleId) const;
70 
72  std::optional<SimBarcode> makeParticleId(G4int trackId, G4int parentId) const;
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