ATLAS Offline Software
Loading...
Searching...
No Matches
ALFA_DetectorTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#include "ALFA_DetectorTool.h"
7
9
10#include "GaudiKernel/IService.h"
11#include "GaudiKernel/ISvcLocator.h"
12#include "GaudiKernel/MsgStream.h"
13
14#include "GeoModelKernel/GeoFullPhysVol.h"
16
20
21
22
23
24using namespace std;
25
27 const std::string& name,
28 const IInterface* parent )
29 : GeoModelTool( type, name, parent)
30{
31 m_Config.clear();
32
33 declareProperty("MetrologyType",m_Config.GeometryConfig.eRPMetrologyGeoType=EMT_NOMINAL);//EMT_METROLOGY
34 declareProperty("MetrologySource",m_Config.GeometryConfig.strRPMetrologyConnString=string(""));//"rpmetrology.dat"
35 declareProperty("ShiftToX97Pos",m_Config.GeometryConfig.bShiftToX97Pos=false);
36 declareProperty("ConstructBeampipe",m_Config.bConstructBeampipe=false);
37 declareProperty("AddBPInStation",m_Config.bAddIBP=true);
38
39 declareProperty("NominalZPosA7L1",m_Config.GeometryConfig.fNominalZPosA7L1=237388*CLHEP::mm);
40 declareProperty("NominalZPosB7L1",m_Config.GeometryConfig.fNominalZPosB7L1=241528*CLHEP::mm);
41 declareProperty("NominalZPosA7R1",m_Config.GeometryConfig.fNominalZPosA7R1=-237408*CLHEP::mm);
42 declareProperty("NominalZPosB7R1",m_Config.GeometryConfig.fNominalZPosB7R1=-241548*CLHEP::mm);
43
44 declareProperty("B7L1U_PosType",m_Config.GeometryConfig.CfgRPosParams[0].eRPPosType=ERPPT_ACTIVE);
45 declareProperty("B7L1U_MDGeometryType",m_Config.GeometryConfig.CfgRPosParams[0].eMDGeoType=EGST_IDEALGEOMETRY);//EGST_DATABASE
46 declareProperty("B7L1U_ODGeometryType",m_Config.GeometryConfig.CfgRPosParams[0].eODGeoType=EGST_IDEALGEOMETRY);//EGST_DATABASE
47 declareProperty("B7L1U_MDSource",m_Config.GeometryConfig.CfgRPosParams[0].strMDConnString=string(""));//string("ALFA:ALFA-00:ALFAFibreUp")
48 declareProperty("B7L1U_ODSource",m_Config.GeometryConfig.CfgRPosParams[0].strODConnString=string(""));//string("ALFA:ALFA-00:ALFAOvFibUp")
49 declareProperty("B7L1U_CurrentLVDT",m_Config.GeometryConfig.CfgRPosParams[0].fCurrentLVDTmm=7.0*CLHEP::mm);
50
51 declareProperty("B7L1L_PosType",m_Config.GeometryConfig.CfgRPosParams[1].eRPPosType=ERPPT_ACTIVE);
52 declareProperty("B7L1L_MDGeometryType",m_Config.GeometryConfig.CfgRPosParams[1].eMDGeoType=EGST_IDEALGEOMETRY);
53 declareProperty("B7L1L_ODGeometryType",m_Config.GeometryConfig.CfgRPosParams[1].eODGeoType=EGST_IDEALGEOMETRY);
54 declareProperty("B7L1L_MDSource",m_Config.GeometryConfig.CfgRPosParams[1].strMDConnString=string(""));
55 declareProperty("B7L1L_ODSource",m_Config.GeometryConfig.CfgRPosParams[1].strODConnString=string(""));
56 declareProperty("B7L1L_CurrentLVDT",m_Config.GeometryConfig.CfgRPosParams[1].fCurrentLVDTmm=-7.0*CLHEP::mm);
57
58 declareProperty("A7L1U_PosType",m_Config.GeometryConfig.CfgRPosParams[2].eRPPosType=ERPPT_ACTIVE);
59 declareProperty("A7L1U_MDGeometryType",m_Config.GeometryConfig.CfgRPosParams[2].eMDGeoType=EGST_IDEALGEOMETRY);
60 declareProperty("A7L1U_ODGeometryType",m_Config.GeometryConfig.CfgRPosParams[2].eODGeoType=EGST_IDEALGEOMETRY);
61 declareProperty("A7L1U_MDSource",m_Config.GeometryConfig.CfgRPosParams[2].strMDConnString=string(string("")));
62 declareProperty("A7L1U_ODSource",m_Config.GeometryConfig.CfgRPosParams[2].strODConnString=string(string("")));
63 declareProperty("A7L1U_CurrentLVDT",m_Config.GeometryConfig.CfgRPosParams[2].fCurrentLVDTmm=7.0*CLHEP::mm);
64
65 declareProperty("A7L1L_PosType",m_Config.GeometryConfig.CfgRPosParams[3].eRPPosType=ERPPT_ACTIVE);
66 declareProperty("A7L1L_MDGeometryType",m_Config.GeometryConfig.CfgRPosParams[3].eMDGeoType=EGST_IDEALGEOMETRY);
67 declareProperty("A7L1L_ODGeometryType",m_Config.GeometryConfig.CfgRPosParams[3].eODGeoType=EGST_IDEALGEOMETRY);
68 declareProperty("A7L1L_MDSource",m_Config.GeometryConfig.CfgRPosParams[3].strMDConnString=string(""));
69 declareProperty("A7L1L_ODSource",m_Config.GeometryConfig.CfgRPosParams[3].strODConnString=string(""));
70 declareProperty("A7L1L_CurrentLVDT",m_Config.GeometryConfig.CfgRPosParams[3].fCurrentLVDTmm=-7.0*CLHEP::mm);
71
72 declareProperty("A7R1U_PosType",m_Config.GeometryConfig.CfgRPosParams[4].eRPPosType=ERPPT_ACTIVE);
73 declareProperty("A7R1U_MDGeometryType",m_Config.GeometryConfig.CfgRPosParams[4].eMDGeoType=EGST_IDEALGEOMETRY);
74 declareProperty("A7R1U_ODGeometryType",m_Config.GeometryConfig.CfgRPosParams[4].eODGeoType=EGST_IDEALGEOMETRY);
75 declareProperty("A7R1U_MDSource",m_Config.GeometryConfig.CfgRPosParams[4].strMDConnString=string(""));
76 declareProperty("A7R1U_ODSource",m_Config.GeometryConfig.CfgRPosParams[4].strODConnString=string(""));
77 declareProperty("A7R1U_CurrentLVDT",m_Config.GeometryConfig.CfgRPosParams[4].fCurrentLVDTmm=7.0*CLHEP::mm);
78
79 declareProperty("A7R1L_PosType",m_Config.GeometryConfig.CfgRPosParams[5].eRPPosType=ERPPT_ACTIVE);
80 declareProperty("A7R1L_MDGeometryType",m_Config.GeometryConfig.CfgRPosParams[5].eMDGeoType=EGST_IDEALGEOMETRY);
81 declareProperty("A7R1L_ODGeometryType",m_Config.GeometryConfig.CfgRPosParams[5].eODGeoType=EGST_IDEALGEOMETRY);
82 declareProperty("A7R1L_MDSource",m_Config.GeometryConfig.CfgRPosParams[5].strMDConnString=string(""));
83 declareProperty("A7R1L_ODSource",m_Config.GeometryConfig.CfgRPosParams[5].strODConnString=string(""));
84 declareProperty("A7R1L_CurrentLVDT",m_Config.GeometryConfig.CfgRPosParams[5].fCurrentLVDTmm=-7.0*CLHEP::mm);
85
86 declareProperty("B7R1U_PosType",m_Config.GeometryConfig.CfgRPosParams[6].eRPPosType=ERPPT_ACTIVE);
87 declareProperty("B7R1U_MDGeometryType",m_Config.GeometryConfig.CfgRPosParams[6].eMDGeoType=EGST_IDEALGEOMETRY);
88 declareProperty("B7R1U_ODGeometryType",m_Config.GeometryConfig.CfgRPosParams[6].eODGeoType=EGST_IDEALGEOMETRY);
89 declareProperty("B7R1U_MDSource",m_Config.GeometryConfig.CfgRPosParams[6].strMDConnString=string(""));
90 declareProperty("B7R1U_ODSource",m_Config.GeometryConfig.CfgRPosParams[6].strODConnString=string(""));
91 declareProperty("B7R1U_CurrentLVDT",m_Config.GeometryConfig.CfgRPosParams[6].fCurrentLVDTmm=7.0*CLHEP::mm);
92
93 declareProperty("B7R1L_PosType",m_Config.GeometryConfig.CfgRPosParams[7].eRPPosType=ERPPT_ACTIVE);
94 declareProperty("B7R1L_MDGeometryType",m_Config.GeometryConfig.CfgRPosParams[7].eMDGeoType=EGST_IDEALGEOMETRY);
95 declareProperty("B7R1L_ODGeometryType",m_Config.GeometryConfig.CfgRPosParams[7].eODGeoType=EGST_IDEALGEOMETRY);
96 declareProperty("B7R1L_MDSource",m_Config.GeometryConfig.CfgRPosParams[7].strMDConnString=string(""));
97 declareProperty("B7R1L_ODSource",m_Config.GeometryConfig.CfgRPosParams[7].strODConnString=string(""));
98 declareProperty("B7R1L_CurrentLVDT",m_Config.GeometryConfig.CfgRPosParams[7].fCurrentLVDTmm=-7.0*CLHEP::mm);
99
100 declareProperty("bIsTransformInStation", m_Config.bIsTransformInStation, "status if transformation in station will be calculated");
101 declareProperty("bIsTransformInDetector", m_Config.bIsTransformInDetector, "status if transformation in station will be calculated");
102
103 declareProperty("pointTransformInDetectorB7L1U", m_Config.pointTransformInDetectorB7L1U, "transformation point in the detectorfor B7L1U RP");
104 declareProperty("pointTransformInDetectorB7L1L", m_Config.pointTransformInDetectorB7L1L, "transformation point in the detectorfor B7L1L RP");
105 declareProperty("pointTransformInDetectorA7L1U", m_Config.pointTransformInDetectorA7L1U, "transformation point in the detectorfor A7L1U RP");
106 declareProperty("pointTransformInDetectorA7L1L", m_Config.pointTransformInDetectorA7L1L, "transformation point in the detectorfor A7L1L RP");
107 declareProperty("pointTransformInDetectorA7R1U", m_Config.pointTransformInDetectorA7R1U, "transformation point in the detectorfor A7R1U RP");
108 declareProperty("pointTransformInDetectorA7R1L", m_Config.pointTransformInDetectorA7R1L, "transformation point in the detectorfor A7R1L RP");
109 declareProperty("pointTransformInDetectorB7R1U", m_Config.pointTransformInDetectorB7R1U, "transformation point in the detectorfor B7R1U RP");
110 declareProperty("pointTransformInDetectorB7R1L", m_Config.pointTransformInDetectorB7R1L, "transformation point in the detectorfor B7R1L RP");
111
112 declareProperty("vecTransformInDetectorB7L1U", m_Config.vecTransformInDetectorB7L1U, "transformation data in the detectorfor B7L1U RP");
113 declareProperty("vecTransformInDetectorB7L1L", m_Config.vecTransformInDetectorB7L1L, "transformation data in the detectorfor B7L1L RP");
114 declareProperty("vecTransformInDetectorA7L1U", m_Config.vecTransformInDetectorA7L1U, "transformation data in the detectorfor A7L1U RP");
115 declareProperty("vecTransformInDetectorA7L1L", m_Config.vecTransformInDetectorA7L1L, "transformation data in the detectorfor A7L1L RP");
116 declareProperty("vecTransformInDetectorA7R1U", m_Config.vecTransformInDetectorA7R1U, "transformation data in the detectorfor A7R1U RP");
117 declareProperty("vecTransformInDetectorA7R1L", m_Config.vecTransformInDetectorA7R1L, "transformation data in the detectorfor A7R1L RP");
118 declareProperty("vecTransformInDetectorB7R1U", m_Config.vecTransformInDetectorB7R1U, "transformation data in the detectorfor B7R1U RP");
119 declareProperty("vecTransformInDetectorB7R1L", m_Config.vecTransformInDetectorB7R1L, "transformation data in the detectorfor B7R1L RP");
120
121 declareProperty("vecTransformInStationB7L1U", m_Config.vecTransformInStationB7L1U, "transformation data in the stationfor B7L1U RP");
122 declareProperty("vecTransformInStationB7L1L", m_Config.vecTransformInStationB7L1L, "transformation data in the stationfor B7L1L RP");
123 declareProperty("vecTransformInStationA7L1U", m_Config.vecTransformInStationA7L1U, "transformation data in the stationfor A7L1U RP");
124 declareProperty("vecTransformInStationA7L1L", m_Config.vecTransformInStationA7L1L, "transformation data in the stationfor A7L1L RP");
125 declareProperty("vecTransformInStationA7R1U", m_Config.vecTransformInStationA7R1U, "transformation data in the stationfor A7R1U RP");
126 declareProperty("vecTransformInStationA7R1L", m_Config.vecTransformInStationA7R1L, "transformation data in the stationfor A7R1L RP");
127 declareProperty("vecTransformInStationB7R1U", m_Config.vecTransformInStationB7R1U, "transformation data in the stationfor B7R1U RP");
128 declareProperty("vecTransformInStationB7R1L", m_Config.vecTransformInStationB7R1L, "transformation data in the stationfor B7R1L RP");
129}
130
132
134{
135 ATH_MSG_INFO("Building ALFA_ geometry");
136
137 if(((eMetrologyType)m_Config.GeometryConfig.eRPMetrologyGeoType)==EMT_SWCORRECTIONS){
138 CHECK(m_iovDbSvc.retrieve());
139 }
140
141 // Retrieve GeoModel Experiment
142 GeoModelExperiment * theExpt{nullptr};
143 ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS"));
144
145 GeoPhysVol *world=theExpt->getPhysVol();
146
147 // Get pointer to the RDBAccessSvc
148 // Use this pointer later for Geometry DB access
149 SmartIF<IRDBAccessSvc> raccess{Gaudi::svcLocator()->service("RDBAccessSvc")};
150 ATH_CHECK(raccess.isValid());
151
152 // Construct Factory
153 m_pALFADetectorFactory=new ALFA_DetectorFactory(detStore().operator->(),raccess,&m_Config);
154
155 // Build geometry
156 m_pALFADetectorFactory->create(world);
157
158 // Add ALFA_ manager to the Store Gate and GeoModel Experiment
159 theExpt->addManager(m_pALFADetectorFactory->getDetectorManager());
160 ATH_CHECK(detStore()->record(m_pALFADetectorFactory->getDetectorManager()
161 , m_pALFADetectorFactory->getDetectorManager()->getName()));
162
163 return StatusCode::SUCCESS;
164}
165
167{
168 StatusCode sc=StatusCode::FAILURE;
169
170 if(((eMetrologyType)m_Config.GeometryConfig.eRPMetrologyGeoType)==EMT_SWCORRECTIONS) {
172 sc=detStore()->regFcn(&IGeoModelTool::align,dynamic_cast<IGeoModelTool*>(this), DataPtr, COOLFOLDER_DETSWCORR, true);
173 if(sc!=StatusCode::SUCCESS) {
174 ATH_MSG_ERROR("Cannot register COOL callback for folder '"<<COOLFOLDER_DETSWCORR <<"'");
175 }
176 else {
177 ATH_MSG_INFO("Call-back to ALFA_DetectorTool::align() against folder "<< COOLFOLDER_DETSWCORR <<" registered ");
178 }
179 }
180 else {
181 ATH_MSG_INFO("No callback registed");
182 }
183
184 return sc;
185}
186
188{
189 int nChannel;
190 StatusCode sc=StatusCode::SUCCESS;
191 const CondAttrListCollection* listAttrColl;
193
194 ALIGNPARAMETERS AlignParams;
195
196 if(((eMetrologyType)m_Config.GeometryConfig.eRPMetrologyGeoType)==EMT_SWCORRECTIONS){
197 // debug printout of global positions:
198 StoredPhysVol* pStPhysRPBox=nullptr;
199 sc=detStore()->retrieve(pStPhysRPBox,"StRPBox[03]");
200 if(sc.isSuccess()){
201 const GeoFullPhysVol* pPhysRPBox=pStPhysRPBox->getPhysVol();
202 const GeoTrf::Transform3D& xf= pPhysRPBox->getAbsoluteTransform();
203
204 ATH_MSG_INFO("Translation of RPBOX: "<< xf.translation());
205 }
206
207 if(detStore()->retrieve(listAttrColl,COOLFOLDER_DETSWCORR )==StatusCode::SUCCESS){
208 for(iterAttr=listAttrColl->begin();iterAttr!=listAttrColl->end();++iterAttr){
209 nChannel=iterAttr->first; //RPot ID
210 AlignParams.fXOffset[nChannel]=((iterAttr->second)[0]).data<float>();
211 AlignParams.fTheta[nChannel]=((iterAttr->second)[1]).data<float>();
212 AlignParams.fYOffset[nChannel]=((iterAttr->second)[2]).data<float>();
213 }
214
215 m_pALFADetectorFactory->UpdateTransforms(&AlignParams);
216
217 // debug printout of global positions:
218 sc=detStore()->retrieve(pStPhysRPBox,"StRPBox[03]");
219 if(sc.isSuccess()){
220 const GeoFullPhysVol* pPhysRPBox=pStPhysRPBox->getPhysVol();
221 const GeoTrf::Transform3D& xf= pPhysRPBox->getAbsoluteTransform();
222 ATH_MSG_INFO("Translation of RPBOX after update: "<< xf.translation());
223 }
224 }
225 else{
226 ATH_MSG_ERROR("Folder '"<<"/FWD/ALFA/position_calibration"<<"' not found");
227 sc=StatusCode::FAILURE;
228 }
229 }
230
231 return sc;
232}
struct _ALIGNPARAMETERS ALIGNPARAMETERS
#define COOLFOLDER_DETSWCORR
@ ERPPT_ACTIVE
@ EGST_IDEALGEOMETRY
@ EMT_SWCORRECTIONS
@ EMT_NOMINAL
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
#define CHECK(...)
Evaluate an expression and check for errors.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
#define IOVSVC_CALLBACK_ARGS
short hand for IOVSvc call back argument list, to be used when no access to formal arguments is neede...
Definition IOVSvcDefs.h:24
Definition of the abstract IRDBAccessSvc interface.
static Double_t sc
CONFIGURATION m_Config
virtual StatusCode create() override final
ALFA_DetectorFactory * m_pALFADetectorFactory
virtual StatusCode align(IOVSVC_CALLBACK_ARGS) override final
ServiceHandle< IIOVDbSvc > m_iovDbSvc
virtual StatusCode registerCallback() override final
ALFA_DetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual ~ALFA_DetectorTool() override final
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
an iterator over instances of a given type in StoreGateSvc.
Definition DataHandle.h:43
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
GeoFullPhysVol * getPhysVol()
Destructor.
STL namespace.
double fTheta[RPOTSCNT]
double fYOffset[RPOTSCNT]
double fXOffset[RPOTSCNT]