Project
Loading...
Searching...
No Matches
ToyAbsorberFastSim.cxx
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13
14#include <cmath>
15
16namespace o2::fastsim
17{
18
19namespace
20{
22constexpr double kAbsorptionLengthCm = 60.;
23} // namespace
24
25//_____________________________________________________________________________
26std::vector<FastSimOutput> ToyAbsorberFastSim::sample(const FastSimInput& input) const
27{
28 // A toy transformation, not a physics model: the incident particle carries on
29 // in its direction with the energy attenuated over the path through the
30 // envelope. A trained model returns a shower here instead.
31 // Always positive: ModelTrigger only calls a model above its threshold, and
32 // an exponential of a finite path cannot reach zero.
33 const double kinetic = input.kineticEnergy * std::exp(-input.exitDistance / kAbsorptionLengthCm);
34 const double momentum = std::sqrt(kinetic * (kinetic + 2. * input.mass));
35
36 FastSimOutput out;
37 out.pdg = input.pdg;
38 out.time = input.time;
39 for (int i = 0; i < 3; ++i) {
40 out.position[i] =
41 input.position[i] + (input.exitDistance + kSurfaceEpsilonCm) * input.direction[i];
42 out.momentum[i] = momentum * input.direction[i];
43 }
44 return {out};
45}
46
47} // namespace o2::fastsim
int32_t i
std::vector< FastSimOutput > sample(const FastSimInput &input) const override
constexpr double kSurfaceEpsilonCm
double position[3]
global, on the envelope surface
double direction[3]
unit vector
double exitDistance
cm from position to the ENVELOPE surface along direction
One particle leaving the envelope.
double position[3]
global; put it outside the envelope surface