Read misalignment data from an xml file and store sensor misalignments.
41 {
42 const double mradToDeg = 0.18 / M_PI;
43 ptree propertyTree;
44
45
47
49 B2ERROR("The filename: " << filename << endl <<
50 "resolved to: " << xmlFullPath << endl <<
51 "by FileSystem::findFile but has no file with it." << endl <<
52 "Misaligner cache cannot be initialized." << endl <<
53 "No misalignment will be applied." << endl
54 );
55 return;
56 }
57
58 try {
59 read_xml(xmlFullPath, propertyTree);
60 } catch (std::exception const& ex) {
61 B2ERROR("Excpetion raised during xml parsing " << ex.what() << endl <<
62 "Misaligner cache cannot be initialized." << endl <<
63 "No misalignment will be applied." << endl);
64 return;
65 } catch (...) {
66 B2ERROR("Unknown excpetion raised during xml parsing "
67 "Misaligner cache cannot be initialized." << endl <<
68 "No misalignment will be applied." << endl);
69 return;
70 }
71
72 try {
73
74 for (ptree::value_type const& detector : propertyTree.get_child("SVDMisalignment")) {
75 for (ptree::value_type const& layer : detector.second.get_child("layer"))
76 for (ptree::value_type const& ladder : layer.second.get_child("ladder"))
77 for (ptree::value_type const& sensor : ladder.second.get_child("sensor")) {
78
79 TGeoHMatrix transform;
80 transform.SetDx(sensor.second.get<
double>(
"du") *
Unit::um);
81 transform.SetDy(sensor.second.get<
double>(
"dv") *
Unit::um);
82 transform.SetDz(sensor.second.get<
double>(
"dw") *
Unit::um);
83 transform.RotateX(sensor.second.get<double>("dalpha") * mradToDeg);
84 transform.RotateY(sensor.second.get<double>("dbeta") * mradToDeg);
85 transform.RotateZ(sensor.second.get<double>("dgamma") * mradToDeg);
88 }
89 }
90 } catch (...) {
91 B2ERROR("Unknown excpetion raised during map initialization! "
92 "Misalignment data corrupted." << endl <<
93 "No misalignment will be applied." << endl);
95 return;
96 }
98 }
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
static bool fileExists(const std::string &filename)
Check if the file with given filename exists.
static const double um
[micrometers]
unsigned short baseType
The base integer type for VxdID.