Пример #1
0
template <> void AlignmentActor<DDAlign_standard_operations::node_reset>::operator()(Nodes::value_type& n) const  {
  TGeoPhysicalNode* p = n.second.first;
  //Entry*            e = n.second.second;
  string np;
  if ( p->IsAligned() )   {
    for (Int_t i=0, nLvl=p->GetLevel(); i<=nLvl; i++) {
      TGeoNode* node = p->GetNode(i);
      TGeoMatrix* mm = node->GetMatrix();  // Node's relative matrix
      np += string("/")+node->GetName();
      if ( !mm->IsIdentity() && i > 0 )  {    // Ignore the 'world', is identity anyhow
        GlobalAlignment a = cache.get(np);
        if ( a.isValid() )  {
          printout(ALWAYS,"AlignmentActor<reset>","Correct path:%s leaf:%s",p->GetName(),np.c_str());
          TGeoHMatrix* glob = p->GetMatrix(i-1);
          if ( a.isValid() && i!=nLvl )   {
            *mm = *(a->GetOriginalMatrix());
          }
          else if ( i==nLvl ) {
            TGeoHMatrix* hm = dynamic_cast<TGeoHMatrix*>(mm);
            TGeoMatrix*  org = p->GetOriginalMatrix();
            hm->SetTranslation(org->GetTranslation());
            hm->SetRotation(org->GetRotationMatrix());
          }
          *glob *= *mm;
        }
      }
    }
  }
}
Пример #2
0
void alignment_reset_dbg(const string& path, const Alignment& a)   {
  TGeoPhysicalNode* n = a.ptr();
  cout << " +++++++++++++++++++++++++++++++ " << path << endl;
  cout << "      +++++ Misaligned physical node: " << endl;
  n->Print();
  string np;
  if ( n->IsAligned() ) {
    for (Int_t i=0; i<=n->GetLevel(); i++) {
      TGeoMatrix* mm = n->GetNode(i)->GetMatrix();
      np += "/";
      np += n->GetNode(i)->GetName();
      if ( mm->IsIdentity() ) continue;
      if ( i == 0 ) continue;

      TGeoHMatrix* glob = n->GetMatrix(i-1);
      NodeMap::const_iterator j=original_matrices.find(np);
      if ( j != original_matrices.end() && i!=n->GetLevel() )   {
        cout << "      +++++ Patch Level: " << i << np << endl;
        *mm = *((*j).second);
      }
      else  {
        if ( i==n->GetLevel() ) {
          cout << "      +++++ Level: " << i << np << " --- Original matrix: " << endl;
          n->GetOriginalMatrix()->Print();
          cout << "      +++++ Level: " << i << np << " --- Local matrix: " << endl;
          mm->Print();
          TGeoHMatrix* hm = dynamic_cast<TGeoHMatrix*>(mm);
          hm->SetTranslation(n->GetOriginalMatrix()->GetTranslation());
          hm->SetRotation(n->GetOriginalMatrix()->GetRotationMatrix());
          cout << "      +++++ Level: " << i << np << " --- New local matrix" << endl;
          mm->Print();
        }
        else          {
          cout << "      +++++ Level: " << i << np << " --- Keep matrix " << endl;
          mm->Print();
        }
      }
      cout << "      +++++ Level: " << i << np << " --- Global matrix: " << endl;
      glob->Print();
      *glob *= *mm;
      cout << "      +++++ Level: " << i << np << " --- New global matrix: " << endl;
      glob->Print();
    }
  }
  cout << "\n\n\n      +++++ physical node (full): " << np <<  endl;
  n->Print();
  cout << "      +++++ physical node (global): " << np <<  endl;
  n->GetMatrix()->Print();
}