20 std::pair<std::vector<float>, std::vector<uint32_t>> readHistogram(
22 std::vector<float>* binBorders =
nullptr;
23 std::vector<uint32_t>* binContents =
nullptr;
25 binBorders = (std::vector<float>*)gDirectory->Get(binBordersName.c_str());
27 (std::vector<uint32_t>*)gDirectory->Get(binContentsName.c_str());
29 if (binBorders !=
nullptr && binContents !=
nullptr) {
30 return std::make_pair(*binBorders, *binContents);
32 return std::make_pair(std::vector<float>(), std::vector<uint32_t>());
36 std::vector<float>* vector =
nullptr;
38 vector = (std::vector<float>*)gDirectory->Get(vectorName.c_str());
40 if (vector !=
nullptr) {
42 const unsigned int sizeVec = vector->size();
43 result.resize(sizeVec);
44 for (
unsigned int i = 0;
i < sizeVec;
i++) {
45 result(
i) = (*vector)[
i];
53 void readKinematicParameters(
55 TObject* folder,
bool softInteractionParameters) {
56 if (folder->IsFolder()) {
58 const char* distributionName = folder->GetName();
59 unsigned int mult = std::stoi(distributionName);
60 gDirectory->cd(distributionName);
61 std::vector<std::pair<std::vector<float>, std::vector<uint32_t>>>
63 momentumDistributions.resize(mult + 1);
64 std::vector<std::pair<std::vector<float>, std::vector<uint32_t>>>
65 invariantMassDistributions;
66 invariantMassDistributions.resize(mult);
67 for (
unsigned int i = 0;
i < mult;
i++) {
68 momentumDistributions[
i] = readHistogram(
72 invariantMassDistributions[
i] = readHistogram(
77 momentumDistributions.back() = readHistogram(
78 (
"MomentumDistributionBinBorders_" +
std::to_string(mult)).c_str(),
79 (
"MomentumDistributionBinContents_" +
std::to_string(mult)).c_str());
83 readVector(
"MomentumEigenvalues");
85 readVector(
"MomentumEigenvectors");
88 readVector(
"InvariantMassEigenvalues");
90 readVector(
"InvariantMassEigenvectors");
94 if (momentumEigenvalues.size() != 0 && momentumEigenvectors.size() != 0 &&
95 momentumMean.size() != 0 && invariantMassEigenvalues.size() != 0 &&
96 invariantMassEigenvectors.size() != 0 &&
97 invariantMassMean.size() != 0) {
101 momentumDistributions, momentumEigenvalues, momentumEigenvectors,
102 momentumMean, invariantMassDistributions,
103 invariantMassEigenvalues, invariantMassEigenvectors,
105 if (softInteractionParameters) {
117 gDirectory->cd(
"..");
126 auto opt = desc.add_options();
127 opt(
"fatras-nuclear-interaction-parametrisation",
128 value<std::string>()->default_value({}),
129 "File containing parametrisations for nuclear interaction.");
133 const boost::program_options::variables_map& variables) {
134 return variables[
"fatras-nuclear-interaction-parametrisation"]
145 TFile tf(fileName.c_str(),
"read");
147 auto listOfParticles = gDirectory->GetListOfKeys();
148 auto initialParticle = listOfParticles->First();
149 while (initialParticle !=
nullptr) {
151 char const* particleName = initialParticle->GetName();
152 gDirectory->cd(particleName);
155 auto listOfMomenta = gDirectory->GetListOfKeys();
156 auto initialMomentum = listOfMomenta->First();
157 while (initialMomentum !=
nullptr) {
161 char const* nameMomentum = initialMomentum->GetName();
162 parameters.
momentum = std::stof(nameMomentum);
163 gDirectory->cd(nameMomentum);
167 "NuclearInteractionBinBorders",
"NuclearInteractionBinContents");
170 TVectorF* softInteraction = (TVectorF*)gDirectory->Get(
"SoftInteraction");
174 std::vector<int> branchingPdgIds =
175 *((std::vector<int>*)gDirectory->Get(
"BranchingPdgIds"));
176 std::vector<int> targetPdgIds =
177 *((std::vector<int>*)gDirectory->Get(
"TargetPdgIds"));
178 std::vector<float> targetPdgProbability =
179 *((std::vector<float>*)gDirectory->Get(
"TargetPdgProbability"));
180 parameters.
pdgMap.reserve(branchingPdgIds.size());
181 for (
unsigned int i = 0;
i < branchingPdgIds.size();
i++) {
182 auto it = parameters.
pdgMap.begin();
183 while (
it->first != branchingPdgIds[
i] &&
189 std::make_pair(targetPdgIds[
i], targetPdgProbability[i]);
190 if (
it != parameters.
pdgMap.end()) {
193 parameters.
pdgMap.push_back(std::make_pair(
194 branchingPdgIds[i], std::vector<std::pair<int, float>>{
target}));
199 gDirectory->cd(
"soft");
202 readHistogram(
"MultiplicityBinBorders",
"MultiplicityBinContents");
204 auto softList = gDirectory->GetListOfKeys();
205 auto softElement = softList->First();
206 while (softElement !=
nullptr) {
207 readKinematicParameters(parameters, softElement,
true);
208 softElement = softList->After(softElement);
212 gDirectory->cd(
"../hard");
215 readHistogram(
"MultiplicityBinBorders",
"MultiplicityBinContents");
218 auto hardList = gDirectory->GetListOfKeys();
219 auto hardElement = hardList->First();
220 while (hardElement !=
nullptr) {
221 readKinematicParameters(parameters, hardElement,
false);
222 hardElement = hardList->After(hardElement);
225 initialMomentum = listOfMomenta->After(initialMomentum);
227 parametrisation.push_back(
228 std::make_pair(parameters.
momentum, parameters));
233 mpp.push_back(std::make_pair(std::stof(particleName), parametrisation));
235 initialParticle = listOfParticles->After(initialParticle);