ATLAS Offline Software
TRT_AlignDbSvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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  : AthService(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.
77  InDetDD::TRT_DetElementCollection::const_iterator iter,itermin,itermax;
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 
131  if(m_alignString != "ALold"){
132 
133  for(unsigned int i=0; i<14; ++i){
134  std::string testA = "A"+intToString(i);
135  //m_alignobjs.push_back("/TRT/Align/"+testA);
136  m_alignobjs.push_back(m_alignDBprefix+testA);
137  m_alignchans.push_back(ichan++);
138 
139  std::string testC = "C"+intToString(i);
140  // m_alignobjs.push_back("/TRT/Align/"+testC);
141  m_alignobjs.push_back(m_alignDBprefix+testC);
142  m_alignchans.push_back(ichan++);
143 
144  }
145  }
146 
154  bool alignFolderExists = m_detStore->contains<AlignableTransformContainer>(m_alignroot) ;
155  if (m_dynamicDB) alignFolderExists = ( alignFolderExists && m_detStore->contains<CondAttrListCollection>("/TRT/AlignL1/TRT"));
156 
159  bool alignTextFileExists = !m_par_alitextfile.empty();
160 
161  if( alignFolderExists ) {
162 
165 
167  if( alignTextFileExists )
168  ATH_MSG_INFO( "AlignableTransformContainer with name " << m_alignroot
169  << " exists. Will read text file from callback function." );
170 
171  } else if ( alignTextFileExists ) {
172 
174  ATH_CHECK( this->createAlignObjects() );
175 
178 
179  } else {
180  ATH_MSG_ERROR( "AlignableTransformContainer not in IOV service and no textfile specified." );
181  }
182 
183  ATH_MSG_DEBUG ("The TRT/Align keys and channels are:");
184  for (unsigned int i=0;i<m_alignobjs.size();++i)
185  ATH_MSG_DEBUG (" key " << m_alignobjs[i] << " chan " << m_alignchans[i]);
186 
187  return StatusCode::SUCCESS;
188 }
189 //
190 //-----------------------------------------------------------------------------
191 
193 {
194  ATH_MSG_INFO( "TRT_AlignDbSvc finalize method called" );
196  delete *it;
197  }
198  return StatusCode::SUCCESS;
199 }
200 
203 {
204  ATH_MSG_DEBUG( "In IOVCallBack" );
205 
214 
217  for (std::list<std::string>::const_iterator itr=keys.begin(); itr!=keys.end(); ++itr)
218  ATH_MSG_INFO( "IOVCALLBACK for key " << *itr<< " number " << I );
219 
220 
221  if(!m_par_alitextfile.empty()){
223  }else{
224  ATH_MSG_INFO( "Text file " << m_par_alitextfile << " is empty" );
225  }
226 
229  printCondObjects() ;
230 
231  ATH_MSG_DEBUG( "Leaving IOVCallBack" );
232  return StatusCode::SUCCESS;
233 }
234 
237 {
238  ATH_MSG_DEBUG(" in writeAlignTextFile ");
239  ATH_MSG_INFO( " Write AlignableTransforms to text file: "<< file );
240  std::ofstream outfile(file);
241 
242  int ntrans=0;
243  int nobj=0;
244 
246  std::vector<std::string>::const_iterator iobj=m_alignobjs.begin();
247  std::vector<std::string>::const_iterator iobjE=m_alignobjs.end();
248  for (;iobj!=iobjE; ++iobj) {
249  const AlignableTransform* pat=cgetTransPtr(*iobj);
250  std::string key=*iobj;
251 
253  if(isOldKey(key) && m_alignString != "ALold")
254  continue;
255 
257  if (!pat){
258  ATH_MSG_ERROR( "Cannot find AlignableTransform for key "<< key );
259  ATH_MSG_ERROR( "Skipping it. " );
260  outfile << key << std::endl;
261  continue;
262  }
263 
264  // first record is the name
265  ATH_MSG_INFO( " Write folder: " << key );
266  outfile << key << std::endl;
267  ++nobj;
268 
269  // loop over all transforms in the AlignableTransform object
272  for (;cit!=citE;++cit) {
273 
274  int bec(0);
275  int layer(0);
276  int sector(0);
277  int strawLayer(0);
278 
280  ++ntrans;
281 
283  const Identifier& ident=cit->identify();
286  sector=m_trtid->phi_module(ident);
288 
290  const Amg::Transform3D& trans = Amg::CLHEPTransformToEigen(cit->transform());
291 
292  if(msgLvl(MSG::DEBUG)){
293  std::string thisMess = key+" for "+file;
294  printTransform(thisMess,trans);
295  }
296 
297 
299  CLHEP::HepRotation rot=transCLHEP.getRotation();
300  Amg::Vector3D eulerangles;
301  eulerangles[0] = rot.getPhi();
302  eulerangles[1] = rot.getTheta();
303  eulerangles[2] = rot.getPsi();
304 
305  Amg::Vector3D shift=trans.translation();
306  //Matthias: was initially 2,1,2 --> this should be equivalent to complicated method above
307  //Amg::Vector3D eulerangles = trans.rotation().eulerAngles(2,0,2) ;
308 
309  if(key == (m_alignDBprefix+"L2A") || key == (m_alignDBprefix+"L2C") ){
310 
311  ATH_MSG_INFO( " Write member: "
312  << ident << " " << bec << " " << layer << " " << strawLayer << " " << key );
313 
314  outfile << bec << " " << layer << " " << strawLayer << " "
315  << std::setprecision(10) << " "
316  << shift.x() << " " << shift.y() << " " << shift.z() << " "
317  << eulerangles[0] << " " << eulerangles[1] << " " << eulerangles[2]
318  << std::endl;
319 
320  ATH_MSG_DEBUG( "Writing transform to log file " );
321  ATH_MSG_DEBUG( bec << " " << layer << " " << strawLayer << " "
322  << std::setprecision(10) << " "
323  << shift.x() << " " << shift.y() << " " << shift.z() << " "
324  << eulerangles[0] << " " << eulerangles[1] << " " << eulerangles[2]
325  );
326 
327  }else{
328  //Need to validate this for writing out L1 Endcap alignments
329  ATH_MSG_INFO( " Write member: "
330  << ident << " " << bec << " " << layer << " " << sector << " " << key );
331 
332  outfile << bec << " " << layer << " " << sector << " "
333  << std::setprecision(10) << " "
334  << shift.x() << " " << shift.y() << " " << shift.z() << " "
335  << eulerangles[0] << " " << eulerangles[1] << " " << eulerangles[2]
336  << std::endl;
337 
338  ATH_MSG_DEBUG( "Writing transform to log file " );
339  ATH_MSG_DEBUG( bec << " " << layer << " " << sector << " "
340  << std::setprecision(10) << " "
341  << shift.x() << " " << shift.y() << " " << shift.z() << " "
342  << eulerangles[0] << " " << eulerangles[1] << " " << eulerangles[2]
343  );
344  }
345 
346  }
347  }
348 
349  outfile.close();
350 
351  ATH_MSG_INFO( "Written " << nobj << " AlignableTransform objects" << " with " << ntrans
352  << " transforms to text file" );
353 
354  ATH_MSG_DEBUG( " leaving writeAlignTextFile " );
355  return StatusCode::SUCCESS;
356 }
357 
359 {
360  ATH_MSG_DEBUG( " in writeAlignTextFile " );
361 
362  ATH_MSG_INFO( "Writing the straw alignments " );
363  if( m_trtStrawAlignDbSvc -> writeTextFile(file) != StatusCode::SUCCESS )
364  ATH_MSG_ERROR("Cannot write to file "<< file );
365 
366  return StatusCode::SUCCESS;
367 }
368 
371  ATH_MSG_DEBUG( " In readAlignTextFile " );
372  ATH_MSG_INFO( "Read alignment constants from text file: " << file );
373  std::ifstream infile;
374  infile.open(file.c_str());
375 
379  const AlignableTransformContainer* container= getContainer();
380  if(container) {
381  AlignableTransformContainer* nccontainer = const_cast<AlignableTransformContainer*>(container) ;
382 
385  for(;it!=itE;++it)
386  // there is no 'clear' function in alignable transform, so we do it with this hack
387  **it = AlignableTransform( (*it)->tag() ) ;
388  } else {
389  return StatusCode::FAILURE ;
390  }
391 
392  // loop over file
393  int nobj=0;
394  int ntrans=0;
395  std::string atname;
396  AlignableTransform* pat(nullptr) ;
397  char line[512] ;
398 
399  while( infile.getline(line,512) ) {
400  if(line[0] != '#') {
401 
402  std::string linestring(line) ;
403  if( linestring.find('/') != std::string::npos) {
404  // this must be a line with a container name
405  atname = linestring ;
406  ATH_MSG_INFO( "now reading container: " << atname );
407  pat=getTransPtr(atname);
408  if (!pat) {
409  ATH_MSG_ERROR( "Cannot find AlignableTransform object for key " << atname );
410  return StatusCode::FAILURE;
411  } else {
412  nobj++;
413  }
414  } else if(pat!=nullptr) {
415  // this must be a line with constants
416  std::istringstream is(line) ;
417 
418  int bec(0),layer(0),sector(0),strawLayer(0);
419  double dx,dy,dz,phi,theta,psi;
420 
421  if(atname == (m_alignDBprefix+"L2A") || atname == (m_alignDBprefix+"L2C") ){
422  if( is >> bec >> layer >> strawLayer >> dx >> dy >> dz >> phi ) {
423  CLHEP::Hep3Vector translation(dx, dy, dz);
424  CLHEP::HepRotation rotation;
425  if (is >> theta >> psi) {
426  ATH_MSG_DEBUG ("read a line with euler angles!" << phi
427  << " " << theta << " " << psi);
428  rotation.set(phi, theta, psi);
429  }
430  //We have to give a phi sector, so we'll give 0.
432  ATH_MSG_DEBUG( "The identifier is for bec " << bec
433  << " layer " << layer << " strawLayer " << strawLayer );
434  ATH_MSG_DEBUG( "The code is " << m_trtid->show_to_string(ident) );
435  if( pat->findIdent(ident)!=pat->end() ) {
436  ATH_MSG_WARNING ("WARNING: read module from file which was already in AlignableTransform. Will skip it."
437  << " bec,lay,sec,strawlay = " << bec << " " << layer << " " << sector << " " );
438  } else {
439  pat->add(ident,HepGeom::Transform3D(rotation, translation));
440  HepGeom::Transform3D testtrans = HepGeom::Transform3D(rotation, translation);
441  if(msgLvl(MSG::DEBUG)){
442  std::string thisMess = atname+" for "+file;
443  printTransform(thisMess,Amg::CLHEPTransformToEigen(testtrans));
444  }
445 
446 
447  ++ntrans;
448  ATH_MSG_DEBUG( "Set transform: "
449  << " [" << bec << "," << layer << "," << strawLayer
450  << "] key " << atname
451  << " rotation=(" << phi << "," << theta << "," << psi
452  << "), translation=(" << dx << "," << dy << "," << dz << "])"
453  );
454  }
455  } else if(!linestring.empty()) {
456  ATH_MSG_WARNING( "Read invalid line from textfile. Line=\'" << line << "\'" );
457  }
458  }//if endcap
459  else{
460  if( is >> bec >> layer >> sector >> dx >> dy >> dz >> phi ) {
461  CLHEP::Hep3Vector translation(dx,dy,dz) ;
462  CLHEP::HepRotation rotation;
463  if( is >> theta >> psi ) {
464  ATH_MSG_DEBUG( "read a line with euler angles!" << phi << " " << theta << " " << psi );
465  rotation.set(phi,theta,psi) ;
466 
467  } else {
468  ATH_MSG_DEBUG( "read a line with angle in phi!" << phi );
469  rotation = CLHEP::HepRotationZ(phi) ;
470  }
471 
473  if( pat->findIdent(ident)!=pat->end() ) {
474  ATH_MSG_WARNING ("WARNING: read module from file which was already in AlignableTransform. Will skip it."
475  << " bec,lay,sec = " << bec << " " << layer << " " << sector);
476  } else {
477  pat->add(ident,HepGeom::Transform3D(rotation, translation));
478  ++ntrans ;
479  ATH_MSG_DEBUG( "Set transform: "
480  << " [" << bec << "," << layer << "," << sector
481  << "] key " << atname << " rotation=(" << phi << "," << theta << "," << psi
482  << "), translation=(" << dx << "," << dy << "," << dz << "])" );
483  }
484  } else if(!linestring.empty()) {
485  ATH_MSG_WARNING( "Read invalid line from textfile. Line=\'" << line << "\'" );
486  }
487  }//if not the endcap
488 
489 
490  }//if pat!=0
491  }//if line != "#"
492  }//while
493 
494  infile.close() ;
495  ATH_MSG_INFO( "Read " << nobj << " objects from file with " << ntrans << " transforms."
496  << " Now forcing callback in detector manager." );
497 
499  int i(0);
500  std::list<std::string> keys;
501  if((const_cast<InDetDD::TRT_DetectorManager*>(m_trtman))->align(i,keys).isFailure()){
502  ATH_MSG_ERROR("Failed to force the alignment callback!" );
503  }
504 
505  ATH_MSG_DEBUG( " Leaving readAlignTextFile " );
506  return StatusCode::SUCCESS;
507 }
508 
511  ATH_MSG_DEBUG( "In streamOutAlignObjects " );
512 
513  // Get Output Stream tool for writing
514  ATH_CHECK( m_streamer.retrieve() );
515 
516  IAthenaOutputStreamTool* streamer=const_cast<IAthenaOutputStreamTool*>(&(*m_streamer));
517 
518  ATH_CHECK( streamer->connectOutput() );
519 
521  IAthenaOutputStreamTool::TypeKeyPair arraypair("AlignableTransformContainer",m_alignroot);
522  typeKeys.push_back(arraypair);
524 
525  ATH_CHECK( streamer->streamObjects(typeKeys) );
526  ATH_CHECK( streamer->commitOutput() );
527 
528  ATH_MSG_INFO( " Streamed out and committed AlignableTransformContainer" );
529  printCondObjects() ;
530 
531  ATH_MSG_DEBUG( "Leaving streamOutAlignObjects " );
532  return StatusCode::SUCCESS;
533 }
534 
536 StatusCode TRT_AlignDbSvc::registerAlignObjects(const std::string & tag, int run1, int event1, int run2, int event2) const{
537 
538  ATH_MSG_INFO( "registerAlignObjects with IOV " );
539  ATH_MSG_INFO( "Run/evt1 [" << run1 << "," << event1 << "]" );
540  ATH_MSG_INFO( "Run/evt2 [" << run2 << "," << event2 << "]" );
541 
542  // get pointer to registration svc
543  IIOVRegistrationSvc* regsvc;
544  ATH_CHECK( service("IOVRegistrationSvc",regsvc) );
545 
546  if (StatusCode::SUCCESS==regsvc->registerIOV("AlignableTransformContainer",m_alignroot,tag,run1,run2,event1,event2)){
547  ATH_MSG_INFO( " Register AlignableTransformContainer object "
548  << m_alignroot );
549  } else {
550  ATH_MSG_ERROR( " Failed to register AlignableTranformContainer "
551  << m_alignroot );
552  return StatusCode::FAILURE;
553  }
554 
555  return StatusCode::SUCCESS;
556 }
557 
560  ATH_MSG_DEBUG( "In getAlignmentTransform" );
561 
562  if(level != 1 && level != 2){
563  ATH_MSG_ERROR( "Call to trans wrong!" );
564  ATH_MSG_ERROR( "Level must be 1 or 2!" );
565  ATH_MSG_ERROR( "Returning NULL" );
566  return Amg::Transform3D();
567  }
568 
570 }
571 
574  ATH_MSG_DEBUG( "In getAlignmentTransformL1" );
575  // return level 1 AlignableTransform for the TRT subdetector bec (+-1,+-2)
576  // or return null transform.
577 
578  std::string key="/TRT/Align/TRT";
580  if (!pat) return Amg::Transform3D();
581 
582  // get Amg::Transform3d via AlignTransMember
584  return ( itr!=pat->end() ? Amg::CLHEPTransformToEigen(itr->transform()) : Amg::Transform3D() );
585 }
586 
589  ATH_MSG_DEBUG( "In getAlignmentTransformL2" );
590  // return level 2 AlignableTransform for the module containing ident
591  // or return null transform.
592 
593  std::string key=findkey(ident,m_alignString);
594  //does a key exist corresponding to this identifier?
595 
597  if (!pat) return Amg::Transform3D();
598 
599  // OK it exists
600  // get "module identifier" from identifier
601  int bec=m_trtid->barrel_ec(ident);
603  int sector=m_trtid->phi_module(ident);
605  int ring = getRingForStrawLayer(strawLayer);
606 
607  Identifier mid;
608  if(key == (m_alignDBprefix+"L2A") || key == (m_alignDBprefix+"L2C") )
609  mid=m_trtid->layer_id(bec,0,layer,ring);
610  else
611  mid=m_trtid->module_id(bec,sector,layer);
612 
613  // get Amg::Transform3d via AlignTransMember
614  AlignableTransform::AlignTransMem_citr itr = pat->findIdent(mid);
615  return ( itr!=pat->end() ? Amg::CLHEPTransformToEigen(itr->transform()) : Amg::Transform3D() );
616 }
617 
620  ATH_MSG_DEBUG( "In getAlignmentTransformPtr" );
621 
622  if(level != 1 && level != 2){
623  ATH_MSG_ERROR( "Call to trans wrong!" );
624  ATH_MSG_ERROR( "Level must be 1 or 2!" );
625  ATH_MSG_ERROR( "Returning NULL" );
626  return nullptr;
627  }
628 
630 }
631 
634  ATH_MSG_DEBUG( "In getAlignmentTransformL1Ptr" );
635  // get level 1 (despite name, will change soon) AlignableTransform for the subdetector containing ident
636  const Amg::Transform3D* rc(nullptr) ;
637  if( m_trtid->is_trt(ident) ) {
638  const AlignableTransform* pat = cgetTransPtr( "/TRT/Align/TRT" ) ;
639  if( pat ) {
640  int bec=m_trtid->barrel_ec(ident);
641  Identifier mid=m_trtid->module_id(bec,0,0);
642  AlignableTransform::AlignTransMem_citr iter = pat->findIdent(mid) ;
643  if(iter != pat->end() ) {
644  Amg::Transform3D* amgTransform = new Amg::Transform3D((Amg::CLHEPTransformToEigen(iter->transform())));
645  m_amgTransformCache.push_back(amgTransform);
646  rc = amgTransform;
647  }
648  }
649  }
650 
651  ATH_MSG_DEBUG( "Leaving getAlignmentTransformL1Ptr" );
652  return rc ;
653 }
654 
657  ATH_MSG_DEBUG( "In getAlignmentTransformL2Ptr" );
658  // set level 2 (despite name, will change soon) AlignableTransform for the module containing ident
659  // or add a new one.
660  const Amg::Transform3D* rc(nullptr) ;
661  //does a folder exist corresponding to this identifier?
662  if( m_trtid->is_trt(ident) ) {
663  std::string key=findkey(ident,m_alignString);
665  if(pat) {
666  // make sure the identifier is a "module identifier"
667  int bec=m_trtid->barrel_ec(ident);
669  int sector=m_trtid->phi_module(ident);
671  int ring = getRingForStrawLayer(strawLayer);
672  Identifier mid;
673  if(key == (m_alignDBprefix+"L2A") || key == (m_alignDBprefix+"L2C") ){
674  mid =m_trtid->layer_id(bec,0,layer,ring);
675  }else
676  mid =m_trtid->module_id(bec,sector,layer);
677 
678  AlignableTransform::AlignTransMem_citr iter = pat->findIdent(mid) ;
679  if(iter != pat->end() ){
680  AlignableTransform::AlignTransMem_citr iter = pat->findIdent(mid) ;
681  Amg::Transform3D* amgTransform = new Amg::Transform3D((Amg::CLHEPTransformToEigen(iter->transform())));
682  m_amgTransformCache.push_back(amgTransform);
683  rc = amgTransform;
684  }
685 
686  else
687  ATH_MSG_WARNING( "Did not find the transform for " << m_trtid->show_to_string(mid) );
688  }
689  }
690 
691  ATH_MSG_DEBUG( "Leaving getAlignmentTransformL2Ptr" );
692  return rc ;
693 }
694 
697  ATH_MSG_DEBUG( "In getAlignmentTransform" );
698 
699  if(level != 1 && level != 2 && level != 3){
700  ATH_MSG_FATAL( "Call to setAlignTransform wrong!" );
701  ATH_MSG_FATAL( "Level must be 1,2 or 3!" );
702  return StatusCode::FAILURE;
703  }
704 
705  switch (level) {
706 
707  case 1:
709  break;
710  case 2:
712  break;
713  case 3:
715  break;
716  }
717 
718  return StatusCode::SUCCESS;
719 }
720 
726  ATH_MSG_DEBUG( "In setAlignTransformL1" );
727  if(msgLvl(MSG::DEBUG)){
728  printTransform("Transform in setAlignTransformL1",trans);
729  }
730 
731  // New additions for new global folder structure
732  // No ATs exist for levels 1 & 2 --> need alternative
733  if (m_dynamicDB){
734  if(!tweakGlobalFolder(ident, trans)) {
735  ATH_MSG_ERROR( "Attempt tweak GlobalDB folder failed" );
736  return StatusCode::FAILURE;
737  }
738  }
739  else {
740 
741  //does a folder exist corresponding to this identifier?
742  AlignableTransform* pat=getTransPtr("/TRT/Align/TRT");
743  if (!pat){
744  ATH_MSG_FATAL( "The AlignableTransform for key " << "/TRT/Align/TRT" << " does not exist " );
745  ATH_MSG_FATAL( "Failing ... " );
746  return StatusCode::FAILURE;
747  }
748 
749  // make sure the identifier is a "subdetector identifier"
750  if( !(m_trtid->is_trt(ident)) ){
751  ATH_MSG_FATAL( "The identifier " << ident << " is not from the TRT " );
752  ATH_MSG_FATAL( "Failing ... " );
753  return StatusCode::FAILURE;
754  }
755 
756  int bec=m_trtid->barrel_ec(ident);
757  Identifier mid=m_trtid->module_id(bec,0,0);
758  // update or add (mid,trans) pair
760  if( !(pat->update(mid,clhepTrans)) ) {
761  pat->add(mid,clhepTrans);
762  pat->sortv() ;
763  }
764  }
765 
766  ATH_MSG_DEBUG( "Leaving setAlignTransformL1" );
767  return StatusCode::SUCCESS;
768 }
769 
772  ATH_MSG_DEBUG( "In setAlignTransformL2" );
777  //does a folder exist corresponding to this identifier?
778  std::string key=findkey(ident,m_alignString);
780  if (!pat) return StatusCode::FAILURE;
781 
782  // make sure the identifier is a "module identifier"
783  if( !(m_trtid->is_trt(ident)) ) return StatusCode::FAILURE;
784  int bec=m_trtid->barrel_ec(ident);
786  int sector=m_trtid->phi_module(ident);
788  int ring = getRingForStrawLayer(strawLayer);
789  Identifier ident2;
790 
791  ATH_MSG_DEBUG( "Setting the L2 Alignment for: "
792  << " Bec= " << bec << " layer= " << layer << " sector= " << sector
793  << " strawLayer= " << strawLayer );
794  ATH_MSG_DEBUG( "The translations are: x= " << trans(0,3) << " y= "<<trans(1,3) << " z= "<<trans(2,3) );
795 
796  if(key == (m_alignDBprefix+"L2A") || key == (m_alignDBprefix+"L2C"))
797  ident2=m_trtid->layer_id(bec,0,layer,ring);
798  else
799  ident2=m_trtid->module_id(bec,sector,layer);
800 
801  // make sure the identifier is a TRT identifier
802  if( !(m_trtid->is_trt(ident2)) ){
803  ATH_MSG_FATAL( "The identifier " << ident2 << " is not from the TRT " );
804  ATH_MSG_FATAL( "Failing ... " );
805  return StatusCode::FAILURE;
806  }
807 
808  // update or add (mid,trans) pair
810  if( !(pat->update(ident2,clhepTrans)) ) {
811  pat->add(ident2,clhepTrans);
812  pat->sortv() ;
813  }
814 
815  ATH_MSG_DEBUG( "Leaving setAlignTransformL2 " );
816  return StatusCode::SUCCESS;
817 }
818 
821  ATH_MSG_DEBUG( "In setAlignTransformL3" );
822 
823  // make sure the identifier is a "module identifier"
824  if( !(m_trtid->is_trt(ident)) ) return StatusCode::FAILURE;
825  int bec=m_trtid->barrel_ec(ident);
826 
827  //Only L3 in the barrel is currently supported
828  if(abs(bec) == 1){
829 
830  // Currently at L3 only displacements in the plane of the straw layer can be stored.
831  // For tracks coming from the interaction point this coorisponds to the sensitive coordinate
832  ATH_MSG_INFO("Storing L3 Barrel constants, Only dx and rotz will be written to DB");
833  float dx = trans.translation().x();
834  float rotz = atan2(trans.rotation()(0,1),trans.rotation()(0,0));
835 
836  // Need the length of the wires to translate the rotation to a translation.
837  const InDetDD::TRT_BaseElement* strawElement = m_trtman->getElement( ident );
838  double strawLenthOver2 = 0.5* strawElement->strawLength();
839 
840  // The alignment frames are the same for straws on side A and side C (verrify this!!)
841  // but variables stored in the db are not. We'll calculate the dispacement of each end
842  // in the alignment frame and in a second step, convert to the values in the DB.
843  double delta_dx_atLargerZ = dx + strawLenthOver2 * sin(rotz);
844  double delta_dx_atSmallerZ = dx - strawLenthOver2 * sin(rotz);
845 
846  // For the definition of dx1 and dx2 see TRT_ConditionsData/StrawDx.h
847  // Now we need to know the real meaning of dx1 and dx2. Alas, we
848  // are in the frame of either of the two barrel sides, but not
849  // both, so we need to know which one.
850  bool sideA = m_trtid->barrel_ec(ident) == 1;
851 
852  // Straw position closest to the electronics
853  double dx1_new = sideA ? delta_dx_atLargerZ : delta_dx_atSmallerZ;
854 
855  // Straw position away from the electronics
856  double dx2_new = sideA ? delta_dx_atSmallerZ : delta_dx_atLargerZ;
857 
858  // Uncertianty on straw positions (Arbitrary for now)
859  double dxErr = 0.001;
860 
861  m_trtStrawAlignDbSvc->setDx(ident, dx1_new, dx2_new, dxErr);
862  }else{
863  // Currently at L3 only displacements in the plane of the straw layer can be stored.
864  // For tracks coming from the interaction point this coorisponds to the sensitive coordinate
865  ATH_MSG_INFO("Storing L3 Endcap constants, Only dy and rotz will be written to DB");
866 
867  // The expected transformation is in the local frame of the Endcap Straws
868  // In the local straw frame:
869  // - the z-axis is along the straw and points toward the beampipe
870  // - the x-axis is along global-z and away from the interaction point
871  // (locX = globZ A-side / locX = -1 *gobZ C-side)
872  // - the y-axis is along global phi_hat direction determined by the other 2.
873  // (clockwise C-side, counter clockwise A-Side)
874  float dy = trans.translation().y();
875  float rotx = atan2(trans.rotation()(1,2),trans.rotation()(2,2));
876 
877  // Need the length of the wires to translate the rotation to a translation.
878  const InDetDD::TRT_BaseElement* strawElement = m_trtman->getElement( ident );
879  double strawLenthOver2 = 0.5* strawElement->strawLength();
880 
881  // In the global frame, 'dx1' corresponds to the readout side and 'dx2'
882  // to the side closest the beampipe.
883  double delta_dx_nearBeamPipe = dy + strawLenthOver2 * sin(rotx);
884  double delta_dx_nearReadOut = dy - strawLenthOver2 * sin(rotx);
885 
886  // Uncertianty on straw positions (Arbitrary for now)
887  double dxErr = 0.001;
888 
889  m_trtStrawAlignDbSvc->setDx(ident, delta_dx_nearReadOut, delta_dx_nearBeamPipe, dxErr);
890  }
891 
892  ATH_MSG_DEBUG( "Leaving setAlignTransformL3 " );
893  return StatusCode::SUCCESS;
894 }
895 
898 
899  ATH_MSG_DEBUG( "In tweakAlignTransform" );
900 
901  if(level != 1 && level != 2 && level != 3){
902  ATH_MSG_FATAL( "Incorrect call to tweakTrans" );
903  ATH_MSG_FATAL( "level must be 1,2 or 3" );
904  return StatusCode::FAILURE;
905  }
906 
907  if(level == 1){
908  if(tweakAlignTransformL1(ident,trans).isFailure()){
909 
910  ATH_MSG_WARNING( "tweak failed...just setting it." );
911 
912  if(setAlignTransformL1(ident,trans).isFailure()){
913  ATH_MSG_FATAL( "Set also failed!" );
914  ATH_MSG_FATAL( "Fail for real." );
915  return StatusCode::FAILURE;
916  }
917  }
918  }
919 
920  else if(level == 2){
921  if(tweakAlignTransformL2(ident,trans).isFailure()){
922 
923  ATH_MSG_WARNING( "tweak failed...just setting it." );
924 
925  if(setAlignTransformL2(ident,trans).isFailure()){
926  ATH_MSG_FATAL( "Set also failed!" );
927  ATH_MSG_FATAL( "Fail for real." );
928  return StatusCode::FAILURE;
929  }
930  }
931  }
932 
933  else if(level == 3){
934  if(tweakAlignTransformL3(ident,trans).isFailure()){
935 
936  ATH_MSG_WARNING( "tweak failed...just setting it." );
937 
938  if(setAlignTransformL3(ident,trans).isFailure()){
939  ATH_MSG_FATAL( "Set also failed!" );
940  ATH_MSG_FATAL( "Fail for real." );
941  return StatusCode::FAILURE;
942  }
943  }
944  }
945 
946  ATH_MSG_DEBUG( "Leaving tweakAlignTransform" );
947  return StatusCode::SUCCESS;
948 }
949 
955  ATH_MSG_DEBUG( "In tweakAlignTransformL1" );
956 
957  // New additions for new global folder structure
958  // No ATs exist for levels 1 & 2 --> need alternative
959  if (m_dynamicDB){
960  if(!tweakGlobalFolder(ident, trans)) {
961  ATH_MSG_ERROR( "Attempt tweak GlobalDB folder failed" );
962  return StatusCode::FAILURE;
963  }
964  }
965  else {
966 
968  AlignableTransform* pat=getTransPtr("/TRT/Align/TRT");
969  if (!pat){
970  ATH_MSG_WARNING( "The AlignableTransform for key " << "/TRT/Align/TRT" << " does not exist " );
971  ATH_MSG_WARNING( "Failing ... " );
972  return StatusCode::FAILURE;
973  }
974 
978  if( !(m_trtid->is_trt(ident)) ){
979  ATH_MSG_WARNING( "The identifier " << ident << " is not from the TRT " );
980  ATH_MSG_WARNING( "Failing ... " );
981  return StatusCode::FAILURE;
982  }
983 
984  int bec=m_trtid->barrel_ec(ident);
985  Identifier mid=m_trtid->module_id(bec,0,0);
986 
988  if( !(pat->tweak(mid,Amg::EigenTransformToCLHEP(trans))) ){
989  ATH_MSG_WARNING( "The Alignable transfor tweek failed for " << mid );
990  ATH_MSG_WARNING( "Failing ... " );
991  return StatusCode::FAILURE;
992  }
993  }
994 
995  ATH_MSG_DEBUG( "Leaving tweakAlignTransformL1" );
996  return StatusCode::SUCCESS;
997 }
998 
1001  ATH_MSG_DEBUG( "In tweakAlignTransformL2" );
1002  // multiply level 2 AlignableTransform for the module containing ident
1003  // by an additional transform.
1004 
1005  //does a folder exist corresponding to this identifier?
1006  std::string key=findkey(ident,m_alignString);
1008  if (!pat){
1009  ATH_MSG_WARNING( "The transfor for key: " << key << "Does not exist" );
1010  ATH_MSG_WARNING( " Failing ... " );
1011  return StatusCode::FAILURE;
1012  }
1013 
1014  //OK the key exists
1015  // make sure the identifier is a "module identifier"
1016  if( !(m_trtid->is_trt(ident)) ) return StatusCode::FAILURE;
1017  int bec=m_trtid->barrel_ec(ident);
1019  int sector=m_trtid->phi_module(ident);
1021  int ring = getRingForStrawLayer(strawLayer);
1022  Identifier mid;
1023  if(key == (m_alignDBprefix+"L2A") || key == (m_alignDBprefix+"L2C"))
1024  mid = m_trtid->layer_id(bec,0,layer,ring);
1025  else
1026  mid = m_trtid->module_id(bec,sector,layer);
1027 
1028  // multiply the additional transformation
1029  if( !(pat->tweak(mid,Amg::EigenTransformToCLHEP(trans))) ){
1030  ATH_MSG_WARNING( "Leaving tweakAlignTransformL2. TWEAK FAILED!!" );
1031  return StatusCode::FAILURE;
1032  }
1033 
1034  ATH_MSG_DEBUG( "Leaving tweakAlignTransformL2" );
1035  return StatusCode::SUCCESS;
1036 }
1037 
1040  ATH_MSG_DEBUG( "In tweakAlignTransformL3" );
1041 
1042  // make sure the identifier is a "module identifier"
1043  if( !(m_trtid->is_trt(ident)) ) return StatusCode::FAILURE;
1044  int bec=m_trtid->barrel_ec(ident);
1045 
1046  //Only L3 in the barrel is currently supported
1047  if(abs(bec) == 1){
1048 
1049  // Currently at L3 only displacements in the plane of the straw layer can be stored.
1050  // For tracks coming from the interaction point this coorisponds to the sensitive coordinate
1051  ATH_MSG_INFO("Storing L3 constants, Only dx and rotz will be written to DB");
1052  float dx = trans.translation().x();
1053 
1054  ATH_MSG_DEBUG("xx: " << trans.rotation()(0,0));
1055  ATH_MSG_DEBUG("xy: " << trans.rotation()(0,1));
1056  ATH_MSG_DEBUG("xz: " << trans.rotation()(0,2));
1057  ATH_MSG_DEBUG("yx: " << trans.rotation()(1,0));
1058  ATH_MSG_DEBUG("yy: " << trans.rotation()(1,1));
1059  ATH_MSG_DEBUG("yz: " << trans.rotation()(1,2));
1060  ATH_MSG_DEBUG("zx: " << trans.rotation()(2,0));
1061  ATH_MSG_DEBUG("zy: " << trans.rotation()(2,1));
1062  ATH_MSG_DEBUG("zz: " << trans.rotation()(2,2));
1063 
1064  // For the definition of dx1 and dx2 see TRT_ConditionsData/StrawDx.h
1065  // Now we need to know the real meaning of dx1 and dx2. Alas, we
1066  // are in the frame of either of the two barrel sides, but not
1067  // both, so we need to know which one.
1068  bool sideA = m_trtid->barrel_ec(ident) == 1;
1069 
1070  float rotz = atan2(trans.rotation()(0,2),trans.rotation()(0,0));
1071 
1072  // Need the length of the wires to translate the rotation to a translation.
1073  const InDetDD::TRT_BaseElement* strawElement = m_trtman->getElement( ident );
1074  double strawLenthOver2 = 0.5* strawElement->strawLength();
1075 
1076  // Old way (buggy)
1077  //double delta_dx_atLargerZ = dx + strawLenthOver2 * sin(rotz);
1078  //double delta_dx_atSmallerZ = dx - strawLenthOver2 * sin(rotz);
1079 
1080  // New way - The rotation is opposite for side A as compared to side C
1081  double delta_dx_atLargerZ;
1082  double delta_dx_atSmallerZ;
1083  if (sideA){
1084  delta_dx_atLargerZ = dx - strawLenthOver2 * sin(rotz);
1085  delta_dx_atSmallerZ = dx + strawLenthOver2 * sin(rotz);
1086  }
1087  else{
1088  delta_dx_atLargerZ = dx + strawLenthOver2 * sin(rotz);
1089  delta_dx_atSmallerZ = dx - strawLenthOver2 * sin(rotz);
1090  }
1091 
1092  // Straw position closest to the electronics
1093  double delta_dx1 = sideA ? delta_dx_atLargerZ : delta_dx_atSmallerZ;
1094 
1095  // Straw position away from the electronics
1096  double delta_dx2 = sideA ? delta_dx_atSmallerZ : delta_dx_atLargerZ;
1097 
1098  // Uncertianty on straw positions
1099  double dxErr = 0.001;
1100 
1101  // now we do some gymnastics: because the strawdisplacement is
1102  // binned, we would rather not just 'add' the current change,
1103  // but rather 'set' the total change. note that this goes
1104  // wrong if there were other straw corrections
1105  // applied. We might have to worry about that at
1106  // some point.
1107  double dx1_current = m_trtStrawAlignDbSvc->getDx1(ident);
1108  double dx2_current = m_trtStrawAlignDbSvc->getDx2(ident) ;
1109  ATH_MSG_DEBUG("Current dx1 is: " << dx1_current);
1110  ATH_MSG_DEBUG("Current dx2 is: " << dx2_current);
1111 
1112  double dx1_new = dx1_current + delta_dx1;
1113  double dx2_new = dx2_current + delta_dx2;
1114 
1115  //ATH_MSG_INFO("New dx1 is: " << dx1_new);
1116  //ATH_MSG_INFO("New dx2 is: " << dx2_new);
1117 
1118  m_trtStrawAlignDbSvc->setDx(ident, dx1_new, dx2_new, dxErr);
1119  }else{
1120 
1121  // Currently at L3 only displacements in the plane of the straw layer can be stored.
1122  // For tracks coming from the interaction point this coorisponds to the sensitive coordinate
1123  ATH_MSG_INFO("Storing L3 Endcap constants, Only dy and rotz will be written to DB");
1124 
1125  // The expected transformation is in the local frame of the Endcap Straws
1126  // In the local straw frame:
1127  // - the z-axis is along the straw and points toward the beampipe
1128  // - the x-axis is along global-z and away from the interaction point
1129  // (locX = globZ A-side / locX = -1 *gobZ C-side)
1130  // - the y-axis is along global phi_hat direction determined by the other 2.
1131  // (clockwise C-side, counter clockwise A-Side)
1132  float dy = trans.translation().y();
1133  float rotx = atan2(trans.rotation()(1,2),trans.rotation()(2,2));
1134 
1135  // Need the length of the wires to translate the rotation to a translation.
1136  const InDetDD::TRT_BaseElement* strawElement = m_trtman->getElement( ident );
1137  double strawLenthOver2 = 0.5* strawElement->strawLength();
1138 
1139  // In the global frame, 'dx1' corresponds to the readout side and 'dx2'
1140  // to the side closest the beampipe.
1141  double delta_dx_nearBeamPipe = dy + strawLenthOver2 * sin(rotx);
1142  double delta_dx_nearReadOut = dy - strawLenthOver2 * sin(rotx);
1143 
1144  // Uncertianty on straw positions
1145  double dxErr = 0.001;
1146 
1147  // now we do some gymnastics: because the strawdisplacement is
1148  // binned, we would rather not just 'add' the current change,
1149  // but rather 'set' the total change. note that this goes
1150  // wrong if there were other straw corrections
1151  // applied. We might have to worry about that at
1152  // some point.
1153  double dx1_current = m_trtStrawAlignDbSvc->getDx1(ident);
1154  double dx2_current = m_trtStrawAlignDbSvc->getDx2(ident) ;
1155  ATH_MSG_DEBUG("Current dx1 is: " << dx1_current);
1156  ATH_MSG_DEBUG("Current dx2 is: " << dx2_current);
1157 
1158  double dx1_new = dx1_current + delta_dx_nearReadOut;
1159  double dx2_new = dx2_current + delta_dx_nearBeamPipe;
1160 
1161  m_trtStrawAlignDbSvc->setDx(ident, dx1_new, dx2_new, dxErr);
1162  }
1163 
1164  ATH_MSG_DEBUG( "Leaving tweakAlignTransformL3 " );
1165  return StatusCode::SUCCESS;
1166 }
1167 
1169 std::string TRT_AlignDbSvc::findkey(const Identifier& ident, const std::string& type) const {
1195  std::ostringstream result;
1196  if (!m_trtid->is_trt(ident)) return result.str();
1197 
1198  if(type=="AL" || type=="ALold") {
1199  // result << "/TRT/Align/";
1201  } else if(type=="DF") {
1202  result << "/TRT/Calib/DF";
1203  } else return result.str();
1204 
1205  int bec=m_trtid->barrel_ec(ident);
1206 
1207  if(type!="AL" && type!="ALold") result << "_";
1208 
1209  if(type=="AL"){
1210  if(bec==2) {
1211  result << "L2A";
1212  } else if(bec==-2) {
1213  result << "L2C";
1214  } else {
1215  result << "B";
1217  result << layer;
1218  }
1219  }else if(type=="ALold"){
1220  if(bec==2) {
1221  result << "A";
1222  } else if(bec==-2) {
1223  result << "C";
1224  } else {
1225  result << "B";
1226  }
1228  result << layer;
1229  }
1230 
1236  return result.str();
1237 }
1238 
1240 std::string TRT_AlignDbSvc::prefixtag(const std::string& key) {
1254  std::ostringstream result;
1255  std::string detector=key.substr(1,3);
1256 
1257  std::string type,quantity;
1258  int ind,ind1;
1259  if(detector=="TRT") {
1260  type=key.substr(5,5);
1261  ind=11;
1262  ind1=11;
1263  quantity=key.substr(ind,2);
1264  } else if(detector=="Indet") {
1265  type=key.substr(7,5);
1266  ind=17;
1267  ind1=13;
1268  quantity="";
1269  if(type=="Align" && key.substr(ind1,2)!="ID") {
1270  if(key.substr(ind1+3,1)=="_") quantity="DF";
1271  }
1272  } else {
1273  return "";
1274  }
1275  if(type=="Calib") {
1276 
1277  if(quantity=="DF") {
1278  result << "TrtDf";
1279  } else if (quantity=="RT") {
1280  result << "TrtRt";
1281  } else if (quantity=="T0") {
1282  result << "TrtT0";
1283  } else {
1284  return "TrtDe_";
1285  }
1286  std::string module=key.substr(ind+3,2);
1287  result << module;
1288  } else if(type=="Align") {
1289  std::string module=key.substr(ind1,2);
1290  if(module=="ID" || module=="TR") {
1291  return "TrtAl_";
1292  } else {
1293  result << "TrtAl";
1294  }
1295  module=key.substr(ind+3,2);
1296  result << module;
1297  } else {
1298  return "";
1299  }
1300  result << "_";
1301  return result.str();
1302 }
1303 
1306 
1311  ATH_MSG_DEBUG( "createAlignObjects method called" );
1312 
1315  ATH_MSG_WARNING( "createAlignObjects: AlignableTransformContainer with name " << m_alignroot
1316  << " already exists." );
1317  return StatusCode::FAILURE;
1318  }
1319 
1321  auto patc = std::make_unique<AlignableTransformContainer>();
1322 
1323  for (unsigned int i=0;i<m_alignobjs.size();++i) {
1324  patc->push_back(std::make_unique<AlignableTransform>(m_alignobjs[i]));
1325  patc->add(m_alignchans[i]);
1326  ATH_MSG_INFO( " added empty AlignableTransform for key " << m_alignobjs[i] );
1327  }
1328 
1330  ATH_CHECK( m_detStore->record(std::move(patc),m_alignroot) );
1331 
1332  ATH_MSG_DEBUG( "Leaving createAlignObjects" );
1333  return StatusCode::SUCCESS;
1334 }
1335 
1339 
1342  ATH_MSG_DEBUG( "createAlignObjectsWhichDoNotAlreadyExist method called" );
1343 
1346 
1349 
1351  AlignableTransformContainer* patc_NonConst = const_cast<AlignableTransformContainer*>(patc);
1352 
1353  for (unsigned int i=0;i<m_alignobjs.size();++i) {
1354 
1356  if(m_alignString != "Alold" && !isOldKey(m_alignobjs[i] )){
1357 
1359  if(!cgetTransPtr(m_alignobjs[i])){
1360 
1362  patc_NonConst->push_back(pat);
1363  patc_NonConst->add(m_alignchans[i]);
1364  ATH_MSG_INFO( " added empty AlignableTransform for key " << m_alignobjs[i] );
1365 
1366  }
1367  }
1368  }
1369 
1370  ATH_MSG_DEBUG( "Leaving createAlignObjectsWhichDoNotAlreadyExist" );
1371  return StatusCode::SUCCESS;
1372 }
1373 
1376  ATH_MSG_DEBUG( " In printCondObjects " );
1377  ATH_MSG_INFO( " TRT Conditions DB contains " << m_alignobjs.size() <<" AlignableTransforms: " );
1378 
1379  const AlignableTransform *pat;
1380  std::vector<std::string>::const_iterator iobj=m_alignobjs.begin();
1381  std::vector<std::string>::const_iterator iobjE=m_alignobjs.end();
1382  for (;iobj!=iobjE;++iobj) {
1383  ATH_MSG_INFO( " " << *iobj );
1384  pat=cgetTransPtr(*iobj);
1385  if (pat) {
1386  pat->print2();
1387  } else {
1388  ATH_MSG_ERROR( " Could not find key: " << *iobj );
1389  }
1390  }
1391 
1392  ATH_MSG_DEBUG( " Leaving printCondObjects" );
1393  return;
1394 }
1395 
1398  ATH_MSG_DEBUG( "In (and leaving) getTransPtr" );
1399  return const_cast<AlignableTransform*>(cgetTransPtr(key)) ;
1400 }
1401 
1403 const AlignableTransform* TRT_AlignDbSvc::cgetTransPtr(const std::string& key) const {
1404  ATH_MSG_DEBUG( "In cgetTransPtr" );
1405  ATH_MSG_DEBUG( "Getting the poiter for key " << key );
1406 
1407  // Retrieve AlignableTransform pointer for a given key - const version
1408  const AlignableTransform* pat=nullptr;
1410  // the retrieve is unnecessary. in fact, if patc==0, retrieve should
1411  // fail as well.
1412 
1413  if( patc || StatusCode::SUCCESS==m_detStore->retrieve(patc,m_alignroot)) {
1414  for(DataVector<AlignableTransform>::const_iterator dva=patc->begin();dva!=patc->end();++dva) {
1415  if( (*dva)->tag()==key ) {
1416  pat = *dva;
1417  break;
1418  }
1419  }
1420  }
1421 
1422  if(!pat){
1423  ATH_MSG_WARNING( "AlignableTransform poiter is NULL!!!!!" );
1424  ATH_MSG_WARNING( "Failed to get the AlignableTransform for key " << key );
1425  }
1426 
1427  ATH_MSG_DEBUG( "leaving cgetTransPtr " );
1428  return pat;
1429 }
1430 
1434  return strawlayer / 4 * 4;
1435 }
1436 
1437 
1440 bool TRT_AlignDbSvc::isOldKey(const std::string& input) const{
1441 
1442  for(unsigned int i=0; i<14; ++i){
1443  std::string testA = "A"+intToString(i);
1444  ATH_MSG_VERBOSE( " The testA is " << testA << " "
1445  << bool(input.find(testA)!=std::string::npos) );
1446  if(input.find(testA)!=std::string::npos){
1447  return true;
1448  }
1449 
1450  std::string testC = "C"+intToString(i);
1451  ATH_MSG_VERBOSE( " The testC is " << testC << " "
1452  << bool(input.find(testC)!=std::string::npos) );
1453  if(input.find(testC)!=std::string::npos){
1454  return true;
1455  }
1456 
1457  }
1458 
1459  return false;
1460 }
1461 
1464  std::ostringstream stm;
1465  stm << input;
1466  return stm.str();
1467 }
1468 
1470 void TRT_AlignDbSvc::printTransform(const std::string& thisName, const Amg::Transform3D& transform) {
1471  std::cout << thisName << " " << transform(0,3) << " " << transform(1,3) << " " << transform(2,3) << std::endl;
1472  std::cout << thisName << " " << transform(0,0) << " " << transform(0,1) << " " << transform(0,2) << std::endl;
1473  std::cout << thisName << " " << transform(1,0) << " " << transform(1,1) << " " << transform(1,2) << std::endl;
1474  std::cout << thisName << " " << transform(2,1) << " " << transform(2,1) << " " << transform(2,2) << std::endl;
1475  return;
1476 }
1477 
1478 // write global DB to file
1480  const {
1481 
1482  if (m_dynamicDB){
1483  ATH_MSG_DEBUG( "writeFile: Write GlobalFolder DB in text file: " << file );
1484  std::ofstream outfile(file);
1485  std::vector<std::string> folder_list = {"/TRT/AlignL1/TRT"};
1486 
1487  for (std::vector<std::string>::iterator it = folder_list.begin(); it != folder_list.end(); ++it){
1488 
1489  outfile << *it << std::endl;
1490  const CondAttrListCollection* atrlistcol=nullptr;
1491  if (StatusCode::SUCCESS==m_detStore->retrieve(atrlistcol,*it)) {
1492  // loop over objects in collection
1493  for (CondAttrListCollection::const_iterator citr=atrlistcol->begin(); citr!=atrlistcol->end();++citr) {
1494 
1495  const coral::AttributeList& atrlist=citr->second;
1496  outfile << atrlist["bec"].data<int>()
1497  << " " << atrlist["layer"].data<int>()
1498  << " " << atrlist["sector"].data<int>()
1499  << " " << atrlist["Tx"].data<float>()
1500  << " " << atrlist["Ty"].data<float>()
1501  << " " << atrlist["Tz"].data<float>()
1502  << " " << atrlist["phi"].data<float>()
1503  << " " << atrlist["theta"].data<float>()
1504  << " " << atrlist["psi"].data<float>() << std::endl;
1505  }
1506  }
1507  else {
1508  if (msgLvl(MSG::INFO)){
1509  ATH_MSG_INFO( "Cannot find " << *it << " Container - cannot write DB in text file " );
1510  return StatusCode::FAILURE;
1511  }
1512  }
1513  }
1514 
1515  return StatusCode::SUCCESS;
1516  }
1517  else {
1518  ATH_MSG_DEBUG( "writeFile: No dynamic Run2 DB structure is present --> skipping writing file " << file );
1519  return StatusCode::SUCCESS;
1520  }
1521 }
1522 
1523 
1524 
1525 
1526 
1527 
1529 
1530  // find transform key, then set appropriate transform
1531  const CondAttrListCollection* atrlistcol1=nullptr;
1532  CondAttrListCollection* atrlistcol2=nullptr;
1533  bool result = false;
1534  std::string key="/TRT/AlignL1/TRT";
1535  ATH_MSG_DEBUG( " Identifier is valid: "<< ident.is_valid() );
1536  int bec=m_trtid->barrel_ec(ident);
1537  const unsigned int DBident=1000+bec*100;
1538  // so far not a very fancy DB identifier, but seems elaborate enough for this simple structure
1539 
1540  if (StatusCode::SUCCESS==m_detStore->retrieve(atrlistcol1,key)) {
1541  // loop over objects in collection
1542  atrlistcol2 = const_cast<CondAttrListCollection*>(atrlistcol1);
1543  if (atrlistcol1!=nullptr){
1544  for (CondAttrListCollection::const_iterator citr=atrlistcol2->begin(); citr!=atrlistcol2->end();++citr) {
1545 
1546  const coral::AttributeList& atrlist=citr->second;
1547  coral::AttributeList& atrlist2 = const_cast<coral::AttributeList&>(atrlist);
1548 
1549  if(citr->first!=DBident){
1550  ATH_MSG_DEBUG( "tweakGlobalFolder fails due to identifier mismatch" );
1551  continue;
1552  }
1553  else {
1554  ATH_MSG_DEBUG( "Tweak Old global DB -- channel: " << citr->first
1555  << " ,bec: " << atrlist2["bec"].data<int>()
1556  << " ,layer: " << atrlist2["layer"].data<int>()
1557  << " ,sector: " << atrlist2["sector"].data<int>()
1558  << " ,Tx: " << atrlist2["Tx"].data<float>()
1559  << " ,Ty: " << atrlist2["Ty"].data<float>()
1560  << " ,Tz: " << atrlist2["Tz"].data<float>()
1561  << " ,phi: " << atrlist2["phi"].data<float>()
1562  << " ,theta: " << atrlist2["theta"].data<float>()
1563  << " ,psi: " << atrlist2["psi"].data<float>() );
1564 
1565 
1566  // Follow same definitions as in TRT_AlignDbSvc.cxx
1567  CLHEP::Hep3Vector oldtranslation(atrlist2["Tx"].data<float>(),atrlist2["Ty"].data<float>(),atrlist2["Tz"].data<float>());
1568  CLHEP::HepRotation oldrotation;
1569  oldrotation.set(atrlist["phi"].data<float>(),atrlist["theta"].data<float>(),atrlist["psi"].data<float>());
1570  HepGeom::Transform3D oldtransform(oldrotation, oldtranslation);
1571 
1572  // get the new transform
1573  HepGeom::Transform3D newtrans = Amg::EigenTransformToCLHEP(trans)*oldtransform;
1574  Amg::Transform3D newtransAMG = trans*Amg::CLHEPTransformToEigen(oldtransform);
1575 
1576  // Extract the values we need to write to DB
1577  Amg::Vector3D shift=newtransAMG.translation();
1578  CLHEP::HepRotation rot=newtrans.getRotation();
1579  Amg::Vector3D eulerangles;
1580  eulerangles[0] = rot.getPhi();
1581  eulerangles[1] = rot.getTheta();
1582  eulerangles[2] = rot.getPsi();
1583 
1584  atrlist2["Tx"].data<float>() = shift.x();
1585  atrlist2["Ty"].data<float>() = shift.y();
1586  atrlist2["Tz"].data<float>() = shift.z();
1587  atrlist2["phi"].data<float>() = eulerangles[0] ;
1588  atrlist2["theta"].data<float>() = eulerangles[1] ;
1589  atrlist2["psi"].data<float>() = eulerangles[2] ;
1590 
1591  result = true;
1592  ATH_MSG_DEBUG( "Tweak New global DB -- channel: " << citr->first
1593  << " ,bec: " << atrlist2["bec"].data<int>()
1594  << " ,layer: " << atrlist2["layer"].data<int>()
1595  << " ,sector: " << atrlist2["sector"].data<int>()
1596  << " ,Tx: " << atrlist2["Tx"].data<float>()
1597  << " ,Ty: " << atrlist2["Ty"].data<float>()
1598  << " ,Tz: " << atrlist2["Tz"].data<float>()
1599  << " ,phi: " << atrlist2["phi"].data<float>()
1600  << " ,theta: " << atrlist2["theta"].data<float>()
1601  << " ,psi: " << atrlist2["psi"].data<float>() );
1602 
1603  }
1604  }
1605  }
1606  else {
1607  ATH_MSG_ERROR("tweakGlobalFolder: cast fails for DBident " << DBident );
1608  return StatusCode::FAILURE;
1609  }
1610  }
1611  else {
1612  ATH_MSG_ERROR("tweakGlobalFolder: cannot retrieve CondAttrListCollection for key " << key );
1613  return StatusCode::FAILURE;
1614  }
1615 
1616  if (result) return StatusCode::SUCCESS;
1617  else return StatusCode::FAILURE;
1618 }
1619 
1620 
1622 {
1623  if (m_aligncontainerhandle.isValid())
1624  return m_aligncontainerhandle.cptr();
1625  const AlignableTransformContainer* ptr = nullptr;
1626  if (m_detStore->retrieve (ptr, m_alignroot).isFailure()) {
1627  ATH_MSG_ERROR ("Cannot retrieve " << m_alignroot << " from detStore ");
1628  }
1629  return ptr;
1630 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TRT_AlignDbSvc::m_forceUserDBConfig
bool m_forceUserDBConfig
Definition: TRT_AlignDbSvc.h:176
TRT_AlignDbSvc::setAlignTransformL2
StatusCode setAlignTransformL2(Identifier ident, Amg::Transform3D trans)
set Level 2 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:771
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:500
TRT_AlignDbSvc::m_amgTransformCache
std::vector< Amg::Transform3D * > m_amgTransformCache
Definition: TRT_AlignDbSvc.h:171
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
checkFileSG.line
line
Definition: checkFileSG.py:75
IAthenaOutputStreamTool::TypeKeyPairs
std::vector< TypeKeyPair > TypeKeyPairs
Definition: IAthenaOutputStreamTool.h:99
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:64
TRT_AlignDbSvc::tweakAlignTransformL2
StatusCode tweakAlignTransformL2(Identifier ident, const Amg::Transform3D &trans)
tweak Level 2 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:1000
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:168
TRT_AlignDbSvc::getTransPtr
AlignableTransform * getTransPtr(const std::string &key) const
get AlignableTransform pointer for an object key
Definition: TRT_AlignDbSvc.cxx:1397
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:1169
TRT_AlignDbSvc::tweakAlignTransform
StatusCode tweakAlignTransform(Identifier ident, Amg::Transform3D trans, unsigned int level)
tweak AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:897
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:1433
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
TRT::Hit::strawLayer
@ strawLayer
Definition: HitInfo.h:81
TRT_AlignDbSvc::writeGlobalFolderFile
StatusCode writeGlobalFolderFile(const std::string &file) const
Definition: TRT_AlignDbSvc.cxx:1479
IAthenaOutputStreamTool
This is a tool that allows streaming out of DataObjects. This has been factorized out from AthenaOutp...
Definition: IAthenaOutputStreamTool.h:70
TRT_AlignDbSvc::m_trtman
const InDetDD::TRT_DetectorManager * m_trtman
detector manager
Definition: TRT_AlignDbSvc.h:163
skel.it
it
Definition: skel.GENtoEVGEN.py:423
TRT_AlignDbSvc::m_par_alitextfile
std::string m_par_alitextfile
input text file
Definition: TRT_AlignDbSvc.h:166
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:633
AthCommonMsg< Service >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
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:782
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TRT_AlignDbSvc::m_alignobjs
std::vector< std::string > m_alignobjs
folder names
Definition: TRT_AlignDbSvc.h:167
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:1403
IIOVRegistrationSvc::registerIOV
virtual StatusCode registerIOV(const std::string &typeName) const =0
Register IOV DB for an object given its typeName - run/LB numbers interval or times interval and tag ...
TRT_AlignDbSvc::setAlignTransform
StatusCode setAlignTransform(Identifier ident, Amg::Transform3D trans, unsigned int level)
set AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:696
TruthTest.itE
itE
Definition: TruthTest.py:25
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TRT::Hit::detector
@ detector
Definition: HitInfo.h:78
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:134
GeoPrimitives.h
TRT_AlignDbSvc::IOVCallBack
StatusCode IOVCallBack(IOVSVC_CALLBACK_ARGS)
Call back function for alignment folders.
Definition: TRT_AlignDbSvc.cxx:202
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:1338
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:619
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:170
TRT_AlignDbSvc::readAlignTextFile
StatusCode readAlignTextFile(const std::string &file)
read AlignableTransforms from text file into TDS
Definition: TRT_AlignDbSvc.cxx:370
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
lumiFormat.i
int i
Definition: lumiFormat.py:92
TRT_AlignDbSvc::~TRT_AlignDbSvc
virtual ~TRT_AlignDbSvc()
destructor
Definition: TRT_AlignDbSvc.cxx:63
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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
AthService
Definition: AthService.h:32
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:1621
IAthenaOutputStreamTool::TypeKeyPair
std::pair< std::string, std::string > TypeKeyPair
Stream out objects.
Definition: IAthenaOutputStreamTool.h:98
TRT_AlignDbSvc::createAlignObjects
StatusCode createAlignObjects() const
Create an empty set of AlignableTransforms for the GeoModel setup.
Definition: TRT_AlignDbSvc.cxx:1305
TRT_AlignDbSvc::m_alignString
std::string m_alignString
alignment string searched for
Definition: TRT_AlignDbSvc.h:165
TRT_AlignDbSvc::getAlignmentTransformL1
const Amg::Transform3D getAlignmentTransformL1(Identifier const &ident) const
get Level 1 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:573
IIOVRegistrationSvc
This is an interface to a service used to register conditions objects in the Interval of Validity (IO...
Definition: IIOVRegistrationSvc.h:52
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:820
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:866
TRT_ID::straw_layer
int straw_layer(const Identifier &id) const
Definition: TRT_ID.h:893
TRT_AlignDbSvc::m_dynamicDB
bool m_dynamicDB
Definition: TRT_AlignDbSvc.h:175
TRT_AlignDbSvc::streamOutAlignObjects
StatusCode streamOutAlignObjects() const
write the alignment objects to output
Definition: TRT_AlignDbSvc.cxx:510
TRT_AlignDbSvc::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition: TRT_AlignDbSvc.h:160
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
TRT_AlignDbSvc::setAlignTransformL1
StatusCode setAlignTransformL1(Identifier ident, const Amg::Transform3D &trans)
set Level 1 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:722
AlignableTransform
Definition: AlignableTransform.h:24
InDetDD::TRT_DetectorManager::getDetectorElementBegin
TRT_DetElementCollection::const_iterator getDetectorElementBegin() const
Definition: TRT_DetectorManager.cxx:185
InDetDD::TRT_DetectorManager::getDetectorElementEnd
TRT_DetElementCollection::const_iterator getDetectorElementEnd() const
Definition: TRT_DetectorManager.cxx:190
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:39
TRT_BaseElement.h
EventPrimitives.h
TRT_AlignDbSvc::printCondObjects
void printCondObjects() const
Output the conditions objects currently in memory.
Definition: TRT_AlignDbSvc.cxx:1375
defineDB.ichan
int ichan
Definition: JetTagCalibration/share/defineDB.py:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TRT_AlignDbSvc::writeStrawAlignTextFile
StatusCode writeStrawAlignTextFile(const std::string &file) const
Definition: TRT_AlignDbSvc.cxx:358
InDetDD::TRT_DetectorManager::getElement
const TRT_BaseElement * getElement(Identifier id) const
Access Elements Generically---------------------------------------------—.
Definition: TRT_DetectorManager.cxx:158
TRT_AlignDbSvc::m_alignroot
std::string m_alignroot
root alignment folder
Definition: TRT_AlignDbSvc.h:164
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:875
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:192
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
ZDC::sideA
BySideTypeMod sideA(1)
InDetDD::TRT_DetectorManager
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Definition: TRT_DetectorManager.h:69
TRT_AlignDbSvc::m_alignDBprefix
std::string m_alignDBprefix
Definition: TRT_AlignDbSvc.h:173
TRT_AlignDbSvc::tweakAlignTransformL3
StatusCode tweakAlignTransformL3(Identifier ident, Amg::Transform3D trans)
tweak Level 3 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:1039
TRT_AlignDbSvc::getAlignmentTransformL2
const Amg::Transform3D getAlignmentTransformL2(Identifier const &ident) const
get Level 2 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:588
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:574
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
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
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
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:1528
InDetDD::InDetDetectorManager::m_alignfoldertype
AlignFolderType m_alignfoldertype
Definition: InDetDetectorManager.h:96
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
TRT_AlignDbSvc::getAlignmentTransformL2Ptr
const Amg::Transform3D * getAlignmentTransformL2Ptr(Identifier const &ident) const
get Level L2 Transform for an identifier
Definition: TRT_AlignDbSvc.cxx:656
TRT_AlignDbSvc::m_trtStrawAlignDbSvc
ServiceHandle< ITRT_StrawAlignDbSvc > m_trtStrawAlignDbSvc
Definition: TRT_AlignDbSvc.h:161
IOVSvcDefs.h
defines and typedefs for IOVSvc
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
TRT_AlignDbSvc::tweakAlignTransformL1
StatusCode tweakAlignTransformL1(Identifier ident, const Amg::Transform3D &trans)
tweak Level 1 AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:951
TRT_AlignDbSvc::intToString
static std::string intToString(int input)
Convert from an int to a string.
Definition: TRT_AlignDbSvc.cxx:1463
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
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:162
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:1470
TRT_AlignDbSvc::getAlignmentTransform
const Amg::Transform3D getAlignmentTransform(const Identifier &ident, unsigned int level) const
get AlignableTransform for an identifier
Definition: TRT_AlignDbSvc.cxx:559
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:1440
TRT_AlignDbSvc::m_aligncontainerhandle
const DataHandle< AlignableTransformContainer > m_aligncontainerhandle
Definition: TRT_AlignDbSvc.h:169
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:536
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
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:57
TRT_AlignDbSvc::writeAlignTextFile
StatusCode writeAlignTextFile(const std::string &file) const
write AlignableTransforms to flat text file
Definition: TRT_AlignDbSvc.cxx:236
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:448
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:1240