9#include "CoralBase/AttributeListSpecification.h"
10#include "CoralBase/Attribute.h"
17#include "GaudiKernel/NTuple.h"
18#include "GaudiKernel/INTupleSvc.h"
19#include "GaudiKernel/SmartDataPtr.h"
21#include "GaudiKernel/RndmGenerators.h"
22#include "GaudiKernel/IRndmGenSvc.h"
65 const std::string& name,
const IInterface* parent)
68 declareInterface<IInDetAlignDBTool>(
this);
77 ATH_MSG_DEBUG(
"InDetAlignDBTool initialize instance: " << name() );
80 if (
detStore().retrieve().isFailure()){
86 return StatusCode::FAILURE;
123 ATH_MSG_FATAL(
"Pixel and SCT Managers have different alignfolder type registered --> Check ");
124 return StatusCode::FAILURE;
132 return StatusCode::FAILURE;
137 return StatusCode::FAILURE;
150 int TransfLevel_low = 0;
153 for (
int i=0;i<3;++i) chan[i]=100*i;
154 std::string man_name;
158 if (element!=
nullptr) {
160 int det,bec,layer,ring,sector,side;
161 if (
idToDetSet(ident,det,bec,layer,ring,sector,side)) {
162 std::string level[3];
163 for (
int i=TransfLevel_low;i<3;++i) {
164 level[i]=
dirkey(det,bec,layer,1+i,sector);
166 std::vector<std::string>::const_iterator ix=
175 ATH_MSG_ERROR(
"Si detector element type " << idet <<
" has no detset conversion" );
182 ATH_MSG_INFO(
"Geometry initialisation sees " << ndet[0] <<
183 " pixel and " << ndet[1] <<
" SCT modules giving " <<
m_alignobjs.size()
184 <<
" alignment keys" );
189 " pixel and " << ndet[1] <<
" SCT modules giving " <<
m_alignobjs.size()
190 <<
" alignment keys" );
197 ATH_MSG_DEBUG(
"Assuming new COOL alignment DB model based on AlignableTransformContainer");
200 ATH_MSG_DEBUG(
"Assuming old (Lisbon) alignment DB model based on separate AlignableTransforms");
207 coral::AttributeListSpecification* spec =
new coral::AttributeListSpecification();
208 spec->extend(
"stave",
"int");
209 spec->extend(
"eta",
"int");
210 spec->extend(
"mag",
"float");
211 spec->extend(
"base",
"float");
212 spec->extend(
"free",
"float");
214 const int ibl_stave_max = 14;
216 for (
int this_stave=0; this_stave<ibl_stave_max; this_stave++){
218 coral::AttributeList atrlist(*spec);
220 atrlist[
"stave" ].data<
int>()=this_stave;
221 atrlist[
"eta" ].data<
int>()=0;
222 atrlist[
"mag" ].data<
float>()=0;
223 atrlist[
"base" ].data<
float>()=0;
224 atrlist[
"free" ].data<
float>()=0;
228 return StatusCode::SUCCESS;
234 return StatusCode::SUCCESS;
242 ATH_MSG_FATAL(
"Cannot create new database when geometry is faked");
253 ATH_MSG_ERROR(
"createDB: AlignableTransformContainer already exists");
257 ATH_MSG_DEBUG(
"Setup database structures in AlignableTransformContainer");
261 ATH_MSG_DEBUG(
"Setup separate AlignableTransform for each layer");
266 else ATH_MSG_DEBUG(
"Treat both sides of SCT module as single entity" );
291 ATH_MSG_ERROR(
"Could not record AlignableTransformContainer");
296 std::vector<std::string> level2;
303 if (element!=
nullptr) {
305 std::string key=
dirkey(ident,3);
311 else ATH_MSG_ERROR(
"Cannot retrieve AlignableTransform for key " << key );
315 std::vector<std::string>::const_iterator ix =
find(level2.begin(),level2.end(),key);
316 if (ix==level2.end()) {
317 level2.push_back(std::move(key));
321 if (
m_pixid->is_pixel(ident)) {
331 std::string key2=
dirkey(ident,2);
334 }
else ATH_MSG_ERROR(
"Cannot retrieve AlignableTransform for key " << key2 );
342 std::string key1=
dirkey(ident1,1);
345 globshift.setIdentity();
348 ident1=
m_pixid->wafer_id(0,0,0,0);
353 ident1=
m_sctid->wafer_id(0,0,0,0,0);
356 ident1=
m_sctid->wafer_id(-2,0,0,0,0);
358 ident1=
m_sctid->wafer_id(2,0,0,0,0);
362 ATH_MSG_ERROR(
"Cannot retrieve AlignableTransform for key " << key1 );
367 ATH_MSG_DEBUG(
"Dumping size of created AlignableTransform objects");
373 int& layer,
int& ring,
int& sector,
int& side)
const {
381 bec=
m_pixid->barrel_ec(ident)/2;
382 layer=
m_pixid->layer_disk(ident);
383 ring=
m_pixid->eta_module(ident);
384 sector=
m_pixid->phi_module(ident);
389 bec=
m_sctid->barrel_ec(ident)/2;
390 layer=
m_sctid->layer_disk(ident);
391 ring=
m_sctid->eta_module(ident);
392 sector=
m_sctid->phi_module(ident);
400 const int level)
const {
403 int det,bec,layer,ring,sector,side;
404 idToDetSet(ident,det,bec,layer,ring,sector,side);
405 return dirkey(det,bec,layer,level,sector);
411 int layer,
const int level)
const {
414 std::ostringstream result;
419 if (det==1) result <<
"PIX";
420 if (det==2) result <<
"SCT";
422 if (bec==1) result <<
"EA";
423 if (bec==0) result <<
"B";
424 if (bec==-1) result <<
"EC";
432 int layer,
const int level,
const int sector)
const {
436 std::ostringstream result;
438 result <<
"/Indet/AlignL";
448 if (det==1) result <<
"PIX";
449 if (det==2) result <<
"SCT";
451 if (det==1 && abs(bec)==2) result <<
DBMkey(det,bec,level,sector);
453 if (bec==1) result <<
"EA";
454 if (bec==0) result <<
"B";
455 if (bec==-1) result <<
"EC";
465 const int level,
const int sector)
const {
468 std::ostringstream result;
469 if (det==1 && level==3 && abs(bec)==2) {
470 if (bec==2) result <<
"EADBM";
471 if (bec==-2) result <<
"ECDBM";
482 const int layer,
const int ring,
const int sector,
483 const float rphidisp,
const float rdisp,
const float zdisp,
484 const int syst,
const int level,
const int skip)
const {
486 ATH_MSG_DEBUG(
"dispGroup called: level " << level <<
" syst " << syst);
489 SmartIF<IRndmGenSvc> randsvc{Gaudi::svcLocator()->service(
"RndmGenSvc")};
490 if(!randsvc.isValid())
ATH_MSG_ERROR(
"Cannot find RndmGenSvc" );
492 Rndm::Numbers gauss(randsvc,Rndm::Gauss(0.,1.));
495 for (
int i=0;i<
skip;++i) gauss();
498 float rpd=0,rd=0,zd=0;
500 rpd=rphidisp*gauss();
505 std::vector<Identifier> lvl12id;
508 for (
int idet=1;idet<3;++idet) {
510 if (element!=
nullptr) {
512 int mdet,mbec,mlayer,mring,msector,mside;
513 idToDetSet(ident,mdet,mbec,mlayer,mring,msector,mside);
515 if ((dettype==-1 || mdet==dettype) && (bec==-1 || std::abs(2*mbec)==bec) &&
516 (layer==-1 || mlayer==layer) && (ring==-1 || mring==ring) &&
517 (sector== -1 || msector==sector) && mside==0) {
524 if (dettype!=2 || mside!=1) {
525 if (syst==2 || syst==4 || (syst==6 && mring==-6)) {
526 rpd=rphidisp*gauss();
530 mlayer <<
" " << mring <<
" z " << zd );
539 if (syst<=2 || syst==6) {
542 float dx=modcent.x();
543 float dy=modcent.y();
544 float dr=std::sqrt(dx*dx+dy*dy);
545 xd=(rd*dx-rpd*dy)/dr;
546 yd=(rd*dy+rpd*dx)/dr;
552 std::string key=
dirkey(mdet,mbec,mlayer,level);
561 }
else if (level==2) {
565 m_pixid->layer_disk(ident),0,0);
568 m_sctid->layer_disk(ident),0,0,0);
571 std::vector<Identifier>::const_iterator ix=
572 find(lvl12id.begin(),lvl12id.end(),ident2);
573 if (ix==lvl12id.end()) {
574 lvl12id.push_back(ident2);
581 ident2=
m_pixid->wafer_id(0,0,0,0);
583 ident2=
m_sctid->wafer_id(0,0,0,0,0);
586 std::vector<Identifier>::const_iterator ix=
587 find(lvl12id.begin(),lvl12id.end(),ident2);
588 if (ix==lvl12id.end()) {
589 lvl12id.push_back(ident2);
600 <<
"," << mlayer <<
"," << mring <<
"," << msector <<
" to xyz" <<
601 xd <<
"," << yd <<
"," << zd );
605 ATH_MSG_ERROR(
"Cannot find AlignableTransform for key" << key <<
" in AlignableTransform container");
611 ATH_MSG_DEBUG(
"Added displacement to " << nmod <<
" modules " << dettype <<
","
612 << bec <<
"," << layer <<
" [" << rphidisp <<
"," << rdisp
613 <<
"," << zdisp <<
"]"
614 <<
" type " << syst );
619 std::ofstream* outfile=
nullptr;
620 SmartIF<INTupleSvc> ntsvc{Gaudi::svcLocator()->service(
"NTupleSvc")};
621 if(!ntsvc.isValid())
ATH_MSG_ERROR(
"Cannot find NTupleSvc" );
622 const std::string path=
file+
"/9002";
623 NTuplePtr nt(ntsvc.get(),path);
626 ATH_MSG_DEBUG(
"writeFile: Write AlignableTransforms on ntuple 9002, path: " <<
file );
632 nt=ntsvc->book(
file,ntid,CLID_ColumnWiseTuple,
"AlignDB");
637 sc=nt->addItem(
"MODPROP/Bec",
nt_bec);
646 sc=nt->addItem(
"MODPROP/Phi",
nt_phi);
648 sc=nt->addItem(
"MODPROP/Psi",
nt_psi);
649 sc=nt->addItem(
"MODPROP/Phi",
nt_phi);
651 sc=nt->addItem(
"MODPROP/Psi",
nt_psi);
653 "Error booking ntuple 9002 contents" );
656 outfile=
new std::ofstream(
file.c_str());
660 for (std::vector<std::string>::const_iterator iobj=
m_alignobjs.begin();
665 if (!ntuple) *outfile << *iobj <<
'\n';
667 cit!=pat->end();++cit) {
670 int det,bec,layer,ring,sector,side;
672 if(!ident.is_valid())
ATH_MSG_FATAL(
"Attempting to write an Invalid ID!!!");
673 if (!
idToDetSet(ident,det,bec,layer,ring,sector,side)) {
678 det=1;bec=0;layer=0;ring=0;sector=0;side=0;
685 double alpha, beta, gamma;
704 std::string r3=iobj->substr(iobj->size()-3,3);
706 if (r3==
"SCT" || r3==
"PIX")
nt_level=2;
717 if (StatusCode::SUCCESS!=nt->write())
ATH_MSG_ERROR(
"Problem filling ntuple 9002" );
719 *outfile <<
"2 " << det <<
" " << 2*bec <<
" " << layer <<
" " << sector <<
720 " " << ring <<
" " << side <<
" " << dx <<
" " << dy <<
" "
721 << dz <<
" " << alpha/CLHEP::mrad <<
" " << beta/CLHEP::mrad <<
" " << gamma/CLHEP::mrad <<
'\n';
723 << *iobj <<
" when writing output file");
728 << *iobj <<
" when writing output file");
736 ATH_MSG_DEBUG(
"Written " << nobj <<
" AlignableTransform objects" <<
" with " << ntrans <<
" transforms to text file" );
742 std::ofstream* outfile=
nullptr;
745 outfile=
new std::ofstream(
file.c_str());
746 *outfile <<
"/Indet/IBLDist" <<
'\n';
749 if (StatusCode::SUCCESS==
detStore()->retrieve(atrlistcol,
"/Indet/IBLDist")) {
753 const coral::AttributeList& atrlist=citr->second;
754 *outfile << citr->first <<
" " << atrlist[
"stave"].data<
int>()
755 <<
" " << atrlist[
"eta"].data<int>()
756 <<
" " << atrlist[
"mag"].data<
float>()
757 <<
" " << atrlist[
"base"].data<float>() <<
'\n';
762 msg(MSG::INFO) <<
"Cannot find IBLDist Container - cannot write IBLDist DB in text file " <<
endmsg;
774 std::ofstream* outfile=
nullptr;
778 outfile=
new std::ofstream(
file.c_str());
779 std::vector<std::string> folder_list = {
"/Indet/AlignL1/ID",
"/Indet/AlignL2/PIX",
"/Indet/AlignL2/SCT"};
781 for (std::vector<std::string>::iterator it = folder_list.begin(); it != folder_list.end(); ++it){
783 *outfile << *it <<
'\n';
786 if (StatusCode::SUCCESS==
detStore()->retrieve(atrlistcol,*it)) {
790 const coral::AttributeList& atrlist=citr->second;
791 *outfile << atrlist[
"subsystem"].data<
int>()
792 <<
" " << atrlist[
"det"].data<int>()
793 <<
" " << atrlist[
"bec"].data<
int>()
794 <<
" " << atrlist[
"layer"].data<int>()
795 <<
" " << atrlist[
"ring"].data<
int>()
796 <<
" " << atrlist[
"sector"].data<int>()
797 <<
" " << atrlist[
"side"].data<
int>()
798 <<
" " << atrlist[
"Tx"].data<float>()
799 <<
" " << atrlist[
"Ty"].data<
float>()
800 <<
" " << atrlist[
"Tz"].data<float>()
801 <<
" " << atrlist[
"Rx"].data<
float>()
802 <<
" " << atrlist[
"Ry"].data<float>()
803 <<
" " << atrlist[
"Rz"].data<
float>() <<
'\n';
808 msg(MSG::INFO) <<
"Cannot find " << *it <<
" Container - cannot write DB in text file " <<
endmsg;
815 ATH_MSG_DEBUG(
"writeFile: No dynamic Run2 DB structure is present --> skipping writing file " <<
file );
824 ATH_MSG_DEBUG(
"readTextFile - set alignment constants from text file: " <<
file );
825 std::ifstream infile;
826 infile.open(
file.c_str());
836 std::string channelName;
841 std::getline(infile, tmpline);
845 if ((tmpline.substr(0,2) ==
"//") || (tmpline.substr(0,1) ==
"#"))
continue;
847 std::istringstream instring(tmpline);
852 if (tmpstr.empty())
continue;
854 if (tmpstr[0] ==
'/') {
856 channelName = std::move(tmpstr);
857 ATH_MSG_DEBUG(
"Read in AlignableTransform data, key " << channelName );
861 ATH_MSG_ERROR(
"Cannot find AlignableTransform object for key"
862 << channelName <<
" when reading text file");
875 std::istringstream datastream(tmpline);
877 int subsystem,dettype,bec,layer,phiModule,etaModule,side;
878 float dx,dy,dz,alpha,beta,gamma;
879 datastream >> subsystem >> dettype >> bec >> layer >> phiModule >> etaModule >> side >> dx
880 >> dy >> dz >> alpha >> beta >> gamma;
882 if (datastream.fail()) {
885 alpha *= CLHEP::mrad;
887 gamma *= CLHEP::mrad;
892 ident=
m_pixid->wafer_id(bec,layer,phiModule,etaModule);
893 }
else if (dettype==2) {
894 ident=
m_sctid->wafer_id(bec,layer,phiModule,etaModule,side);
899 if (!ident.is_valid()) {
901 " [" << subsystem <<
"," << dettype <<
"," << bec <<
"," << layer <<
"," <<
902 phiModule <<
"," << etaModule <<
"," << side <<
"] key " << channelName <<
903 " shift [" << dx <<
"," << dy <<
"," << dz <<
"]" );
910 Amg::Transform3D newtrans = newtranslation * Amg::RotationMatrix3D::Identity();
922 while ((itr->identify()!=ident) && (itr!=pat2->
mend())) ++itr;
923 if (itr!=pat2->
mend()) {
932 " shift [" << dx <<
"," << dy <<
"," << dz <<
"]" );
940 ATH_MSG_DEBUG(
"Read " << nobj <<
" objects from file with " << ntrans <<
" transforms" );
945 ATH_MSG_DEBUG(
"readNtuple - set alignment constants from ntuple path: " <<
file );
946 SmartIF<INTupleSvc> ntsvc{Gaudi::svcLocator()->service(
"NTupleSvc")};
947 if(!ntsvc.isValid())
ATH_MSG_ERROR(
"Cannot find NTupleSvc" );
948 const std::string path=
file+
"/9002";
949 NTuplePtr nt(ntsvc.get(),path);
967 "Error booking ntuple 9002 contents" );
969 while (nt->read().isSuccess()) {
981 Amg::Transform3D newtrans = newtranslation * Amg::RotationMatrix3D::Identity();
989 ATH_MSG_DEBUG(
"Read " << ntrans <<
" transforms from ntuple");
1004 if (!result )
ATH_MSG_ERROR(
"Attempt tweak GlobalDB folder failed" );
1009 std::string key=
dirkey(ident,level);
1015 if (pat2!=
nullptr) {
1017 if (!result)
ATH_MSG_ERROR(
"Attempt to set non-existant transform" );
1020 ATH_MSG_ERROR(
"setTrans: cannot retrieve AlignableTransform for key" << key );
1028 const Amg::Vector3D& translate,
double alpha,
double beta,
double gamma)
const
1032 Amg::Transform3D newtrans = newtranslation * Amg::RotationMatrix3D::Identity();
1037 return setTrans(ident, level, newtrans);
1050 if (!result )
ATH_MSG_ERROR(
"Attempt tweak GlobalDB folder failed" );
1054 std::string key=
dirkey(ident,level);
1059 if (pat2!=
nullptr) {
1062 "Attempt to tweak non-existent transform for element "<<
m_pixid->show_to_string(ident));
1068 "tweakTrans: cannot retrieve AlignableTransform for key" << key );
1076 const Amg::Vector3D& translate,
double alpha,
double beta,
double gamma)
const
1080 Amg::Transform3D newtrans = newtranslation * Amg::RotationMatrix3D::Identity();
1092 if( level == 3 )
return ident ;
1094 if(
m_pixid->is_pixel(ident) ) {
1096 return m_pixid->wafer_id( 0, 0, 0, 0 ) ;
1099 int barrel_ec =
m_pixid->barrel_ec( ident ) ;
1100 int layer_disk =
m_pixid->layer_disk( ident ) ;
1101 return m_pixid->wafer_id( barrel_ec, layer_disk, 0, 0 ) ;
1105 if(
m_sctid->is_sct(ident) ) {
1107 int barrel_ec =
m_sctid->barrel_ec( ident ) ;
1108 return m_sctid->wafer_id( barrel_ec, 0, 0, 0, 0 ) ;
1111 int barrel_ec =
m_sctid->barrel_ec( ident ) ;
1112 int layer_disk =
m_sctid->layer_disk( ident ) ;
1113 return m_sctid->wafer_id( barrel_ec, layer_disk, 0, 0, 0 ) ;
1125 element =
m_sctman->getDetectorElement( ident ) ;
1128 ATH_MSG_ERROR(
"getTransL123(): Module not found in PIX or SCT!" );
1134 ATH_MSG_FATAL(
"Code needs to corrected otherwise you will get nonsensical results-- IndetAlignDBTool:2060");
1137 result = trfL1 * trfL2 * trfL3 ;
1145 const int level)
const {
1148 const std::string key=
dirkey(identifier,level);
1164 return StatusCode::FAILURE;
1196 ATH_MSG_DEBUG(
"starting to register typeKey for IBLDist" );
1199 typekeys_IBLDist[0] = std::move(
pair);
1202 if (StatusCode::SUCCESS!=
m_par_condstream->streamObjects(typekeys_IBLDist)) {
1204 return StatusCode::FAILURE;
1216 return StatusCode::SUCCESS;
1220 const unsigned int run1,
const unsigned int event1,
1221 const unsigned int run2,
const unsigned int event2)
const {
1224 ATH_MSG_DEBUG(
"Run/evt1 [" << run1 <<
"," << event1 <<
"]" );
1225 ATH_MSG_DEBUG(
"Run/evt2 [" << run2 <<
"," << event2 <<
"]" );
1228 SmartIF<IIOVRegistrationSvc> regsvc{Gaudi::svcLocator()->service(
"IOVRegistrationSvc")};
1229 if (!regsvc.isValid()) {
1236 if (StatusCode::SUCCESS==regsvc->registerIOV(
1237 "AlignableTransformContainer",
m_par_dbroot,tag,run1,run2,event1,event2)) {
1245 for (std::vector<std::string>::const_iterator iobj=
m_alignobjs.begin();
1247 if (StatusCode::SUCCESS==regsvc->registerIOV(
"AlignableTransform",
1248 *iobj,tag,run1,run2,event1,event2)) {
1249 ATH_MSG_DEBUG(
"Stored AlignableTransform object " << *iobj );
1252 ATH_MSG_ERROR(
"Failed (registerIOV) to store object " << *iobj );
1256 ATH_MSG_DEBUG(
" Written " << nobj <<
" AlignableTransform objects to conditions database" );
1261 ATH_MSG_DEBUG(
"Printout InDetAlign database contents, detail level" << level );
1263 for (std::vector<std::string>::const_iterator iobj=
m_alignobjs.begin();
1270 cit!=pat->end();++cit) {
1275 int det,bec,layer,ring,sector,side;
1276 if (
idToDetSet(ident,det,bec,layer,ring,sector,side)) {
1278 double alpha, beta, gamma;
1280 ATH_MSG_DEBUG(
"ID [" << det <<
"," << bec <<
"," << layer <<
1281 "," << ring <<
"," << sector <<
"," << side <<
"] Trans:(" <<
1282 shift.x() <<
"," << shift.y() <<
"," << shift.z() <<
") Rot:{"
1283 << alpha <<
"," << beta <<
"," << gamma <<
"}");
1290 ATH_MSG_DEBUG(
"Object contains " << nobj <<
" transforms" );
1292 ATH_MSG_ERROR(
"AlignableTransform " << *iobj <<
" not found" );
1308 dva!=patc->
end();++dva) {
1309 if ((*dva)->tag()==key) {
1316 if (StatusCode::SUCCESS!=
detStore()->retrieve(pat,key)) pat=
nullptr;
1331 dva!=patc->
end();++dva) {
1332 if ((*dva)->tag()==key) {
1339 if (StatusCode::SUCCESS!=
detStore()->retrieve(pat,key)) pat=
nullptr;
1345 const int nbsct,
const int necsct) {
1357 if (nbpix!=0 || necpix!=0) {
1364 for (
int i=0;i<necpix;++i) {
1369 for (
int i=0;i<nbpix;++i) {
1374 for (
int i=0;i<necpix;++i) {
1379 if (nbsct!=0 || necsct!=0) {
1385 for (
int i=0;i<necsct;++i) {
1390 for (
int i=0;i<nbsct;++i) {
1395 for (
int i=0;i<necsct;++i) {
1413 double& alpha,
double& beta,
double &gamma)
const
1415 double siny = trans(0,2);
1423 if ((trans(1,2) == 0) && (trans(2,2) == 0)) {
1427 alpha = atan2(trans(1,1),trans(2,1));
1429 alpha = atan2(-trans(1,2),trans(2,2));
1430 gamma = atan2(-trans(0,1),trans(0,0));
1431 if (alpha == 0) alpha = 0;
1432 if (gamma == 0) gamma = 0;
1443 if (StatusCode::SUCCESS==
detStore()->retrieve(atrlistcol1,
"/Indet/IBLDist")) {
1446 if (atrlistcol2!=
nullptr){
1449 const coral::AttributeList& atrlist=citr->second;
1450 coral::AttributeList& atrlist2 =
const_cast<coral::AttributeList&
>(atrlist);
1452 if(atrlist2[
"stave"].data<int>()!=stave)
continue;
1454 msg(MSG::DEBUG) <<
"IBLDist DB -- channel before update: " << citr->first
1455 <<
" ,stave: " << atrlist2[
"stave"].data<
int>()
1456 <<
" ,mag: " << atrlist2[
"mag"].data<float>()
1457 <<
" ,base: " << atrlist2[
"base"].data<
float>() <<
endmsg;
1459 atrlist2[
"mag"].data<
float>() += bowx;
1461 msg(MSG::DEBUG) <<
"IBLDist DB -- channel after update: " << citr->first
1462 <<
" ,stave: " << atrlist2[
"stave"].data<
int>()
1463 <<
" ,mag: " << atrlist2[
"mag"].data<float>()
1464 <<
" ,base: " << atrlist2[
"base"].data<
float>() <<
endmsg;
1470 ATH_MSG_ERROR(
"tweakIBLDist: cast fails for stave " << stave );
1475 ATH_MSG_ERROR(
"tweakIBLDist: cannot retrieve CondAttrListCollection for key /Indet/IBLDist" );
1491 std::string key=
dirkey(ident,level);
1492 int det,bec,layer,ring,sector,side;
1493 idToDetSet(ident,det,bec,layer,ring,sector,side);
1494 const unsigned int DBident=det*10000+2*bec*1000+layer*100+ring*10+sector;
1497 if (StatusCode::SUCCESS==
detStore()->retrieve(atrlistcol1,key)) {
1501 if (atrlistcol2!=
nullptr){
1504 const coral::AttributeList& atrlist=citr->second;
1505 coral::AttributeList& atrlist2 =
const_cast<coral::AttributeList&
>(atrlist);
1507 if(citr->first!=DBident)
continue;
1509 msg(MSG::DEBUG) <<
"Tweak Old global DB -- channel: " << citr->first
1510 <<
" ,det: " << atrlist2[
"det"].data<
int>()
1511 <<
" ,bec: " << atrlist2[
"bec"].data<int>()
1512 <<
" ,layer: " << atrlist2[
"layer"].data<
int>()
1513 <<
" ,ring: " << atrlist2[
"ring"].data<int>()
1514 <<
" ,sector: " << atrlist2[
"sector"].data<
int>()
1515 <<
" ,Tx: " << atrlist2[
"Tx"].data<float>()
1516 <<
" ,Ty: " << atrlist2[
"Ty"].data<
float>()
1517 <<
" ,Tz: " << atrlist2[
"Tz"].data<float>()
1518 <<
" ,Rx: " << atrlist2[
"Rx"].data<
float>()
1519 <<
" ,Ry: " << atrlist2[
"Ry"].data<float>()
1520 <<
" ,Rz: " << atrlist2[
"Rz"].data<
float>() <<
endmsg;
1524 Amg::Translation3D oldtranslation(atrlist2[
"Tx"].data<float>(),atrlist2[
"Ty"].data<float>(),atrlist2[
"Tz"].data<float>());
1525 Amg::Transform3D oldtrans = oldtranslation * Amg::RotationMatrix3D::Identity();
1535 double alpha, beta, gamma;
1538 atrlist2[
"Tx"].data<
float>() = shift.x();
1539 atrlist2[
"Ty"].data<
float>() = shift.y();
1540 atrlist2[
"Tz"].data<
float>() = shift.z();
1541 atrlist2[
"Rx"].data<
float>() = alpha/CLHEP::mrad ;
1542 atrlist2[
"Ry"].data<
float>() = beta/CLHEP::mrad ;
1543 atrlist2[
"Rz"].data<
float>() = gamma/CLHEP::mrad ;
1546 msg(MSG::DEBUG) <<
"Tweak New global DB -- channel: " << citr->first
1547 <<
" ,det: " << atrlist2[
"det"].data<
int>()
1548 <<
" ,bec: " << atrlist2[
"bec"].data<int>()
1549 <<
" ,layer: " << atrlist2[
"layer"].data<
int>()
1550 <<
" ,ring: " << atrlist2[
"ring"].data<int>()
1551 <<
" ,sector: " << atrlist2[
"sector"].data<
int>()
1552 <<
" ,Tx: " << atrlist2[
"Tx"].data<float>()
1553 <<
" ,Ty: " << atrlist2[
"Ty"].data<
float>()
1554 <<
" ,Tz: " << atrlist2[
"Tz"].data<float>()
1555 <<
" ,Rx: " << atrlist2[
"Rx"].data<
float>()
1556 <<
" ,Ry: " << atrlist2[
"Ry"].data<float>()
1557 <<
" ,Rz: " << atrlist2[
"Rz"].data<
float>() <<
endmsg;
1563 ATH_MSG_ERROR(
"tweakGlobalFolder: cast fails for DBident " << DBident );
1568 ATH_MSG_ERROR(
"tweakGlobalFolder: cannot retrieve CondAttrListCollection for key " << key );
Scalar phi() const
phi method
Scalar theta() const
theta method
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
This is an interface to a tool used to register conditions objects in the Interval of Validity (IOV) ...
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator
void add(ChanNum chanNum)
Adding in channel numbers.
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataModel_detail::iterator< DataVector > iterator
Standard iterator.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated pixel ...
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated SCT in...
Class to hold geometrical description of a silicon detector element.
Base class for Pixel and SCT Detector managers.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
std::string find(const std::string &s)
return a remapped string
Eigen::AngleAxisd AngleAxis3D
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Amg::Transform3D CLHEPTransformToEigen(const HepGeom::Transform3D &CLHEPtransf)
Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D