R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandNeutron.cxx
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2025 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
14#include "R3BNeulandNeutron.h"
15#include "R3BNeulandCluster.h"
16#include "R3BNeulandHit.h"
17#include <Math/Vector3Dfwd.h>
18#include <RtypesCore.h>
19#include <cmath>
20#include <iostream>
21#include <ostream>
22#include <utility>
23
24static const double MASS_OF_NEUTRON = 939.565379; // MeV/c²
25static const double SPEED_OF_LIGHT = 29.9792458; // cm/ns
26static const double SPEED_OF_LIGHT_SQ = 898.75517873681758374; // cm²/ns²
27
28R3BNeulandNeutron::R3BNeulandNeutron(Int_t paddle, double time, ROOT::Math::XYZVector pos, ROOT::Math::XYZVector pix)
29 : fPaddle(paddle)
30 , fT(time)
31 , fPosition(std::move(pos))
32 , fPixel(std::move(pix))
33{
34}
35
37 : fPaddle(hit.GetPaddle())
38 , fT(hit.GetT())
39 , fPosition(hit.GetPosition())
40 , fPixel(hit.GetPixel())
41{
42}
43
45 : R3BNeulandNeutron(cluster.GetFirstHit())
46{
47}
48
49auto R3BNeulandNeutron::GetGamma() const -> double
50{
51 const double velocity_sq = GetPosition().Mag2() / std::pow(GetT(), 2); // cm²/ns²
52 return 1. / std::sqrt(1. - (velocity_sq / SPEED_OF_LIGHT_SQ));
53}
54
55auto R3BNeulandNeutron::GetP() const -> ROOT::Math::XYZVector
56{
58}
59
60auto R3BNeulandNeutron::GetEtot() const -> double { return GetGamma() * MASS_OF_NEUTRON; }
61
62auto R3BNeulandNeutron::GetEkin() const -> double { return (GetGamma() - 1.) * MASS_OF_NEUTRON; }
63
64auto operator<<(std::ostream& ostream, const R3BNeulandNeutron& digi) -> std::ostream&
65{
66 ostream << "R3BNeulandNeutron: XYZTE " << digi.GetPosition().X() << " " << digi.GetPosition().Y() << " "
67 << digi.GetPosition().Z() << " " << digi.GetT() << " " << digi.GetEkin() << "\n";
68 return ostream;
69}
70
71void R3BNeulandNeutron::Print(const Option_t* /*option*/) const { std::cout << *this; }
auto operator<<(std::ostream &ostream, const R3BNeulandNeutron &digi) -> std::ostream &
static const double SPEED_OF_LIGHT
static const double SPEED_OF_LIGHT_SQ
static const double MASS_OF_NEUTRON
auto GetPaddle() const -> int
ROOT::Math::XYZVector fPixel
void Print(const Option_t *) const override
R3BNeulandNeutron()=default
ROOT::Math::XYZVector fPosition
auto GetPixel() const -> ROOT::Math::XYZVector
auto GetPosition() const -> ROOT::Math::XYZVector
auto GetEkin() const -> double
auto GetEtot() const -> double
auto GetT() const -> double
auto GetP() const -> ROOT::Math::XYZVector
auto GetGamma() const -> double