33 TGeoPhysicalNode* pn = 0;
34 nodes.emplace(e->path,std::make_pair(pn,e));
38 TGeoPhysicalNode* pn = entry.second;
39 for(Entries::const_iterator j=
entries.begin(); j !=
entries.end(); ++j) {
40 Entries::value_type e = (*j);
42 const char* p = pn->GetName();
44 if ( reset_children && ::strstr(p,e->path.c_str()) == p ) {
45 nodes.emplace(p,std::make_pair(pn,e));
48 else if ( e->path == p ) {
49 nodes.emplace(p,std::make_pair(pn,e));
57 printout(ALWAYS,
"GlobalAlignmentCache",
"++++++++++++++++++++++++ Summary ++++++++++++++++++++++++");
61 TGeoPhysicalNode* p = n.second.first;
62 const Entry& e = *n.second.second;
63 printout(ALWAYS,
"GlobalAlignmentCache",
"Need to reset entry:%s - %s [needsReset:%s, hasMatrix:%s]",
64 p->GetName(), e.
path.c_str(),
70 delete n.second.second;
75 TGeoPhysicalNode* p = n.second.first;
77 if ( p->IsAligned() ) {
78 for (Int_t i=0, nLvl=p->GetLevel(); i<=nLvl; i++) {
79 TGeoNode* node = p->GetNode(i);
80 TGeoMatrix* mat = node->GetMatrix();
81 np += std::string(
"/")+node->GetName();
82 if ( !mat->IsIdentity() && i > 0 ) {
85 printout(ALWAYS,
"GlobalAlignmentActor<reset>",
"Correct path:%s leaf:%s",p->GetName(),np.c_str());
86 TGeoHMatrix* glob = p->GetMatrix(i-1);
88 *mat = *(a->GetOriginalMatrix());
91 TGeoHMatrix* hm =
dynamic_cast<TGeoHMatrix*
>(mat);
92 TGeoMatrix* org = p->GetOriginalMatrix();
94 hm->SetTranslation(org->GetTranslation());
95 hm->SetRotation(org->GetRotationMatrix());
98 printout(ALWAYS,
"GlobalAlignmentActor<reset>",
99 "Invalid operation: %p %p", (
void*)hm, (
void*)org);
110 Entry& e = *n.second.second;
115 printout(WARNING,
"GlobalAlignmentActor",
"++++ SKIP Alignment %s DE:%s Valid:%s Matrix:%s",
116 e.
path.c_str(),
det.placementPath().c_str(),
121 printout(INFO,
"GlobalAlignmentActor",
"++++ %s DE:%s Matrix:%s",
129 bool no_vol = e.
path ==
det.placementPath();
130 double ovl_precision = e.
overlap;
144 align = no_vol ? ad.align(trafo,ovl_precision,e.
overlap) : ad.align(e.
path,trafo,ovl_precision,e.
overlap);
146 align = no_vol ? ad.align(trafo,ovl_precision) : ad.align(e.
path,trafo,ovl_precision);
148 align = no_vol ? ad.align(trafo) : ad.align(e.
path,trafo);
154 except(
"GlobalAlignmentActor",
"Failed to apply alignment for "+e.
path);
158 void alignment_reset_dbg(
const string& path,
const GlobalAlignment& a) {
159 TGeoPhysicalNode* n = a.
ptr();
160 cout <<
" +++++++++++++++++++++++++++++++ " << path << endl;
161 cout <<
" +++++ Misaligned physical node: " << endl;
164 if ( n->IsAligned() ) {
165 for (Int_t i=0; i<=n->GetLevel(); i++) {
166 TGeoMatrix* mat = n->GetNode(i)->GetMatrix();
168 np += n->GetNode(i)->GetName();
169 if ( mat->IsIdentity() )
continue;
170 if ( i == 0 )
continue;
172 TGeoHMatrix* glob = n->GetMatrix(i-1);
173 NodeMap::const_iterator j=original_matrices.find(np);
174 if ( j != original_matrices.end() && i!=n->GetLevel() ) {
175 cout <<
" +++++ Patch Level: " << i << np << endl;
176 *mat = *((*j).second);
179 if ( i==n->GetLevel() ) {
180 cout <<
" +++++ Level: " << i << np <<
" --- Original matrix: " << endl;
181 n->GetOriginalMatrix()->Print();
182 cout <<
" +++++ Level: " << i << np <<
" --- Local matrix: " << endl;
184 TGeoHMatrix* hm =
dynamic_cast<TGeoHMatrix*
>(mat);
185 hm->SetTranslation(n->GetOriginalMatrix()->GetTranslation());
186 hm->SetRotation(n->GetOriginalMatrix()->GetRotationMatrix());
187 cout <<
" +++++ Level: " << i << np <<
" --- New local matrix" << endl;
191 cout <<
" +++++ Level: " << i << np <<
" --- Keep matrix " << endl;
195 cout <<
" +++++ Level: " << i << np <<
" --- Global matrix: " << endl;
198 cout <<
" +++++ Level: " << i << np <<
" --- New global matrix: " << endl;
202 cout <<
"\n\n\n +++++ physical node (full): " << np << endl;
204 cout <<
" +++++ physical node (global): " << np << endl;
205 n->GetMatrix()->Print();