ATLAS Offline Software
TRT_AlignDbSvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #include "TRT_AlignDbSvc.h"
11 
12 
13 
16 #include "InDetIdentifier/TRT_ID.h"
17 
22 
25 
26 // Amg
31 #include <fstream>
32 #include <iostream>
33 #include <sstream>
34 
35 ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // This class uses const_cast and regFcn (callback). Legacy code
36 
37 TRT_AlignDbSvc::TRT_AlignDbSvc( const std::string& name, ISvcLocator* pSvcLocator )
38  : base_class(name,pSvcLocator),
39  m_detStore("DetectorStore",name),
40  m_trtStrawAlignDbSvc("TRT_StrawAlignDbSvc",name),
41  m_trtid(nullptr),
42  m_trtman(nullptr),
43  m_alignroot("/TRT/Align"),
44  m_alignString("AL"),
45  m_par_alitextfile(""),
46  m_streamer("AthenaOutputStreamTool/CondStream1"),
47  m_alignDBprefix("/TRT/Align/"),
48  m_dynamicDB(false),
49  m_forceUserDBConfig(false)
50 {
51  declareProperty("StreamTool",m_streamer);
52  declareProperty("alignroot",m_alignroot);
53  declareProperty("alignTextFile",m_par_alitextfile);
54  declareProperty("DetectorStore",m_detStore);
55  declareProperty("TrtStrawAlignDbSvc", m_trtStrawAlignDbSvc,"Service for interaction with the TRT straw alignment DB");
56  declareProperty("alignString",m_alignString);
57  declareProperty("alignDBprefix",m_alignDBprefix);
58  declareProperty("forceUserDBConfig",m_forceUserDBConfig, "Set to true to override any DB auto-configuration");
59 }
60 
61 //-------------------------------------------------------------------------
62 
64 {}
65 
66 //
67 //-----------------------------------------------------------------------------
69 {
70  ATH_MSG_INFO( " in initialize " );
71 
72  ATH_CHECK( m_detStore.retrieve() );
73  ATH_CHECK (m_trtStrawAlignDbSvc.retrieve() );
74  ATH_MSG_INFO ("retrieved " << m_trtStrawAlignDbSvc);
75 
76  // Get the geometry.
78  ATH_CHECK (m_detStore->retrieve(m_trtman,"TRT") );
79 
80  // Get TRT manager and ID helper
83  ATH_CHECK( m_detStore->retrieve(m_trtid,"TRT_ID") );
84  ATH_MSG_INFO( "found all TRT services " );
85 
87  m_dynamicDB = true;
88  m_alignroot = "/TRT/AlignL2";
89  m_alignDBprefix = "/TRT/AlignL2/";
90  }
92  m_dynamicDB = false;
93  m_alignroot = "/TRT/Align";
94  m_alignDBprefix = "/TRT/Align/";
95  }
96 
97 
98  // setup list of TDS objects from geometry description
99  m_alignobjs.clear();
100  m_alignchans.clear();
101 
102  // Include a level 1 alignment
103  int ichan(0) ;
104  if (!m_dynamicDB){
105  m_alignobjs.emplace_back("/TRT/Align/TRT");
106  ATH_MSG_INFO( "Adding key: /TRT/Align/TRT --> We are using static DB folder scheme" );
107  m_alignchans.push_back(ichan++);
108  }
109 
110  //Check all detector elements in the present geometry setup
111  for (iter=itermin;iter!=itermax;++iter) {
112  const InDetDD::TRT_BaseElement* element=*iter;
113  if (element!=nullptr) {
114  const Identifier ident=element->identify();
115  if (m_trtid->is_trt(ident)) { //OK this Element is included
116  std::string key = findkey(ident,m_alignString);
117  std::vector<std::string>::const_iterator ix = find(m_alignobjs.begin(),m_alignobjs.end(),key);
118  if (ix==m_alignobjs.end()) {
119  m_alignobjs.push_back(key);
120  ATH_MSG_INFO( "Adding key: " << key );
121  m_alignchans.push_back(ichan++);
122  }
123  }
124  }
125  }
126 
134  bool alignFolderExists = m_detStore->contains<AlignableTransformContainer>(m_alignroot) ;
135  if (m_dynamicDB) alignFolderExists = ( alignFolderExists && m_detStore->contains<CondAttrListCollection>("/TRT/AlignL1/TRT"));
136 
139  bool alignTextFileExists = !m_par_alitextfile.empty();
140 
141  if( alignFolderExists ) {
142 
145 
147  if( alignTextFileExists )
148  ATH_MSG_INFO( "AlignableTransformContainer with name " << m_alignroot
149  << " exists. Will read text file from callback function." );
150 
151  } else if ( alignTextFileExists ) {
152 
154  ATH_CHECK( this->createAlignObjects() );
155 
158 
159  } else {
160  ATH_MSG_ERROR( "AlignableTransformContainer not in IOV service and no textfile specified." );
161  }
162 
163  ATH_MSG_DEBUG ("The TRT/Align keys and channels are:");
164  for (unsigned int i=0;i<m_alignobjs.size();++i)
165  ATH_MSG_DEBUG (" key " << m_alignobjs[i] << " chan " << m_alignchans[i]);
166 
167  return StatusCode::SUCCESS;
168 }
169 //
170 //-----------------------------------------------------------------------------
171 
173 {
174  ATH_MSG_INFO( "TRT_AlignDbSvc finalize method called" );
176  delete *it;
177  }
178  return StatusCode::SUCCESS;
179 }
180 
183 {
184  ATH_MSG_DEBUG( "In IOVCallBack" );
185 
194 
197  for (std::list<std::string>::const_iterator itr=keys.begin(); itr!=keys.end(); ++itr)
198  ATH_MSG_INFO( "IOVCALLBACK for key " << *itr<< " number " << I );
199 
200 
201  if(!m_par_alitextfile.empty()){
203  }else{
204  ATH_MSG_INFO( "Text file " << m_par_alitextfile << " is empty" );
205  }
206 
209  printCondObjects() ;
210 
211  ATH_MSG_DEBUG( "Leaving IOVCallBack" );
212  return StatusCode::SUCCESS;
213 }
214 
217 {
218  ATH_MSG_DEBUG(" in writeAlignTextFile ");
219  ATH_MSG_INFO( " Write AlignableTransforms to text file: "<< file );
220  std::ofstream outfile(file);
221 
222  int ntrans=0;
223  int nobj=0;
224 
226  std::vector<std::string>::const_iterator iobj=m_alignobjs.begin();
227  std::vector<std::string>::const_iterator iobjE=m_alignobjs.end();
228  for (;iobj!=iobjE; ++iobj) {
229  const AlignableTransform* pat=cgetTransPtr(*iobj);
230  std::string key=*iobj;
231 
233  if(isOldKey(key) && m_alignString != "ALold")
234  continue;
235 
237  if (!pat){
238  ATH_MSG_ERROR( "Cannot find AlignableTransform for key "<< key );
239  ATH_MSG_ERROR( "Skipping it. " );
240  outfile << key << std::endl;
241  continue;
242  }
243 
244  // first record is the name
245  ATH_MSG_INFO( " Write folder: " << key );
246  outfile << key << std::endl;
247  ++nobj;
248 
249  // loop over all transforms in the AlignableTransform object
252  for (;cit!=citE;++cit) {
253 
254  int bec(0);
255  int layer(0);
256  int sector(0);
257  int strawLayer(0);
258 
260  ++ntrans;
261 
263  const Identifier& ident=cit->identify();
266  sector=m_trtid->phi_module(ident);
268 
270  const Amg::Transform3D& trans = Amg::CLHEPTransformToEigen(cit->transform());
271 
272  if(msgLvl(MSG::DEBUG)){
273  std::string thisMess = key+" for "+file;
274  printTransform(thisMess,trans);
275  }
276 
277 
279  CLHEP::HepRotation rot=transCLHEP.getRotation();
280  Amg::Vector3D eulerangles;
281  eulerangles[0] = rot.getPhi();
282  eulerangles[1] = rot.getTheta();
283  eulerangles[2] = rot.getPsi();
284 
285  Amg::Vector3D shift=trans.translation();
286  //Matthias: was initially 2,1,2 --> this should be equivalent to complicated method above
287  //Amg::Vector3D eulerangles = trans.rotation().eulerAngles(2,0,2) ;
288 
289  if(key == (m_alignDBprefix+"L2A") || key == (m_alignDBprefix+"L2C") ){
290 
291  ATH_MSG_INFO( " Write member: "
292  << ident << " " << bec << " " << layer << " " << strawLayer << " " << key );
293 
294  outfile << bec << " " << layer << " " << strawLayer << " "
295  << std::setprecision(10) << " "
296  << shift.x() << " " << shift.y() << " " << shift.z() << " "
297  << eulerangles[0] << " " << eulerangles[1] << " " << eulerangles[2]
298  << std::endl;
299 
300  ATH_MSG_DEBUG( "Writing transform to log file " );
301  ATH_MSG_DEBUG( bec << " " << layer << " " << strawLayer << " "
302  << std::setprecision(10) << " "
303  << shift.x() << " " << shift.y() << " " << shift.z() << " "
304  << eulerangles[0] << " " << eulerangles[1] << " " << eulerangles[2]
305  );
306 
307  }else{
308  //Need to validate this for writing out L1 Endcap alignments
309  ATH_MSG_INFO( " Write member: "
310  << ident << " " << bec << " " << layer << " " << sector << " " << key );
311 
312  outfile << bec << " " << layer << " " << sector << " "
313  << std::setprecision(10) << " "
314  << shift.x() << " " << shift.y() << " " << shift.z() << " "
315  << eulerangles[0] << " " << eulerangles[1] << " " << eulerangles[2]
316  << std::endl;
317 
318  ATH_MSG_DEBUG( "Writing transform to log file " );
319  ATH_MSG_DEBUG( bec << " " << layer << " " << sector << " "
320  << std::setprecision(10) << " "
321  << shift.x() << " " << shift.y() << " " << shift.z() << " "
322  << eulerangles[0] << " " << eulerangles[1] << " " << eulerangles[2]
323  );
324  }
325 
326  }
327  }
328 
329  outfile.close();
330 
331  ATH_MSG_INFO( "Written " << nobj << " AlignableTransform objects" << " with " << ntrans
332  << " transforms to text file" );
333 
334  ATH_MSG_DEBUG( " leaving writeAlignTextFile " );
335  return StatusCode::SUCCESS;
336 }
337 
339 {
340  ATH_MSG_DEBUG( " in writeAlignTextFile " );
341 
342  ATH_MSG_INFO( "Writing the straw alignments " );
343  if( m_trtStrawAlignDbSvc -> writeTextFile(file) != StatusCode::SUCCESS )
344  ATH_MSG_ERROR("Cannot write to file "<< file );
345 
346  return StatusCode::SUCCESS;
347 }
348 
351  ATH_MSG_DEBUG( " In readAlignTextFile " );
352  ATH_MSG_INFO( "Read alignment constants from text file: " << file );
353  std::ifstream infile;
354  infile.open(file.c_str());
355 
359  const AlignableTransformContainer* container= getContainer();
360  if(container) {
361  AlignableTransformContainer* nccontainer = const_cast<AlignableTransformContainer*>(container) ;
362 
365  for(;it!=itE;++it)
366  // there is no 'clear' function in alignable transform, so we do it with this hack
367  **it = AlignableTransform( (*it)->tag() ) ;
368  } else {
369  return StatusCode::FAILURE ;
370  }
371 
372  // loop over file
373  int nobj=0;
374  int ntrans=0;
375  std::string atname;
376  AlignableTransform* pat(nullptr) ;
377  char line[512] ;
378 
379  while( infile.getline(line,512) ) {
380  if(line[0] != '#') {
381 
382  std::string linestring(line) ;
383  if( linestring.find('/') != std::string::npos) {
384  // this must be a line with a container name
385  atname = linestring ;
386  ATH_MSG_INFO( "now reading container: " << atname );
387  pat=getTransPtr(atname);
388  if (!pat) {
389  ATH_MSG_ERROR( "Cannot find AlignableTransform object for key " << atname );
390  return StatusCode::FAILURE;
391  } else {
392  nobj++;
393  }
394  } else if(pat!=nullptr) {
395  // this must be a line with constants
396  std::istringstream is(line) ;
397 
398  int bec(0),layer(0),sector(0),strawLayer(0);
399  double dx,dy,dz,phi,theta,psi;
400 
401  if(atname == (m_alignDBprefix+"L2A") || atname == (m_alignDBprefix+"L2C") ){
402  if( is >> bec >> layer >> strawLayer >> dx >> dy >> dz >> phi ) {
403  CLHEP::Hep3Vector translation(dx, dy, dz);
404  CLHEP::HepRotation rotation;
405  if (is >> theta >> psi) {
406  ATH_MSG_DEBUG ("read a line with euler angles!" << phi
407  << " " << theta << " " << psi);
408  rotation.set(phi, theta, psi);
409  }
410  //We have to give a phi sector, so we'll give 0.
412  ATH_MSG_DEBUG( "The identifier is for bec " << bec
413  << " layer " << layer << " strawLayer " << strawLayer );
414  ATH_MSG_DEBUG( "The code is " << m_trtid->show_to_string(ident) );
415  if( pat->findIdent(ident)!=pat->end() ) {
416  ATH_MSG_WARNING ("WARNING: read module from file which was already in AlignableTransform. Will skip it."
417  << " bec,lay,sec,strawlay = " << bec << " " << layer << " " << sector << " " );
418  } else {
419  pat->add(ident,HepGeom::Transform3D(rotation, translation));
420  HepGeom::Transform3D testtrans = HepGeom::Transform3D(rotation, translation);
421  if(msgLvl(MSG::DEBUG)){
422  std::string thisMess = atname+" for "+file;
423  printTransform(thisMess,Amg::CLHEPTransformToEigen(testtrans));
424  }
425 
426 
427  ++ntrans;
428  ATH_MSG_DEBUG( "Set transform: "
429  << " [" << bec << "," << layer << "," << strawLayer
430  << "] key " << atname
431  << " rotation=(" << phi << "," << theta << "," << psi
432  << "), translation=(" << dx << "," << dy << "," << dz << "])"
433  );
434  }
435  } else if(!linestring.empty()) {
436  ATH_MSG_WARNING( "Read invalid line from textfile. Line=\'" << line << "\'" );
437  }
438  }//if endcap
439  else{
440  if( is >> bec >> layer >> sector >> dx >> dy >> dz >> phi ) {
441  CLHEP::Hep3Vector translation(dx,dy,dz) ;
442  CLHEP::HepRotation rotation;
443  if( is >> theta >> psi ) {
444  ATH_MSG_DEBUG( "read a line with euler angles!" << phi << " " << theta << " " << psi );
445  rotation.set(phi,theta,psi) ;
446 
447  } else {
448  ATH_MSG_DEBUG( "read a line with angle in phi!" << phi );
449  rotation = CLHEP::HepRotationZ(phi) ;
450  }
451 
453  if( pat->findIdent(ident)!=pat->end() ) {
454  ATH_MSG_WARNING ("WARNING: read module from file which was already in AlignableTransform. Will skip it."
455  << " bec,lay,sec = " << bec << " " << layer << " " << sector);
456  } else {
457  pat->add(ident,HepGeom::Transform3D(rotation, translation));
458  ++ntrans ;
459  ATH_MSG_DEBUG( "Set transform: "
460  << " [" << bec << "," << layer << "," << sector
461  << "] key " << atname << " rotation=(" << phi << "," << theta << "," << psi
462  << "), translation=(" << dx << "," << dy << "," << dz << "])" );
463  }
464  } else if(!linestring.empty()) {
465  ATH_MSG_WARNING( "Read invalid line from textfile. Line=\'" << line << "\'" );
466  }
467  }//if not the endcap
468 
469 
470  }//if pat!=0
471  }//if line != "#"
472  }//while
473 
474  infile.close() ;
475  ATH_MSG_INFO( "Read " << nobj << " objects from file with " << ntrans << " transforms."
476  << " Now forcing callback in detector manager." );
477 
479  int i(0);
480  std::list<std::string> keys;
481  if((const_cast<InDetDD::TRT_DetectorManager*>(m_trtman))->align(i,keys).isFailure()){
482  ATH_MSG_ERROR("Failed to force the alignment callback!" );
483  }
484 
485  ATH_MSG_DEBUG( " Leaving readAlignTextFile " );
486  return StatusCode::SUCCESS;
487 }
488 
491  ATH_MSG_DEBUG( "In streamOutAlignObjects " );
492 
493  // Get Output Stream tool for writing
494  ATH_CHECK( m_streamer.retrieve() );
495 
496  IAthenaOutputStreamTool* streamer=const_cast<IAthenaOutputStreamTool*>(&(*m_streamer));
497 
498  ATH_CHECK( streamer->connectOutput() );
499 
501  IAthenaOutputStreamTool::TypeKeyPair arraypair("AlignableTransformContainer",m_alignroot);
502  typeKeys.push_back(arraypair);
504 
505  ATH_CHECK( streamer->streamObjects(typeKeys) );
506  ATH_CHECK( streamer->commitOutput() );
507 
508  ATH_MSG_INFO( " Streamed out and committed AlignableTransformContainer" );
509  printCondObjects() ;
510 
511  ATH_MSG_DEBUG( "Leaving streamOutAlignObjects " );
512  return StatusCode::SUCCESS;
513 }
514 
516 StatusCode TRT_AlignDbSvc::registerAlignObjects(const std::string & tag, int run1, int event1, int run2, int event2) const{
517 
518  ATH_MSG_INFO( "registerAlignObjects with IOV " );
519  ATH_MSG_INFO( "Run/evt1 [" << run1 << "," << event1 << "]" );
520  ATH_MSG_INFO( "Run/evt2 [" << run2 << "," << event2 << "]" );
521 
522  // get pointer to registration svc
523  SmartIF<IIOVRegistrationSvc> regsvc(service("IOVRegistrationSvc"));
524  ATH_CHECK( regsvc.isValid() );
525 
526  if (StatusCode::SUCCESS==regsvc->registerIOV("AlignableTransformContainer",m_alignroot,tag,run1,run2,event1,event2)){
527  ATH_MSG_INFO( " Register AlignableTransformContainer object "
528  << m_alignroot );
529  } else {
530  ATH_MSG_ERROR( " Failed to register AlignableTranformContainer "
531  << m_alignroot );
532  return StatusCode::FAILURE;
533  }
534 
535  return StatusCode::SUCCESS;
536 }
537 
540  ATH_MSG_DEBUG( "In getAlignmentTransform" );
541 
542  if(level != 1 && level != 2){
543  ATH_MSG_ERROR( "Call to trans wrong!" );
544  ATH_MSG_ERROR( "Level must be 1 or 2!" );
545  ATH_MSG_ERROR( "Returning NULL" );
546  return Amg::Transform3D();
547  }
548 
550 }
551 
554  ATH_MSG_DEBUG( "In getAlignmentTransformL1" );
555  // return level 1 AlignableTransform for the TRT subdetector bec (+-1,+-2)
556  // or return null transform.
557 
558  std::string key="/TRT/Align/TRT";
560  if (!pat) return Amg::Transform3D();
561 
562  // get Amg::Transform3d via AlignTransMember
564  return ( itr!=pat->end() ? Amg::CLHEPTransformToEigen(itr->transform()) : Amg::Transform3D() );
565 }
566 
569  ATH_MSG_DEBUG( "In getAlignmentTransformL2" );
570  // return level 2 AlignableTransform for the module containing ident
571  // or return null transform.
572 
573  std::string key=findkey(ident,m_alignString);
574  //does a key exist corresponding to this identifier?
575 
577  if (!pat) return Amg::Transform3D();
578 
579  // OK it exists
580  // get "module identifier" from identifier
581  int bec=m_trtid->barrel_ec(ident);
583  int sector=m_trtid->phi_module(ident);
585  int ring = getRingForStrawLayer(strawLayer);
586 
587  Identifier mid;
588  if(key == (m_alignDBprefix+"L2A") || key == (m_alignDBprefix+"L2C") )
589  mid=m_trtid->layer_id(bec,0,layer,ring);
590  else
591  mid=m_trtid->module_id(bec,sector,layer);
592 
593  // get Amg::Transform3d via AlignTransMember
594  AlignableTransform::AlignTransMem_citr itr = pat->findIdent(mid);
595  return ( itr!=pat->end() ? Amg::CLHEPTransformToEigen(itr->transform()) : Amg::Transform3D() );
596 }
597 
600  ATH_MSG_DEBUG( "In getAlignmentTransformPtr" );
601 
602  if(level != 1 && level != 2){
603  ATH_MSG_ERROR( "Call to trans wrong!" );
604  ATH_MSG_ERROR( "Level must be 1 or 2!" );
605  ATH_MSG_ERROR( "Returning NULL" );
606  return nullptr;
607  }
608 
610 }
611 
614  ATH_MSG_DEBUG( "In getAlignmentTransformL1Ptr" );
615  // get level 1 (despite name, will change soon) AlignableTransform for the subdetector containing ident
616  const Amg::Transform3D* rc(nullptr) ;
617  if( m_trtid->is_trt(ident) ) {
618  const AlignableTransform* pat = cgetTransPtr( "/TRT/Align/TRT" ) ;
619  if( pat ) {
620  int bec=m_trtid->barrel_ec(ident);
621  Identifier mid=m_trtid->module_id(bec,0,0);
623  if(iter != pat->end() ) {
624  Amg::Transform3D* amgTransform = new Amg::Transform3D((Amg::CLHEPTransformToEigen(iter->transform())));
625  m_amgTransformCache.push_back(amgTransform);
626  rc = amgTransform;
627  }
628  }
629  }
630 
631  ATH_MSG_DEBUG( "Leaving getAlignmentTransformL1Ptr" );
632  return rc ;
633 }
634 
637  ATH_MSG_DEBUG( "In getAlignmentTransformL2Ptr" );
638  // set level 2 (despite name, will change soon) AlignableTransform for the module containing ident
639  // or add a new one.
640  const Amg::Transform3D* rc(nullptr) ;
641  //does a folder exist corresponding to this identifier?
642  if( m_trtid->is_trt(ident) ) {
643  std::string key=findkey(ident,m_alignString);
645  if(pat) {
646  // make sure the identifier is a "module identifier"
647  int bec=m_trtid->barrel_ec(ident);
649  int sector=m_trtid->phi_module(ident);
651  int ring = getRingForStrawLayer(strawLayer);
652  Identifier mid;
653  if(key == (m_alignDBprefix+"L2A") || key == (m_alignDBprefix+"L2C") ){
654  mid =m_trtid->layer_id(bec,0,layer,ring);
655  }else
656  mid =m_trtid->module_id(bec,sector,layer);
657 
659  if(iter != pat->end() ){
661  Amg::Transform3D* amgTransform = new Amg::Transform3D((Amg::CLHEPTransformToEigen(iter->transform())));
662  m_amgTransformCache.push_back(amgTransform);
663  rc = amgTransform;
664  }
665 
666  else
667  ATH_MSG_WARNING( "Did not find the transform for " << m_trtid->show_to_string(mid) );
668  }
669  }
670 
671  ATH_MSG_DEBUG( "Leaving getAlignmentTransformL2Ptr" );
672  return rc ;
673 }
674 
677  ATH_MSG_DEBUG( "In getAlignmentTransform" );
678 
679  if(level != 1 && level != 2 && level != 3){
680  ATH_MSG_FATAL( "Call to setAlignTransform wrong!" );
681  ATH_MSG_FATAL( "Level must be 1,2 or 3!" );
682  return StatusCode::FAILURE;
683  }
684 
685  switch (level) {
686 
687  case 1:
689  break;
690  case 2:
692  break;
693  case 3:
695  break;
696  }
697 
698  return StatusCode::SUCCESS;
699 }
700 
706  ATH_MSG_DEBUG( "In setAlignTransformL1" );
707  if(msgLvl(MSG::DEBUG)){
708  printTransform("Transform in setAlignTransformL1",trans);
709  }
710 
711  // New additions for new global folder structure
712  // No ATs exist for levels 1 & 2 --> need alternative
713  if (m_dynamicDB){
714  if(!tweakGlobalFolder(ident, trans)) {
715  ATH_MSG_ERROR( "Attempt tweak GlobalDB folder failed" );
716  return StatusCode::FAILURE;
717  }
718  }
719  else {
720 
721  //does a folder exist corresponding to this identifier?
722  AlignableTransform* pat=getTransPtr("/TRT/Align/TRT");
723  if (!pat){
724  ATH_MSG_FATAL( "The AlignableTransform for key " << "/TRT/Align/TRT" << " does not exist " );
725  ATH_MSG_FATAL( "Failing ... " );
726  return StatusCode::FAILURE;
727  }
728 
729  // make sure the identifier is a "subdetector identifier"
730  if( !(m_trtid->is_trt(ident)) ){
731  ATH_MSG_FATAL( "The identifier " << ident << " is not from the TRT " );
732  ATH_MSG_FATAL( "Failing ... " );
733  return StatusCode::FAILURE;
734  }
735 
736  int bec=m_trtid->barrel_ec(ident);
737  Identifier mid=m_trtid->module_id(bec,0,0);
738  // update or add (mid,trans) pair
740  if( !(pat->update(mid,clhepTrans)) ) {
741  pat->add(mid,clhepTrans);
742  pat->sortv() ;
743  }
744  }
745 
746  ATH_MSG_DEBUG( "Leaving setAlignTransformL1" );
747  return StatusCode::SUCCESS;
748 }
749 
752  ATH_MSG_DEBUG( "In setAlignTransformL2" );
757  //does a folder exist corresponding to this identifier?
758  std::string key=findkey(ident,m_alignString);
760  if (!pat) return StatusCode::FAILURE;
761 
762  // make sure the identifier is a "module identifier"
763  if( !(m_trtid->is_trt(ident)) ) return StatusCode::FAILURE;
764  int bec=m_trtid->barrel_ec(ident);
766  int sector=m_trtid->phi_module(ident);
768  int ring = getRingForStrawLayer(strawLayer);
769  Identifier ident2;
770 
771  ATH_MSG_DEBUG( "Setting the L2 Alignment for: "
772  << " Bec= " << bec << " layer= " << layer << " sector= " << sector
773  << " strawLayer= " << strawLayer );
774  ATH_MSG_DEBUG( "The translations are: x= " << trans(0,3) << " y= "<<trans(1,3) << " z= "<<trans(2,3) );
775 
776  if(key == (m_alignDBprefix+"L2A") || key == (m_alignDBprefix+"L2C"))
777  ident2=m_trtid->layer_id(bec,0,layer,ring);
778  else
779  ident2=m_trtid->module_id(bec,sector,layer);
780 
781  // make sure the identifier is a TRT identifier
782  if( !(m_trtid->is_trt(ident2)) ){
783  ATH_MSG_FATAL( "The identifier " << ident2 << " is not from the TRT " );
784  ATH_MSG_FATAL( "Failing ... " );
785  return StatusCode::FAILURE;
786  }
787 
788  // update or add (mid,trans) pair
790  if( !(pat->update(ident2,clhepTrans)) ) {
791  pat->add(ident2,clhepTrans);
792  pat->sortv() ;
793  }
794 
795  ATH_MSG_DEBUG( "Leaving setAlignTransformL2 " );
796  return StatusCode::SUCCESS;
797 }
798 
801  ATH_MSG_DEBUG( "In setAlignTransformL3" );
802 
803  // make sure the identifier is a "module identifier"
804  if( !(m_trtid->is_trt(ident)) ) return StatusCode::FAILURE;
805  int bec=m_trtid->barrel_ec(ident);
806 
807  //Only L3 in the barrel is currently supported
808  if(abs(bec) == 1){
809 
810  // Currently at L3 only displacements in the plane of the straw layer can be stored.
811  // For tracks coming from the interaction point this coorisponds to the sensitive coordinate
812  ATH_MSG_INFO("Storing L3 Barrel constants, Only dx and rotz will be written to DB");
813  float dx = trans.translation().x();
814  float rotz = std::atan2(trans.rotation()(0,1),trans.rotation()(0,0));
815 
816  // Need the length of the wires to translate the rotation to a translation.
817  const InDetDD::TRT_BaseElement* strawElement = m_trtman->getElement( ident );
818  double strawLenthOver2 = 0.5* strawElement->strawLength();
819 
820  // The alignment frames are the same for straws on side A and side C (verrify this!!)
821  // but variables stored in the db are not. We'll calculate the dispacement of each end
822  // in the alignment frame and in a second step, convert to the values in the DB.
823  double delta_dx_atLargerZ = dx + strawLenthOver2 * std::sin(rotz);
824  double delta_dx_atSmallerZ = dx - strawLenthOver2 * std::sin(rotz);
825 
826  // For the definition of dx1 and dx2 see TRT_ConditionsData/StrawDx.h
827  // Now we need to know the real meaning of dx1 and dx2. Alas, we
828  // are in the frame of either of the two barrel sides, but not
829  // both, so we need to know which one.
830  bool sideA = m_trtid->barrel_ec(ident) == 1;
831 
832  // Straw position closest to the electronics
833  double dx1_new = sideA ? delta_dx_atLargerZ : delta_dx_atSmallerZ;
834 
835  // Straw position away from the electronics
836  double dx2_new = sideA ? delta_dx_atSmallerZ : delta_dx_atLargerZ;
837 
838  // Uncertianty on straw positions (Arbitrary for now)
839  double dxErr = 0.001;
840 
841  m_trtStrawAlignDbSvc->setDx(ident, dx1_new, dx2_new, dxErr);
842  }else{
843  // Currently at L3 only displacements in the plane of the straw layer can be stored.
844  // For tracks coming from the interaction point this coorisponds to the sensitive coordinate
845  ATH_MSG_INFO("Storing L3 Endcap constants, Only dy and rotz will be written to DB");
846 
847  // The expected transformation is in the local frame of the Endcap Straws
848  // In the local straw frame:
849  // - the z-axis is along the straw and points toward the beampipe
850  // - the x-axis is along global-z and away from the interaction point
851  // (locX = globZ A-side / locX = -1 *gobZ C-side)
852  // - the y-axis is along global phi_hat direction determined by the other 2.
853  // (clockwise C-side, counter clockwise A-Side)
854  float dy = trans.translation().y();
855  float rotx = std::atan2(trans.rotation()(1,2),trans.rotation()(2,2));
856 
857  // Need the length of the wires to translate the rotation to a translation.
858  const InDetDD::TRT_BaseElement* strawElement = m_trtman->getElement( ident );
859  double strawLenthOver2 = 0.5* strawElement->strawLength();
860 
861  // In the global frame, 'dx1' corresponds to the readout side and 'dx2'
862  // to the side closest the beampipe.
863  double delta_dx_nearBeamPipe = dy + strawLenthOver2 * std::sin(rotx);
864  double delta_dx_nearReadOut = dy - strawLenthOver2 * std::sin(rotx);
865 
866  // Uncertianty on straw positions (Arbitrary for now)
867  double dxErr = 0.001;
868 
869  m_trtStrawAlignDbSvc->setDx(ident, delta_dx_nearReadOut, delta_dx_nearBeamPipe, dxErr);
870  }
871 
872  ATH_MSG_DEBUG( "Leaving setAlignTransformL3 " );
873  return StatusCode::SUCCESS;
874 }
875 
878 
879  ATH_MSG_DEBUG( "In tweakAlignTransform" );
880 
881  if(level != 1 && level != 2 && level != 3){
882  ATH_MSG_FATAL( "Incorrect call to tweakTrans" );
883  ATH_MSG_FATAL( "level must be 1,2 or 3" );
884  return StatusCode::FAILURE;
885  }
886 
887  if(level == 1){
888  if(tweakAlignTransformL1(ident,trans).isFailure()){
889 
890  ATH_MSG_WARNING( "tweak failed...just setting it." );
891 
892  if(setAlignTransformL1(ident,trans).isFailure()){
893  ATH_MSG_FATAL( "Set also failed!" );
894  ATH_MSG_FATAL( "Fail for real." );
895  return StatusCode::FAILURE;
896  }
897  }
898  }
899 
900  else if(level == 2){
901  if(tweakAlignTransformL2(ident,trans).isFailure()){
902 
903  ATH_MSG_WARNING( "tweak failed...just setting it." );
904 
905  if(setAlignTransformL2(ident,trans).isFailure()){
906  ATH_MSG_FATAL( "Set also failed!" );
907  ATH_MSG_FATAL( "Fail for real." );
908  return StatusCode::FAILURE;
909  }
910  }
911  }
912 
913  else if(level == 3){
914  if(tweakAlignTransformL3(ident,trans).isFailure()){
915 
916  ATH_MSG_WARNING( "tweak failed...just setting it." );
917 
918  if(setAlignTransformL3(ident,trans).isFailure()){
919  ATH_MSG_FATAL( "Set also failed!" );
920  ATH_MSG_FATAL( "Fail for real." );
921  return StatusCode::FAILURE;
922  }
923  }
924  }
925 
926  ATH_MSG_DEBUG( "Leaving tweakAlignTransform" );
927  return StatusCode::SUCCESS;
928 }
929 
935  ATH_MSG_DEBUG( "In tweakAlignTransformL1" );
936 
937  // New additions for new global folder structure
938  // No ATs exist for levels 1 & 2 --> need alternative
939  if (m_dynamicDB){
940  if(!tweakGlobalFolder(ident, trans)) {
941  ATH_MSG_ERROR( "Attempt tweak GlobalDB folder failed" );
942  return StatusCode::FAILURE;
943  }
944  }
945  else {
946 
948  AlignableTransform* pat=getTransPtr("/TRT/Align/TRT");
949  if (!pat){
950  ATH_MSG_WARNING( "The AlignableTransform for key " << "/TRT/Align/TRT" << " does not exist " );
951  ATH_MSG_WARNING( "Failing ... " );
952  return StatusCode::FAILURE;
953  }
954 
958  if( !(m_trtid->is_trt(ident)) ){
959  ATH_MSG_WARNING( "The identifier " << ident << " is not from the TRT " );
960  ATH_MSG_WARNING( "Failing ... " );
961  return StatusCode::FAILURE;
962  }
963 
964  int bec=m_trtid->barrel_ec(ident);
965  Identifier mid=m_trtid->module_id(bec,0,0);
966 
968  if( !(pat->tweak(mid,Amg::EigenTransformToCLHEP(trans))) ){
969  ATH_MSG_WARNING( "The Alignable transfor tweek failed for " << mid );
970  ATH_MSG_WARNING( "Failing ... " );
971  return StatusCode::FAILURE;
972  }
973  }
974 
975  ATH_MSG_DEBUG( "Leaving tweakAlignTransformL1" );
976  return StatusCode::SUCCESS;
977 }
978 
981  ATH_MSG_DEBUG( "In tweakAlignTransformL2" );
982  // multiply level 2 AlignableTransform for the module containing ident
983  // by an additional transform.
984 
985  //does a folder exist corresponding to this identifier?
986  std::string key=findkey(ident,m_alignString);
988  if (!pat){
989  ATH_MSG_WARNING( "The transfor for key: " << key << "Does not exist" );
990  ATH_MSG_WARNING( " Failing ... " );
991  return StatusCode::FAILURE;
992  }
993 
994  //OK the key exists
995  // make sure the identifier is a "module identifier"
996  if( !(m_trtid->is_trt(ident)) ) return StatusCode::FAILURE;
997  int bec=m_trtid->barrel_ec(ident);
999  int sector=m_trtid->phi_module(ident);
1001  int ring = getRingForStrawLayer(strawLayer);
1002  Identifier mid;
1003  if(key == (m_alignDBprefix+"L2A") || key == (m_alignDBprefix+"L2C"))
1004  mid = m_trtid->layer_id(bec,0,layer,ring);
1005  else
1006  mid = m_trtid->module_id(bec,sector,layer);
1007 
1008  // multiply the additional transformation
1009  if( !(pat->tweak(mid,Amg::EigenTransformToCLHEP(trans))) ){
1010  ATH_MSG_WARNING( "Leaving tweakAlignTransformL2. TWEAK FAILED!!" );
1011  return StatusCode::FAILURE;
1012  }
1013 
1014  ATH_MSG_DEBUG( "Leaving tweakAlignTransformL2" );
1015  return StatusCode::SUCCESS;
1016 }
1017 
1020  ATH_MSG_DEBUG( "In tweakAlignTransformL3" );
1021 
1022  // make sure the identifier is a "module identifier"
1023  if( !(m_trtid->is_trt(ident)) ) return StatusCode::FAILURE;
1024  int bec=m_trtid->barrel_ec(ident);
1025 
1026  //Only L3 in the barrel is currently supported
1027  if(abs(bec) == 1){
1028 
1029  // Currently at L3 only displacements in the plane of the straw layer can be stored.
1030  // For tracks coming from the interaction point this coorisponds to the sensitive coordinate
1031  ATH_MSG_INFO("Storing L3 constants, Only dx and rotz will be written to DB");
1032  float dx = trans.translation().x();
1033 
1034  ATH_MSG_DEBUG("xx: " << trans.rotation()(0,0));
1035  ATH_MSG_DEBUG("xy: " << trans.rotation()(0,1));
1036  ATH_MSG_DEBUG("xz: " << trans.rotation()(0,2));
1037  ATH_MSG_DEBUG("yx: " << trans.rotation()(1,0));
1038  ATH_MSG_DEBUG("yy: " << trans.rotation()(1,1));
1039  ATH_MSG_DEBUG("yz: " << trans.rotation()(1,2));
1040  ATH_MSG_DEBUG("zx: " << trans.rotation()(2,0));
1041  ATH_MSG_DEBUG("zy: " << trans.rotation()(2,1));
1042  ATH_MSG_DEBUG("zz: " << trans.rotation()(2,2));
1043 
1044  // For the definition of dx1 and dx2 see TRT_ConditionsData/StrawDx.h
1045  // Now we need to know the real meaning of dx1 and dx2. Alas, we
1046  // are in the frame of either of the two barrel sides, but not
1047  // both, so we need to know which one.
1048  bool sideA = m_trtid->barrel_ec(ident) == 1;
1049 
1050  float rotz = std::atan2(trans.rotation()(0,2),trans.rotation()(0,0));
1051 
1052  // Need the length of the wires to translate the rotation to a translation.
1053  const InDetDD::TRT_BaseElement* strawElement = m_trtman->getElement( ident );
1054  double strawLenthOver2 = 0.5* strawElement->strawLength();
1055 
1056  // Old way (buggy)
1057  //double delta_dx_atLargerZ = dx + strawLenthOver2 * std::sin(rotz);
1058  //double delta_dx_atSmallerZ = dx - strawLenthOver2 * std::sin(rotz);
1059 
1060  // New way - The rotation is opposite for side A as compared to side C
1061  double delta_dx_atLargerZ;
1062  double delta_dx_atSmallerZ;
1063  if (sideA){
1064  delta_dx_atLargerZ = dx - strawLenthOver2 * std::sin(rotz);
1065  delta_dx_atSmallerZ = dx + strawLenthOver2 * std::sin(rotz);
1066  }
1067  else{
1068  delta_dx_atLargerZ = dx + strawLenthOver2 * std::sin(rotz);
1069  delta_dx_atSmallerZ = dx - strawLenthOver2 * std::sin(rotz);
1070  }
1071 
1072  // Straw position closest to the electronics
1073  double delta_dx1 = sideA ? delta_dx_atLargerZ : delta_dx_atSmallerZ;
1074 
1075  // Straw position away from the electronics
1076  double delta_dx2 = sideA ? delta_dx_atSmallerZ : delta_dx_atLargerZ;
1077 
1078  // Uncertianty on straw positions
1079  double dxErr = 0.001;
1080 
1081  // now we do some gymnastics: because the strawdisplacement is
1082  // binned, we would rather not just 'add' the current change,
1083  // but rather 'set' the total change. note that this goes
1084  // wrong if there were other straw corrections
1085  // applied. We might have to worry about that at
1086  // some point.
1087  double dx1_current = m_trtStrawAlignDbSvc->getDx1(ident);
1088  double dx2_current = m_trtStrawAlignDbSvc->getDx2(ident) ;
1089  ATH_MSG_DEBUG("Current dx1 is: " << dx1_current);
1090  ATH_MSG_DEBUG("Current dx2 is: " << dx2_current);
1091 
1092  double dx1_new = dx1_current + delta_dx1;
1093  double dx2_new = dx2_current + delta_dx2;
1094 
1095  //ATH_MSG_INFO("New dx1 is: " << dx1_new);
1096  //ATH_MSG_INFO("New dx2 is: " << dx2_new);
1097 
1098  m_trtStrawAlignDbSvc->setDx(ident, dx1_new, dx2_new, dxErr);
1099  }else{
1100 
1101  // Currently at L3 only displacements in the plane of the straw layer can be stored.
1102  // For tracks coming from the interaction point this coorisponds to the sensitive coordinate
1103  ATH_MSG_INFO("Storing L3 Endcap constants, Only dy and rotz will be written to DB");
1104 
1105  // The expected transformation is in the local frame of the Endcap Straws
1106  // In the local straw frame:
1107  // - the z-axis is along the straw and points toward the beampipe
1108  // - the x-axis is along global-z and away from the interaction point
1109  // (locX = globZ A-side / locX = -1 *gobZ C-side)
1110  // - the y-axis is along global phi_hat direction determined by the other 2.
1111  // (clockwise C-side, counter clockwise A-Side)
1112  float dy = trans.translation().y();
1113  float rotx = std::atan2(trans.rotation()(1,2),trans.rotation()(2,2));
1114 
1115  // Need the length of the wires to translate the rotation to a translation.
1116  const InDetDD::TRT_BaseElement* strawElement = m_trtman->getElement( ident );
1117  double strawLenthOver2 = 0.5* strawElement->strawLength();
1118 
1119  // In the global frame, 'dx1' corresponds to the readout side and 'dx2'
1120  // to the side closest the beampipe.
1121  double delta_dx_nearBeamPipe = dy + strawLenthOver2 * std::sin(rotx);
1122  double delta_dx_nearReadOut = dy - strawLenthOver2 * std::sin(rotx);
1123 
1124  // Uncertianty on straw positions
1125  double dxErr = 0.001;
1126 
1127  // now we do some gymnastics: because the strawdisplacement is
1128  // binned, we would rather not just 'add' the current change,
1129  // but rather 'set' the total change. note that this goes
1130  // wrong if there were other straw corrections
1131  // applied. We might have to worry about that at
1132  // some point.
1133  double dx1_current = m_trtStrawAlignDbSvc->getDx1(ident);
1134  double dx2_current = m_trtStrawAlignDbSvc->getDx2(ident) ;
1135  ATH_MSG_DEBUG("Current dx1 is: " << dx1_current);
1136  ATH_MSG_DEBUG("Current dx2 is: " << dx2_current);
1137 
1138  double dx1_new = dx1_current + delta_dx_nearReadOut;
1139  double dx2_new = dx2_current + delta_dx_nearBeamPipe;
1140 
1141  m_trtStrawAlignDbSvc->setDx(ident, dx1_new, dx2_new, dxErr);
1142  }
1143 
1144  ATH_MSG_DEBUG( "Leaving tweakAlignTransformL3 " );
1145  return StatusCode::SUCCESS;
1146 }
1147 
1149 std::string TRT_AlignDbSvc::findkey(const Identifier& ident, const std::string& type) const {
1175  std::ostringstream result;
1176  if (!m_trtid->is_trt(ident)) return result.str();
1177 
1178  if(type=="AL" || type=="ALold") {
1179  // result << "/TRT/Align/";
1181  } else if(type=="DF") {
1182  result << "/TRT/Calib/DF";
1183  } else return result.str();
1184 
1185  int bec=m_trtid->barrel_ec(ident);
1186 
1187  if(type!="AL" && type!="ALold") result << "_";
1188 
1189  if(type=="AL"){
1190  if(bec==2) {
1191  result << "L2A";
1192  } else if(bec==-2) {
1193  result << "L2C";
1194  } else {
1195  result << "B";
1197  result << layer;
1198  }
1199  }else if(type=="ALold"){
1200  if(bec==2) {
1201  result << "A";
1202  } else if(bec==-2) {
1203  result << "C";
1204  } else {
1205  result << "B";
1206  }
1208  result << layer;
1209  }
1210 
1216  return result.str();
1217 }
1218 
1220 std::string TRT_AlignDbSvc::prefixtag(const std::string& key) {
1234  std::ostringstream result;
1235  std::string detector=key.substr(1,3);
1236 
1237  std::string type,quantity;
1238  int ind,ind1;
1239  if(detector=="TRT") {
1240  type=key.substr(5,5);
1241  ind=11;
1242  ind1=11;
1243  quantity=key.substr(ind,2);
1244  } else if(detector=="Indet") {
1245  type=key.substr(7,5);
1246  ind=17;
1247  ind1=13;
1248  quantity="";
1249  if(type=="Align" && key.substr(ind1,2)!="ID") {
1250  if(key.substr(ind1+3,1)=="_") quantity="DF";
1251  }
1252  } else {
1253  return "";
1254  }
1255  if(type=="Calib") {
1256 
1257  if(quantity=="DF") {
1258  result << "TrtDf";
1259  } else if (quantity=="RT") {
1260  result << "TrtRt";
1261  } else if (quantity=="T0") {
1262  result << "TrtT0";
1263  } else {
1264  return "TrtDe_";
1265  }
1266  std::string module=key.substr(ind+3,2);
1267  result << module;
1268  } else if(type=="Align") {
1269  std::string module=key.substr(ind1,2);
1270  if(module=="ID" || module=="TR") {
1271  return "TrtAl_";
1272  } else {
1273  result << "TrtAl";
1274  }
1275  module=key.substr(ind+3,2);
1276  result << module;
1277  } else {
1278  return "";
1279  }
1280  result << "_";
1281  return result.str();
1282 }
1283 
1286 
1291  ATH_MSG_DEBUG( "createAlignObjects method called" );
1292 
1295  ATH_MSG_WARNING( "createAlignObjects: AlignableTransformContainer with name " << m_alignroot
1296  << " already exists." );
1297  return StatusCode::FAILURE;
1298  }
1299 
1301  auto patc = std::make_unique<AlignableTransformContainer>();
1302 
1303  for (unsigned int i=0;i<m_alignobjs.size();++i) {
1304  patc->push_back(std::make_unique<AlignableTransform>(m_alignobjs[i]));
1305  patc->add(m_alignchans[i]);
1306  ATH_MSG_INFO( " added empty AlignableTransform for key " << m_alignobjs[i] );
1307  }
1308 
1310  ATH_CHECK( m_detStore->record(std::move(patc),m_alignroot) );
1311 
1312  ATH_MSG_DEBUG( "Leaving createAlignObjects" );
1313  return StatusCode::SUCCESS;
1314 }
1315 
1319 
1322  ATH_MSG_DEBUG( "createAlignObjectsWhichDoNotAlreadyExist method called" );
1323 
1326 
1329 
1331  AlignableTransformContainer* patc_NonConst = const_cast<AlignableTransformContainer*>(patc);
1332 
1333  for (unsigned int i=0;i<m_alignobjs.size();++i) {
1334 
1336  if(m_alignString != "Alold" && !isOldKey(m_alignobjs[i] )){
1337 
1339  if(!cgetTransPtr(m_alignobjs[i])){
1340 
1342  patc_NonConst->push_back(pat);
1343  patc_NonConst->add(m_alignchans[i]);
1344  ATH_MSG_INFO( " added empty AlignableTransform for key " << m_alignobjs[i] );
1345 
1346  }
1347  }
1348  }
1349 
1350  ATH_MSG_DEBUG( "Leaving createAlignObjectsWhichDoNotAlreadyExist" );
1351  return StatusCode::SUCCESS;
1352 }
1353 
1356  ATH_MSG_DEBUG( " In printCondObjects " );
1357  ATH_MSG_INFO( " TRT Conditions DB contains " << m_alignobjs.size() <<" AlignableTransforms: " );
1358 
1359  const AlignableTransform *pat;
1360  std::vector<std::string>::const_iterator iobj=m_alignobjs.begin();
1361  std::vector<std::string>::const_iterator iobjE=m_alignobjs.end();
1362  for (;iobj!=iobjE;++iobj) {
1363  ATH_MSG_INFO( " " << *iobj );
1364  pat=cgetTransPtr(*iobj);
1365  if (pat) {
1366  pat->print2();
1367  } else {
1368  ATH_MSG_ERROR( " Could not find key: " << *iobj );
1369  }
1370  }
1371 
1372  ATH_MSG_DEBUG( " Leaving printCondObjects" );
1373  return;
1374 }
1375 
1378  ATH_MSG_DEBUG( "In (and leaving) getTransPtr" );
1379  return const_cast<AlignableTransform*>(cgetTransPtr(key)) ;
1380 }
1381 
1383 const AlignableTransform* TRT_AlignDbSvc::cgetTransPtr(const std::string& key) const {
1384  ATH_MSG_DEBUG( "In cgetTransPtr" );
1385  ATH_MSG_DEBUG( "Getting the poiter for key " << key );
1386 
1387  // Retrieve AlignableTransform pointer for a given key - const version
1388  const AlignableTransform* pat=nullptr;
1390  // the retrieve is unnecessary. in fact, if patc==0, retrieve should
1391  // fail as well.
1392 
1393  if( patc || StatusCode::SUCCESS==m_detStore->retrieve(patc,m_alignroot)) {
1394  for(DataVector<AlignableTransform>::const_iterator dva=patc->begin();dva!=patc->end();++dva) {
1395  if( (*dva)->tag()==key ) {
1396  pat = *dva;
1397  break;
1398  }
1399  }
1400  }
1401 
1402  if(!pat){
1403  ATH_MSG_WARNING( "AlignableTransform poiter is NULL!!!!!" );
1404  ATH_MSG_WARNING( "Failed to get the AlignableTransform for key " << key );
1405  }
1406 
1407  ATH_MSG_DEBUG( "leaving cgetTransPtr " );
1408  return pat;
1409 }
1410 
1414  return strawlayer / 4 * 4;
1415 }
1416 
1417 
1420 bool TRT_AlignDbSvc::isOldKey(const std::string& input) const{
1421 
1422  for(unsigned int i=0; i<14; ++i){
1423  std::string testA = "A"+intToString(i);
1424  ATH_MSG_VERBOSE( " The testA is " << testA << " "
1425  << bool(input.find(testA)!=std::string::npos) );
1426  if(input.find(testA)!=std::string::npos){
1427  return true;
1428  }
1429 
1430  std::string testC = "C"+intToString(i);
1431  ATH_MSG_VERBOSE( " The testC is " << testC << " "
1432  << bool(input.find(testC)!=std::string::npos) );
1433  if(input.find(testC)!=std::string::npos){
1434  return true;
1435  }
1436 
1437  }
1438 
1439  return false;
1440 }
1441 
1444  std::ostringstream stm;
1445  stm << input;
1446  return stm.str();
1447 }
1448 
1450 void TRT_AlignDbSvc::printTransform(const std::string& thisName, const Amg::Transform3D& transform) {
1451  std::cout << thisName << " " << transform(0,3) << " " << transform(1,3) << " " << transform(2,3) << std::endl;
1452  std::cout << thisName << " " << transform(0,0) << " " << transform(0,1) << " " << transform(0,2) << std::endl;
1453  std::cout << thisName << " " << transform(1,0) << " " << transform(1,1) << " " << transform(1,2) << std::endl;
1454  std::cout << thisName << " " << transform(2,1) << " " << transform(2,1) << " " << transform(2,2) << std::endl;
1455  return;
1456 }
1457 
1458 // write global DB to file
1460  const {
1461 
1462  if (m_dynamicDB){
1463  ATH_MSG_DEBUG( "writeFile: Write GlobalFolder DB in text file: " << file );
1464  std::ofstream outfile(file);
1465  std::vector<std::string> folder_list = {"/TRT/AlignL1/TRT"};
1466 
1467  for (std::vector<std::string>::iterator it = folder_list.begin(); it != folder_list.end(); ++it){
1468 
1469  outfile << *it << std::endl;
1470  const CondAttrListCollection* atrlistcol=nullptr;
1471  if (StatusCode::SUCCESS==m_detStore->retrieve(atrlistcol,*it)) {
1472  // loop over objects in collection
1473  for (CondAttrListCollection::const_iterator citr=atrlistcol->begin(); citr!=atrlistcol->end();++citr) {
1474 
1475  const coral::AttributeList& atrlist=citr->second;
1476  outfile << atrlist["bec"].data<int>()
1477  << " " << atrlist["layer"].data<int>()
1478  << " " << atrlist["sector"].data<int>()
1479  << " " << atrlist["Tx"].data<float>()
1480  << " " << atrlist["Ty"].data<float>()
1481  << " " << atrlist["Tz"].data<float>()
1482  << " " << atrlist["phi"].data<float>()
1483  << " " << atrlist["theta"].data<float>()
1484  << " " << atrlist["psi"].data<float>() << std::endl;
1485  }
1486  }
1487  else {
1488  if (msgLvl(MSG::INFO)){
1489  ATH_MSG_INFO( "Cannot find " << *it << " Container - cannot write DB in text file " );
1490  return StatusCode::FAILURE;
1491  }
1492  }
1493  }
1494 
1495  return StatusCode::SUCCESS;
1496  }
1497  else {
1498  ATH_MSG_DEBUG( "writeFile: No dynamic Run2 DB structure is present --> skipping writing file " << file );
1499  return StatusCode::SUCCESS;
1500  }
1501 }
1502 
1503 
1504 
1505 
1506 
1507 
1509 
1510  // find transform key, then set appropriate transform
1511  const CondAttrListCollection* atrlistcol1=nullptr;
1512  CondAttrListCollection* atrlistcol2=nullptr;
1513  bool result = false;
1514  std::string key="/TRT/AlignL1/TRT";
1515  ATH_MSG_DEBUG( " Identifier is valid: "<< ident.is_valid() );
1516  int bec=m_trtid->barrel_ec(ident);
1517  const unsigned int DBident=1000+bec*100;
1518  // so far not a very fancy DB identifier, but seems elaborate enough for this simple structure
1519 
1520  if (StatusCode::SUCCESS==m_detStore->retrieve(atrlistcol1,key)) {
1521  // loop over objects in collection
1522  atrlistcol2 = const_cast<CondAttrListCollection*>(atrlistcol1);
1523  if (atrlistcol1!=nullptr){
1524  for (CondAttrListCollection::const_iterator citr=atrlistcol2->begin(); citr!=atrlistcol2->end();++citr) {
1525 
1526  const coral::AttributeList& atrlist=citr->second;
1527  coral::AttributeList& atrlist2 = const_cast<coral::AttributeList&>(atrlist);
1528 
1529  if(citr->first!=DBident){
1530  ATH_MSG_DEBUG( "tweakGlobalFolder fails due to identifier mismatch" );
1531  continue;
1532  }
1533  else {
1534  ATH_MSG_DEBUG( "Tweak Old global DB -- channel: " << citr->first
1535  << " ,bec: " << atrlist2["bec"].data<int>()
1536  << " ,layer: " << atrlist2["layer"].data<int>()
1537  << " ,sector: " << atrlist2["sector"].data<int>()
1538  << " ,Tx: " << atrlist2["Tx"].data<float>()
1539  << " ,Ty: " << atrlist2["Ty"].data<float>()
1540  << " ,Tz: " << atrlist2["Tz"].data<float>()
1541  << " ,phi: " << atrlist2["phi"].data<float>()
1542  << " ,theta: " << atrlist2["theta"].data<float>()
1543  << " ,psi: " << atrlist2["psi"].data<float>() );
1544 
1545 
1546  // Follow same definitions as in TRT_AlignDbSvc.cxx
1547  CLHEP::Hep3Vector oldtranslation(atrlist2["Tx"].data<float>(),atrlist2["Ty"].data<float>(),atrlist2["Tz"].data<float>());
1548  CLHEP::HepRotation oldrotation;
1549  oldrotation.set(atrlist["phi"].data<float>(),atrlist["theta"].data<float>(),atrlist["psi"].data<float>());
1550  HepGeom::Transform3D oldtransform(oldrotation, oldtranslation);
1551 
1552  // get the new transform
1553  HepGeom::Transform3D newtrans = Amg::EigenTransformToCLHEP(trans)*oldtransform;
1554  Amg::Transform3D newtransAMG = trans*Amg::CLHEPTransformToEigen(oldtransform);
1555 
1556  // Extract the values we need to write to DB
1557  Amg::Vector3D shift=newtransAMG.translation();
1558  CLHEP::HepRotation rot=newtrans.getRotation();
1559  Amg::Vector3D eulerangles;
1560  eulerangles[0] = rot.getPhi();
1561  eulerangles[1] = rot.getTheta();
1562  eulerangles[2] = rot.getPsi();
1563 
1564  atrlist2["Tx"].data<float>() = shift.x();
1565  atrlist2["Ty"].data<float>() = shift.y();
1566  atrlist2["Tz"].data<float>() = shift.z();
1567  atrlist2["phi"].data<float>() = eulerangles[0] ;
1568  atrlist2["theta"].data<float>() = eulerangles[1] ;
1569  atrlist2["psi"].data<float>() = eulerangles[2] ;
1570 
1571  result = true;
1572  ATH_MSG_DEBUG( "Tweak New global DB -- channel: " << citr->first
1573  << " ,bec: " << atrlist2["bec"].data<int>()
1574  << " ,layer: " << atrlist2["layer"].data<int>()
1575  << " ,sector: " << atrlist2["sector"].data<int>()
1576  << " ,Tx: " << atrlist2["Tx"].data<float>()
1577  << " ,Ty: " << atrlist2["Ty"].data<float>()
1578  << " ,Tz: " << atrlist2["Tz"].data<float>()
1579  << " ,phi: " << atrlist2["phi"].data<float>()
1580  << " ,theta: " << atrlist2["theta"].data<float>()
1581  << " ,psi: " << atrlist2["psi"].data<float>() );
1582 
1583  }
1584  }
1585  }
1586  else {
1587  ATH_MSG_ERROR("tweakGlobalFolder: cast fails for DBident " << DBident );
1588  return StatusCode::FAILURE;
1589  }
1590  }
1591  else {
1592  ATH_MSG_ERROR("tweakGlobalFolder: cannot retrieve CondAttrListCollection for key " << key );
1593  return StatusCode::FAILURE;
1594  }
1595 
1596  if (result) return StatusCode::SUCCESS;
1597  else return StatusCode::FAILURE;
1598 }
1599 
1600 
1602 {
1603  if (m_aligncontainerhandle.isValid())
1604  return m_aligncontainerhandle.cptr();
1605  const AlignableTransformContainer* ptr = nullptr;
1606  if (m_detStore->retrieve (ptr, m_alignroot).isFailure()) {
1607  ATH_MSG_ERROR ("Cannot retrieve " << m_alignroot << " from detStore ");
1608  }
1609  return ptr;
1610 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TRT_AlignDbSvc::m_forceUserDBConfig
bool m_forceUserDBConfig
Definition: TRT_AlignDbSvc.h:174
TRT_AlignDbSvc::setAlignTransformL2
StatusCode setAlignTransformL2(Identifier ident, Amg::Transform3D trans)
set Level 2 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:751
FloatArrayStore.h
CondAttrListCollection::end
const_iterator end() const
Definition: CondAttrListCollection.h:315
TRT_ID::layer_id
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition: TRT_ID.h:494
createLinkingScheme.iter
iter
Definition: createLinkingScheme.py:62
TRT_AlignDbSvc::m_amgTransformCache
std::vector< Amg::Transform3D * > m_amgTransformCache
Definition: TRT_AlignDbSvc.h:169
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
InDetDD::TRT_BaseElement::strawLength
virtual const double & strawLength() const =0
Active straw length.
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
IAthenaOutputStreamTool::TypeKeyPairs
std::vector< TypeKeyPair > TypeKeyPairs
Definition: IAthenaOutputStreamTool.h:100
get_generator_info.result
result
Definition: get_generator_info.py:21
run.infile
string infile
Definition: run.py:13
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
TRT_AlignDbSvc::tweakAlignTransformL2
StatusCode tweakAlignTransformL2(Identifier ident, const Amg::Transform3D &trans)
tweak Level 2 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:980
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TRT_DetectorManager.h
TRT_DetElementCollection.h
InDetDD::timedependent_run2
@ timedependent_run2
Definition: InDetDD_Defs.h:19
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
TRT_AlignDbSvc::m_alignchans
std::vector< int > m_alignchans
channels
Definition: TRT_AlignDbSvc.h:166
TRT_AlignDbSvc::getTransPtr
AlignableTransform * getTransPtr(const std::string &key) const
get AlignableTransform pointer for an object key
Definition: TRT_AlignDbSvc.cxx:1377
TRT_AlignDbSvc::findkey
std::string findkey(const Identifier &ident, const std::string &type) const
Return the object key for a given identifier and data type.
Definition: TRT_AlignDbSvc.cxx:1149
TRTCalib_cfilter.detector
detector
Definition: TRTCalib_cfilter.py:241
TRT_AlignDbSvc::tweakAlignTransform
StatusCode tweakAlignTransform(Identifier ident, Amg::Transform3D trans, unsigned int level)
tweak AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:877
CondMultChanCollection
A CondMultChanCollection is a template class which can hold a collection of T* objects which are inte...
Definition: CondMultChanCollection.h:52
AlignableTransform::AlignTransMem_citr
std::vector< AlignTransMember >::const_iterator AlignTransMem_citr
Definition: AlignableTransform.h:46
TRT_AlignDbSvc::getRingForStrawLayer
static int getRingForStrawLayer(int strawlayer)
Returns the ring for a given strawLayer.
Definition: TRT_AlignDbSvc.cxx:1413
defineDB.ichan
ichan
Definition: JetTagCalibration/share/defineDB.py:28
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
TRT::Hit::strawLayer
@ strawLayer
Definition: HitInfo.h:81
TRT_AlignDbSvc::writeGlobalFolderFile
StatusCode writeGlobalFolderFile(const std::string &file) const
Definition: TRT_AlignDbSvc.cxx:1459
IAthenaOutputStreamTool
This is a tool that allows streaming out of DataObjects. This has been factorized out from AthenaOutp...
Definition: IAthenaOutputStreamTool.h:69
TRT_AlignDbSvc::m_trtman
const InDetDD::TRT_DetectorManager * m_trtman
detector manager
Definition: TRT_AlignDbSvc.h:161
skel.it
it
Definition: skel.GENtoEVGEN.py:407
TRT_AlignDbSvc::m_par_alitextfile
std::string m_par_alitextfile
input text file
Definition: TRT_AlignDbSvc.h:164
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
TRT_AlignDbSvc::getAlignmentTransformL1Ptr
const Amg::Transform3D * getAlignmentTransformL1Ptr(Identifier const &ident) const
get Level L1 Transform for an identifier
Definition: TRT_AlignDbSvc.cxx:613
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition: CondAttrListCollection.h:309
IIOVRegistrationSvc.h
This is an interface to a tool used to register conditions objects in the Interval of Validity (IOV) ...
InDetDD::static_run1
@ static_run1
Definition: InDetDD_Defs.h:19
IOVSVC_CALLBACK_ARGS_P
#define IOVSVC_CALLBACK_ARGS_P(I, K)
short hand for IOVSvc call back argument list, to be used when access to formal arguments is needed,...
Definition: IOVSvcDefs.h:42
AtlasDetectorID::is_trt
bool is_trt(Identifier id) const
Definition: AtlasDetectorID.h:789
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
TRT_AlignDbSvc::m_alignobjs
std::vector< std::string > m_alignobjs
folder names
Definition: TRT_AlignDbSvc.h:165
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
TRT_AlignDbSvc::cgetTransPtr
const AlignableTransform * cgetTransPtr(const std::string &key) const
get const AlignableTransform pointer for an object key
Definition: TRT_AlignDbSvc.cxx:1383
dq_defect_bulk_create_defects.line
line
Definition: dq_defect_bulk_create_defects.py:27
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
TRT_AlignDbSvc::setAlignTransform
StatusCode setAlignTransform(Identifier ident, Amg::Transform3D trans, unsigned int level)
set AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:676
TruthTest.itE
itE
Definition: TruthTest.py:25
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
IAthenaOutputStreamTool.h
Interface to an output stream tool.
TRT_AlignDbSvc::TRT_AlignDbSvc
TRT_AlignDbSvc(const std::string &name, ISvcLocator *pSvcLocator)
constructor
Definition: TRT_AlignDbSvc.cxx:37
python.PyAthena.module
module
Definition: PyAthena.py:131
GeoPrimitives.h
TRT_AlignDbSvc::IOVCallBack
StatusCode IOVCallBack(IOVSVC_CALLBACK_ARGS)
Call back function for alignment folders.
Definition: TRT_AlignDbSvc.cxx:182
TRT_AlignDbSvc::createAlignObjectsWhichDoNotAlreadyExist
StatusCode createAlignObjectsWhichDoNotAlreadyExist()
Create an empty set of AlignableTransforms for the transforms which are not created by XXXXXXX from t...
Definition: TRT_AlignDbSvc.cxx:1318
TRT_AlignDbSvc::getAlignmentTransformPtr
const Amg::Transform3D * getAlignmentTransformPtr(const Identifier &ident, unsigned int level) const
get Level L2 Transform for an identifier
Definition: TRT_AlignDbSvc.cxx:599
InDetDD_Defs.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TRT_AlignDbSvc::m_streamer
ToolHandle< IAthenaOutputStreamTool > m_streamer
OutputStreamTool.
Definition: TRT_AlignDbSvc.h:168
TRT_AlignDbSvc::readAlignTextFile
StatusCode readAlignTextFile(const std::string &file)
read AlignableTransforms from text file into TDS
Definition: TRT_AlignDbSvc.cxx:350
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
lumiFormat.i
int i
Definition: lumiFormat.py:85
TRT_AlignDbSvc::~TRT_AlignDbSvc
virtual ~TRT_AlignDbSvc()
destructor
Definition: TRT_AlignDbSvc.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
maskDeadModules.run1
run1
Definition: maskDeadModules.py:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::rotation
rotation
Definition: TrackSurface_v1.cxx:15
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
IAthenaOutputStreamTool::connectOutput
virtual StatusCode connectOutput(const std::string &outputName="")=0
Connect to the output stream Must connectOutput BEFORE streaming Only specify "outputName" if one wan...
file
TFile * file
Definition: tile_monitor.h:29
TRT_AlignDbSvc::getContainer
const AlignableTransformContainer * getContainer() const
Return the container.
Definition: TRT_AlignDbSvc.cxx:1601
IAthenaOutputStreamTool::TypeKeyPair
std::pair< std::string, std::string > TypeKeyPair
Stream out objects.
Definition: IAthenaOutputStreamTool.h:99
TRT_AlignDbSvc::createAlignObjects
StatusCode createAlignObjects() const
Create an empty set of AlignableTransforms for the GeoModel setup.
Definition: TRT_AlignDbSvc.cxx:1285
TRT_AlignDbSvc::m_alignString
std::string m_alignString
alignment string searched for
Definition: TRT_AlignDbSvc.h:163
TRT_AlignDbSvc::getAlignmentTransformL1
const Amg::Transform3D getAlignmentTransformL1(Identifier const &ident) const
get Level 1 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:553
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TRT_AlignDbSvc::setAlignTransformL3
StatusCode setAlignTransformL3(Identifier ident, Amg::Transform3D trans)
set Level 3 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:800
InDetDD::TRT_BaseElement::identify
virtual Identifier identify() const override final
identifier of this detector element:
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Definition: TRT_AlignDbSvc.cxx:35
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:860
TRT_ID::straw_layer
int straw_layer(const Identifier &id) const
Definition: TRT_ID.h:887
TRT_AlignDbSvc::m_dynamicDB
bool m_dynamicDB
Definition: TRT_AlignDbSvc.h:173
TRT_AlignDbSvc::streamOutAlignObjects
StatusCode streamOutAlignObjects() const
write the alignment objects to output
Definition: TRT_AlignDbSvc.cxx:490
TRT_AlignDbSvc::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition: TRT_AlignDbSvc.h:158
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:878
TRT_AlignDbSvc::setAlignTransformL1
StatusCode setAlignTransformL1(Identifier ident, const Amg::Transform3D &trans)
set Level 1 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:702
AlignableTransform
Definition: AlignableTransform.h:24
InDetDD::TRT_DetectorManager::getDetectorElementBegin
TRT_DetElementCollection::const_iterator getDetectorElementBegin() const
Definition: TRT_DetectorManager.cxx:172
RPDUtils::sideA
unsigned constexpr int sideA
Definition: RPDUtils.h:16
InDetDD::TRT_DetectorManager::getDetectorElementEnd
TRT_DetElementCollection::const_iterator getDetectorElementEnd() const
Definition: TRT_DetectorManager.cxx:177
CLHEPtoEigenConverter.h
ReadCellNoiseFromCoolCompare.run2
run2
Definition: ReadCellNoiseFromCoolCompare.py:53
TRT_AlignDbSvc.h
a Service to manage TRT alignment conditions
CondMultChanCollection::add
void add(ChanNum chanNum)
Adding in channel numbers.
Definition: CondMultChanCollection.h:199
dso-stats.pat
pat
Definition: dso-stats.py:37
TRT_BaseElement.h
EventPrimitives.h
TRT_AlignDbSvc::printCondObjects
void printCondObjects() const
Output the conditions objects currently in memory.
Definition: TRT_AlignDbSvc.cxx:1355
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TRT_AlignDbSvc::writeStrawAlignTextFile
StatusCode writeStrawAlignTextFile(const std::string &file) const
Definition: TRT_AlignDbSvc.cxx:338
InDetDD::TRT_DetectorManager::getElement
const TRT_BaseElement * getElement(Identifier id) const
Access Elements Generically---------------------------------------------—.
Definition: TRT_DetectorManager.cxx:145
TRT_AlignDbSvc::m_alignroot
std::string m_alignroot
root alignment folder
Definition: TRT_AlignDbSvc.h:162
TRT_AlignDbSvc::initialize
virtual StatusCode initialize()
tool initialize
Definition: TRT_AlignDbSvc.cxx:68
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TRT::Hit::ident
@ ident
Definition: HitInfo.h:77
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:869
IAthenaOutputStreamTool::commitOutput
virtual StatusCode commitOutput(bool doCommit=false)=0
Commit the output stream after having streamed out objects Must commitOutput AFTER streaming.
TRT_AlignDbSvc::finalize
virtual StatusCode finalize()
tool finalize
Definition: TRT_AlignDbSvc.cxx:172
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
InDetDD::TRT_DetectorManager
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Definition: TRT_DetectorManager.h:63
TRT_AlignDbSvc::m_alignDBprefix
std::string m_alignDBprefix
Definition: TRT_AlignDbSvc.h:171
TRT_AlignDbSvc::tweakAlignTransformL3
StatusCode tweakAlignTransformL3(Identifier ident, Amg::Transform3D trans)
tweak Level 3 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:1019
TRT_AlignDbSvc::getAlignmentTransformL2
const Amg::Transform3D getAlignmentTransformL2(Identifier const &ident) const
get Level 2 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:568
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:360
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
Amg::CLHEPTransformToEigen
Amg::Transform3D CLHEPTransformToEigen(const HepGeom::Transform3D &CLHEPtransf)
Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.
Definition: CLHEPtoEigenConverter.h:38
DEBUG
#define DEBUG
Definition: page_access.h:11
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
CLHEPtoEigenEulerAnglesConverters.h
Amg::EigenTransformToCLHEP
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
Definition: CLHEPtoEigenConverter.h:120
TRT_AlignDbSvc::tweakGlobalFolder
StatusCode tweakGlobalFolder(Identifier ident, const Amg::Transform3D &trans)
tweak L1 DB for global folders for an identifier
Definition: TRT_AlignDbSvc.cxx:1508
InDetDD::InDetDetectorManager::m_alignfoldertype
AlignFolderType m_alignfoldertype
Definition: InDetDetectorManager.h:96
TRT_AlignDbSvc::getAlignmentTransformL2Ptr
const Amg::Transform3D * getAlignmentTransformL2Ptr(Identifier const &ident) const
get Level L2 Transform for an identifier
Definition: TRT_AlignDbSvc.cxx:636
TRT_AlignDbSvc::m_trtStrawAlignDbSvc
ServiceHandle< ITRT_StrawAlignDbSvc > m_trtStrawAlignDbSvc
Definition: TRT_AlignDbSvc.h:159
IOVSvcDefs.h
defines and typedefs for IOVSvc
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
TRT_AlignDbSvc::tweakAlignTransformL1
StatusCode tweakAlignTransformL1(Identifier ident, const Amg::Transform3D &trans)
tweak Level 1 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:931
TRT_AlignDbSvc::intToString
static std::string intToString(int input)
Convert from an int to a string.
Definition: TRT_AlignDbSvc.cxx:1443
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:23
I
#define I(x, y, z)
Definition: MD5.cxx:116
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
TRT_AlignDbSvc::m_trtid
const TRT_ID * m_trtid
trt id helper
Definition: TRT_AlignDbSvc.h:160
TRT_AlignDbSvc::printTransform
static void printTransform(const std::string &thisName, const Amg::Transform3D &transform)
Output the transform to the cout, for debugging.
Definition: TRT_AlignDbSvc.cxx:1450
TRT_AlignDbSvc::getAlignmentTransform
const Amg::Transform3D getAlignmentTransform(const Identifier &ident, unsigned int level) const
get AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:539
TRT_AlignDbSvc::isOldKey
bool isOldKey(const std::string &input) const
Returns the true if the input key is from the old endcap scheme.
Definition: TRT_AlignDbSvc.cxx:1420
TRT_AlignDbSvc::m_aligncontainerhandle
const DataHandle< AlignableTransformContainer > m_aligncontainerhandle
Definition: TRT_AlignDbSvc.h:167
IAthenaOutputStreamTool::streamObjects
virtual StatusCode streamObjects(const TypeKeyPairs &typeKeys, const std::string &outputName="")=0
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
TRT_AlignDbSvc::registerAlignObjects
StatusCode registerAlignObjects(const std::string &tag, int run1, int event1, int run2, int event2) const
register alignment objects with the IoV service
Definition: TRT_AlignDbSvc.cxx:516
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
InDetDD::TRT_BaseElement
Definition: TRT_BaseElement.h:52
TRT_AlignDbSvc::writeAlignTextFile
StatusCode writeAlignTextFile(const std::string &file) const
write AlignableTransforms to flat text file
Definition: TRT_AlignDbSvc.cxx:216
TRT_ID::module_id
Identifier module_id(int barrel_ec, int phi_module, int layer_or_wheel) const
For an individual module phi sector.
Definition: TRT_ID.h:442
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
TRT_AlignDbSvc::prefixtag
static std::string prefixtag(const std::string &key)
Return the prefix tag for a given calibration folder.
Definition: TRT_AlignDbSvc.cxx:1220
Identifier
Definition: IdentifierFieldParser.cxx:14