Files
uLib/src/HEP/Geant/GeantEvent.h
AndreaRigoni d8ef413216 vtkGeantEvent
2026-03-16 17:51:53 +00:00

93 lines
3.0 KiB
C++

/*//////////////////////////////////////////////////////////////////////////////
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
All rights reserved
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
------------------------------------------------------------------
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library.
//////////////////////////////////////////////////////////////////////////////*/
#ifndef U_GEANTEVENT_H
#define U_GEANTEVENT_H
#include "Core/Types.h"
#include "Core/Vector.h"
#include "Math/Dense.h"
#include <string>
namespace uLib {
namespace Geant {
// Forward declaration for friend access
class SteppingAction;
///////////////////////////////////////////////////////////////////////////////
/// GeantEvent — output of a Geant4 simulation run.
///
/// m_Momentum and m_GenVector are set from the EmitterPrimary at generation.
/// During simulation, each scattering interaction deposits a Delta in m_Path,
/// recording the change of momentum and direction at each step boundary.
///////////////////////////////////////////////////////////////////////////////
class GeantEvent {
public:
/// A single interaction step along the muon path.
struct Delta {
Scalarf m_Length; ///< step length through the solid
Scalarf m_Momentum; ///< momentum magnitude at this step
HVector3f m_Direction; ///< direction after scattering
std::string m_SolidName; ///< name of the solid where interaction occurred
uLibGetMacro(Length, Scalarf)
uLibGetMacro(Momentum, Scalarf)
uLibConstRefMacro(Direction, HVector3f)
uLibConstRefMacro(SolidName, std::string)
Delta() : m_Length(0), m_Momentum(0), m_Direction(HVector3f::Zero()) {}
};
// --- Read-only accessors (public) --- //
uLibGetMacro(EventID, Id_t)
uLibGetMacro(Momentum, Scalarf)
uLibConstRefMacro(GenVector, HLine3f)
uLibConstRefMacro(Path, Vector<Delta>)
void Print(const size_t size = 10) const;
private:
Id_t m_EventID;
Scalarf m_Momentum;
HLine3f m_GenVector;
Vector<Delta> m_Path;
public:
GeantEvent() : m_EventID(0), m_Momentum(0), m_GenVector(HLine3f()), m_Path() {}
// SteppingAction can populate the private fields during simulation
friend class SteppingAction;
};
} // namespace Geant
} // namespace uLib
#endif // U_GEANTEVENT_H