ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MMEventAction.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MMEventAction.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2018 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 <stdexcept>
12 
15 #include "G4Event.hh"
16 #include "G4RunManager.hh"
17 
19 
21  // Static acces function via G4RunManager
22  return fgInstance;
23 }
24 
26  if (fgInstance) {
27  throw std::logic_error("Attempted to duplicate a singleton");
28  } else {
29  fgInstance = this;
30  }
31 }
32 
34  fgInstance = nullptr;
35 }
36 
38  // reset the collection of material steps
40 }
41 
43  const auto* rawPos = event->GetPrimaryVertex();
44  // access the initial direction of the track
46  // create the RecordedMaterialTrack
48  mtrecord.first.first =
49  Acts::Vector3D(rawPos->GetX0(), rawPos->GetY0(), rawPos->GetZ0());
50  mtrecord.first.second = Acts::Vector3D(rawDir.x(), rawDir.y(), rawDir.z());
51  mtrecord.second.materialInteractions =
53 
54  // write out the RecordedMaterialTrack of one event
55  m_records.push_back(mtrecord);
56 
57  // write out the steps of one track in an event
58  m_tracksteps.adopt_sequence(MMSteppingAction::Instance()->trackSteps());
59 }
60