ATLAS Offline Software
ALFA_LocRecCorr.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "ALFA_LocRecCorr.h"
7 
10 
11 using namespace std;
12 
13 
14 ALFA_LocRecCorr::ALFA_LocRecCorr(const string& name, ISvcLocator* pSvcLocator) :
15 AthAlgorithm(name, pSvcLocator)
16 {
17  //MsgStream LogStream(Athena::getMessageSvc(), "ALFA_LocRecCorr::ALFA_LocRecCorr");
18  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::ALFA_LocRecCorr");
19 
20  m_pGeometryReader = nullptr;
21 
22 // m_Config.eOwner=EOT_RECO;
23  m_Config.clear();
24 
25  //begin of Geometry properties
26  declareProperty("MetrologyType",m_Config.eRPMetrologyGeoType=EMT_NOMINAL);//EGST_FILE
27  declareProperty("MetrologySource",m_Config.strRPMetrologyConnString=string(""));//"rpmetrology.dat"
28  declareProperty("ShiftToX97Pos",m_Config.bShiftToX97Pos=false);
29 
33  declareProperty("B7L1U_MDSource",m_Config.CfgRPosParams[0].strMDConnString=string(""));
34  declareProperty("B7L1U_ODSource",m_Config.CfgRPosParams[0].strODConnString=string(""));
36 
40  declareProperty("B7L1L_MDSource",m_Config.CfgRPosParams[1].strMDConnString=string(""));
41  declareProperty("B7L1L_ODSource",m_Config.CfgRPosParams[1].strODConnString=string(""));
43 
47  declareProperty("A7L1U_MDSource",m_Config.CfgRPosParams[2].strMDConnString=string(string("")));
48  declareProperty("A7L1U_ODSource",m_Config.CfgRPosParams[2].strODConnString=string(string("")));
50 
54  declareProperty("A7L1L_MDSource",m_Config.CfgRPosParams[3].strMDConnString=string(""));
55  declareProperty("A7L1L_ODSource",m_Config.CfgRPosParams[3].strODConnString=string(""));
57 
61  declareProperty("A7R1U_MDSource",m_Config.CfgRPosParams[4].strMDConnString=string(""));
62  declareProperty("A7R1U_ODSource",m_Config.CfgRPosParams[4].strODConnString=string(""));
64 
68  declareProperty("A7R1L_MDSource",m_Config.CfgRPosParams[5].strMDConnString=string(""));
69  declareProperty("A7R1L_ODSource",m_Config.CfgRPosParams[5].strODConnString=string(""));
71 
75  declareProperty("B7R1U_MDSource",m_Config.CfgRPosParams[6].strMDConnString=string(""));
76  declareProperty("B7R1U_ODSource",m_Config.CfgRPosParams[6].strODConnString=string(""));
78 
82  declareProperty("B7R1L_MDSource",m_Config.CfgRPosParams[7].strMDConnString=string(""));
83  declareProperty("B7R1L_ODSource",m_Config.CfgRPosParams[7].strODConnString=string(""));
85  //end of Geometry properties
86 
87  //for transformations
88  m_bIsTransformInStation.assign(8, false);
89  m_bIsTransformInDetector.assign(8, false);
90 
91  m_pointTransformInDetectorB7L1U.assign(3, 0.0);
92  m_pointTransformInDetectorB7L1L.assign(3, 0.0);
93  m_pointTransformInDetectorA7L1U.assign(3, 0.0);
94  m_pointTransformInDetectorA7L1L.assign(3, 0.0);
95  m_pointTransformInDetectorB7R1U.assign(3, 0.0);
96  m_pointTransformInDetectorB7R1L.assign(3, 0.0);
97  m_pointTransformInDetectorA7R1U.assign(3, 0.0);
98  m_pointTransformInDetectorA7R1L.assign(3, 0.0);
99 
100  m_vecTransformInDetectorB7L1U.assign(7, 0.0);
101  m_vecTransformInDetectorB7L1L.assign(7, 0.0);
102  m_vecTransformInDetectorA7L1U.assign(7, 0.0);
103  m_vecTransformInDetectorA7L1L.assign(7, 0.0);
104  m_vecTransformInDetectorB7R1U.assign(7, 0.0);
105  m_vecTransformInDetectorB7R1L.assign(7, 0.0);
106  m_vecTransformInDetectorA7R1U.assign(7, 0.0);
107  m_vecTransformInDetectorA7R1L.assign(7, 0.0);
108 
109  m_vecTransformInStationB7L1U.assign(7, 0.0);
110  m_vecTransformInStationB7L1L.assign(7, 0.0);
111  m_vecTransformInStationA7L1U.assign(7, 0.0);
112  m_vecTransformInStationA7L1L.assign(7, 0.0);
113  m_vecTransformInStationB7R1U.assign(7, 0.0);
114  m_vecTransformInStationB7R1L.assign(7, 0.0);
115  m_vecTransformInStationA7R1U.assign(7, 0.0);
116  m_vecTransformInStationA7R1L.assign(7, 0.0);
117 
118  declareProperty("bIsTransformInStation", m_bIsTransformInStation, "status if transformation in station will be calculated");
119  declareProperty("bIsTransformInDetector", m_bIsTransformInDetector, "status if transformation in station will be calculated");
120 
121  declareProperty("pointTransformInDetectorB7L1U", m_pointTransformInDetectorB7L1U, "transformation point in the detectorfor B7L1U RP");
122  declareProperty("pointTransformInDetectorB7L1L", m_pointTransformInDetectorB7L1L, "transformation point in the detectorfor B7L1L RP");
123  declareProperty("pointTransformInDetectorA7L1U", m_pointTransformInDetectorA7L1U, "transformation point in the detectorfor A7L1U RP");
124  declareProperty("pointTransformInDetectorA7L1L", m_pointTransformInDetectorA7L1L, "transformation point in the detectorfor A7L1L RP");
125  declareProperty("pointTransformInDetectorA7R1U", m_pointTransformInDetectorA7R1U, "transformation point in the detectorfor A7R1U RP");
126  declareProperty("pointTransformInDetectorA7R1L", m_pointTransformInDetectorA7R1L, "transformation point in the detectorfor A7R1L RP");
127  declareProperty("pointTransformInDetectorB7R1U", m_pointTransformInDetectorB7R1U, "transformation point in the detectorfor B7R1U RP");
128  declareProperty("pointTransformInDetectorB7R1L", m_pointTransformInDetectorB7R1L, "transformation point in the detectorfor B7R1L RP");
129 
130  declareProperty("vecTransformInDetectorB7L1U", m_vecTransformInDetectorB7L1U, "transformation data in the detectorfor B7L1U RP");
131  declareProperty("vecTransformInDetectorB7L1L", m_vecTransformInDetectorB7L1L, "transformation data in the detectorfor B7L1L RP");
132  declareProperty("vecTransformInDetectorA7L1U", m_vecTransformInDetectorA7L1U, "transformation data in the detectorfor A7L1U RP");
133  declareProperty("vecTransformInDetectorA7L1L", m_vecTransformInDetectorA7L1L, "transformation data in the detectorfor A7L1L RP");
134  declareProperty("vecTransformInDetectorA7R1U", m_vecTransformInDetectorA7R1U, "transformation data in the detectorfor A7R1U RP");
135  declareProperty("vecTransformInDetectorA7R1L", m_vecTransformInDetectorA7R1L, "transformation data in the detectorfor A7R1L RP");
136  declareProperty("vecTransformInDetectorB7R1U", m_vecTransformInDetectorB7R1U, "transformation data in the detectorfor B7R1U RP");
137  declareProperty("vecTransformInDetectorB7R1L", m_vecTransformInDetectorB7R1L, "transformation data in the detectorfor B7R1L RP");
138 
139  declareProperty("vecTransformInStationB7L1U", m_vecTransformInStationB7L1U, "transformation data in the stationfor B7L1U RP");
140  declareProperty("vecTransformInStationB7L1L", m_vecTransformInStationB7L1L, "transformation data in the stationfor B7L1L RP");
141  declareProperty("vecTransformInStationA7L1U", m_vecTransformInStationA7L1U, "transformation data in the stationfor A7L1U RP");
142  declareProperty("vecTransformInStationA7L1L", m_vecTransformInStationA7L1L, "transformation data in the stationfor A7L1L RP");
143  declareProperty("vecTransformInStationA7R1U", m_vecTransformInStationA7R1U, "transformation data in the stationfor A7R1U RP");
144  declareProperty("vecTransformInStationA7R1L", m_vecTransformInStationA7R1L, "transformation data in the stationfor A7R1L RP");
145  declareProperty("vecTransformInStationB7R1U", m_vecTransformInStationB7R1U, "transformation data in the stationfor B7R1U RP");
146  declareProperty("vecTransformInStationB7R1L", m_vecTransformInStationB7R1L, "transformation data in the stationfor B7R1L RP");
147 
148  m_ListExistingRPots.clear();
149 
150  // data type using in the local reconstruction
151  // for the simulation data the value is 0, for the real data the value is 1. Unset value is -1
152  declareProperty("DataType", m_iDataType=1, "data type using in the local reconstruction");
153 
154  m_strKeyGeometryForReco = "ALFA_GeometryForReco";
155  m_strLocRecCollectionName = "ALFA_LocRecEvCollection";
156  m_strLocRecODCollectionName = "ALFA_LocRecODEvCollection";
157  m_strKeyLocRecEvCollection = "ALFA_LocRecEvCollection";
158  m_strKeyLocRecODEvCollection = "ALFA_LocRecODEvCollection";
159  m_strKeyLocRecCorrEvCollection = "ALFA_LocRecCorrEvCollection";
160  m_strKeyLocRecCorrODEvCollection = "ALFA_LocRecCorrODEvCollection";
161 
162  m_bCoolData = true;
163  declareProperty("CoolData", m_bCoolData);
164 
165  m_pLocRecCorrEvCollection = nullptr;
166  m_pLocRecCorrODEvCollection = nullptr;
167  m_iEvt = 0;
168 
169  ATH_MSG_DEBUG("end ALFA_LocRecCorr::ALFA_LocRecCorr");
170 }
171 
173 {
174  //MsgStream LogStream(Athena::getMessageSvc(), "ALFA_LocRecCorr::~ALFA_LocRecCorr");
175  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::~ALFA_LocRecCorr");
176 
177  ATH_MSG_DEBUG("end ALFA_LocRecCorr::~ALFA_LocRecCorr");
178 }
179 
181 {
182  //MsgStream LogStream(Athena::getMessageSvc(), "ALFA_LocRecCorr::Initialize()");
183  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::Initialize()");
184 
185  //read ALFA_Geometry from StoreGate
186  if (!detStore()->contains<ALFA_GeometryReader>(m_strKeyGeometryForReco))
187  {
188  ATH_MSG_ERROR("m_pGeometryReader is not in StoreGate");
189  }
190  else ATH_MSG_DEBUG("m_pGeometryReader is in StoreGate");
191 
192  if (StatusCode::SUCCESS != detStore()->retrieve(m_pGeometryReader, m_strKeyGeometryForReco))
193  {
194  ATH_MSG_ERROR("m_pGeometryReader: unable to retrieve data from SG");
195  }
196  else ATH_MSG_DEBUG("m_pGeometryReader: retrieved from SG");
197 
199  {
200  CHECK(COOLUpdate());
201  }
202 
205 
206  // do update geometry at the end of the initialization process
207  if (UpdateGeometryAtlas())
208  ATH_MSG_DEBUG("Geometry updated successfully.");
209  else
210  ATH_MSG_FATAL("Unable to update a geometry!");
211 
212  ATH_MSG_DEBUG("end ALFA_LocRecCorr::initialize()");
213 
214  return StatusCode::SUCCESS;
215 }
216 
218 {
219  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::Execute()");
220 
221  StatusCode sc = StatusCode::SUCCESS;
222 
223  sc = RecordCollection();
224  if (sc.isFailure())
225  {
226  ATH_MSG_ERROR("ALFA_LocRecCorr recordCollection failed");
227  return StatusCode::SUCCESS;
228  }
229 
231  if (sc.isFailure())
232  {
233  ATH_MSG_ERROR("ALFA_LocRecCorr recordODCollection failed");
234  return StatusCode::SUCCESS;
235  }
236 
237  int iRPot, iSide;
238  int iAlgo;
239  double fRecPosX = -9999.0, fRecPosY = -9999.0, fRecPosOD = -9999.0;
240  HepGeom::Point3D<double> PointInDetCS;
241  HepGeom::Point3D<double> PointInPotCS;
242  HepGeom::Point3D<double> PointInStatCS;
243  HepGeom::Point3D<double> PointInAtlasCS;
244 
245  const ALFA_LocRecEvCollection* pLocRecCorrCol = nullptr;
246  const ALFA_LocRecODEvCollection* pLocRecCorrODCol = nullptr;
247 
248  sc = evtStore()->retrieve(pLocRecCorrCol, m_strLocRecCollectionName);
249  if(sc.isFailure() || !pLocRecCorrCol)
250  {
251  ATH_MSG_ERROR("Container "<< m_strLocRecCollectionName <<" NOT FOUND !!!!!!!");
252 // return StatusCode::FAILURE;
253  }
254  else
255  {
256  ALFA_LocRecEvCollection::const_iterator mcColBeg = pLocRecCorrCol->begin();
257  ALFA_LocRecEvCollection::const_iterator mcColEnd = pLocRecCorrCol->end();
258 
259  //loop over collection (container) with hits (i.e. over 1 event)
260  for(; mcColBeg!=mcColEnd; ++mcColBeg)
261  {
262  iAlgo = (*mcColBeg)->getAlgoNum();
263  iRPot = (*mcColBeg)->getPotNum();
264  fRecPosX = (*mcColBeg)->getXposition();
265  fRecPosY = (*mcColBeg)->getYposition();
266 
267  PointInDetCS = HepGeom::Point3D<double>(fRecPosX, fRecPosY, 10.0);
268  PointInAtlasCS = m_pGeometryReader->GetDetPointInAtlas((eRPotName)(iRPot+1), PointInDetCS);
269  PointInPotCS = m_pGeometryReader->GetDetPointInRPot((eRPotName)(iRPot+1), PointInDetCS);
270  PointInStatCS = m_TransMatrixSt[iRPot]*PointInDetCS;
271 
272  m_pLocRecCorrEvCollection->push_back(new ALFA_LocRecCorrEvent(iAlgo, iRPot, PointInAtlasCS[0], PointInAtlasCS[1], PointInAtlasCS[2], PointInPotCS[0], PointInPotCS[1], PointInStatCS[0], PointInStatCS[1], -9999.0, -9999.0));
273  }
274  }
275 
276  sc = evtStore()->retrieve(pLocRecCorrODCol, m_strLocRecODCollectionName);
277  if(sc.isFailure() || !pLocRecCorrODCol)
278  {
279  ATH_MSG_ERROR("Container "<< m_strLocRecODCollectionName <<" NOT FOUND !!!!!!!");
280 // return StatusCode::FAILURE;
281  }
282  else
283  {
284  ALFA_LocRecODEvCollection::const_iterator mcColODBeg = pLocRecCorrODCol->begin();
285  ALFA_LocRecODEvCollection::const_iterator mcColODEnd = pLocRecCorrODCol->end();
286 
287  //loop over collection (container) with hits (i.e. over 1 event)
288  Int_t iSign;
289  for(; mcColODBeg!=mcColODEnd; ++mcColODBeg)
290  {
291  iAlgo = (*mcColODBeg)->getAlgoNum();
292  iRPot = (*mcColODBeg)->getPotNum();
293  iSide = (*mcColODBeg)->getSide();
294  fRecPosOD = (*mcColODBeg)->getYposition();
295 
296  iSign = (iSide==0)? -1 : 1;
297  PointInDetCS = HepGeom::Point3D<double>(iSign*22, fRecPosOD, 35.5);
298  PointInAtlasCS = m_pGeometryReader->GetDetPointInAtlas((eRPotName)(iRPot+1), PointInDetCS);
299  PointInPotCS = m_pGeometryReader->GetDetPointInRPot((eRPotName)(iRPot+1), PointInDetCS);
300  PointInStatCS = m_TransMatrixSt[iRPot]*PointInDetCS;
301  m_pLocRecCorrODEvCollection->push_back(new ALFA_LocRecCorrODEvent(iAlgo, iRPot, iSide, PointInAtlasCS[1], PointInAtlasCS[2], PointInPotCS[1], PointInStatCS[1], -9999.0));
302  }
303  }
304 
305  ATH_MSG_DEBUG("end ALFA_LocRecCorr::execute()");
306  return StatusCode::SUCCESS;
307 }
308 
309 
311 {
312  //MsgStream LogStream(Athena::getMessageSvc(), "ALFA_LocRecCorr::UserTransform3DInStation(eRPotName eRPName)");
313  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::UserTransform3DInStation()");
314 
315  CLHEP::HepRep3x3 matRotation;
316  USERTRANSFORM structUserTransform;
317 
318  switch(eRPName)
319  {
320  case ERPN_B7L1U:
321  structUserTransform.fAngle = m_vecTransformInStationB7L1U[0];
324  break;
325  case ERPN_B7L1L:
326  structUserTransform.fAngle = m_vecTransformInStationB7L1L[0];
329  break;
330  case ERPN_A7L1U:
331  structUserTransform.fAngle = m_vecTransformInStationA7L1U[0];
334  break;
335  case ERPN_A7L1L:
336  structUserTransform.fAngle = m_vecTransformInStationA7L1L[0];
339  break;
340  case ERPN_A7R1U:
341  structUserTransform.fAngle = m_vecTransformInStationA7R1U[0];
344  break;
345  case ERPN_A7R1L:
346  structUserTransform.fAngle = m_vecTransformInStationA7R1L[0];
349  break;
350  case ERPN_B7R1U:
351  structUserTransform.fAngle = m_vecTransformInStationB7R1U[0];
354  break;
355  case ERPN_B7R1L:
356  structUserTransform.fAngle = m_vecTransformInStationB7R1L[0];
359  break;
360  default:
361  ATH_MSG_WARNING("Unknown Roman pot, station transformation will be set to default (zero) values");
362  structUserTransform.fAngle = 0.0;
363  structUserTransform.vecRotation = CLHEP::Hep3Vector(0.0, 0.0, 0.0);
364  structUserTransform.vecTranslation = CLHEP::Hep3Vector(0.0, 0.0, 0.0);
365  }
366 
367  double fPhi = structUserTransform.fAngle;
368 
369  CLHEP::Hep3Vector vRotation = CLHEP::Hep3Vector(structUserTransform.vecRotation);
370  CLHEP::Hep3Vector vTranslation = CLHEP::Hep3Vector(structUserTransform.vecTranslation);
371 
372  matRotation.xx_ = vRotation.x()*vRotation.x()*(1 - cos(fPhi)) + cos(fPhi);
373  matRotation.xy_ = vRotation.x()*vRotation.y()*(1 - cos(fPhi)) - vRotation.z()*sin(fPhi);
374  matRotation.xz_ = vRotation.x()*vRotation.z()*(1 - cos(fPhi)) + vRotation.y()*sin(fPhi);
375 
376  matRotation.yx_ = vRotation.y()*vRotation.x()*(1 - cos(fPhi)) + vRotation.z()*sin(fPhi);
377  matRotation.yy_ = vRotation.y()*vRotation.y()*(1 - cos(fPhi)) + cos(fPhi);
378  matRotation.yz_ = vRotation.y()*vRotation.z()*(1 - cos(fPhi)) - vRotation.x()*sin(fPhi);
379 
380  matRotation.zx_ = vRotation.z()*vRotation.x()*(1 - cos(fPhi)) - vRotation.y()*sin(fPhi);
381  matRotation.zy_ = vRotation.z()*vRotation.y()*(1 - cos(fPhi)) + vRotation.x()*sin(fPhi);
382  matRotation.zz_ = vRotation.z()*vRotation.z()*(1 - cos(fPhi)) + cos(fPhi);
383 
384  ATH_MSG_DEBUG("end ALFA_LocRecCorr::UserTransform3DInStation()");
385 
386  return HepGeom::Transform3D(CLHEP::HepRotation(matRotation), vTranslation);
387 }
388 
390 {
391  //MsgStream LogStream(Athena::getMessageSvc(), "ALFA_LocRecCorr::UserTransform3DInDetector(eRPotName eRPName)");
392  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::UserTransform3DInDetector()");
393 
394  CLHEP::HepRep3x3 matRotation;
395  USERTRANSFORM structUserTransform;
396 
397  switch(eRPName)
398  {
399  case ERPN_B7L1U:
400  structUserTransform.fAngle = m_vecTransformInDetectorB7L1U[0];
403  break;
404  case ERPN_B7L1L:
405  structUserTransform.fAngle = m_vecTransformInDetectorB7L1L[0];
408  break;
409  case ERPN_A7L1U:
410  structUserTransform.fAngle = m_vecTransformInDetectorA7L1U[0];
413  break;
414  case ERPN_A7L1L:
415  structUserTransform.fAngle = m_vecTransformInDetectorA7L1L[0];
418  break;
419  case ERPN_A7R1U:
420  structUserTransform.fAngle = m_vecTransformInDetectorA7R1U[0];
423  break;
424  case ERPN_A7R1L:
425  structUserTransform.fAngle = m_vecTransformInDetectorA7R1L[0];
428  break;
429  case ERPN_B7R1U:
430  structUserTransform.fAngle = m_vecTransformInDetectorB7R1U[0];
433  break;
434  case ERPN_B7R1L:
435  structUserTransform.fAngle = m_vecTransformInDetectorB7R1L[0];
438  break;
439  default:
440  ATH_MSG_WARNING("Unknown Roman pot, detector transformation will be set to default (zero) values");
441  structUserTransform.fAngle = 0.0;
442  structUserTransform.vecRotation = CLHEP::Hep3Vector(0.0, 0.0, 0.0);
443  structUserTransform.vecTranslation = CLHEP::Hep3Vector(0.0, 0.0, 0.0);
444  }
445 
446  double fPhi = structUserTransform.fAngle;
447 
448  CLHEP::Hep3Vector vRotation = CLHEP::Hep3Vector(structUserTransform.vecRotation);
449  CLHEP::Hep3Vector vTranslation = CLHEP::Hep3Vector(structUserTransform.vecTranslation);
450 
451  matRotation.xx_ = vRotation.x()*vRotation.x()*(1 - cos(fPhi)) + cos(fPhi);
452  matRotation.xy_ = vRotation.x()*vRotation.y()*(1 - cos(fPhi)) - vRotation.z()*sin(fPhi);
453  matRotation.xz_ = vRotation.x()*vRotation.z()*(1 - cos(fPhi)) + vRotation.y()*sin(fPhi);
454 
455  matRotation.yx_ = vRotation.y()*vRotation.x()*(1 - cos(fPhi)) + vRotation.z()*sin(fPhi);
456  matRotation.yy_ = vRotation.y()*vRotation.y()*(1 - cos(fPhi)) + cos(fPhi);
457  matRotation.yz_ = vRotation.y()*vRotation.z()*(1 - cos(fPhi)) - vRotation.x()*sin(fPhi);
458 
459  matRotation.zx_ = vRotation.z()*vRotation.x()*(1 - cos(fPhi)) - vRotation.y()*sin(fPhi);
460  matRotation.zy_ = vRotation.z()*vRotation.y()*(1 - cos(fPhi)) + vRotation.x()*sin(fPhi);
461  matRotation.zz_ = vRotation.z()*vRotation.z()*(1 - cos(fPhi)) + cos(fPhi);
462 
463  ATH_MSG_DEBUG("end ALFA_LocRecCorr::UserTransform3DInDetector()");
464 
465  return HepGeom::Transform3D(CLHEP::HepRotation(matRotation), vTranslation);
466 }
467 
468 HepGeom::Point3D<double> ALFA_LocRecCorr::Point3DInDetector(eRPotName eRPName)
469 {
470  //MsgStream LogStream(Athena::getMessageSvc(), "ALFA_LocRecCorr::Point3DInDetector(eRPotName eRPName)");
471  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::Point3DInDetector()");
472 
473  HepGeom::Point3D<double> Point;
474 
475  switch(eRPName)
476  {
477  case ERPN_B7L1U:
479  break;
480  case ERPN_B7L1L:
482  break;
483  case ERPN_A7L1U:
485  break;
486  case ERPN_A7L1L:
488  break;
489  case ERPN_A7R1U:
491  break;
492  case ERPN_A7R1L:
494  break;
495  case ERPN_B7R1U:
497  break;
498  case ERPN_B7R1L:
500  break;
501  default:
502  ATH_MSG_WARNING("Unknown Roman pot, transformation point will be set to default (zero) value");
503  }
504 
505  ATH_MSG_DEBUG("end ALFA_LocRecCorr::Point3DInDetector()");
506 
507  return Point;
508 }
509 
511 {
512  //MsgStream LogStream(Athena::getMessageSvc(), "ALFA_LocRecCorr::RecordCollection()");
513  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::RecordCollection()");
514 
515  StatusCode sc = StatusCode::SUCCESS;
516 
519 
520  if (sc.isFailure())
521  {
522  ATH_MSG_FATAL("MD - Could not record the empty LocRecCorrEv collection in StoreGate");
523  return sc;
524  }
525  else
526  {
527  ATH_MSG_DEBUG("MD - LocRecCorrEv collection was recorded in StoreGate");
528  }
529 
530  ATH_MSG_DEBUG("end ALFA_LocRecCorr::RecordCollection()");
531 
532  return sc;
533 }
534 
536 {
537  //MsgStream LogStream(Athena::getMessageSvc(), "ALFA_LocRecCorr::RecordODCollection()");
538  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::RecordODCollection()");
539 
540  StatusCode sc = StatusCode::SUCCESS;
541 
544 
545  if (sc.isFailure())
546  {
547  ATH_MSG_FATAL("OD - Could not record the empty LocRecCorrEv collection in StoreGate");
548 
549  return sc;
550  }
551  else
552  {
553  ATH_MSG_DEBUG("OD - LocRecCorrEv collection is recorded in StoreGate");
554  }
555 
556  ATH_MSG_DEBUG("end ALFA_LocRecCorr::RecordODCollection()");
557 
558  return sc;
559 }
560 
562 {
563  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::COOLUpdate()");
564 
565  SG::ReadCondHandleKey<CondAttrListCollection> key("/FWD/ALFA/position_calibration");
567  ATH_CHECK( listAttrColl.isValid() );
568 
569  for(CondAttrListCollection::const_iterator iterAttr=listAttrColl->begin();iterAttr!=listAttrColl->end();++iterAttr)
570  {
571  int iChannel=iterAttr->first; //RPot ID
572  m_Config.CfgRPosParams[iChannel].swcorr.fXOffset=((iterAttr->second)[0]).data<float>();
573  m_Config.CfgRPosParams[iChannel].swcorr.fTheta =((iterAttr->second)[1]).data<float>();
574  m_Config.CfgRPosParams[iChannel].swcorr.fYOffset=((iterAttr->second)[2]).data<float>();
575 
576  ATH_MSG_DEBUG("iChannel, fXOffset, fTheta, fYOffset = " << iChannel << ", " << m_Config.CfgRPosParams[iChannel].swcorr.fXOffset);
577  ATH_MSG_DEBUG(", " << m_Config.CfgRPosParams[iChannel].swcorr.fTheta << ", " << m_Config.CfgRPosParams[iChannel].swcorr.fYOffset);
578  }
579 
580  // update SW corrections - needs to be updated during the COOL DB check
581  if (UpdateGeometryAtlas())
582  {
583  ATH_MSG_DEBUG("Geometry for the SW corrections updated successfully");
584  }
585  else
586  {
587  ATH_MSG_FATAL("Unable to update a geometry of the SW corrections!");
588  ATH_MSG_DEBUG("end ALFA_LocRecCorr::COOLUpdate()");
589  return StatusCode::FAILURE;
590  }
591 
592  return StatusCode::SUCCESS;
593 }
594 
596 {
597  //MsgStream LogStream(Athena::getMessageSvc(), "ALFA_LocRecCorr::UpdateGeometryAtlas()");
598  ATH_MSG_DEBUG("begin ALFA_LocRecCorr::UpdateGeometryAtlas()");
599 
601  {
602  ATH_MSG_DEBUG("Geometry successfully updated.");
604  }
605  else
606  {
607  ATH_MSG_FATAL("Cannot update geometry. Initialization process failed.");
608  ATH_MSG_DEBUG("end ALFA_LocRecCorr::UpdateGeometryAtlas()");
609  return false;
610  }
611 
612  ATH_MSG_DEBUG("end ALFA_LocRecCorr::UpdateGeometryAtlas()");
613  return true;
614 }
615 
617 {
618  eRPotName eRPName;
619  for(int i=0;i<RPOTSCNT;i++)
620  {
621  eRPName=(eRPotName)(i+1);
623  {
627  }
629  {
632  }
633  }
634 }
635 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ALFA_LocRecCorr::RecordCollection
StatusCode RecordCollection()
Definition: ALFA_LocRecCorr.cxx:510
ALFA_LocRecCorr::m_pointTransformInDetectorB7R1L
std::vector< double > m_pointTransformInDetectorB7R1L
Definition: ALFA_LocRecCorr.h:85
CFGRPPOSPARAMS::fYOffset
double fYOffset
Definition: ALFA_GeometryReader.h:182
ALFA_LocRecCorr::m_vecTransformInDetectorB7R1U
std::vector< double > m_vecTransformInDetectorB7R1U
Definition: ALFA_LocRecCorr.h:92
CondAttrListCollection::end
const_iterator end() const
Definition: CondAttrListCollection.h:315
ALFA_LocRecCorr::RecordODCollection
StatusCode RecordODCollection()
Definition: ALFA_LocRecCorr.cxx:535
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
python.SystemOfUnits.mm
float mm
Definition: SystemOfUnits.py:98
ALFA_LocRecCorr::m_strKeyLocRecCorrEvCollection
std::string m_strKeyLocRecCorrEvCollection
Definition: ALFA_LocRecCorr.h:108
ALFA_LocRecCorr::m_pLocRecCorrEvCollection
ALFA_LocRecCorrEvCollection * m_pLocRecCorrEvCollection
Definition: ALFA_LocRecCorr.h:66
ALFA_LocRecCorr::execute
StatusCode execute()
Definition: ALFA_LocRecCorr.cxx:217
ALFA_LocRecCorrODEvent
Definition: ALFA_LocRecCorrODEvent.h:8
ALFA_LocRecCorr::UserTransform3DInDetector
HepGeom::Transform3D UserTransform3DInDetector(eRPotName eRPName)
Definition: ALFA_LocRecCorr.cxx:389
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
_USERTRANSFORM::vecRotation
CLHEP::Hep3Vector vecRotation
Definition: ALFA_DetectorTool.h:21
ALFA_LocRecCorr::m_vecTransformInStationB7L1L
std::vector< double > m_vecTransformInStationB7L1L
Definition: ALFA_LocRecCorr.h:97
ALFA_LocRecCorr::m_strKeyGeometryForReco
std::string m_strKeyGeometryForReco
Definition: ALFA_LocRecCorr.h:105
EGST_IDEALGEOMETRY
@ EGST_IDEALGEOMETRY
Definition: ALFA_GeometryReader.h:23
ERPN_B7R1U
@ ERPN_B7R1U
Definition: ALFA_GeometryReader.h:27
eRPotName
eRPotName
Definition: ALFA_GeometryReader.h:27
ALFA_LocRecCorr::initialize
StatusCode initialize()
Definition: ALFA_LocRecCorr.cxx:180
ALFA_LocRecCorr::m_strKeyLocRecODEvCollection
std::string m_strKeyLocRecODEvCollection
Definition: ALFA_LocRecCorr.h:107
EMT_SWCORRECTIONS
@ EMT_SWCORRECTIONS
Definition: ALFA_GeometryReader.h:24
ALFA_GeometryReader.h
ALFA_LocRecCorr::UserTransform3DInStation
HepGeom::Transform3D UserTransform3DInStation(eRPotName eRPName)
Definition: ALFA_LocRecCorr.cxx:310
ERPN_A7L1U
@ ERPN_A7L1U
Definition: ALFA_GeometryReader.h:27
ALFA_LocRecCorr::m_pointTransformInDetectorA7R1U
std::vector< double > m_pointTransformInDetectorA7R1U
Definition: ALFA_LocRecCorr.h:86
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:210
RPOTSCNT
#define RPOTSCNT
Definition: ALFA_CLinkAlg.h:26
ALFA_LocRecCorr::m_vecTransformInStationB7R1U
std::vector< double > m_vecTransformInStationB7R1U
Definition: ALFA_LocRecCorr.h:100
ERPN_B7R1L
@ ERPN_B7R1L
Definition: ALFA_GeometryReader.h:27
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition: CondAttrListCollection.h:309
ALFA_LocRecCorr::m_pointTransformInDetectorA7L1U
std::vector< double > m_pointTransformInDetectorA7L1U
Definition: ALFA_LocRecCorr.h:82
ALFA_LocRecCorrEvCollection
Definition: ALFA_LocRecCorrEvCollection.h:13
CFGRPPOSPARAMS::fTheta
double fTheta
Definition: ALFA_GeometryReader.h:184
ALFA_LocRecCorr::m_vecTransformInDetectorB7R1L
std::vector< double > m_vecTransformInDetectorB7R1L
Definition: ALFA_LocRecCorr.h:93
ALFA_GeometryReader::GetDetPointInRPot
HepGeom::Point3D< double > GetDetPointInRPot(eRPotName eRPName, const HepGeom::Point3D< double > &PointInDetCS)
Definition: ALFA_GeometryReader.cxx:2740
CFGRPPOSPARAMS::fXOffset
double fXOffset
Definition: ALFA_GeometryReader.h:183
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Point
ChargedTracksWeightFilter::Spline::Point Point
Definition: ChargedTracksWeightFilter.cxx:11
GEOMETRYCONFIGURATION::clear
void clear()
Definition: ALFA_GeometryReader.cxx:72
ReadCondHandle.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
EMT_NOMINAL
@ EMT_NOMINAL
Definition: ALFA_GeometryReader.h:24
CFGRPPOSPARAMS::strODConnString
std::string strODConnString
Definition: ALFA_GeometryReader.h:178
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
CFGRPPOSPARAMS::strMDConnString
std::string strMDConnString
Definition: ALFA_GeometryReader.h:177
CFGRPPOSPARAMS::fCurrentLVDTmm
double fCurrentLVDTmm
Definition: ALFA_GeometryReader.h:180
CFGRPPOSPARAMS::UserTransformOfDetInRPot
HepGeom::Transform3D UserTransformOfDetInRPot
Definition: ALFA_GeometryReader.h:190
ALFA_LocRecODEvCollection
Definition: ALFA_LocRecODEvCollection.h:13
ALFA_LocRecCorr::m_vecTransformInDetectorA7R1L
std::vector< double > m_vecTransformInDetectorA7R1L
Definition: ALFA_LocRecCorr.h:95
ALFA_LocRecCorr::m_vecTransformInStationA7R1U
std::vector< double > m_vecTransformInStationA7R1U
Definition: ALFA_LocRecCorr.h:102
ALFA_LocRecCorrODEvCollection
Definition: ALFA_LocRecCorrODEvCollection.h:13
ALFA_LocRecCorr::m_vecTransformInStationA7L1L
std::vector< double > m_vecTransformInStationA7L1L
Definition: ALFA_LocRecCorr.h:99
ALFA_LocRecCorr::m_bIsTransformInDetector
std::vector< bool > m_bIsTransformInDetector
Definition: ALFA_LocRecCorr.h:79
CFGRPPOSPARAMS::swcorr
struct CFGRPPOSPARAMS::@51 swcorr
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ALFA_LocRecCorr::m_Config
GEOMETRYCONFIGURATION m_Config
Definition: ALFA_LocRecCorr.h:59
CFGRPPOSPARAMS::bIsEnabledUserTranform
bool bIsEnabledUserTranform
Definition: ALFA_GeometryReader.h:188
_USERTRANSFORM::vecTranslation
CLHEP::Hep3Vector vecTranslation
Definition: ALFA_DetectorTool.h:22
ALFA_LocRecCorr::m_strLocRecCollectionName
std::string m_strLocRecCollectionName
Definition: ALFA_LocRecCorr.h:72
ALFA_LocRecCorr::m_vecTransformInStationB7L1U
std::vector< double > m_vecTransformInStationB7L1U
Definition: ALFA_LocRecCorr.h:96
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ALFA_LocRecCorr::m_vecTransformInStationA7R1L
std::vector< double > m_vecTransformInStationA7R1L
Definition: ALFA_LocRecCorr.h:103
ERPPT_ACTIVE
@ ERPPT_ACTIVE
Definition: ALFA_GeometryReader.h:28
ALFA_LocRecCorr::m_pGeometryReader
ALFA_GeometryReader * m_pGeometryReader
Definition: ALFA_LocRecCorr.h:60
ERPN_B7L1U
@ ERPN_B7L1U
Definition: ALFA_GeometryReader.h:27
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
ALFA_LocRecCorr::m_bCoolData
bool m_bCoolData
Definition: ALFA_LocRecCorr.h:69
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
ALFA_LocRecCorr.h
ALFA_LocRecCorrEvent
Definition: ALFA_LocRecCorrEvent.h:8
ALFA_GeometryReader::Initialize
bool Initialize(const PGEOMETRYCONFIGURATION pConfig, eFiberCoordSystem eFCoordSystem)
Definition: ALFA_GeometryReader.cxx:623
ALFA_LocRecCorr::UpdateGeometryAtlas
bool UpdateGeometryAtlas()
Definition: ALFA_LocRecCorr.cxx:595
ALFA_LocRecCorr::ALFA_LocRecCorr
ALFA_LocRecCorr(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ALFA_LocRecCorr.cxx:14
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ERPN_B7L1L
@ ERPN_B7L1L
Definition: ALFA_GeometryReader.h:27
GEOMETRYCONFIGURATION::CfgRPosParams
CFGRPPOSPARAMS CfgRPosParams[RPOTSCNT]
Definition: ALFA_GeometryReader.h:205
ALFA_LocRecCorr::m_pointTransformInDetectorB7R1U
std::vector< double > m_pointTransformInDetectorB7R1U
Definition: ALFA_LocRecCorr.h:84
ALFA_LocRecCorr::m_pointTransformInDetectorB7L1L
std::vector< double > m_pointTransformInDetectorB7L1L
Definition: ALFA_LocRecCorr.h:81
ALFA_LocRecCorr::COOLUpdate
StatusCode COOLUpdate()
Definition: ALFA_LocRecCorr.cxx:561
AthAlgorithm
Definition: AthAlgorithm.h:47
CFGRPPOSPARAMS::usercorr
struct CFGRPPOSPARAMS::@52 usercorr
ALFA_LocRecCorr::m_TransMatrixSt
HepGeom::Transform3D m_TransMatrixSt[RPOTSCNT]
Definition: ALFA_LocRecCorr.h:116
ERPN_A7R1L
@ ERPN_A7R1L
Definition: ALFA_GeometryReader.h:27
ALFA_LocRecCorr::m_iEvt
Int_t m_iEvt
Definition: ALFA_LocRecCorr.h:76
GEOMETRYCONFIGURATION::eRPMetrologyGeoType
int eRPMetrologyGeoType
Definition: ALFA_GeometryReader.h:197
ALFA_LocRecEvCollection
Definition: ALFA_LocRecEvCollection.h:13
ALFA_GeometryReader::GetDetPointInAtlas
HepGeom::Point3D< double > GetDetPointInAtlas(eRPotName eRPName, const HepGeom::Point3D< double > &PointInDetCS)
Definition: ALFA_GeometryReader.cxx:2714
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ALFA_LocRecCorr::m_vecTransformInDetectorA7R1U
std::vector< double > m_vecTransformInDetectorA7R1U
Definition: ALFA_LocRecCorr.h:94
ChargedTracksWeightFilter::Spline::Point
Linear spline representation of a function used to calculate weights.
Definition: ChargedTracksWeightFilter.h:28
errorcheck.h
Helpers for checking error return status codes and reporting errors.
ALFA_LocRecCorr::m_vecTransformInDetectorB7L1U
std::vector< double > m_vecTransformInDetectorB7L1U
Definition: ALFA_LocRecCorr.h:88
_USERTRANSFORM::fAngle
double fAngle
Definition: ALFA_DetectorTool.h:20
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ALFA_LocRecCorr::m_strKeyLocRecCorrODEvCollection
std::string m_strKeyLocRecCorrODEvCollection
Definition: ALFA_LocRecCorr.h:109
ALFA_LocRecCorr::SetNominalGeometry
void SetNominalGeometry()
Definition: ALFA_LocRecCorr.cxx:616
ALFA_LocRecCorr::m_vecTransformInDetectorA7L1L
std::vector< double > m_vecTransformInDetectorA7L1L
Definition: ALFA_LocRecCorr.h:91
ALFA_LocRecCorr::m_pointTransformInDetectorA7L1L
std::vector< double > m_pointTransformInDetectorA7L1L
Definition: ALFA_LocRecCorr.h:83
CFGRPPOSPARAMS::UserOriginOfDetTransInRPot
HepGeom::Point3D< double > UserOriginOfDetTransInRPot
Definition: ALFA_GeometryReader.h:189
ALFA_LocRecCorr::m_ListExistingRPots
std::list< eRPotName > m_ListExistingRPots
Definition: ALFA_LocRecCorr.h:70
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
SG::ReadCondHandleKey< CondAttrListCollection >
CFGRPPOSPARAMS::eODGeoType
int eODGeoType
Definition: ALFA_GeometryReader.h:176
ERPN_A7R1U
@ ERPN_A7R1U
Definition: ALFA_GeometryReader.h:27
ALFA_LocRecCorr::m_vecTransformInDetectorA7L1U
std::vector< double > m_vecTransformInDetectorA7L1U
Definition: ALFA_LocRecCorr.h:90
ALFA_GeometryReader::GetListOfExistingRPotIDs
void GetListOfExistingRPotIDs(std::list< eRPotName > *pListRPotName)
Definition: ALFA_GeometryReader.cxx:1818
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
ALFA_LocRecCorr::m_pLocRecCorrODEvCollection
ALFA_LocRecCorrODEvCollection * m_pLocRecCorrODEvCollection
Definition: ALFA_LocRecCorr.h:67
EFCS_ATLAS
@ EFCS_ATLAS
Definition: ALFA_GeometryReader.h:29
CFGRPPOSPARAMS::eRPPosType
int eRPPosType
Definition: ALFA_GeometryReader.h:174
_USERTRANSFORM
Definition: ALFA_DetectorTool.h:18
ALFA_LocRecCorr::m_pointTransformInDetectorB7L1U
std::vector< double > m_pointTransformInDetectorB7L1U
Definition: ALFA_LocRecCorr.h:80
ALFA_LocRecCorr::m_strKeyLocRecEvCollection
std::string m_strKeyLocRecEvCollection
Definition: ALFA_LocRecCorr.h:106
GEOMETRYCONFIGURATION::bShiftToX97Pos
bool bShiftToX97Pos
Definition: ALFA_GeometryReader.h:199
ALFA_LocRecCorr::m_pointTransformInDetectorA7R1L
std::vector< double > m_pointTransformInDetectorA7R1L
Definition: ALFA_LocRecCorr.h:87
CFGRPPOSPARAMS::UserTransformOfRPInStation
HepGeom::Transform3D UserTransformOfRPInStation
Definition: ALFA_GeometryReader.h:191
ALFA_LocRecCorr::m_bIsTransformInStation
std::vector< bool > m_bIsTransformInStation
Definition: ALFA_LocRecCorr.h:78
ALFA_LocRecCorr::m_iDataType
Int_t m_iDataType
Definition: ALFA_LocRecCorr.h:75
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
GEOMETRYCONFIGURATION::strRPMetrologyConnString
std::string strRPMetrologyConnString
Definition: ALFA_GeometryReader.h:198
ERPN_A7L1L
@ ERPN_A7L1L
Definition: ALFA_GeometryReader.h:27
ALFA_LocRecCorr::m_strLocRecODCollectionName
std::string m_strLocRecODCollectionName
Definition: ALFA_LocRecCorr.h:73
ALFA_LocRecCorr::m_vecTransformInStationA7L1U
std::vector< double > m_vecTransformInStationA7L1U
Definition: ALFA_LocRecCorr.h:98
ALFA_LocRecCorr::Point3DInDetector
HepGeom::Point3D< double > Point3DInDetector(eRPotName eRPName)
Definition: ALFA_LocRecCorr.cxx:468
ALFA_LocRecCorr::m_vecTransformInStationB7R1L
std::vector< double > m_vecTransformInStationB7R1L
Definition: ALFA_LocRecCorr.h:101
CFGRPPOSPARAMS::eMDGeoType
int eMDGeoType
Definition: ALFA_GeometryReader.h:175
ALFA_LocRecCorr::~ALFA_LocRecCorr
~ALFA_LocRecCorr()
Definition: ALFA_LocRecCorr.cxx:172
ALFA_LocRecCorr::m_vecTransformInDetectorB7L1L
std::vector< double > m_vecTransformInDetectorB7L1L
Definition: ALFA_LocRecCorr.h:89
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37