static void print_world_trafo(AlignmentsCalib& calib, const std::string& path)  {
  DetElement d(calib.detector(path));
  Alignment  a = calib.slice.get(d,align::Keys::alignmentKey);
  if ( a.isValid() )  {
    const double* tr = a.worldTransformation().GetTranslation();
    printout(INFO,"Example","++ World transformation of: %-32s  Tr:(%8.2g,%8.2g,%8.2g [cm])",
             path.c_str(), tr[0],tr[1],tr[2]);
    a.worldTransformation().Print();
    return;
  }
  Condition c = calib.slice.get(d,align::Keys::deltaKey);
  printout(WARNING,"Example",
           "++ Detector element:%s No alignment conditions present. Delta:%s",
           path.c_str(), c.isValid() ? "Present" : "Not availible");
}
Пример #2
0
template <> void AlignmentActor<DDAlign_standard_operations::node_align>::operator()(Nodes::value_type& n) const  {
  Entry& e = *n.second.second;
  bool       check = e.checkOverlap();
  bool       overlap = e.overlapDefined();
  bool       has_matrix  = e.hasMatrix();
  DetElement det = e.detector;
  bool       valid     = det->global_alignment.isValid();
  string     det_placement = det.placementPath();

  if ( !valid && !has_matrix )  {
    cout << "++++ SKIP ALIGNMENT: ++++ " << e.path
         << " DE:" << det_placement
         << " Valid:" << yes_no(valid)
         << " Matrix:" << yes_no(has_matrix) << endl;
    /*    */
    return;
  }

  cout << "++++ " << e.path
       << " DE:" << det_placement
       << " Valid:" << yes_no(valid)
       << " Matrix:" << yes_no(has_matrix)
       << endl;
  /*  */
  // Need to care about optional arguments 'check_overlaps' and 'overlap'
  DetectorAlignment ad(det);
  Alignment alignment;
  bool is_not_volume = e.path == det_placement;
  if ( check && overlap )     {
    alignment = is_not_volume
      ? ad.align(e.transform, e.overlapValue(), e.overlap)
      : ad.align(e.path, e.transform, e.overlapValue(), e.overlap);
  }
  else if ( check )    {
    alignment = is_not_volume
      ? ad.align(e.transform, e.overlapValue())
      : ad.align(e.path, e.transform, e.overlapValue());
  }
  else     {
    alignment = is_not_volume ? ad.align(e.transform) : ad.align(e.path, e.transform);
  }
  if ( alignment.isValid() )  {
    insert(alignment);
    return;
  }
  throw runtime_error("Failed to apply alignment for "+e.path);
}