R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandCommon.h
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#pragma once
15#include <TObject.h>
16#include <cassert>
17#include <cmath>
18#include <cstdint>
19#include <limits>
20#include <vector>
21
22namespace R3B::Neuland
23{
24 // Constants
25
26 constexpr auto SQRT_12 = 3.464101615;
27 constexpr auto NaN = std::numeric_limits<double>::quiet_NaN();
28 constexpr auto Inf = std::numeric_limits<double>::infinity();
29
30 // Usefull functions I do not want to redefine in every file
31
32 template <typename T>
33 constexpr T Sqr(const T val)
34 {
35 return val * val;
36 }
37
38 // Millepede calibration defaults:
39 constexpr auto DEFAULT_EFFECTIVE_C = 8.; // cm/ns
40 constexpr auto DEFAULT_CALIBRATION_P_VALUE_CUT = 1e-10; // any smaller values will be discarded
41 constexpr auto DEFAULT_T_DIFF_RESIDUAL_CUT = 400; // any larger values will be discarded
42
43 // Initialize variables from Birk' s Law
44
45 constexpr double BirkdP = 1.032;
46 constexpr double BirkC1 = 0.013 / BirkdP;
47 constexpr double BirkC2 = 9.6e-6 / (BirkdP * BirkdP);
48
49 constexpr double GetLightYieldAfterBirk(const int charge, const double length_mm, const double edep_MeV)
50 {
51 return (charge * length_mm == 0.
52 ? edep_MeV
53 : edep_MeV / (1. + BirkC1 * (Sqr(charge) > 1 ? 7.2 / 12.6 : 1.) * (edep_MeV / length_mm) +
54 BirkC2 * Sqr(edep_MeV / length_mm)));
55 }
56
57 // Physical Constants
58
59 constexpr auto CLight = 29.9792458; // Speed of light [cm/ns]
60 constexpr auto InvCLight = 1. / CLight; // Speed of light [cm/ns]>
61 constexpr auto MUON_MASS = 0.105; // Muonmass [GeV]
62
63 // Electronics Constans
64
65 constexpr auto COARSE_TIME_CLOCK_FREQUENCY_MHZ = 200.F;
66 constexpr auto MaxCalTime = 5. * 2048;
67 constexpr auto MaxFTValue = 4097;
68 constexpr auto MAXCTValue = 2048U;
69 // Geometry & Material Constants
70
71 constexpr auto BarSize_XY = 5.0; // cm NeuLAND parameter
72 constexpr auto BarUncertainty_XY = BarSize_XY / SQRT_12; // cm NeuLAND parameter
73 constexpr auto BarSize_Z = 5.0; // cm NeuLAND parameter
74 constexpr auto BarUncertainty_Z = BarSize_Z / SQRT_12; // cm NeuLAND parameter
75 constexpr auto BarLength = 250.0; // cm NeuLAND parameter
76 constexpr auto LightGuideLength = 10.0; // cm NeuLAND parameter
77 constexpr auto TotalBarLength = BarLength + 2 * LightGuideLength; // cm NeuLAND parameter, Bar including Light Guide
78
79 constexpr auto ScintillatorDensity = 1.032; // g / cm^3
80 constexpr auto MIPStoppingPowerPerDensity = 1.956; // MeV cm^2 / g
81 constexpr auto MIPStoppingPower = 1.73; // MeV / cm
82
83 constexpr auto FirstHorizontalPlane = 0;
84 constexpr auto BarsPerPlane = 50;
85 constexpr auto MaxNumberOfPlanes = 26;
87
88 // naming convention:
89 // _num starts at 1 and _id starts at 0
90 // module number has the range of 1 ~ BarsPerPlane * NumOfPlanes
91 // bar number has the range of 1 ~ BarsPerPlane
92 constexpr auto GetBarVerticalDisplacement(int module_num) -> double
93 {
94 const auto bar_num = module_num % BarsPerPlane;
95 return (2 * bar_num - 1 - BarsPerPlane) / 2. * BarSize_XY;
96 }
97 constexpr auto IsPlaneIDHorizontal(int plane_id) -> bool { return (plane_id % 2 == FirstHorizontalPlane); }
98 constexpr auto IsPlaneIDVertical(int plane_id) -> bool { return !IsPlaneIDHorizontal(plane_id); }
99 constexpr auto ModuleID2PlaneID(int moduleID) -> int { return moduleID / BarsPerPlane; }
100 constexpr auto ModuleID2PlaneNum(int moduleID) -> int { return ModuleID2PlaneID(moduleID) + 1; }
101 // planeNum, barNum and ModuleNum is 1-based
102 constexpr auto Neuland_PlaneBar2ModuleNum(unsigned int planeNum, unsigned int barNum) -> unsigned int
103 {
104 assert(planeNum > 0);
105 return (planeNum - 1) * BarsPerPlane + barNum;
106 }
107 template <typename T = double>
108 constexpr auto PlaneID2ZPos(int plane_id) -> T
109 {
110 return static_cast<T>((plane_id + 0.5) * BarSize_Z);
111 }
112 template <typename T = double>
113 constexpr auto ModuleNum2ZPos(int module_num) -> T
114 {
115 return PlaneID2ZPos<T>(ModuleID2PlaneID(module_num - 1));
116 }
117
118 // Average Parameters
119
120 constexpr auto AvgTimeResolution = 0.150; // ns
121 constexpr auto AvgEffectiveCLight = -7.95; // cm / ns
122 constexpr auto AvgGain = 15; // MeV / ns
123 constexpr auto AvgThreshold = 1.75; // MeV
124 constexpr auto AvgAttenuationLength = 400.; // cm
125
126 constexpr auto SaturationCoefficient = 1.75e-3; // 1 / ns
127
128 // NeuLAND TPAT:
129 constexpr auto NeulandOnSpillTpatPos = 0U; // 0 based
130
132 {
133 double x{};
134 double y{};
135 double z{};
136 };
137} // namespace R3B::Neuland
Simulation of NeuLAND Bar/Paddle.
constexpr auto COARSE_TIME_CLOCK_FREQUENCY_MHZ
constexpr double GetLightYieldAfterBirk(const int charge, const double length_mm, const double edep_MeV)
constexpr auto BarsPerPlane
constexpr auto DEFAULT_T_DIFF_RESIDUAL_CUT
constexpr auto ModuleID2PlaneID(int moduleID) -> int
constexpr auto AvgTimeResolution
constexpr auto NeulandOnSpillTpatPos
constexpr auto BarUncertainty_Z
constexpr auto GetBarVerticalDisplacement(int module_num) -> double
constexpr auto Neuland_PlaneBar2ModuleNum(unsigned int planeNum, unsigned int barNum) -> unsigned int
constexpr auto SQRT_12
constexpr auto ModuleID2PlaneNum(int moduleID) -> int
constexpr auto DEFAULT_CALIBRATION_P_VALUE_CUT
constexpr auto InvCLight
constexpr auto SaturationCoefficient
constexpr double BirkC1
constexpr auto MaxNumberOfBars
constexpr auto BarLength
constexpr double BirkdP
constexpr auto BarSize_Z
constexpr auto MIPStoppingPower
constexpr auto AvgEffectiveCLight
constexpr auto CLight
constexpr auto BarSize_XY
constexpr auto FirstHorizontalPlane
constexpr auto TotalBarLength
constexpr auto NaN
constexpr auto ModuleNum2ZPos(int module_num) -> T
constexpr auto AvgAttenuationLength
constexpr auto AvgThreshold
constexpr auto BarUncertainty_XY
constexpr double BirkC2
constexpr auto MUON_MASS
constexpr auto MaxFTValue
constexpr auto MAXCTValue
constexpr auto IsPlaneIDHorizontal(int plane_id) -> bool
constexpr auto LightGuideLength
constexpr auto MaxNumberOfPlanes
constexpr auto IsPlaneIDVertical(int plane_id) -> bool
constexpr auto AvgGain
constexpr auto MIPStoppingPowerPerDensity
constexpr T Sqr(const T val)
constexpr auto MaxCalTime
constexpr auto DEFAULT_EFFECTIVE_C
constexpr auto PlaneID2ZPos(int plane_id) -> T
constexpr auto Inf
constexpr auto ScintillatorDensity