R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandSignalMatcher.cxx
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2023 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
15#include <cmath>
16#include <cstdlib>
17
18namespace R3B::Neuland
19{
20
21 auto SignalMatcher::GetGoodnessOfMatch(const Input& firstSignal, const Input& secondSignal, const Par& par) -> float
22 {
23 auto firstE = static_cast<float>(firstSignal.energy);
24 auto secondE = static_cast<float>(secondSignal.energy);
25 auto firstT = firstSignal.time;
26 auto secondT = secondSignal.time;
27
28 // keep the exponent always negative to prevent the exploding of exponential function
29 auto res = 0.F;
30 if (firstT > secondT)
31 {
32 // res = std::abs(
33 // (firstE / secondE) * std::exp(static_cast<float>(par.attenuation * par.c_medium * (firstT -
34 // secondT))) - 1);
35 res = std::abs((firstE / secondE) *
36 std::exp(static_cast<float>(par.attenuation * par.c_medium * (firstT - secondT))));
37 }
38 else
39 {
40 // res = std::abs((secondE / firstE) * std::exp(static_cast<float>(par.attenuation * par.c_medium *
41 // static_cast<float>(secondT - firstT))) -
42 // 1);
43 res = std::abs((secondE / firstE) * std::exp(static_cast<float>(par.attenuation * par.c_medium *
44 static_cast<float>(secondT - firstT))));
45 }
46 return res;
47 }
48
49} // namespace R3B::Neuland
Simulation of NeuLAND Bar/Paddle.
static auto GetGoodnessOfMatch(const Input &firstSignal, const Input &secondSignal, const Par &par) -> float