MUSIC
unknown
Analysis for the MUSIC active-target ionization chamber
Toggle main menu visibility
Loading...
Searching...
No Matches
BeamEnergies.cpp
Go to the documentation of this file.
1
#include "
BeamEnergies.hpp
"
2
#include "
Constants.hpp
"
3
#include "
Paths.hpp
"
4
#include "
RemixSim.hpp
"
5
#include <TFile.h>
6
#include <TLeaf.h>
7
#include <TTree.h>
8
9
namespace
BeamEnergies
{
10
11
TString
SimPath
() {
12
return
Paths::DatasetDir
() +
"/sim_root_files/"
+
13
Constants::cfg
.CROSS_SECTION_CONFIG.BEAM_SIM_FILE;
14
}
15
16
Bool_t
Profile
(
const
TString &path, Double_t *dE, Double_t &e_strip0) {
17
TFile f(path,
"READ"
);
18
if
(f.IsZombie())
19
return
kFALSE;
20
TTree *t =
static_cast<
TTree *
>
(f.Get(
"events_MeV"
));
21
TTree *mc =
static_cast<
TTree *
>
(f.Get(
"MC"
));
22
if
(!t || !mc)
23
return
kFALSE;
24
RemixSim::Event
e;
25
if
(!e.
Attach
(t))
26
return
kFALSE;
27
for
(Int_t s = 0; s < 18; s++)
28
dE[s] = 0.0;
29
const
Long64_t n = t->GetEntries();
30
if
(n == 0)
31
return
kFALSE;
32
for
(Long64_t i = 0; i < n; i++) {
33
t->GetEntry(i);
34
for
(Int_t s = 0; s < 18; s++)
35
dE[s] += e.
Total
(s);
36
}
37
for
(Int_t s = 0; s < 18; s++)
38
dE[s] /= Double_t(n);
39
40
TLeaf *gas = mc->GetLeaf(
"beam_energy_gas"
);
41
TLeaf *dead = mc->GetLeaf(
"DeadUS_dE"
);
42
if
(!gas || !dead)
43
return
kFALSE;
44
const
Long64_t nm = mc->GetEntries();
45
if
(nm == 0)
46
return
kFALSE;
47
Double_t sum = 0.0;
48
for
(Long64_t i = 0; i < nm; i++) {
49
mc->GetEntry(i);
50
sum += gas->GetValue() - dead->GetValue();
51
}
52
e_strip0 = sum / Double_t(nm);
53
return
kTRUE;
54
}
55
56
Double_t
LabAtStrip
(
const
Double_t *dE, Double_t e_strip0, Int_t reac) {
57
Double_t e = e_strip0;
58
for
(Int_t s = 0; s < reac; s++)
59
e -= dE[s];
60
return
e;
61
}
62
63
Double_t
CmFraction
() {
64
const
CrossSectionConfig
&X =
Constants::cfg
.CROSS_SECTION_CONFIG;
65
const
Int_t target_a =
TargetGasA
(X.
TARGET_GAS
);
66
return
Double_t(target_a) / Double_t(X.
BEAM_A
+ target_a);
67
}
68
69
}
// namespace BeamEnergies
BeamEnergies.hpp
Constants.hpp
Dataset configuration.
TargetGasA
Int_t TargetGasA(TargetGas gas)
Mass number of the target nucleus in a fill gas.
Definition
Constants.cpp:3
Paths.hpp
RemixSim.hpp
Paths::DatasetDir
static TString DatasetDir()
Absolute path to the active dataset directory, analysis/<iso>.
Definition
Paths.cpp:63
BeamEnergies
The beam's energy at each anode strip, from the simulated unreacted beam.
Definition
BeamEnergies.hpp:26
BeamEnergies::LabAtStrip
Double_t LabAtStrip(const Double_t *dE, Double_t e_strip0, Int_t reac)
Lab energy entering a given strip.
Definition
BeamEnergies.cpp:56
BeamEnergies::Profile
Bool_t Profile(const TString &path, Double_t *dE, Double_t &e_strip0)
Read the per-strip energy loss profile from a beam simulation.
Definition
BeamEnergies.cpp:16
BeamEnergies::CmFraction
Double_t CmFraction()
Centre-of-mass energy fraction for this dataset's reaction.
Definition
BeamEnergies.cpp:63
BeamEnergies::SimPath
TString SimPath()
Path to the dataset's beam simulation file.
Definition
BeamEnergies.cpp:11
Constants::cfg
const DatasetConfig & cfg
The active dataset's configuration, flat block.
CrossSectionConfig
Experimental details needed to properly calculate the cross section.
Definition
Constants.hpp:358
CrossSectionConfig::TARGET_GAS
TargetGas TARGET_GAS
Definition
Constants.hpp:359
CrossSectionConfig::BEAM_A
Int_t BEAM_A
Beam mass number, for the lab-to-centre-of-mass conversion; its Z and element symbol name it to a rea...
Definition
Constants.hpp:369
RemixSim::Event
One entry of a simulation's events_MeV tree.
Definition
RemixSim.hpp:91
RemixSim::Event::Total
Double_t Total(Int_t s) const
The strip's deposit, Left(s) + Right(s).
Definition
RemixSim.hpp:111
RemixSim::Event::Attach
Bool_t Attach(TTree *t)
Bind to an events_MeV tree and set up the branch addresses.
Definition
RemixSim.cpp:10
tooling
src
BeamEnergies.cpp
Generated by
1.17.0