Belle II Software development
FarBeamLineGeo.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <framework/gearbox/GearDir.h>
10#include <ir/dbobjects/FarBeamLineGeo.h>
11
12using namespace std;
13using namespace Belle2;
14
16{
17 //------------------------------
18 // Get FarBeamLine geometry parameters from the gearbox
19 //------------------------------
20
21 addParameter("LimitStepLength", content.getInt("LimitStepLength"));
22
23 std::vector<std::string> names = {"TubeR", "TubeL"};
24
25 for (auto name : names) {
26 GearDir sect(content, name + "/");
27 addParameters(sect, name);
28 }
29
30 std::string straightSections;
31 for (const GearDir& straight : content.getNodes("Straight")) {
32 std::string name = straight.getString("@name");
33 addParameters(straight, name);
34 if (!straightSections.empty()) straightSections += " ";
35 straightSections += name;
36 }
37 addParameter("Straight", straightSections);
38
39 std::string bendingSections;
40 for (const GearDir& bend : content.getNodes("Bending")) {
41 std::string name = bend.getString("@name");
42 addParameters(bend, name);
43 if (!bendingSections.empty()) bendingSections += " ";
44 bendingSections += name;
45 }
46 addParameter("Bending", bendingSections);
47
48 std::string collimators;
49 for (const GearDir& coll : content.getNodes("Collimator")) {
50 std::string name = coll.getString("@name");
51 addParameters(coll, name);
52 if (!collimators.empty()) collimators += " ";
53 collimators += name;
54 }
55 addParameter("Collimator", collimators);
56
57 std::string shields;
58 for (const GearDir& shield : content.getNodes("Shield")) {
59 std::string name = shield.getString("@name");
60 addParameters(shield, name);
61 if (!shields.empty()) shields += " ";
62 shields += name;
63 }
64 addParameter("Shield", shields);
65}
void initialize(const GearDir &content)
Initialize from gearbox (xml files)
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
void addParameters(const GearDir &content, const std::string &section)
Add parameters from Gearbox.
Definition: IRGeoBase.h:124
void addParameter(const std::string &name, double val)
Add parameter to map of parameters.
Definition: IRGeoBase.h:98
Abstract base class for different kinds of events.
STL namespace.