コード例 #1
0
ファイル: StandardPlugins.cpp プロジェクト: vvolkl/DD4hep
 static long dump(DetElement de,int level, bool sensitive_only) {
   const DetElement::Children& c = de.children();
   if ( !sensitive_only || 0 != de.volumeID() )  {
     PlacedVolume place = de.placement();
     const TGeoNode* node = place.ptr();
     char sens = place.volume().isSensitive() ? 'S' : ' ';
     int value = flag;
     char fmt[128];
     switch(value)  {
     case 0:
       ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s #Dau:%%d VolID:%%08X Place:%%p  %%c",level+1,2*level+1);
       printout(INFO,"DetectorDump",fmt,"",de.path().c_str(),int(c.size()),
                (unsigned long)de.volumeID(), (void*)node, sens);
       break;
     case 1:
       ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds Detector: %%s #Dau:%%d VolID:%%p",level+1,2*level+1);
       printout(INFO,"DetectorDump", fmt, "", de.path().c_str(),
                int(c.size()), (void*)de.volumeID());
       ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds Placement: %%s   %%c",level+1,2*level+3);
       printout(INFO,"DetectorDump",fmt,"", de.placementPath().c_str(), sens);
       break;
     default:
       break;
     }
   }
   for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i)
     dump((*i).second,level+1,sensitive_only);
   return 1;
 }
コード例 #2
0
ファイル: StandardPlugins.cpp プロジェクト: vvolkl/DD4hep
 static long cache(DetElement de) {
   const DetElement::Children& c = de.children();
   de.worldTransformation();
   de.parentTransformation();
   de.placementPath();
   de.path();
   for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i)
     cache((*i).second);
   return 1;
 }
コード例 #3
0
ファイル: AlignmentOperators.cpp プロジェクト: vvolkl/DD4hep
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);
}