98 edm::LogInfo(
"Alignment") <<
"CocoaAnalyzer::ReadXML: world object = " << worldVolume.name();
103 worldInfo.
name_ = worldVolume.name();
104 worldInfo.
type_ =
"system";
139 const std::string cocoaParameterAttribute =
"COCOA";
143 allSpecParSections.filter(cocoaParameterSpecParSections, cocoaParameterAttribute, cocoaParameterValue);
147 myFilteredView.mergedSpecifics(cocoaParameterSpecParSections);
151 bool doCOCOA = myFilteredView.firstChild();
164 const std::string& nodePath = myFilteredView.path();
165 oaInfo.
name_ = nodePath;
168 oaInfo.
parentName_ = nodePath.substr(0, nodePath.rfind(
'/', nodePath.length()));
171 edm::LogInfo(
"Alignment") <<
" CocoaAnalyzer::ReadXML reading object " <<
name;
180 const dd4hep::Direction& transl = myPlacedVolume.position();
183 edm::LogInfo(
"Alignment") <<
"Local translation in cm = " << transl;
190 oaInfo.
x_.
value_ = transl.x() / (1._m);
191 oaInfo.
x_.
error_ = cms::getParameterValueFromSpecParSections<double>(allSpecParSections,
197 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"centre_X_quality", 0));
201 oaInfo.
y_.
value_ = transl.y() / (1._m);
202 oaInfo.
y_.
error_ = cms::getParameterValueFromSpecParSections<double>(allSpecParSections,
208 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"centre_Y_quality", 0));
212 oaInfo.
z_.
value_ = transl.z() / (1._m);
213 oaInfo.
z_.
error_ = cms::getParameterValueFromSpecParSections<double>(allSpecParSections,
219 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"centre_Z_quality", 0));
231 const TGeoHMatrix parentToChild = myPlacedVolume.matrix();
233 const TGeoHMatrix& childToParent = parentToChild.Inverse();
238 const Double_t*
rot = childToParent.GetRotationMatrix();
239 const double xx =
rot[0];
240 const double xy =
rot[1];
241 const double xz =
rot[2];
242 const double yx =
rot[3];
243 const double yy =
rot[4];
244 const double yz =
rot[5];
245 const double zx =
rot[6];
246 const double zy =
rot[7];
247 const double zz =
rot[8];
254 const CLHEP::Hep3Vector colX(
xx, yx, zx);
255 const CLHEP::Hep3Vector colY(
xy,
yy, zy);
256 const CLHEP::Hep3Vector colZ(
xz,
yz,
zz);
257 const CLHEP::HepRotation rotclhep(colX, colY, colZ);
265 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"angles_X_value", 0);
267 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"angles_X_sigma", 0);
269 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"angles_X_quality", 0));
274 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"angles_Y_value", 0);
276 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"angles_Y_sigma", 0);
278 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"angles_Y_quality", 0));
283 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"angles_Z_value", 0);
285 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"angles_Z_sigma", 0);
287 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"angles_Z_quality", 0));
290 cms::getParameterValueFromSpecParSections<std::string>(allSpecParSections, nodePath,
"cocoa_type", 0);
292 oaInfo.
ID_ = static_cast<int>(
293 cms::getParameterValueFromSpecParSections<double>(allSpecParSections, nodePath,
"cmssw_ID", 0));
296 edm::LogInfo(
"Alignment") <<
"CocoaAnalyzer::ReadXML OBJECT " << oaInfo.
name_ <<
" pos/angles read ";
310 const std::vector<std::string>&
names =
311 cms::getAllParameterValuesFromSpecParSections<std::string>(allSpecParSections, nodePath,
"extra_entry");
312 const std::vector<std::string>& dims =
313 cms::getAllParameterValuesFromSpecParSections<std::string>(allSpecParSections, nodePath,
"dimType");
314 const std::vector<double>&
values =
315 cms::getAllParameterValuesFromSpecParSections<double>(allSpecParSections, nodePath,
"value");
316 const std::vector<double>&
errors =
317 cms::getAllParameterValuesFromSpecParSections<double>(allSpecParSections, nodePath,
"sigma");
318 const std::vector<double>&
quality =
319 cms::getAllParameterValuesFromSpecParSections<double>(allSpecParSections, nodePath,
"quality");
322 edm::LogInfo(
"Alignment") <<
" CocoaAnalyzer::ReadXML: Fill extra entries with read parameters ";
327 for (
size_t i = 0;
i <
names.size(); ++
i) {
328 double dimFactor = 1.;
330 if (
type ==
"centre" ||
type ==
"length") {
331 dimFactor = 1. / (1._m);
332 }
else if (
type ==
"angles" ||
type ==
"angle" ||
type ==
"nodim") {
346 edm::LogInfo(
"Alignment") <<
"WARNING FOR NOW: sizes of extra parameters (names, dimType, value, quality) do"
347 <<
" not match! Did not add " << nObjects <<
" item to OpticalAlignments.";
351 const std::vector<std::string>& measNames =
352 cms::getAllParameterValuesFromSpecParSections<std::string>(allSpecParSections, nodePath,
"meas_name");
353 const std::vector<std::string>& measTypes =
354 cms::getAllParameterValuesFromSpecParSections<std::string>(allSpecParSections, nodePath,
"meas_type");
356 std::map<std::string, std::vector<std::string>> measObjectNames;
357 std::map<std::string, std::vector<std::string>> measParamNames;
358 std::map<std::string, std::vector<double>> measParamValues;
359 std::map<std::string, std::vector<double>> measParamSigmas;
360 std::map<std::string, std::vector<double>> measIsSimulatedValue;
361 for (
const auto&
name : measNames) {
362 measObjectNames[
name] = cms::getAllParameterValuesFromSpecParSections<std::string>(
363 allSpecParSections, nodePath,
"meas_object_name_" +
name);
364 measParamNames[
name] = cms::getAllParameterValuesFromSpecParSections<std::string>(
365 allSpecParSections, nodePath,
"meas_value_name_" +
name);
366 measParamValues[
name] =
367 cms::getAllParameterValuesFromSpecParSections<double>(allSpecParSections, nodePath,
"meas_value_" +
name);
368 measParamSigmas[
name] =
369 cms::getAllParameterValuesFromSpecParSections<double>(allSpecParSections, nodePath,
"meas_sigma_" +
name);
370 measIsSimulatedValue[
name] = cms::getAllParameterValuesFromSpecParSections<double>(
371 allSpecParSections, nodePath,
"meas_is_simulated_value_" +
name);
375 edm::LogInfo(
"Alignment") <<
" CocoaAnalyzer::ReadXML: Fill measurements with read parameters ";
378 if (measNames.size() == measTypes.size()) {
379 for (
size_t i = 0;
i < measNames.size(); ++
i) {
381 oaMeas.
name_ = measNames[
i];
382 oaMeas.
type_ = measTypes[
i];
384 if (measParamNames.size() == measParamValues.size() && measParamValues.size() == measParamSigmas.size()) {
385 for (
size_t i2 = 0;
i2 < measParamNames[oaMeas.
name_].size();
i2++) {
390 if (oaMeas.
type_ ==
"SENSOR2D" || oaMeas.
type_ ==
"COPS" || oaMeas.
type_ ==
"DISTANCEMETER" ||
391 oaMeas.
type_ ==
"DISTANCEMETER!DIM" || oaMeas.
type_ ==
"DISTANCEMETER3DIM") {
393 }
else if (oaMeas.
type_ ==
"TILTMETER") {
396 edm::LogError(
"Alignment") <<
"CocoaAnalyzer::readXMLFile. Invalid measurement type: " << oaMeas.
type_;
399 oaMeas.
values_.emplace_back(oaParam);
404 << measIsSimulatedValue[oaMeas.
name_][
i2];
410 edm::LogWarning(
"Alignment") <<
"WARNING FOR NOW: sizes of measurement parameters (name, value, sigma) do"
411 <<
" not match! for measurement " << oaMeas.
name_
412 <<
" !Did not fill parameters for this measurement ";
417 edm::LogInfo(
"Alignment") <<
"CocoaAnalyser: MEASUREMENT " << oaMeas.
name_ <<
" extra entries read "
425 edm::LogWarning(
"Alignment") <<
"WARNING FOR NOW: sizes of measurements (names, types do"
426 <<
" not match! Did not add " << nObjects <<
" item to XXXMeasurements";
431 doCOCOA = myFilteredView.firstChild();
435 edm::LogInfo(
"Alignment") <<
"CocoaAnalyzer::ReadXML: Finished building " << nObjects + 1
436 <<
" OpticalAlignInfo objects"
438 <<
" OpticalAlignMeasurementInfo objects ";