ATLAS Offline Software
ALFA_GeometryReader.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 
8 #include "GaudiKernel/MsgStream.h"
11 
12 #include <CLHEP/Matrix/Matrix.h>
13 #include <CLHEP/Matrix/Vector.h>
14 
18 
19 #include <cstdlib>
20 #include <cstdio>
21 #include <fstream>
22 #include <algorithm>
23 #include <cmath>
24 
26 {
27  IdealRPPin1=RealRPPin1=HepGeom::Point3D<double>();
28  IdealRPPin2=RealRPPin2=HepGeom::Point3D<double>();
29  IdealRPPin3=RealRPPin3=HepGeom::Point3D<double>();
30  DTPInAlfaCS=HepGeom::Point3D<double>();
31  DTPInRPotCS=HepGeom::Point3D<double>();
32  DTPInAtlasCS=HepGeom::Point3D<double>();
33 }
34 
36 {
37  memset(szLabel,0,sizeof(szLabel));
38  IdealMainPoint=HepGeom::Point3D<double>();
39  ShiftE=HepGeom::Vector3D<double>();
40  ShiftS=HepGeom::Vector3D<double>();
43 }
44 
46 {
47  memset(szLabel,0,sizeof(szLabel));
48  IdealRefPoint=HepGeom::Point3D<double>();
49  IdealMainPoint=HepGeom::Point3D<double>();
50  IdealMainPointInStation=HepGeom::Point3D<double>();
51 
52  VecIdealRPRefPoints.clear();
53  VecRealRPRefPoints.clear();
57 
58  VecIdealDetRefPoints.clear();
59  VecRealDetRefPoints.clear();
63 
64  bIsLow=false;
66  fCurrentLVDTmm=0.0;
67  DetectorNormal=HepGeom::Vector3D<double>();
68 
69  RefPins.clear();
70 }
71 
73 {
75  strRPMetrologyConnString=std::string("");
76  bShiftToX97Pos=false;
77 
82 
83  for(int i=0;i<RPOTSCNT;i++){
87  CfgRPosParams[i].strMDConnString=std::string("");
88  CfgRPosParams[i].strODConnString=std::string("");
89 
91 
95 
97  CfgRPosParams[i].usercorr.UserOriginOfDetTransInRPot=HepGeom::Point3D<double>();
100  }
101 }
102 
103 const HepGeom::Point3D<double> ALFA_GeometryReader::ms_NominalRPPin1=HepGeom::Point3D<double>(+77.5*CLHEP::mm,+172.2*CLHEP::mm,-124.0*CLHEP::mm);
104 const HepGeom::Point3D<double> ALFA_GeometryReader::ms_NominalRPMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm,31.525*CLHEP::mm,8.0*CLHEP::mm);//31.025
105 const HepGeom::Point3D<double> ALFA_GeometryReader::ms_NominalAlfaRefPoint=HepGeom::Point3D<double>(-77.5*CLHEP::mm,-35.2*CLHEP::mm,114.0*CLHEP::mm);//-35.7
106 const HepGeom::Point3D<double> ALFA_GeometryReader::ms_NominalDetPin1=HepGeom::Point3D<double>(-77.5*CLHEP::mm,-35.0*CLHEP::mm,114.0*CLHEP::mm);
107 
108 
109 void ALFA_GeometryReader::TransformFiberPositions(PFIBERPARAMS pFiberParams,eRPotName eRPName, const eFiberType eType, const eGeoSourceType eSourceType)
110 {
111  switch(m_eFCoordSystem)
112  {
113  case EFCS_CLADDING:
114  TransformFiberPositionsFCSCladding(pFiberParams, eRPName, eType, eSourceType);
115  break;
116  case EFCS_ATLAS:
117  TransformFiberPositionsFCSAtlas(pFiberParams, eRPName, eType, eSourceType);
118  break;
119  default:
120  break;
121  }
122 }
123 
125 {
126  static constexpr std::array<double,10> ALFA_stagger{0.0, 0.283, -0.141, 0.141, -0.283, 0.354, -0.071, 0.212, -0.212, 0.071};
127  static constexpr std::array<double,3> OD_stagger{0.0, -0.167, -0.334};
128  static constexpr double fSCY=-126.3765+0.0045;
129 
130  static constexpr double fSCY_ODFiberU=-106.333;
131  static constexpr double fSCY_ODFiberV=-113.833;
132 
133  static constexpr double fSCX_ODFiber00=-23.00;
134  static constexpr double fSCX_ODFiber01=+23.00;
135 
136  double fStagger=0.0;
137 
138  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::TransformFiberPositionsFCSCladding");
139 
140  switch(eType)
141  {
142  case EFT_UFIBER:
143  case EFT_VFIBER:
144  if(pFiberParams->nPlateID<1 || pFiberParams->nPlateID>10){
145  LogStream<<MSG::ERROR<<"(EFT_VFIBER): Wrong PlateID "<<pFiberParams->nPlateID<<" (RP no."<<eRPName<<")"<<endmsg;
146  return;
147  } else {
148  fStagger=ALFA_stagger[pFiberParams->nPlateID-1]*CLHEP::mm;
149  }
150  break;
151  case EFT_ODFIBERU0:
152  case EFT_ODFIBERU1:
153  case EFT_ODFIBERV0:
154  case EFT_ODFIBERV1:
155  if(const auto i = pFiberParams->nPlateID; (i<1) || (i>3)){
156  LogStream<<MSG::ERROR<<"(EFT_ODFIBERV1): Wrong ODPlateID "<<i<<" (RP no."<<eRPName<<")"<<endmsg;
157  return;
158  } else {
159  fStagger=OD_stagger[i-1]*CLHEP::mm;
160  }
161  break;
162  default:
163  break;
164  }
165 
166  switch(eSourceType){
167  case EGST_IDEALGEOMETRY:
168  if(eType==EFT_VFIBER){
169  pFiberParams->fcs_cladding.fAngle=(+90*CLHEP::deg-atan(pFiberParams->fSlope))-(+45*CLHEP::deg);
170  pFiberParams->fcs_cladding.fCentreXPos=(+15.75-0.5*(pFiberParams->nFiberID-1))*CLHEP::mm;
171 
172  //adjust fiber offset
173  pFiberParams->fOffset=-1.414213562*pFiberParams->fcs_cladding.fCentreXPos+fSCY-fStagger;
174  }
175  if(eType==EFT_UFIBER){
176  pFiberParams->fcs_cladding.fAngle=(-90*CLHEP::deg-atan(pFiberParams->fSlope))-(-45*CLHEP::deg);
177  pFiberParams->fcs_cladding.fCentreXPos=(+15.75-0.5*(pFiberParams->nFiberID-1))*CLHEP::mm;
178 
179  //adjust fiber offset
180  pFiberParams->fOffset=+1.414213562*pFiberParams->fcs_cladding.fCentreXPos+fSCY+fStagger;
181  }
182  if(eType==EFT_ODFIBERV0)
183  {
184  pFiberParams->fcs_cladding.fAngle=0*CLHEP::deg;
185  pFiberParams->fcs_cladding.fCentreYPos=(-29.75+0.5*(pFiberParams->nFiberID-1))*CLHEP::mm;
186 
187  //adjust fiber offset
188  pFiberParams->fOffset=pFiberParams->fcs_cladding.fCentreYPos+fSCY_ODFiberV+fStagger;
189  }
190  if(eType==EFT_ODFIBERU0)
191  {
192  pFiberParams->fcs_cladding.fAngle=0*CLHEP::deg;
193  pFiberParams->fcs_cladding.fCentreYPos=(-29.75+0.5*(pFiberParams->nFiberID-16))*CLHEP::mm;
194 
195  //adjust fiber offset
196  pFiberParams->fOffset=pFiberParams->fcs_cladding.fCentreYPos+fSCY_ODFiberU+fStagger;
197  }
198  if(eType==EFT_ODFIBERU1)
199  {
200  pFiberParams->fcs_cladding.fAngle=0*CLHEP::deg;
201  pFiberParams->fcs_cladding.fCentreYPos=(-29.75+0.5*(pFiberParams->nFiberID-16))*CLHEP::mm;
202 
203  //adjust fiber offset
204  pFiberParams->fOffset=pFiberParams->fcs_cladding.fCentreYPos+fSCY_ODFiberU+fStagger;
205  }
206  if (eType==EFT_ODFIBERV1)
207  {
208  pFiberParams->fcs_cladding.fAngle=0*CLHEP::deg;
209  //1.10.2010 LN: change of indexation scheme
210  //pFiberParams->fcs_cladding.fCentreYPos=(-22.75-0.5*(pFiberParams->nFiberID-16))*CLHEP::mm;
211  pFiberParams->fcs_cladding.fCentreYPos=(-29.75+0.5*(pFiberParams->nFiberID-1))*CLHEP::mm;
212 
213  //adjust fiber offset
214  pFiberParams->fOffset=pFiberParams->fcs_cladding.fCentreYPos+fSCY_ODFiberV+fStagger;
215  }
216  break;
217  case EGST_FILE:
218  case EGST_DATABASE:
219  if(eType==EFT_VFIBER){
220  //Geant4: pFiberParams->fAngle=(+90*deg-atan(pFiberParams->fSlope))-(+45*deg);
221  pFiberParams->fcs_cladding.fAngle=(+90*CLHEP::deg-atan(pFiberParams->fSlope))-(+45*CLHEP::deg);
222  pFiberParams->fcs_cladding.fCentreXPos=1.414213562*((fStagger+fSCY-pFiberParams->fOffset)/(pFiberParams->fSlope+1)-fStagger);
223  }
224  if(eType==EFT_UFIBER){
225  //Geant4: pFiberParams->fAngle=(-90*deg-atan(pFiberParams->fSlope))-(-45*deg);
226  pFiberParams->fcs_cladding.fAngle=(-90*CLHEP::deg-atan(pFiberParams->fSlope))-(-45*CLHEP::deg);
227  pFiberParams->fcs_cladding.fCentreXPos=1.414213562*((-fStagger+fSCY-pFiberParams->fOffset)/(pFiberParams->fSlope-1)-fStagger);
228  }
229  if(eType==EFT_ODFIBERV0)
230  {
231  pFiberParams->fcs_cladding.fAngle=atan(pFiberParams->fSlope);
232  pFiberParams->fcs_cladding.fCentreYPos=pFiberParams->fSlope*fSCX_ODFiber00+pFiberParams->fOffset-fSCY_ODFiberV-fStagger;
233  }
234  if(eType==EFT_ODFIBERV1)
235  {
236  pFiberParams->fcs_cladding.fAngle=(-1)*atan(pFiberParams->fSlope);
237  pFiberParams->fcs_cladding.fCentreYPos=pFiberParams->fSlope*fSCX_ODFiber01+pFiberParams->fOffset-fSCY_ODFiberV-fStagger;
238  }
239  if(eType==EFT_ODFIBERU0)
240  {
241  pFiberParams->fcs_cladding.fAngle=atan(pFiberParams->fSlope);
242  pFiberParams->fcs_cladding.fCentreYPos=pFiberParams->fSlope*fSCX_ODFiber00+pFiberParams->fOffset-fSCY_ODFiberU-fStagger;
243  }
244  if(eType==EFT_ODFIBERU1)
245  {
246  pFiberParams->fcs_cladding.fAngle=(-1)*atan(pFiberParams->fSlope);
247  pFiberParams->fcs_cladding.fCentreYPos=pFiberParams->fSlope*fSCX_ODFiber01+pFiberParams->fOffset-fSCY_ODFiberU-fStagger;
248  }
249  break;
250  default:
251  break;
252  }
253 }
254 
256 {
257  HepGeom::Transform3D TotTrans;
258  RPPOSPARAMS RPPosParams;
259  ASPOSPARAMS ASPosParams;
260  GetRPPosParams(&RPPosParams, eRPName);
261  GetASPosParams(&ASPosParams, RPPosParams.eASName);
262  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::TransformFiberPositionsFCSAtlas");
263  static constexpr std::array<double,10> MD_stagger{0.0, 0.283, -0.141, 0.141, -0.283, 0.354, -0.071, 0.212, -0.212, 0.071};
264  static constexpr std::array<double,3> OD_stagger{0.0, -0.167, -0.334};
265  static constexpr double fSCY=-126.3765+0.0045;
266 
267  static constexpr double fSCY_ODFiberU=-106.333;
268  static constexpr double fSCY_ODFiberV=-113.833;
269 
270  double fCentrePos=0.0, fZOffset=0.0;
271  double fStagger=0.0;
272 
273  switch(eType)
274  {
275  case EFT_VFIBER:
276  case EFT_UFIBER:
277  fStagger=MD_stagger[pFiberParams->nPlateID-1]*CLHEP::mm;
278 
279  if(eSourceType==EGST_IDEALGEOMETRY){
280  if(eType==EFT_VFIBER){
281  fCentrePos=(+15.75-0.5*(pFiberParams->nFiberID-1))*CLHEP::mm;
282  pFiberParams->fOffset=-1.414213562*fCentrePos+fSCY-fStagger;
283  }
284  else if(eType==EFT_UFIBER){
285  fCentrePos=(+15.75-0.5*(pFiberParams->nFiberID-1))*CLHEP::mm;
286  pFiberParams->fOffset=+1.414213562*fCentrePos+fSCY+fStagger;
287  }
288  }
289 
290  if(!RPPosParams.bIsLow) fZOffset=(pFiberParams->nLayerID-1)*CLHEP::mm;
291  else fZOffset=-(pFiberParams->nLayerID-1)*CLHEP::mm;
292 
293  break;
294  case EFT_ODFIBERV0:
295  case EFT_ODFIBERV1:
296  if(const auto i = pFiberParams->nPlateID; (i<1) || (i>3)){
297  LogStream<<MSG::ERROR<<"(EFT_ODFIBERV1): Wrong ODPlateID "<<i<<" (RP no."<<eRPName<<")"<<endmsg;
298  return;
299  } else {
300  fStagger=OD_stagger[i-1]*CLHEP::mm;
301  }
302 
303 
304  if(eSourceType==EGST_IDEALGEOMETRY){
305  if(eType==EFT_ODFIBERV0){
306  fCentrePos=(-29.75+0.5*(pFiberParams->nFiberID-1))*CLHEP::mm;
307  pFiberParams->fOffset=fCentrePos+fSCY_ODFiberV+fStagger;
308  }
309  else if(eType==EFT_ODFIBERV1){
310  fCentrePos=(-29.75+0.5*(pFiberParams->nFiberID-1))*CLHEP::mm;
311  pFiberParams->fOffset=fCentrePos+fSCY_ODFiberV+fStagger;
312  }
313  }
314 
315  if(!RPPosParams.bIsLow) fZOffset=2*(pFiberParams->nPlateID-1)*CLHEP::mm+33.65*CLHEP::mm;
316  else fZOffset=-2*(pFiberParams->nPlateID-1)*CLHEP::mm-33.65*CLHEP::mm;
317  break;
318  case EFT_ODFIBERU0:
319  case EFT_ODFIBERU1:{
320  if(const auto i = pFiberParams->nPlateID; (i<1) || (i>3)){
321  LogStream<<MSG::ERROR<<"(EFT_ODFIBERU1): Wrong ODPlateID "<<i<<" (RP no."<<eRPName<<")"<<endmsg;
322  return;
323  } else {
324  fStagger=OD_stagger[i-1]*CLHEP::mm;
325  }
326 
327  if(eSourceType==EGST_IDEALGEOMETRY){
328  if(eType==EFT_ODFIBERU0){
329  fCentrePos=(-29.75+0.5*(pFiberParams->nFiberID-16))*CLHEP::mm;
330  pFiberParams->fOffset=fCentrePos+fSCY_ODFiberU+fStagger;
331  }
332  else if(eType==EFT_ODFIBERU1){
333  fCentrePos=(-29.75+0.5*(pFiberParams->nFiberID-16))*CLHEP::mm;
334  pFiberParams->fOffset=fCentrePos+fSCY_ODFiberU+fStagger;
335  }
336  }
337 
338  if(!RPPosParams.bIsLow) fZOffset=2*(pFiberParams->nPlateID-1)*CLHEP::mm+32.35*CLHEP::mm;
339  else fZOffset=-2*(pFiberParams->nPlateID-1)*CLHEP::mm-32.35*CLHEP::mm;
340  break;
341  }
342  default:
343  break;
344  }
345 
346  HepGeom::Point3D<double> DetFiberPoint1, DetFiberPoint2, DetPin1Point;
347  HepGeom::Point3D<double> AtlFiberPoint1, AtlFiberPoint2, AtlDetPin1Point;
348  HepGeom::Point3D<double> AtlProjFiberPoint1, AtlProjFiberPoint2;
349 
350  DetPin1Point=HepGeom::Point3D<double>(0.0,0.0,0.0);
351  DetFiberPoint1=HepGeom::Point3D<double>(0.0,pFiberParams->fOffset,(RPPosParams.bIsLow)? -fZOffset:+fZOffset);
352  DetFiberPoint2=HepGeom::Point3D<double>(-pFiberParams->fOffset/pFiberParams->fSlope,0.0,(RPPosParams.bIsLow)? -fZOffset:+fZOffset);
353 
354  AtlDetPin1Point=GetDetPointInAtlas(eRPName,AtlDetPin1Point);
355  AtlFiberPoint1=GetDetPointInAtlas(eRPName,DetFiberPoint1);
356  AtlFiberPoint2=GetDetPointInAtlas(eRPName,DetFiberPoint2);
357 
358  AtlProjFiberPoint1=HepGeom::Point3D<double>(AtlFiberPoint1[0],AtlFiberPoint1[1],AtlDetPin1Point[2]+fZOffset);
359  AtlProjFiberPoint2=HepGeom::Point3D<double>(AtlFiberPoint2[0],AtlFiberPoint2[1],AtlDetPin1Point[2]+fZOffset);
360 
361  double fx2=AtlProjFiberPoint1[0]+AtlProjFiberPoint1[1]*(AtlProjFiberPoint2[0]-AtlProjFiberPoint1[0])/(AtlProjFiberPoint1[1]-AtlProjFiberPoint2[1]);
362  double fy1=AtlProjFiberPoint1[1]+AtlProjFiberPoint1[0]*(AtlProjFiberPoint2[1]-AtlProjFiberPoint1[1])/(AtlProjFiberPoint1[0]-AtlProjFiberPoint2[0]);
363 
364  pFiberParams->fcs_atlas.fSlope=-fy1/fx2;
365  pFiberParams->fcs_atlas.fOffset=fy1;
366  pFiberParams->fcs_atlas.fZPos=AtlDetPin1Point[2]+fZOffset;
367 
368  //add full space parameters
369  HepGeom::Vector3D<double> DirVector=AtlFiberPoint2-AtlFiberPoint1;
370 
371  pFiberParams->fcs_atlas_full.fOriginX=AtlFiberPoint1[0];
372  pFiberParams->fcs_atlas_full.fOriginY=AtlFiberPoint1[1];
373  pFiberParams->fcs_atlas_full.fOriginZ=AtlFiberPoint1[2];
374  pFiberParams->fcs_atlas_full.fDirX=DirVector[0]/DirVector.mag();
375  pFiberParams->fcs_atlas_full.fDirY=DirVector[1]/DirVector.mag();
376  pFiberParams->fcs_atlas_full.fDirZ=DirVector[2]/DirVector.mag();
377 
378 
379 }
380 
381 
383 {
384  RPPOSPARAMS RPPosParams;
385  ASPOSPARAMS ASPosParams;
386 
387  m_MapRPot.clear();
388  m_RPPosParams.clear();
389  m_ListExistingRPots.clear();
390 
391  double fYOffset;
392 
393  // ALFA Station positions
394  //B7L1
395  ASPosParams.clear();
396  strcpy(ASPosParams.szLabel,"B7L1");
397  ASPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm,0.0*CLHEP::mm,pConfig->fNominalZPosB7L1+10.0*CLHEP::mm); //241538.0
398  ASPosParams.ASTransformInATLAS=HepGeom::Translate3D(0.0*CLHEP::mm,0.0*CLHEP::mm,ASPosParams.IdealMainPoint[2]);
399  m_ASPosParams.insert(std::pair<eAStationName,ASPOSPARAMS>(EASN_B7L1,ASPosParams));
400  //A7L1
401  ASPosParams.clear();
402  strcpy(ASPosParams.szLabel,"A7L1");
403  ASPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm,0.0*CLHEP::mm,pConfig->fNominalZPosA7L1+10.0*CLHEP::mm); //237398.0
404  ASPosParams.ASTransformInATLAS=HepGeom::Translate3D(0.0*CLHEP::mm,0.0*CLHEP::mm,ASPosParams.IdealMainPoint[2]);
405  m_ASPosParams.insert(std::pair<eAStationName,ASPOSPARAMS>(EASN_A7L1,ASPosParams));
406  //A7R1
407  ASPosParams.clear();
408  strcpy(ASPosParams.szLabel,"A7R1");
409  ASPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm,0.0*CLHEP::mm,pConfig->fNominalZPosA7R1+10.0*CLHEP::mm); //-237398 (old:-237418.0)
410  ASPosParams.ASTransformInATLAS=HepGeom::Translate3D(0.0*CLHEP::mm,0.0*CLHEP::mm,ASPosParams.IdealMainPoint[2]);
411  m_ASPosParams.insert(std::pair<eAStationName,ASPOSPARAMS>(EASN_A7R1,ASPosParams));
412  //B7R1
413  ASPosParams.clear();
414  strcpy(ASPosParams.szLabel,"B7R1");
415  ASPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm,0.0*CLHEP::mm,pConfig->fNominalZPosB7R1+10.0*CLHEP::mm); //-241538 (old:-241558.0)
416  ASPosParams.ASTransformInATLAS=HepGeom::Translate3D(0.0*CLHEP::mm,0.0*CLHEP::mm,ASPosParams.IdealMainPoint[2]);
417  m_ASPosParams.insert(std::pair<eAStationName,ASPOSPARAMS>(EASN_B7R1,ASPosParams));
418 
419  // Roma Pot positions
420  //B7L1U -1 --------------------------------------------
421  RPPosParams.clear();
422  strcpy(RPPosParams.szLabel,"B7L1U");
423  RPPosParams.eASName=EASN_B7L1;
424  RPPosParams.bIsLow=false;
426  RPPosParams.IdealRefPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, 136.5*CLHEP::mm, m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2]-10.0*CLHEP::mm); //241528.0
427  RPPosParams.IdealMainPointInStation=HepGeom::Point3D<double>(0.0*CLHEP::mm, (29.525+fYOffset)*CLHEP::mm,18.0*CLHEP::mm);
428  RPPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, (29.525+fYOffset)*CLHEP::mm, RPPosParams.IdealRefPoint[2]+18.0*CLHEP::mm);
429  RPPosParams.RPIdealTransformInStation=HepGeom::Translate3D(RPPosParams.IdealMainPoint[0]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[0],
430  RPPosParams.IdealMainPoint[1]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[1],
431  RPPosParams.IdealMainPoint[2]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2])*HepGeom::RotateX3D(RPPosParams.bIsLow? 180*CLHEP::deg:0*CLHEP::deg);
432  //RPPosParams.RPTransformInStation=RPPosParams.RPIdealTransformInStation;
438  RPPosParams.RefPins.IdealRPPin1=HepGeom::Point3D<double>(+77.5*CLHEP::mm,+172.2*CLHEP::mm,-124.0*CLHEP::mm);
439  RPPosParams.RefPins.IdealRPPin2=HepGeom::Point3D<double>(-77.5*CLHEP::mm,+172.2*CLHEP::mm,+124.0*CLHEP::mm);
440  RPPosParams.RefPins.IdealRPPin3=HepGeom::Point3D<double>(-77.5*CLHEP::mm,+172.2*CLHEP::mm,-124.0*CLHEP::mm);
441  RPPosParams.RefPins.DTPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,0.0*CLHEP::mm);
442  RPPosParams.RefPins.DCPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,+10.0*CLHEP::mm);
443  m_RPPosParams.insert(std::pair<eRPotName,RPPOSPARAMS>(ERPN_B7L1U,RPPosParams));
444 
445  //B7L1L -2
446  RPPosParams.clear();
447  strcpy(RPPosParams.szLabel,"B7L1L");
448  RPPosParams.eASName=EASN_B7L1;
449  RPPosParams.bIsLow=true;
451  RPPosParams.IdealRefPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, -136.5*CLHEP::mm, m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2]+10.0*CLHEP::mm); //241548.0
452  RPPosParams.IdealMainPointInStation=HepGeom::Point3D<double>(0.0*CLHEP::mm, -(29.525+fYOffset)*CLHEP::mm,-18.0*CLHEP::mm);
453  RPPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, -(29.525+fYOffset)*CLHEP::mm, RPPosParams.IdealRefPoint[2]-18.0*CLHEP::mm);
454  RPPosParams.RPIdealTransformInStation=HepGeom::Translate3D(RPPosParams.IdealMainPoint[0]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[0],
455  RPPosParams.IdealMainPoint[1]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[1],
456  RPPosParams.IdealMainPoint[2]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2])*HepGeom::RotateX3D(RPPosParams.bIsLow? 180*CLHEP::deg:0*CLHEP::deg);
457  //RPPosParams.RPTransformInStation=RPPosParams.RPIdealTransformInStation;
463  RPPosParams.RefPins.IdealRPPin1=HepGeom::Point3D<double>(+77.5*CLHEP::mm,-172.2*CLHEP::mm,+124.0*CLHEP::mm);
464  RPPosParams.RefPins.IdealRPPin2=HepGeom::Point3D<double>(-77.5*CLHEP::mm,-172.2*CLHEP::mm,-124.0*CLHEP::mm);
465  RPPosParams.RefPins.IdealRPPin3=HepGeom::Point3D<double>(-77.5*CLHEP::mm,-172.2*CLHEP::mm,+124.0*CLHEP::mm);
466  RPPosParams.RefPins.DTPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,0.0*CLHEP::mm);//HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.012*CLHEP::mm,0.0*CLHEP::mm);
467  RPPosParams.RefPins.DCPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,+10.0*CLHEP::mm);
468  m_RPPosParams.insert(std::pair<eRPotName,RPPOSPARAMS>(ERPN_B7L1L,RPPosParams));
469 
470  //A7L1U -3 --------------------------------------------
471  RPPosParams.clear();
472  strcpy(RPPosParams.szLabel,"A7L1U");
473  RPPosParams.eASName=EASN_A7L1;
474  RPPosParams.bIsLow=false;
476  RPPosParams.IdealRefPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, 136.5*CLHEP::mm, m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2]-10.0*CLHEP::mm); //237388.0
477  RPPosParams.IdealMainPointInStation=HepGeom::Point3D<double>(0.0*CLHEP::mm, (29.525+fYOffset)*CLHEP::mm,+18.0*CLHEP::mm);
478  RPPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, (29.525+fYOffset)*CLHEP::mm, RPPosParams.IdealRefPoint[2]+18.0*CLHEP::mm);
479  RPPosParams.RPIdealTransformInStation=HepGeom::Translate3D(RPPosParams.IdealMainPoint[0]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[0],
480  RPPosParams.IdealMainPoint[1]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[1],
481  RPPosParams.IdealMainPoint[2]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2])*HepGeom::RotateX3D(RPPosParams.bIsLow? 180*CLHEP::deg:0*CLHEP::deg);
482  //RPPosParams.RPTransformInStation=RPPosParams.RPIdealTransformInStation;
488  RPPosParams.RefPins.IdealRPPin1=HepGeom::Point3D<double>(+77.5*CLHEP::mm,+172.2*CLHEP::mm,-124.0*CLHEP::mm);
489  RPPosParams.RefPins.IdealRPPin2=HepGeom::Point3D<double>(-77.5*CLHEP::mm,+172.2*CLHEP::mm,+124.0*CLHEP::mm);
490  RPPosParams.RefPins.IdealRPPin3=HepGeom::Point3D<double>(-77.5*CLHEP::mm,+172.2*CLHEP::mm,-124.0*CLHEP::mm);
491  RPPosParams.RefPins.DTPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,0.0*CLHEP::mm);//HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.034*CLHEP::mm,0.0*CLHEP::mm);
492  RPPosParams.RefPins.DCPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,+10.0*CLHEP::mm);
493  m_RPPosParams.insert(std::pair<eRPotName,RPPOSPARAMS>(ERPN_A7L1U,RPPosParams));
494 
495  //A7L1L -4
496  RPPosParams.clear();
497  strcpy(RPPosParams.szLabel,"A7L1L");
498  RPPosParams.eASName=EASN_A7L1;
499  RPPosParams.bIsLow=true;
501  RPPosParams.IdealRefPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, -136.5*CLHEP::mm, m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2]+10.0*CLHEP::mm); //237408.0
502  RPPosParams.IdealMainPointInStation=HepGeom::Point3D<double>(0.0*CLHEP::mm, -(29.525+fYOffset)*CLHEP::mm,-18.0*CLHEP::mm);
503  RPPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, -(29.525+fYOffset)*CLHEP::mm, RPPosParams.IdealRefPoint[2]-18.0*CLHEP::mm);
504  RPPosParams.RPIdealTransformInStation=HepGeom::Translate3D(RPPosParams.IdealMainPoint[0]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[0],
505  RPPosParams.IdealMainPoint[1]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[1],
506  RPPosParams.IdealMainPoint[2]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2])*HepGeom::RotateX3D(RPPosParams.bIsLow? 180*CLHEP::deg:0*CLHEP::deg);
507  //RPPosParams.RPTransformInStation=RPPosParams.RPIdealTransformInStation;
513  RPPosParams.RefPins.IdealRPPin1=HepGeom::Point3D<double>(+77.5*CLHEP::mm,-172.2*CLHEP::mm,+124.0*CLHEP::mm);
514  RPPosParams.RefPins.IdealRPPin2=HepGeom::Point3D<double>(-77.5*CLHEP::mm,-172.2*CLHEP::mm,-124.0*CLHEP::mm);
515  RPPosParams.RefPins.IdealRPPin3=HepGeom::Point3D<double>(-77.5*CLHEP::mm,-172.2*CLHEP::mm,+124.0*CLHEP::mm);
516  RPPosParams.RefPins.DTPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,0.0*CLHEP::mm);//HepGeom::Point3D<double>(0.0*CLHEP::mm,-134.948*CLHEP::mm,0.0*CLHEP::mm);
517  RPPosParams.RefPins.DCPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,+10.0*CLHEP::mm);
518  m_RPPosParams.insert(std::pair<eRPotName,RPPOSPARAMS>(ERPN_A7L1L,RPPosParams));
519 
520  //A7R1U -5 --------------------------------------------
521  RPPosParams.clear();
522  strcpy(RPPosParams.szLabel,"A7R1U");
523  RPPosParams.eASName=EASN_A7R1;
524  RPPosParams.bIsLow=false;
526  RPPosParams.IdealRefPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, 136.5*CLHEP::mm, m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2]-10.0*CLHEP::mm); //-237408.0
527  RPPosParams.IdealMainPointInStation=HepGeom::Point3D<double>(0.0*CLHEP::mm, (29.525+fYOffset)*CLHEP::mm,+18.0*CLHEP::mm);
528  RPPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, (29.525+fYOffset)*CLHEP::mm, RPPosParams.IdealRefPoint[2]+18.0*CLHEP::mm);
529  RPPosParams.RPIdealTransformInStation=HepGeom::Translate3D(RPPosParams.IdealMainPoint[0]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[0],
530  RPPosParams.IdealMainPoint[1]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[1],
531  RPPosParams.IdealMainPoint[2]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2])*HepGeom::RotateX3D(RPPosParams.bIsLow? 180*CLHEP::deg:0*CLHEP::deg);
532  //RPPosParams.RPTransformInStation=RPPosParams.RPIdealTransformInStation;
538  RPPosParams.RefPins.IdealRPPin1=HepGeom::Point3D<double>(+77.5*CLHEP::mm,+172.2*CLHEP::mm,-124.0*CLHEP::mm);
539  RPPosParams.RefPins.IdealRPPin2=HepGeom::Point3D<double>(-77.5*CLHEP::mm,+172.2*CLHEP::mm,+124.0*CLHEP::mm);
540  RPPosParams.RefPins.IdealRPPin3=HepGeom::Point3D<double>(-77.5*CLHEP::mm,+172.2*CLHEP::mm,-124.0*CLHEP::mm);
541  RPPosParams.RefPins.DTPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,0.0*CLHEP::mm);//HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.08*CLHEP::mm,0.0*CLHEP::mm);
542  RPPosParams.RefPins.DCPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,+10.0*CLHEP::mm);
543  m_RPPosParams.insert(std::pair<eRPotName,RPPOSPARAMS>(ERPN_A7R1U,RPPosParams));
544 
545  //A7R1L -6
546  RPPosParams.clear();
547  strcpy(RPPosParams.szLabel,"A7R1L");
548  RPPosParams.eASName=EASN_A7R1;
549  RPPosParams.bIsLow=true;
551  RPPosParams.IdealRefPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, -136.5*CLHEP::mm, m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2]+10.0*CLHEP::mm); //-237388.0
552  RPPosParams.IdealMainPointInStation=HepGeom::Point3D<double>(0.0*CLHEP::mm, -(29.525+fYOffset)*CLHEP::mm,-18.0*CLHEP::mm);
553  RPPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, -(29.525+fYOffset)*CLHEP::mm, RPPosParams.IdealRefPoint[2]-18.0*CLHEP::mm);
554  RPPosParams.RPIdealTransformInStation=HepGeom::Translate3D(RPPosParams.IdealMainPoint[0]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[0],
555  RPPosParams.IdealMainPoint[1]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[1],
556  RPPosParams.IdealMainPoint[2]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2])*HepGeom::RotateX3D(RPPosParams.bIsLow? 180*CLHEP::deg:0*CLHEP::deg);
557  //RPPosParams.RPTransformInStation=RPPosParams.RPIdealTransformInStation;
563  RPPosParams.RefPins.IdealRPPin1=HepGeom::Point3D<double>(+77.5*CLHEP::mm,-172.2*CLHEP::mm,+124.0*CLHEP::mm);
564  RPPosParams.RefPins.IdealRPPin2=HepGeom::Point3D<double>(-77.5*CLHEP::mm,-172.2*CLHEP::mm,-124.0*CLHEP::mm);
565  RPPosParams.RefPins.IdealRPPin3=HepGeom::Point3D<double>(-77.5*CLHEP::mm,-172.2*CLHEP::mm,+124.0*CLHEP::mm);
566  RPPosParams.RefPins.DTPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,0.0*CLHEP::mm);//HepGeom::Point3D<double>(0.0*CLHEP::mm,-134.995*CLHEP::mm,0.0*CLHEP::mm);
567  RPPosParams.RefPins.DCPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,+10.0*CLHEP::mm);
568  m_RPPosParams.insert(std::pair<eRPotName,RPPOSPARAMS>(ERPN_A7R1L,RPPosParams));
569 
570  //B7R1U -7 --------------------------------------------
571  RPPosParams.clear();
572  strcpy(RPPosParams.szLabel,"B7R1U");
573  RPPosParams.eASName=EASN_B7R1;
574  RPPosParams.bIsLow=false;
576  RPPosParams.IdealRefPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, 136.5*CLHEP::mm, m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2]-10.0*CLHEP::mm); //-241548.0
577  RPPosParams.IdealMainPointInStation=HepGeom::Point3D<double>(0.0*CLHEP::mm, (29.525+fYOffset)*CLHEP::mm,+18.0*CLHEP::mm);
578  RPPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, (29.525+fYOffset)*CLHEP::mm, RPPosParams.IdealRefPoint[2]+18.0*CLHEP::mm);
579  RPPosParams.RPIdealTransformInStation=HepGeom::Translate3D(RPPosParams.IdealMainPoint[0]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[0],
580  RPPosParams.IdealMainPoint[1]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[1],
581  RPPosParams.IdealMainPoint[2]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2])*HepGeom::RotateX3D(RPPosParams.bIsLow? 180*CLHEP::deg:0*CLHEP::deg);
582  //RPPosParams.RPTransformInStation=RPPosParams.RPIdealTransformInStation;
588  RPPosParams.RefPins.IdealRPPin1=HepGeom::Point3D<double>(+77.5*CLHEP::mm,+172.2*CLHEP::mm,-124.0*CLHEP::mm);
589  RPPosParams.RefPins.IdealRPPin2=HepGeom::Point3D<double>(-77.5*CLHEP::mm,+172.2*CLHEP::mm,+124.0*CLHEP::mm);
590  RPPosParams.RefPins.IdealRPPin3=HepGeom::Point3D<double>(-77.5*CLHEP::mm,+172.2*CLHEP::mm,-124.0*CLHEP::mm);
591  RPPosParams.RefPins.DTPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,0.0*CLHEP::mm);//HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.005*CLHEP::mm,0.0*CLHEP::mm);
592  RPPosParams.RefPins.DCPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,+10.0*CLHEP::mm);
593  m_RPPosParams.insert(std::pair<eRPotName,RPPOSPARAMS>(ERPN_B7R1U,RPPosParams));
594 
595  //B7R1L -8
596  RPPosParams.clear();
597  strcpy(RPPosParams.szLabel,"B7R1L");
598  RPPosParams.eASName=EASN_B7R1;
599  RPPosParams.bIsLow=true;
601  RPPosParams.IdealRefPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, -136.5*CLHEP::mm, m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2]+10.0*CLHEP::mm); //-241528.0
602  RPPosParams.IdealMainPointInStation=HepGeom::Point3D<double>(0.0*CLHEP::mm, -(29.525+fYOffset)*CLHEP::mm,-18.0*CLHEP::mm);
603  RPPosParams.IdealMainPoint=HepGeom::Point3D<double>(0.0*CLHEP::mm, -(29.525+fYOffset)*CLHEP::mm, RPPosParams.IdealRefPoint[2]-18.0*CLHEP::mm);
604  RPPosParams.RPIdealTransformInStation=HepGeom::Translate3D(RPPosParams.IdealMainPoint[0]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[0],
605  RPPosParams.IdealMainPoint[1]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[1],
606  RPPosParams.IdealMainPoint[2]-m_ASPosParams[RPPosParams.eASName].IdealMainPoint[2])*HepGeom::RotateX3D(RPPosParams.bIsLow? 180*CLHEP::deg:0*CLHEP::deg);
607  //RPPosParams.RPTransformInStation=RPPosParams.RPIdealTransformInStation;
613  RPPosParams.RefPins.IdealRPPin1=HepGeom::Point3D<double>(+77.5*CLHEP::mm,-172.2*CLHEP::mm,+124.0*CLHEP::mm);
614  RPPosParams.RefPins.IdealRPPin2=HepGeom::Point3D<double>(-77.5*CLHEP::mm,-172.2*CLHEP::mm,-124.0*CLHEP::mm);
615  RPPosParams.RefPins.IdealRPPin3=HepGeom::Point3D<double>(-77.5*CLHEP::mm,-172.2*CLHEP::mm,+124.0*CLHEP::mm);
616  RPPosParams.RefPins.DTPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,0.0*CLHEP::mm);//HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.021*CLHEP::mm,0.0*CLHEP::mm);
617  RPPosParams.RefPins.DCPInAlfaCS=HepGeom::Point3D<double>(0.0*CLHEP::mm,-135.0*CLHEP::mm,+10.0*CLHEP::mm);
618  m_RPPosParams.insert(std::pair<eRPotName,RPPOSPARAMS>(ERPN_B7R1L,RPPosParams));
619 
620  return true;
621 }
622 
624 {
625  int i;
626  bool bRes=true;
627  std::string FilePath;
628  m_eFCoordSystem=eFCoordSystem;
629 
630  if(pConfig!=nullptr)
631  {
632  if(InitializeDefault(pConfig))
633  {
634  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::Initialize");
635  LogStream<<MSG::INFO<<"Metrology type:"<<pConfig->eRPMetrologyGeoType<<endmsg;
636  LogStream<<MSG::INFO<<"Metrology source:"<<pConfig->strRPMetrologyConnString<<endmsg;
637 
638  if(pConfig->bShiftToX97Pos)
639  {
640  m_ASPosParams[EASN_B7L1].ASTransformInATLAS=HepGeom::TranslateX3D(-97.0*CLHEP::mm)*m_ASPosParams[EASN_B7L1].ASTransformInATLAS;
641  m_ASPosParams[EASN_A7L1].ASTransformInATLAS=HepGeom::TranslateX3D(-97.0*CLHEP::mm)*m_ASPosParams[EASN_A7L1].ASTransformInATLAS;
642  m_ASPosParams[EASN_A7R1].ASTransformInATLAS=HepGeom::TranslateX3D(-97.0*CLHEP::mm)*m_ASPosParams[EASN_A7R1].ASTransformInATLAS;
643  m_ASPosParams[EASN_B7R1].ASTransformInATLAS=HepGeom::TranslateX3D(-97.0*CLHEP::mm)*m_ASPosParams[EASN_B7R1].ASTransformInATLAS;
644  }
645 
648  SetupUserCorrections(pConfig);
649  }
650  else if(m_eMetrologyType==EMT_METROLOGY) {
651  SetupCurrentLVDT(pConfig);
652 
654  else FilePath=pConfig->strRPMetrologyConnString;
655  LogStream<<MSG::INFO<<"Metrology data loaded from file "<<FilePath<<endmsg;
656  bRes=ParseRPMetrology(EGST_FILE,FilePath.c_str());
657  if(bRes) {
659  }
660  else return false;
661  }
663  SetupSWCorrections(pConfig);
664  }
666  //do nothing, there will be no shift to regular positions
667  }
668  else{
669  throw GaudiException(" Unknown metrology type ", "ALFA_GeometryReader::Initialize", StatusCode::FAILURE);
670  }
671 
672  for(i=1;i<=RPOTSCNT;i++)
673  {
674  eRPotName eName=(eRPotName)i;
675 
676  if(pConfig->eRPMetrologyGeoType!=EMT_UNDEFINED) UpdateSimRPPos(eName);
677  m_ListExistingRPots.push_back(eName);
678  }
679 
680  }
681  }
682  else
683  {
684  m_ListExistingRPots.push_back(ERPN_B7L1U);
685  m_ListExistingRPots.push_back(ERPN_B7L1L);
686  m_ListExistingRPots.push_back(ERPN_A7L1U);
687  m_ListExistingRPots.push_back(ERPN_A7L1L);
688  m_ListExistingRPots.push_back(ERPN_A7R1U);
689  m_ListExistingRPots.push_back(ERPN_A7R1L);
690  m_ListExistingRPots.push_back(ERPN_B7R1U);
691  m_ListExistingRPots.push_back(ERPN_B7R1L);
692  }
693 
694  //2010-11-04 (LN): ReadGeometry removed and it should be called by user due to SW transformation feature
695  //2012-08-03 (LN): back to call ReadGeometry because user corrections implemented to geometry consfiguration structure
696  //read fiber geometry
697  bRes=ReadFiberGeometry(pConfig);
698 
699  return bRes;
700 }
701 
703 {
704  ASPOSPARAMS Params;
705  eAStationName eASName;
706  HepGeom::Vector3D<double> MeanShift;
707 
708  //EASN_B7L1
709  eASName=EASN_B7L1;
710  GetASPosParams(&Params,eASName);
711  MeanShift=0.5*(Params.ShiftE+Params.ShiftS);
712  m_ASPosParams[eASName].ASTransformInMainPoint=HepGeom::Translate3D(MeanShift);
713 
714  //EASN_A7L1
715  eASName=EASN_A7L1;
716  GetASPosParams(&Params,eASName);
717  MeanShift=0.5*(Params.ShiftE+Params.ShiftS);
718  m_ASPosParams[eASName].ASTransformInMainPoint=HepGeom::Translate3D(MeanShift);
719 
720  //EASN_A7R1
721  eASName=EASN_A7R1;
722  GetASPosParams(&Params,eASName);
723  MeanShift=0.5*(Params.ShiftE+Params.ShiftS);
724  m_ASPosParams[eASName].ASTransformInMainPoint=HepGeom::Translate3D(MeanShift);
725 
726  //EASN_B7R1
727  eASName=EASN_B7R1;
728  GetASPosParams(&Params,eASName);
729  MeanShift=0.5*(Params.ShiftE+Params.ShiftS);
730  m_ASPosParams[eASName].ASTransformInMainPoint=HepGeom::Translate3D(MeanShift);
731 }
732 
734 {
735  int i, nCnt;
736  HepGeom::Transform3D CorrTransform;
737  HepGeom::Scale3D AuxScale;
738  RPPOSPARAMS& Params=m_RPPosParams[eRPName];
739 
740  //MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::UpdateSimRPPos");
741 
742  //correct position of the RP in the station due to metrology data -------------------------------------------------------------------
743  nCnt=Params.VecIdealRPRefPoints.size();
744  HepGeom::Transform3D IdealTransform=Params.RPIdealTransformInStation;
745  if(m_eMetrologyType==EMT_METROLOGY) CorrTransform=ComputeTransformMatrix(Params.VecIdealRPRefPoints,Params.VecRealRPRefPoints, nCnt, AuxScale,true);
746  else CorrTransform=HepGeom::Transform3D();
747 
748  //----------------------------------------------
749  //double fRotZ=atan2(CorrTransform.yx(),CorrTransform.xx());
750  //HepGeom::Transform3D auxTransform=HepGeom::Transform3D(HepRotationZ(fRotZ),CorrTransform.getTranslation());
751  //CorrTransform=auxTransform;
752  //----------------------------------------------
753 
754  //note: SW Corrections are set either via EMT_SWCORRECTIONS flag or by user with EMT_NOMINAL flag
755  m_RPPosParams[eRPName].RPTransformInStation=m_ASPosParams[Params.eASName].ASTransformInMainPoint*CorrTransform*Params.RPSWTransformInStation*IdealTransform;
756  m_RPPosParams[eRPName].RPScaleInStation=AuxScale;
757 
758  m_RPPosParams[eRPName].RefPins.RealRPPin1=CorrTransform*Params.RPSWTransformInStation*m_RPPosParams[eRPName].RefPins.IdealRPPin1;
759  m_RPPosParams[eRPName].RefPins.RealRPPin2=CorrTransform*Params.RPSWTransformInStation*m_RPPosParams[eRPName].RefPins.IdealRPPin2;
760  m_RPPosParams[eRPName].RefPins.RealRPPin3=CorrTransform*Params.RPSWTransformInStation*m_RPPosParams[eRPName].RefPins.IdealRPPin3;
761 
762  HepGeom::Vector3D<double> NominalDetNormal=HepGeom::Vector3D<double>(0.0,0.0,1.0);
763  m_RPPosParams[eRPName].DetectorNormal=m_RPPosParams[eRPName].RPTransformInStation*NominalDetNormal;
764 
765  //correct position of the RP's detector in the RP due to metrology data --------------------------------------------------------------
766  IdealTransform=Params.DetIdealTransformInMainPoint;
767 
768  HepGeom::Point3D<double> RPPin1,MainPoint; //point relative to the station
769 
770  RPPin1=ms_NominalRPPin1;
771  MainPoint=ms_NominalRPMainPoint;
772 
774  nCnt=Params.VecIdealDetRefPoints.size();
775  std::vector<HepGeom::Point3D<double> > VecIdealDetRefPoints(nCnt);
776  std::vector<HepGeom::Point3D<double> > VecRealDetRefPoints(nCnt);
777 
778  for(i=0;i<(int)Params.VecIdealDetRefPoints.size();i++){
779  VecIdealDetRefPoints[i]=m_RPPosParams[eRPName].VecIdealDetRefPoints[i];//+CoordShift;
780  VecRealDetRefPoints[i]=m_RPPosParams[eRPName].VecRealDetRefPoints[i];//+CoordShift;
781  }
782 
783  CorrTransform=ComputeTransformMatrix(VecIdealDetRefPoints,VecRealDetRefPoints, nCnt, AuxScale);
784  }
785  else{
786  CorrTransform=HepGeom::Transform3D();
787  }
788 
789  //recalculate SW transform in MainPoint
790  HepGeom::Vector3D<double> OriginShift=(RPPin1-MainPoint)+Params.OriginOfDetSWTransform;
791  CLHEP::Hep3Vector TranslationInMainPoint=Params.DetSWTransform.getTranslation()-Params.DetSWTransform*OriginShift+OriginShift;
792  CLHEP::HepRotation RotationInMainPoint=Params.DetSWTransform.getRotation();
793  m_RPPosParams[eRPName].DetSWTransformInMainPoint=HepGeom::Transform3D(RotationInMainPoint,TranslationInMainPoint);
794 
795  m_RPPosParams[eRPName].DetTransformInMainPoint=m_RPPosParams[eRPName].DetSWTransformInMainPoint*CorrTransform*IdealTransform;
796  m_RPPosParams[eRPName].RPScaleInStation=AuxScale;
797 
798  m_RPPosParams[eRPName].RefPins.DTPInAtlasCS=GetDetPointInAtlas(eRPName,m_RPPosParams[eRPName].RefPins.DTPInAlfaCS);
799  m_RPPosParams[eRPName].RefPins.DTPInRPotCS=GetDetPointInRPot(eRPName,m_RPPosParams[eRPName].RefPins.DTPInAlfaCS);
800  m_RPPosParams[eRPName].RefPins.DCPInAtlasCS=GetDetPointInAtlas(eRPName,m_RPPosParams[eRPName].RefPins.DCPInAlfaCS);
801  m_RPPosParams[eRPName].RefPins.DCPInRPotCS=GetDetPointInRPot(eRPName,m_RPPosParams[eRPName].RefPins.DCPInAlfaCS);
802 }
803 
804 HepGeom::Transform3D ALFA_GeometryReader::ComputeTransformMatrix(const std::vector<HepGeom::Point3D<double> >& VecIdealRefPoints,const std::vector<HepGeom::Point3D<double> >& VecRealRefPoints, const int nPointCnt,
805  HepGeom::Scale3D& Scale, bool bForceUseSVD)
806 {
807  int i,j;
808  const int N=nPointCnt;
809  CLHEP::HepVector vecAux1,vecAux2;
810  CLHEP::HepVector xmean,ymean,t;
811  CLHEP::HepMatrix C,U,V,R,W;
812  HepGeom::Transform3D TransTot;
813  HepGeom::Rotate3D AuxRot;
814  HepGeom::Translate3D AuxTranslation;
815 
816 
817  if(nPointCnt==3 && !bForceUseSVD)
818  {
819  HepGeom::Transform3D AuxTrans=HepGeom::Transform3D(VecIdealRefPoints[0],VecIdealRefPoints[1],VecIdealRefPoints[2],
820  VecRealRefPoints[0],VecRealRefPoints[1],VecRealRefPoints[2]);
821  AuxTrans.getDecomposition(Scale,AuxRot,AuxTranslation);
822 
823  TransTot=HepGeom::Transform3D(AuxTrans.getRotation(),AuxTrans.getTranslation());
824 
825  }
826  else
827  {
828  std::vector<CLHEP::HepVector> pX (N);
829  std::vector<CLHEP::HepVector> pY (N);
830  std::vector<CLHEP::HepVector> pXs (N);
831  std::vector<CLHEP::HepVector> pYs(N);
832 
833  for(i=0;i<N;i++){
834  pX[i]=CLHEP::Hep3Vector(VecIdealRefPoints[i].x(),VecIdealRefPoints[i].y(),VecIdealRefPoints[i].z());
835  pY[i]=CLHEP::Hep3Vector(VecRealRefPoints[i].x(),VecRealRefPoints[i].y(),VecRealRefPoints[i].z());
836  }
837 
838 
839  vecAux1=CLHEP::Hep3Vector();
840  vecAux2=CLHEP::Hep3Vector();
841  for(i=0;i<N;i++){
842  vecAux1+=pX[i];
843  vecAux2+=pY[i];
844  }
845 
846  xmean=vecAux1/(1.0*N);
847  ymean=vecAux2/(1.0*N);
848 
849  C=CLHEP::HepMatrix(3,3);
850  for(i=0;i<N;i++){
851  pXs[i]=pX[i]-xmean;
852  pYs[i]=pY[i]-ymean;
853  C+=pYs[i]*pXs[i].T();
854  }
855 
856 
857  std::vector<double*> ppfA(3);
858  std::vector<double*> ppfV(3);
859  for(i=0;i<3;i++){
860  ppfA[i]=new double[3];
861  std::fill (ppfA[i], ppfA[i]+3, 0);
862 
863  ppfV[i]=new double[3];
864  std::fill (ppfV[i], ppfV[i]+3, 0);
865  }
866 
867  std::vector<double> pfW (3);
868 
869 
870  for(i=0;i<3;i++){
871  for(j=0;j<3;j++) ppfA[i][j]=(double)C[i][j];
872  }
873 
874  dsvd(ppfA.data(),3,3,pfW.data(),ppfV.data());
875 
876  U=CLHEP::HepMatrix(3,3); V=CLHEP::HepMatrix(3,3);
877  for(i=0;i<3;i++){
878  for(j=0;j<3;j++) U[i][j]=(double)ppfA[i][j];
879  for(j=0;j<3;j++) V[i][j]=(double)ppfV[i][j];
880  }
881 
882  W=CLHEP::HepMatrix(3,3);
883  W[0][0]=1; W[1][1]=1;
884  W[2][2]=(U*V).determinant();
885 
886  R=U*W*V.T();
887  t=ymean-R*xmean;
888 
889 
890  CLHEP::HepRep3x3 matAux;
891  matAux.xx_=R[0][0]; matAux.xy_=R[0][1]; matAux.xz_=R[0][2];
892  matAux.yx_=R[1][0]; matAux.yy_=R[1][1]; matAux.yz_=R[1][2];
893  matAux.zx_=R[2][0]; matAux.zy_=R[2][1]; matAux.zz_=R[2][2];
894  CLHEP::HepRotation TransM=CLHEP::HepRotation(matAux);
895  CLHEP::Hep3Vector TransT=CLHEP::Hep3Vector(t[0],t[1],t[2]);
896  TransTot=HepGeom::Transform3D(TransM,TransT);
897 
898  for(i=0;i<3;i++){
899  delete [] ppfA[i];
900  delete [] ppfV[i];
901  }
902  }
903 
904  return TransTot;
905 }
906 
908 {
909  bool bFailRes=false;
910  int nRPCfgIndex;
911  std::list<eRPotName>::const_iterator iterRPName;
912  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_DetectorReader::ReadGeometry");
913 
914  if(pConfig!=nullptr)
915  {
916  LogStream<<MSG::INFO<<"Number of active or inactive Romain Pots: "<<m_ListExistingRPots.size()<<endmsg;
917 
918  for(iterRPName=m_ListExistingRPots.begin();iterRPName!=m_ListExistingRPots.end();++iterRPName){
919  nRPCfgIndex=((int)(*iterRPName))-1;
920  bFailRes|=!ReadSource((eGeoSourceType)pConfig->CfgRPosParams[nRPCfgIndex].eMDGeoType, *iterRPName, EFT_FIBERMD, pConfig->CfgRPosParams[nRPCfgIndex].strMDConnString.c_str());
921  bFailRes|=!ReadSource((eGeoSourceType)pConfig->CfgRPosParams[nRPCfgIndex].eODGeoType, *iterRPName, EFT_FIBEROD, pConfig->CfgRPosParams[nRPCfgIndex].strODConnString.c_str());
922  }
923  }
924  else //set ideal geometry if pConfig is not provided
925  {
926  for(iterRPName=m_ListExistingRPots.begin();iterRPName!=m_ListExistingRPots.end();++iterRPName){
927  bFailRes|=!ReadSource(EGST_IDEALGEOMETRY, *iterRPName, EFT_FIBERMD, nullptr);
928  bFailRes|=!ReadSource(EGST_IDEALGEOMETRY, *iterRPName, EFT_FIBEROD, nullptr);
929  }
930  }
931 
932  return !bFailRes;
933 }
934 
935 bool ALFA_GeometryReader::ReadSource(const eGeoSourceType eSourceType, const eRPotName eRPName, const eFiberType eFType, const char* szDataSource)
936 {
937  bool bRes=false;
938  int i;
939  std::string strDetType, FilePath, GeomFile;
940  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_DetectorReader::ReadGeometry");
941 
942  if(eFType!=EFT_FIBERMD && eFType!=EFT_FIBEROD) return false;
943 
944  strDetType=(eFType==EFT_FIBERMD)? "MD":"OD";
945 
946  switch(eSourceType){
947  case EGST_IDEALGEOMETRY:
948  LogStream<<MSG::INFO<<"The IDEAL "<<strDetType<<" fiber geometry will be loaded for RP "<<GetRPotLabel(eRPName)<<endmsg;
949  bRes=SetIdealGeometry(eRPName, eFType);
950  break;
951  case EGST_FILE:
952 
953  GeomFile=std::string("geom_")+strDetType+std::string("_")+std::string(GetRPotLabel(eRPName))+std::string(".dat");
954  if(szDataSource==nullptr || !strcmp(szDataSource,"")) FilePath = PathResolver::find_file(GeomFile,"DATAPATH", PathResolver::RecursiveSearch);
955  else FilePath=std::string(szDataSource);
956 
957  LogStream<<MSG::INFO<<"The "<<strDetType<<" fiber geometry will be loaded from FILE "<<FilePath.c_str()<<" for RP "<<GetRPotLabel(eRPName)<<endmsg;
958  bRes=ReadFile(eRPName, eFType, FilePath.c_str());
959  break;
960  case EGST_DATABASE:
961  LogStream<<MSG::INFO<<"The "<<strDetType<<" fiber geometry will be loaded from DATABASE for RP "<<GetRPotLabel(eRPName)<<endmsg;
962  bRes=ReadDatabase(eRPName, eFType, szDataSource);
963  break;
964  default:
965  bRes=false;
966  break;
967  }
968 
969  if(bRes){
970  PLATEPARAMS PlateParams {0, 0};
971  for(i=1;i<=ALFAFIBERSCNT;i++){
972  m_MapRPot[eRPName].MapPlates.insert(std::pair<int,PLATEPARAMS>(i,PlateParams));
973  }
974 
975  for(i=1;i<=ODFIBERSCNT;i++){
976  m_MapRPot[eRPName].MapODPlates.insert(std::pair<int,PLATEPARAMS>(i,PlateParams));
977  }
978 
979  UpdateGeometry();
980  }
981  else
982  {
983  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::ReadSource");
984  LogStream << MSG::FATAL << " Could not load geometry! " << endmsg;
985 
986  throw GaudiException(" Could not load geometry ", "ALFA_GeometryReader::ReadSource", StatusCode::FAILURE);
987  }
988 
989  return bRes;
990 }
991 
993 {
994  if(eFType!=EFT_FIBERMD && eFType!=EFT_FIBEROD) return false;
995 
996  int i,j;
997  bool bRes=true;
998  eFiberType eFiberAlfaType;
999  ROMAPOT RomaPot;
1000 
1001 
1002  if(m_MapRPot.find(eRPName)==m_MapRPot.end())
1003  {
1004  //RP not yet defined
1005  RomaPot.ListUFibers.clear();
1006  RomaPot.ListVFibers.clear();
1007  RomaPot.ListODFibersU0.clear();
1008  RomaPot.ListODFibersU1.clear();
1009  RomaPot.ListODFibersV0.clear();
1010  RomaPot.ListODFibersV1.clear();
1011 
1012  m_MapRPot.insert(std::pair<eRPotName,ROMAPOT>(eRPName,RomaPot));
1013  }
1014 
1015  if(eFType==EFT_FIBERMD) m_MapRPot[eRPName].eMDGeometryType=EGST_IDEALGEOMETRY;
1016  else if(eFType==EFT_FIBEROD) m_MapRPot[eRPName].eODGeometryType=EGST_IDEALGEOMETRY;
1017 
1018  if (eFType==EFT_FIBERMD)
1019  {
1020  for(i=1;i<=ALFALAYERSCNT*ALFAPLATESCNT;i++){
1021  for(j=1;j<=ALFAFIBERSCNT;j++){
1022  FIBERPARAMS FiberParams;
1023 
1024  eFiberAlfaType=(i%2==0)? EFT_VFIBER:EFT_UFIBER;
1025  FiberParams.nLayerID=i;
1026  FiberParams.nFiberID=j;
1027  FiberParams.fSlope=(eFiberAlfaType==EFT_VFIBER)? 1.0:-1.0;
1028  FiberParams.nPlateID=FiberParams.nLayerID/2+FiberParams.nLayerID%2;
1029  TransformFiberPositions(&FiberParams, eRPName, eFiberAlfaType, EGST_IDEALGEOMETRY);
1030 
1031  if(eFiberAlfaType==EFT_UFIBER) m_MapRPot[eRPName].ListUFibers.push_back(FiberParams);
1032  if(eFiberAlfaType==EFT_VFIBER) m_MapRPot[eRPName].ListVFibers.push_back(FiberParams);
1033  }
1034  }
1035  }
1036  else if (eFType==EFT_FIBEROD)
1037  {
1038  for(i=1;i<=ODLAYERSCNT*ODPLATESCNT;i++)
1039  {
1040  for(j=1;j<=ODFIBERSCNT;j++)
1041  {
1042  FIBERPARAMS FiberParams;
1043 
1044  FiberParams.nLayerID=i;
1045  FiberParams.nPlateID=FiberParams.nLayerID/2+FiberParams.nLayerID%2;
1046  FiberParams.fSlope = 0;
1047 
1048  if (i%2==0)
1049  { //for V0 and V1 ODFibers
1050  FiberParams.nFiberID=j;
1051  TransformFiberPositions(&FiberParams, eRPName, EFT_ODFIBERV0, EGST_IDEALGEOMETRY);
1052  m_MapRPot[eRPName].ListODFibersV0.push_back(FiberParams);
1053 
1054  //1.10.2010 LN: change of indexation scheme
1055  FiberParams.nFiberID=j;//j+15;
1056  TransformFiberPositions(&FiberParams, eRPName, EFT_ODFIBERV1, EGST_IDEALGEOMETRY);
1057  m_MapRPot[eRPName].ListODFibersV1.push_back(FiberParams);
1058  }
1059  else if (i%2==1)
1060  { //for U0 and U1 ODFibers
1061  FiberParams.nFiberID=j+15;
1062  TransformFiberPositions(&FiberParams, eRPName, EFT_ODFIBERU0, EGST_IDEALGEOMETRY);
1063  m_MapRPot[eRPName].ListODFibersU0.push_back(FiberParams);
1064 
1065  //1.10.2010 LN: change of indexation scheme
1066  FiberParams.nFiberID=j+15;//j;
1067  TransformFiberPositions(&FiberParams, eRPName, EFT_ODFIBERU1, EGST_IDEALGEOMETRY);
1068  m_MapRPot[eRPName].ListODFibersU1.push_back(FiberParams);
1069  }
1070  }
1071  }
1072  }
1073 
1074  return bRes;
1075 }
1076 
1077 bool ALFA_GeometryReader::ReadFile(const eRPotName eRPName, const eFiberType eFType, const char* szFilename)
1078 {
1079  if(eFType!=EFT_FIBERMD && eFType!=EFT_FIBEROD) return false;
1080 
1081  bool bRes=true;
1082  int i,nLine,nLength;
1083  char szLine[64];
1084  char* pch1, *pch2;
1085  FILE* pFile;
1086  eFiberType eType=EFT_UNDEFINED;
1087  ROMAPOT RomaPot;
1088 
1089  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::ReadFile");
1090 
1091  if(m_MapRPot.find(eRPName)==m_MapRPot.end()){
1092  //RP not yet defined
1093  RomaPot.ListUFibers.clear();
1094  RomaPot.ListVFibers.clear();
1095  RomaPot.ListODFibersU0.clear();
1096  RomaPot.ListODFibersU1.clear();
1097  RomaPot.ListODFibersV0.clear();
1098  RomaPot.ListODFibersV1.clear();
1099 
1100  m_MapRPot.insert(std::pair<eRPotName,ROMAPOT>(eRPName,RomaPot));
1101  }
1102 
1103  if(eFType==EFT_FIBERMD) m_MapRPot[eRPName].eMDGeometryType=EGST_FILE;
1104  else if(eFType==EFT_FIBEROD) m_MapRPot[eRPName].eODGeometryType=EGST_FILE;
1105 
1106  if((pFile=fopen(szFilename,"r"))==nullptr){
1107  LogStream<<MSG::ERROR<< "Could not open the file "<<szFilename<<endmsg;
1108  return false;
1109  }
1110 
1111  nLine=0;
1112  while(!feof(pFile)){
1113  if(fgets(szLine,sizeof(szLine),pFile)!=nullptr){
1114 
1115  FIBERPARAMS FiberParams;
1116 
1117  nLine++;
1118  if(nLine<6) continue;
1119 
1120  nLength=strlen(szLine);
1121 
1122  //1. column - Layer ID
1123  for(i=0;i<nLength;i++) { if(*(szLine+i)==' ') continue; else break; }
1124  pch1=szLine+i;
1125  pch2=strchr(pch1,' ');
1126  if(pch2!=nullptr){
1127  *pch2='\0';
1128  FiberParams.nLayerID=atoi(pch1);
1129  FiberParams.nPlateID=FiberParams.nLayerID/2+FiberParams.nLayerID%2;
1130  }
1131  else{
1132  LogStream<<MSG::ERROR<< "Error at line "<<nLine<<" while reading the data file "<<szFilename<<endmsg;
1133  bRes=false;
1134  break;
1135  }
1136 
1137  //2. column - Fiber ID
1138  pch2++;
1139  for(i=0;i<nLength;i++) { if(*(pch2+i)==' ') continue; else break;}
1140  pch1=pch2+i;
1141  pch2=strchr(pch1,' ');
1142  if(pch2!=nullptr){
1143  *pch2='\0';
1144  FiberParams.nFiberID=atoi(pch1);
1145  }
1146  else{
1147  LogStream<<MSG::ERROR<< "Error at line "<<nLine<<" while reading the data file "<<szFilename<<endmsg;
1148  bRes=false;
1149  break;
1150  }
1151 
1152  //3. column - Slope
1153  pch2++;
1154  for(i=0;i<nLength;i++) { if(*(pch2+i)==' ') continue; else break; }
1155  pch1=pch2+i;
1156  pch2=strchr(pch1,' ');
1157  if(pch2!=nullptr){
1158  *pch2='\0';
1159  FiberParams.fSlope=atof(pch1);
1160  }
1161  else{
1162  LogStream<<MSG::ERROR<< "Error at line "<<nLine<<" while reading the data file "<<szFilename<<endmsg;
1163  bRes=false;
1164  break;
1165  }
1166 
1167  //4. column - Offset
1168  pch2++;
1169  for(i=0;i<nLength;i++) { if(*(pch2+i)==' ') continue; else break; }
1170  pch1=pch2+i;
1171  pch2=strchr(pch1,' ');
1172  if(pch2!=nullptr){
1173  *pch2='\0';
1174  FiberParams.fOffset=atof(pch1);
1175  }
1176  else{
1177  LogStream<<MSG::ERROR<< "Error at line "<<nLine<<" while reading the data file "<<szFilename<<endmsg;
1178  bRes=false;
1179  break;
1180  }
1181 
1182  //5. column - Z position
1183  pch2++;
1184  for(i=0;i<nLength;i++) { if(*(pch2+i)==' ') continue; else break; }
1185  pch1=pch2+i;
1186  FiberParams.fZPos=atof(pch1);
1187 
1188  //Resolve fiber type
1189  if(eFType==EFT_FIBERMD)
1190  {
1191  eType=(FiberParams.fSlope<0)? EFT_UFIBER:EFT_VFIBER;
1192  }
1193  else if(eFType==EFT_FIBEROD)
1194  {
1195  if(FiberParams.nLayerID%2==1 && FiberParams.nFiberID<=15) eType=EFT_ODFIBERV0;
1196  if(FiberParams.nLayerID%2==1 && FiberParams.nFiberID>=16 && FiberParams.nFiberID<=30) eType=EFT_ODFIBERU0;
1197 
1198 
1199  if(FiberParams.nLayerID%2==0 && FiberParams.nFiberID<=15) eType=EFT_ODFIBERV1;
1200  if(FiberParams.nLayerID%2==0 && FiberParams.nFiberID>=16 && FiberParams.nFiberID<=30) eType=EFT_ODFIBERU1;
1201  }
1202 
1203 
1204  //Transform & save values for RP
1205  TransformFiberPositions(&FiberParams, eRPName, eType, EGST_FILE);
1206 
1207  if(eType==EFT_UFIBER) m_MapRPot[eRPName].ListUFibers.push_back(FiberParams);
1208  if(eType==EFT_VFIBER) m_MapRPot[eRPName].ListVFibers.push_back(FiberParams);
1209  if(eType==EFT_ODFIBERU0) m_MapRPot[eRPName].ListODFibersU0.push_back(FiberParams);
1210  if(eType==EFT_ODFIBERV0) m_MapRPot[eRPName].ListODFibersV0.push_back(FiberParams);
1211  if(eType==EFT_ODFIBERV1) m_MapRPot[eRPName].ListODFibersV1.push_back(FiberParams);
1212  if(eType==EFT_ODFIBERU1) m_MapRPot[eRPName].ListODFibersU1.push_back(FiberParams);
1213 
1214  }
1215  }
1216 
1217  if(pFile) fclose(pFile);
1218  pFile=nullptr;
1219 
1220  return bRes;
1221 }
1222 
1223 bool ALFA_GeometryReader::ReadDatabase(const eRPotName eRPName, const eFiberType eFType, const char* szDataSource)
1224 {
1225  bool bRes=false;
1226 
1227 
1228  eFiberType eType=EFT_UNDEFINED;
1229  ROMAPOT RomaPot;
1230 
1231  std::vector<std::string> strDBElements;
1232  char szSource[64];
1233  char *pch;
1234 
1235  memset(szSource,0,sizeof(szSource));
1236  if(szDataSource) strncpy(szSource, szDataSource, sizeof(szSource)-1);
1237  char* strtok_ptr = nullptr;
1238  pch = strtok_r(szSource,":",&strtok_ptr);
1239  while (pch != nullptr)
1240  {
1241  strDBElements.emplace_back(pch);
1242  pch = strtok_r(nullptr, ":",&strtok_ptr);
1243  }
1244 
1245 
1246  ALFA_RDBAccess* p_DBAccess = new ALFA_RDBAccess();
1247 
1248  bRes = p_DBAccess->ReadGeometry(eRPName, eFType, strDBElements[2], strDBElements[1], strDBElements[0]);
1249 
1250  if(m_MapRPot.find(eRPName)==m_MapRPot.end()){
1251  //RP not yet defined
1252  RomaPot.ListUFibers.clear();
1253  RomaPot.ListVFibers.clear();
1254  RomaPot.ListODFibersU0.clear();
1255  RomaPot.ListODFibersU1.clear();
1256  RomaPot.ListODFibersV0.clear();
1257  RomaPot.ListODFibersV1.clear();
1258 
1259  m_MapRPot.insert(std::pair<eRPotName,ROMAPOT>(eRPName,RomaPot));
1260  }
1261 
1262  if(eFType==EFT_FIBERMD) m_MapRPot[eRPName].eMDGeometryType=EGST_DATABASE;
1263  else if(eFType==EFT_FIBEROD) m_MapRPot[eRPName].eODGeometryType=EGST_DATABASE;
1264 
1265  std::list<FIBERDATA>::const_iterator iter;
1266  for(iter = p_DBAccess->m_ListFiberData.begin(); iter != p_DBAccess->m_ListFiberData.end(); ++iter)
1267  {
1268  if (eRPName == (*iter).nPotID)
1269  {
1270  FIBERPARAMS FiberParams;
1271 
1272  FiberParams.nLayerID = (*iter).nLayerID;
1273  FiberParams.nFiberID = (*iter).nFiberID;
1274  FiberParams.fSlope = (*iter).fSlope;
1275  FiberParams.fOffset = (*iter).fOffset;
1276  FiberParams.fZPos = (*iter).fZPos;
1277 
1278  FiberParams.nPlateID=FiberParams.nLayerID/2+FiberParams.nLayerID%2;
1279 
1280  //Resolve fiber type
1281  if(eFType==EFT_FIBERMD)
1282  {
1283  eType=(FiberParams.fSlope<0)? EFT_UFIBER:EFT_VFIBER;
1284  }
1285  else if(eFType==EFT_FIBEROD)
1286  {
1287  if(FiberParams.nLayerID%2==1 && FiberParams.nFiberID<=15) eType=EFT_ODFIBERV0;
1288  if(FiberParams.nLayerID%2==1 && FiberParams.nFiberID>=16 && FiberParams.nFiberID<=30) eType=EFT_ODFIBERU0;
1289  if(FiberParams.nLayerID%2==0 && FiberParams.nFiberID<=15) eType=EFT_ODFIBERU1;
1290  if(FiberParams.nLayerID%2==0 && FiberParams.nFiberID>=16 && FiberParams.nFiberID<=30) eType=EFT_ODFIBERV1;
1291 
1292  }
1293 
1294  //Transform & save values for RP
1295  TransformFiberPositions(&FiberParams, eRPName, eType, EGST_DATABASE);
1296 
1297  if(eType==EFT_UFIBER) m_MapRPot[eRPName].ListUFibers.push_back(FiberParams);
1298  if(eType==EFT_VFIBER) m_MapRPot[eRPName].ListVFibers.push_back(FiberParams);
1299  if(eType==EFT_ODFIBERU0) m_MapRPot[eRPName].ListODFibersU0.push_back(FiberParams);
1300  if(eType==EFT_ODFIBERV0) m_MapRPot[eRPName].ListODFibersV0.push_back(FiberParams);
1301  if(eType==EFT_ODFIBERV1) m_MapRPot[eRPName].ListODFibersV1.push_back(FiberParams);
1302  if(eType==EFT_ODFIBERU1) m_MapRPot[eRPName].ListODFibersU1.push_back(FiberParams);
1303  }
1304  }
1305 
1306  delete p_DBAccess;
1307 
1308  return bRes;
1309 }
1310 
1311 bool ALFA_GeometryReader::GetUFiberParams(PFIBERPARAMS pFiberParams, const eRPotName eRPName, const int nPlateID, const int nFiberID)
1312 {
1313  bool bRes=false;
1314  std::list<FIBERPARAMS>::const_iterator iter;
1315  std::map<eRPotName, ROMAPOT>::const_iterator rpiter;
1316 
1317  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetUFiberParams");
1318 
1319  if((rpiter=m_MapRPot.find(eRPName))!=m_MapRPot.end()){
1320  for(iter=(*rpiter).second.ListUFibers.begin();iter!=(*rpiter).second.ListUFibers.end();++iter){
1321  if(((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
1322  }
1323 
1324  if(iter==(*rpiter).second.ListUFibers.end()){
1325  LogStream<<MSG::ERROR<<"Cannot find fiber PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
1326  }
1327  else{
1328  *pFiberParams = *iter;
1329  bRes=true;
1330  }
1331  }
1332  else{
1333  LogStream<<MSG::ERROR<<"Unknown Roman pot PotID="<<eRPName<<endmsg;
1334  }
1335 
1336  return bRes;
1337 }
1338 
1339 bool ALFA_GeometryReader::GetVFiberParams(PFIBERPARAMS pFiberParams, const eRPotName eRPName, const int nPlateID, const int nFiberID)
1340 {
1341  bool bRes=false;
1342  std::list<FIBERPARAMS>::const_iterator iter;
1343  std::map<eRPotName, ROMAPOT>::const_iterator rpiter;
1344 
1345  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetVFiberParams");
1346 
1347  if((rpiter=m_MapRPot.find(eRPName))!=m_MapRPot.end()){
1348  for(iter=(*rpiter).second.ListVFibers.begin();iter!=(*rpiter).second.ListVFibers.end();++iter){
1349  if(((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
1350  }
1351 
1352  if(iter==(*rpiter).second.ListVFibers.end()) {
1353  LogStream<<MSG::ERROR<<"Cannot find fiber PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
1354  //throw new Exception("Wrong U-fiber");
1355  }
1356  else{
1357  *pFiberParams = *iter;
1358  bRes=true;
1359  }
1360  }
1361  else{
1362  LogStream<<MSG::ERROR<<"Unknown Roman pot PotID="<<eRPName<<endmsg;
1363  }
1364 
1365 
1366  return bRes;
1367 }
1368 
1369 double ALFA_GeometryReader::GetUFiberCentreXPos(const eRPotName eRPName, const int nPlateID, const int nFiberID)
1370 {
1371  double fXPos=0.0;
1372  FIBERPARAMS FiberParams;
1373 
1375  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetUFiberCentreXPos");
1376  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
1377  return 0.0;
1378  }
1379 
1380  if(GetUFiberParams(&FiberParams, eRPName, nPlateID, nFiberID)){
1381  fXPos=FiberParams.fcs_cladding.fCentreXPos;
1382  }
1383 
1384  return fXPos;
1385 }
1386 
1387 double ALFA_GeometryReader::GetVFiberCentreXPos(const eRPotName eRPName, const int nPlateID, const int nFiberID)
1388 {
1389  double fXPos=0.0;
1390  FIBERPARAMS FiberParams;
1391 
1393  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetVFiberCentreXPos");
1394  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
1395  return 0.0;
1396  }
1397 
1398  if(GetVFiberParams(&FiberParams, eRPName, nPlateID, nFiberID)){
1399  fXPos=FiberParams.fcs_cladding.fCentreXPos;
1400  }
1401 
1402  return fXPos;
1403 }
1404 
1405 double ALFA_GeometryReader::GetUFiberAngle(const eRPotName eRPName, const int nPlateID, const int nFiberID)
1406 {
1407  double fAngle=0.0;
1408  FIBERPARAMS FiberParams;
1409 
1411  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetUFiberAngle");
1412  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
1413  return 0.0;
1414  }
1415 
1416  if(GetUFiberParams(&FiberParams, eRPName, nPlateID, nFiberID)){
1417  fAngle=FiberParams.fcs_cladding.fAngle;
1418  }
1419 
1420  return fAngle;
1421 }
1422 
1423 double ALFA_GeometryReader::GetVFiberAngle(const eRPotName eRPName, const int nPlateID, const int nFiberID)
1424 {
1425  double fAngle=0.0;
1426  FIBERPARAMS FiberParams;
1427 
1429  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetVFiberAngle");
1430  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
1431  return 0.0;
1432  }
1433 
1434  if(GetVFiberParams(&FiberParams, eRPName, nPlateID, nFiberID)){
1435  fAngle=FiberParams.fcs_cladding.fAngle;
1436  }
1437 
1438  return fAngle;
1439 }
1440 
1441 void ALFA_GeometryReader::SetUFiberPositionToMainReference(const eRPotName eRPName, const int nPlateID, const int nFiberID, const HepGeom::Point3D<float>& TransPoint,const double fTransSlope)
1442 {
1445  FIBERPARAMS FiberParams;
1446 
1447  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::SetUFiberPositionToMainReference");
1448 
1450  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
1451  return;
1452  }
1453 
1454  if((rpiter=m_MapRPot.find(eRPName))!=m_MapRPot.end()){
1455  for(iter=(*rpiter).second.ListUFibers.begin();iter!=(*rpiter).second.ListUFibers.end();++iter){
1456  if(((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
1457  }
1458 
1459  if(iter==(*rpiter).second.ListUFibers.end()) {
1460  LogStream<<MSG::ERROR<<"Cannot find fiber PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
1461  //throw new Exception("Wrong U-fiber");
1462  }
1463  else{
1464  (*iter).MainRefPointPos=TransPoint;
1465  (*iter).fMainRefPointSlope=fTransSlope;
1466  }
1467  }
1468  else{
1469  LogStream<<MSG::ERROR<<"Unknown Roman pot PotID="<<eRPName<<endmsg;
1470  }
1471 }
1472 
1473 void ALFA_GeometryReader::SetVFiberPositionToMainReference(const eRPotName eRPName, const int nPlateID, const int nFiberID, const HepGeom::Point3D<float>& TransPoint,const double fTransSlope)
1474 {
1477  FIBERPARAMS FiberParams;
1478 
1479  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::SetVFiberPositionToMainReference");
1480 
1482  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
1483  return;
1484  }
1485 
1486  if((rpiter=m_MapRPot.find(eRPName))!=m_MapRPot.end()){
1487  for(iter=(*rpiter).second.ListVFibers.begin();iter!=(*rpiter).second.ListVFibers.end();++iter){
1488  if(((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
1489  }
1490 
1491  if(iter==(*rpiter).second.ListVFibers.end()){
1492  LogStream<<MSG::ERROR<<"Cannot find fiber PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
1493  //throw new Exception("Wrong U-fiber");
1494  }
1495  else{
1496  (*iter).MainRefPointPos=TransPoint;
1497  (*iter).fMainRefPointSlope=fTransSlope;
1498  }
1499  }
1500  else{
1501  LogStream<<MSG::ERROR<<"Unknown Roman pot PotID="<<eRPName<<endmsg;
1502  }
1503 }
1504 
1505 bool ALFA_GeometryReader::GetPlateParams(PPLATEPARAMS pPlateParams, const eRPotName eRPName, const int nPlateID)
1506 {
1507  bool bRes=false;
1510 
1511  MsgStream LogStream(Athena::getMessageSvc(),"ALFA_GeometryReader::GetPlateParams");
1512 
1513  if((rpiter=m_MapRPot.find(eRPName))!=m_MapRPot.end()){
1514  if((pliter=(*rpiter).second.MapPlates.find(nPlateID))!=(*rpiter).second.MapPlates.end()){
1515  *pPlateParams=(*pliter).second;
1516  bRes=true;
1517  }
1518  else{
1519  LogStream<<MSG::ERROR<<"Unknown Ti plate ID "<<nPlateID<<endmsg;
1520  }
1521  }
1522  else{
1523  LogStream<<MSG::ERROR<<"Unknown Roman pot PotID="<<eRPName<<endmsg;
1524  }
1525 
1526  return bRes;
1527 }
1528 
1529 
1530 void ALFA_GeometryReader::PrintFiberGeometry(const char* szOutFilename)
1531 {
1532  std::ofstream OutStream(szOutFilename);
1534  OutStream.close();
1535 }
1536 
1538 {
1539 
1540  std::list<FIBERPARAMS>::const_iterator iter;
1541  std::map<eRPotName, ROMAPOT>::const_iterator rpiter;
1542  FIBERPARAMS FiberParams;
1543 
1544  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::PrintGeometry");
1545 
1547  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
1548  return;
1549  }
1550 
1551  for(rpiter=m_MapRPot.begin();rpiter!=m_MapRPot.end();++rpiter){
1552  OutStream<<std::endl<<"Geometry of U-fibers in Roma Pot "<<(*rpiter).first<<std::endl;
1553  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<"nPotID\t\t\t\tnPlateID\t\t\t\tnFiberID\t\t\t\tnLayerID\t\t\t\tfCentreXPos\t\t\t\tfAngle"<<std::endl;
1554  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<"nPotID\t\t\t\tnPlateID\t\t\t\tnFiberID\t\t\t\tnLayerID\t\t\t\tfSlope\t\t\t\tfOffset\t\t\t\tfZPos"<<std::endl;
1555 
1556  for(iter=(*rpiter).second.ListUFibers.begin();iter!=(*rpiter).second.ListUFibers.end();++iter){
1557  OutStream<<(*rpiter).first<<"\t\t\t\t"<<(*iter).nPlateID<<"\t\t\t\t"<<(*iter).nFiberID<<"\t\t\t\t"<<(*iter).nLayerID<<"\t\t\t\t";
1558  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<(*iter).fcs_cladding.fCentreXPos<<"\t\t\t\t"<<(*iter).fcs_cladding.fAngle<<std::endl;
1559  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<(*iter).fcs_atlas.fSlope<<"\t\t\t\t"<<(*iter).fcs_atlas.fOffset<<(*iter).fcs_atlas.fZPos<<std::endl;
1560  }
1561 
1562  OutStream<<std::endl<<"Geometry of V-fibers in Roma Pot "<<(*rpiter).first<<std::endl;
1563  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<"nPotID\t\t\tnPlateID\t\t\tnFiberID\t\t\tnLayerID\t\t\tfCentreXPos\t\t\tfAngle\t\t\tfSlope\t\t\tfOffset\t\t\tfZPos"<<std::endl;
1564  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<"nPotID\t\t\t\tnPlateID\t\t\t\tnFiberID\t\t\t\tnLayerID\t\t\t\tfSlope\t\t\t\tfOffset\t\t\t\tfZPos"<<std::endl;
1565 
1566  for(iter=(*rpiter).second.ListVFibers.begin();iter!=(*rpiter).second.ListVFibers.end();++iter){
1567  OutStream<<(*rpiter).first<<"\t\t\t\t"<<(*iter).nPlateID<<"\t\t\t\t"<<(*iter).nFiberID<<"\t\t\t\t"<<(*iter).nLayerID<<"\t\t\t\t";
1568  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<(*iter).fcs_cladding.fCentreXPos<<"\t\t\t\t"<<(*iter).fcs_cladding.fAngle<<std::endl;
1569  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<(*iter).fcs_atlas.fSlope<<"\t\t\t\t"<<(*iter).fcs_atlas.fOffset<<(*iter).fcs_atlas.fZPos<<std::endl;
1570  }
1571 
1572  OutStream<<std::endl<<"Geometry of V0-ODFibers in Roma Pot "<<(*rpiter).first<<std::endl;
1573  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<"nPotID\t\t\tnPlateID\t\t\tnFiberID\t\t\tnLayerID\t\t\tfCentreXPos\t\t\tfAngle\t\t\tfSlope\t\t\tfOffset\t\t\tfZPos"<<std::endl;
1574  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<"nPotID\t\t\t\tnPlateID\t\t\t\tnFiberID\t\t\t\tnLayerID\t\t\t\tfSlope\t\t\t\tfOffset\t\t\t\tfZPos"<<std::endl;
1575 
1576  for(iter=(*rpiter).second.ListODFibersV0.begin();iter!=(*rpiter).second.ListODFibersV0.end();++iter){
1577  OutStream<<(*rpiter).first<<"\t\t\t\t"<<(*iter).nPlateID<<"\t\t\t\t"<<(*iter).nFiberID<<"\t\t\t\t"<<(*iter).nLayerID<<"\t\t\t\t";
1578  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<(*iter).fcs_cladding.fCentreYPos<<"\t\t\t\t"<<(*iter).fcs_cladding.fAngle<<std::endl;
1579  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<(*iter).fcs_atlas.fSlope<<"\t\t\t\t"<<(*iter).fcs_atlas.fOffset<<(*iter).fcs_atlas.fZPos<<std::endl;
1580  }
1581 
1582  OutStream<<std::endl<<"Geometry of U0-ODFibers in Roma Pot "<<(*rpiter).first<<std::endl;
1583  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<"nPotID\t\t\tnPlateID\t\t\tnFiberID\t\t\tnLayerID\t\t\tfCentreXPos\t\t\tfAngle\t\t\tfSlope\t\t\tfOffset\t\t\tfZPos"<<std::endl;
1584  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<"nPotID\t\t\t\tnPlateID\t\t\t\tnFiberID\t\t\t\tnLayerID\t\t\t\tfSlope\t\t\t\tfOffset\t\t\t\tfZPos"<<std::endl;
1585 
1586  for(iter=(*rpiter).second.ListODFibersU0.begin();iter!=(*rpiter).second.ListODFibersU0.end();++iter){
1587  OutStream<<(*rpiter).first<<"\t\t\t\t"<<(*iter).nPlateID<<"\t\t\t\t"<<(*iter).nFiberID<<"\t\t\t\t"<<(*iter).nLayerID<<"\t\t\t\t";
1588  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<(*iter).fcs_cladding.fCentreYPos<<"\t\t\t\t"<<(*iter).fcs_cladding.fAngle<<std::endl;
1589  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<(*iter).fcs_atlas.fSlope<<"\t\t\t\t"<<(*iter).fcs_atlas.fOffset<<(*iter).fcs_atlas.fZPos<<std::endl;
1590  }
1591 
1592  OutStream<<std::endl<<"Geometry of U1-ODFibers in Roma Pot "<<(*rpiter).first<<std::endl;
1593  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<"nPotID\t\t\tnPlateID\t\t\tnFiberID\t\t\tnLayerID\t\t\tfCentreXPos\t\t\tfAngle\t\t\tfSlope\t\t\tfOffset\t\t\tfZPos"<<std::endl;
1594  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<"nPotID\t\t\t\tnPlateID\t\t\t\tnFiberID\t\t\t\tnLayerID\t\t\t\tfSlope\t\t\t\tfOffset\t\t\t\tfZPos"<<std::endl;
1595 
1596  for(iter=(*rpiter).second.ListODFibersU1.begin();iter!=(*rpiter).second.ListODFibersU1.end();++iter){
1597  OutStream<<(*rpiter).first<<"\t\t\t\t"<<(*iter).nPlateID<<"\t\t\t\t"<<(*iter).nFiberID<<"\t\t\t\t"<<(*iter).nLayerID<<"\t\t\t\t";
1598  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<(*iter).fcs_cladding.fCentreYPos<<"\t\t\t\t"<<(*iter).fcs_cladding.fAngle<<std::endl;
1599  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<(*iter).fcs_atlas.fSlope<<"\t\t\t\t"<<(*iter).fcs_atlas.fOffset<<(*iter).fcs_atlas.fZPos<<std::endl;
1600  }
1601 
1602  OutStream<<std::endl<<"Geometry of V1-ODFibers in Roma Pot "<<(*rpiter).first<<std::endl;
1603  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<"nPotID\t\t\tnPlateID\t\t\tnFiberID\t\t\tnLayerID\t\t\tfCentreXPos\t\t\tfAngle\t\t\tfSlope\t\t\tfOffset\t\t\tfZPos"<<std::endl;
1604  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<"nPotID\t\t\t\tnPlateID\t\t\t\tnFiberID\t\t\t\tnLayerID\t\t\t\tfSlope\t\t\t\tfOffset\t\t\t\tfZPos"<<std::endl;
1605 
1606  for(iter=(*rpiter).second.ListODFibersV1.begin();iter!=(*rpiter).second.ListODFibersV1.end();++iter){
1607  OutStream<<(*rpiter).first<<"\t\t\t\t"<<(*iter).nPlateID<<"\t\t\t\t"<<(*iter).nFiberID<<"\t\t\t\t"<<(*iter).nLayerID<<"\t\t\t\t";
1608  if(m_eFCoordSystem==EFCS_CLADDING) OutStream<<(*iter).fcs_cladding.fCentreYPos<<"\t\t\t\t"<<(*iter).fcs_cladding.fAngle<<std::endl;
1609  else if(m_eFCoordSystem==EFCS_ATLAS) OutStream<<(*iter).fcs_atlas.fSlope<<"\t\t\t\t"<<(*iter).fcs_atlas.fOffset<<(*iter).fcs_atlas.fZPos<<std::endl;
1610  }
1611  }
1612 }
1613 
1614 bool ALFA_GeometryReader::StoreReconstructionGeometry(const eRPotName eRPName, const eFiberType eFType, const char* szDataDestination)
1615 {
1616  int i,j;
1617  double fParamB, fY, fX, fZ, fSlope;
1618  FILE * pFile;
1619  FIBERPARAMS FiberParams;
1620 
1621  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::StoreReconstructionGeometry");
1622 
1624  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
1625  return false;
1626  }
1627 
1628  pFile = fopen(szDataDestination, "w");
1629  if(pFile==nullptr) return false;
1630 
1631  fprintf(pFile, "xxxxxxxxxxxxxxxxxxx\n");
1632 
1633 
1634  if (eFType==EFT_FIBERMD)
1635  {
1636  fprintf(pFile, "20\n");
1637 
1638  for(i=1;i<=ALFAPLATESCNT;i++){
1639  //U-fiber
1640  for(j=1;j<=ALFAFIBERSCNT;j++){
1641  if(GetUFiberParams(&FiberParams, eRPName, i, j)){
1643  fX=FiberParams.MainRefPointPos.x();
1644  fY=FiberParams.MainRefPointPos.y();
1645  fZ=FiberParams.MainRefPointPos.z();
1646  fSlope=FiberParams.fMainRefPointSlope;
1647  //fSlope=FiberParams.fSlope;
1648  fParamB=fY-fSlope*fX;
1649  }
1650  else {
1651  fSlope=FiberParams.fcs_atlas.fSlope;
1652  fParamB=FiberParams.fcs_atlas.fOffset;
1653  fZ=FiberParams.fcs_atlas.fZPos;
1654  }
1655 
1656  fprintf(pFile, " %2d %2d %7.5f %7.4f %7.3f\n", (i*2-1), j, fSlope, fParamB, fZ);
1657  }
1658  }
1659 
1660  //V-fiber
1661  for(j=1;j<=ALFAFIBERSCNT;j++){
1662  if(GetVFiberParams(&FiberParams, eRPName, i, j)){
1664  fX=FiberParams.MainRefPointPos.x();
1665  fY=FiberParams.MainRefPointPos.y();
1666  fZ=FiberParams.MainRefPointPos.z();
1667  fSlope=FiberParams.fMainRefPointSlope;
1668  //fSlope=FiberParams.fSlope;
1669  fParamB=fY-fSlope*fX;
1670  }
1671  else {
1672  fSlope=FiberParams.fcs_atlas.fSlope;
1673  fParamB=FiberParams.fcs_atlas.fOffset;
1674  fZ=FiberParams.fcs_atlas.fZPos;
1675  }
1676 
1677  fprintf(pFile, " %2d %2d %7.5f %7.4f %7.3f\n", (i*2), j, fSlope, fParamB, fZ);
1678  }
1679  }
1680  }
1681  }
1682  else if (eFType==EFT_FIBEROD)
1683  {
1684  fprintf(pFile, "6\n");
1685 
1686  for(int i=1; i<=ODPLATESCNT; i++)
1687  {
1688  //V0-ODFiber
1689  for(j=1;j<=ODFIBERSCNT;j++)
1690  {
1691  if(GetODFiberParams(&FiberParams, EFT_ODFIBERV0, eRPName, i, j))
1692  {
1694  fX=FiberParams.MainRefPointPos.x();
1695  fY=FiberParams.MainRefPointPos.y();
1696  fZ=FiberParams.MainRefPointPos.z();
1697  fSlope=FiberParams.fMainRefPointSlope;
1698  fParamB=fY-fSlope*fX;
1699  }
1700  else {
1701  fSlope=FiberParams.fcs_atlas.fSlope;
1702  fParamB=FiberParams.fcs_atlas.fOffset;
1703  fZ=FiberParams.fcs_atlas.fZPos;
1704  }
1705 
1706  fprintf(pFile, " %2d %2d %7.5f %7.4f %7.3f\n", (i*2-1), j, fSlope, fParamB, fZ);
1707  }
1708  }
1709 
1710  //U0-ODFiber (note: U0-nFiberID is indexed from 16 to 30)
1711  for(j=ODFIBERSCNT+1;j<=ODFIBERSCNT+15;j++)
1712  {
1713  if(GetODFiberParams(&FiberParams, EFT_ODFIBERU0, eRPName, i, j))
1714  {
1716  fX=FiberParams.MainRefPointPos.x();
1717  fY=FiberParams.MainRefPointPos.y();
1718  fZ=FiberParams.MainRefPointPos.z();
1719  fSlope=FiberParams.fMainRefPointSlope;
1720  fParamB=fY-fSlope*fX;
1721  }
1722  else {
1723  fSlope=FiberParams.fcs_atlas.fSlope;
1724  fParamB=FiberParams.fcs_atlas.fOffset;
1725  fZ=FiberParams.fcs_atlas.fZPos;
1726  }
1727 
1728  fprintf(pFile, " %2d %2d %7.5f %7.4f %7.3f\n", (i*2-1), j, fSlope, fParamB, fZ);
1729  }
1730  }
1731 
1732 
1733  for(j=1;j<=ODFIBERSCNT;j++)
1734  {
1735  if(GetODFiberParams(&FiberParams, EFT_ODFIBERV1, eRPName, i, j))
1736  {
1738  fX=FiberParams.MainRefPointPos.x();
1739  fY=FiberParams.MainRefPointPos.y();
1740  fZ=FiberParams.MainRefPointPos.z();
1741  fSlope=FiberParams.fMainRefPointSlope;
1742  fParamB=fY-fSlope*fX;
1743  }
1744  else {
1745  fSlope=FiberParams.fcs_atlas.fSlope;
1746  fParamB=FiberParams.fcs_atlas.fOffset;
1747  fZ=FiberParams.fcs_atlas.fZPos;
1748  }
1749  fprintf(pFile, " %2d %2d %7.5f %7.4f %7.3f\n", (i*2), j, fSlope, fParamB, fZ);
1750  }
1751  }
1752 
1753  //U1-ODFiber
1754 
1755  for(j=ODFIBERSCNT+1;j<=ODFIBERSCNT+15;j++)
1756  {
1757  if(GetODFiberParams(&FiberParams, EFT_ODFIBERU1, eRPName, i, j))
1758  {
1760  fX=FiberParams.MainRefPointPos.x();
1761  fY=FiberParams.MainRefPointPos.y();
1762  fZ=FiberParams.MainRefPointPos.z();
1763  fSlope=FiberParams.fMainRefPointSlope;
1764  fParamB=fY-fSlope*fX;
1765  }
1766  else {
1767  fSlope=FiberParams.fcs_atlas.fSlope;
1768  fParamB=FiberParams.fcs_atlas.fOffset;
1769  fZ=FiberParams.fcs_atlas.fZPos;
1770  }
1771  fprintf(pFile, " %2d %2d %7.5f %7.4f %7.3f\n", (i*2), j, fSlope, fParamB, fZ);
1772  }
1773  }
1774 
1775  }
1776  }
1777 
1778  fclose(pFile);
1779 
1780  return true;
1781 }
1782 
1784 {
1785  int i;
1787  std::list<FIBERPARAMS>::const_iterator iter;
1788  FIBERPARAMS Fiber01Params,Fiber64Params;
1789 
1790  for(rpiter=m_MapRPot.begin();rpiter!=m_MapRPot.end();++rpiter){
1791  for(i=1;i<=10;i++){
1792  GetUFiberParams(&Fiber01Params,(*rpiter).first,i,1);
1793  GetUFiberParams(&Fiber64Params,(*rpiter).first,i,64);
1794  (*rpiter).second.MapPlates[i].fUCladdingSizeX=2.0*(fmax(fabs(Fiber01Params.fcs_cladding.fCentreXPos),fabs(Fiber64Params.fcs_cladding.fCentreXPos))+0.24);
1795 
1796  GetVFiberParams(&Fiber01Params,(*rpiter).first,i,1);
1797  GetVFiberParams(&Fiber64Params,(*rpiter).first,i,64);
1798  (*rpiter).second.MapPlates[i].fVCladdingSizeX=2.0*(fmax(fabs(Fiber01Params.fcs_cladding.fCentreXPos),fabs(Fiber64Params.fcs_cladding.fCentreXPos))+0.24);
1799  }
1800  }
1801 }
1802 
1803 void ALFA_GeometryReader::GetListOfRPotIDs(std::map<eRPotName,std::string>* pMapRPotName)
1804 {
1805  std::string strLabel;
1806  std::map<eRPotName,ROMAPOT>::const_iterator rpiter;
1807 
1808  if(pMapRPotName!=nullptr){
1809  pMapRPotName->clear();
1810 
1811  for(rpiter=m_MapRPot.begin();rpiter!=m_MapRPot.end();++rpiter){
1812  strLabel=GetRPotLabel((*rpiter).first);
1813  pMapRPotName->insert(std::pair<eRPotName,std::string>((*rpiter).first,strLabel));
1814  }
1815  }
1816 }
1817 
1818 void ALFA_GeometryReader::GetListOfExistingRPotIDs(std::list<eRPotName>* pListRPotName)
1819 {
1820  *pListRPotName=m_ListExistingRPots;
1821 }
1822 
1824 {
1825  bool bRes=false;
1827 
1828  MsgStream LogStream(Athena::getMessageSvc(),"ALFA_GeometryReader::GetRPPosParams");
1829 
1830  pRPPosParams->clear();
1831  if((iter=m_RPPosParams.find(eRPName))!=m_RPPosParams.end()){
1832  *pRPPosParams=(*iter).second;
1833  bRes=true;
1834  }
1835  else{
1836  LogStream<<MSG::ERROR<<"Unknown Roma pot ID="<<eRPName<<endmsg;
1837  }
1838 
1839  return bRes;
1840 }
1841 
1843 {
1844  bool bRes=false;
1846 
1847  MsgStream LogStream(Athena::getMessageSvc(),"ALFA_GeometryReader::GetASPosParams");
1848 
1849  pASPosParams->clear();
1850  if((iter=m_ASPosParams.find(eASName))!=m_ASPosParams.end()){
1851  *pASPosParams=(*iter).second;
1852  bRes=true;
1853  }
1854  else{
1855  LogStream<<MSG::ERROR<<"Unknown ALFA Station ID="<<eASName<<endmsg;
1856  }
1857 
1858  return bRes;
1859 }
1860 
1862 {
1863  eGeoSourceType eGeoType=EGST_UNDEFINED;
1864 
1865  if(m_MapRPot.find(eRPName)!=m_MapRPot.end()){
1866  if(eFType==EFT_FIBERMD) eGeoType=m_MapRPot[eRPName].eMDGeometryType;
1867  else if(eFType==EFT_FIBEROD) eGeoType=m_MapRPot[eRPName].eODGeometryType;
1868  }
1869  else{
1870  MsgStream LogStream(Athena::getMessageSvc(),"ALFA_GeometryReader::GetRPGeometryType");
1871  LogStream<<MSG::ERROR<<"Unknown Roman pot ID="<<eRPName<<endmsg;
1872  }
1873 
1874 
1875  return eGeoType;
1876 }
1877 
1878 bool ALFA_GeometryReader::GetMDFiberParams(PFIBERPARAMS pFiberParams, const eFiberType eFType, const eRPotName eRPName, const int nPlateID, const int nFiberID)
1879 {
1880  bool bRes=false;
1881 
1882  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetMDFiberParams");
1883 
1884  if(pFiberParams==nullptr)
1885  {
1886  LogStream<<MSG::ERROR<<"pFiberParams points to NULL"<<endmsg;
1887  }
1888  else if(m_eFCoordSystem!=EFCS_ATLAS)
1889  {
1890  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
1891  }
1892  else{
1893  switch(eFType){
1894  case EFT_UFIBER:
1895  bRes=GetUFiberParams(pFiberParams, eRPName, nPlateID, nFiberID);
1896  break;
1897  case EFT_VFIBER:
1898  bRes=GetVFiberParams(pFiberParams, eRPName, nPlateID, nFiberID);
1899  break;
1900  default:
1901  LogStream<<MSG::ERROR<<"Invalid fiber type"<<endmsg;
1902  break;
1903  }
1904  }
1905 
1906  return bRes;
1907 }
1908 
1909 // OD functions
1910 bool ALFA_GeometryReader::GetODFiberParams(PFIBERPARAMS pFiberParams, const eFiberType eFType, const eRPotName eRPName, const int nPlateID, const int nFiberID)
1911 {
1912  bool bRes=false;
1913  std::list<FIBERPARAMS>::const_iterator iter;
1914  std::map<eRPotName, ROMAPOT>::const_iterator rpiter;
1915 
1916  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetODFiberParams");
1917 
1918  if ((rpiter=m_MapRPot.find(eRPName))!=m_MapRPot.end())
1919  {
1920  switch (eFType)
1921  {
1922  case EFT_ODFIBERU0:
1923  {
1924  for(iter=(*rpiter).second.ListODFibersU0.begin();iter!=(*rpiter).second.ListODFibersU0.end();++iter)
1925  {
1926  if (((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
1927  }
1928 
1929  if (iter==(*rpiter).second.ListODFibersU0.end())
1930  {
1931  LogStream<<MSG::ERROR<<"Cannot find ODFiberU0 PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
1932  }
1933  else
1934  {
1935  *pFiberParams = *iter;
1936  bRes=true;
1937  }
1938 
1939  break;
1940  }
1941  case EFT_ODFIBERV0:
1942  {
1943  for(iter=(*rpiter).second.ListODFibersV0.begin();iter!=(*rpiter).second.ListODFibersV0.end();++iter)
1944  {
1945  if (((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
1946  }
1947 
1948  if (iter==(*rpiter).second.ListODFibersV0.end())
1949  {
1950  LogStream<<MSG::ERROR<<"Cannot find ODFiberV0 PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
1951  }
1952  else
1953  {
1954  *pFiberParams = *iter;
1955  bRes=true;
1956  }
1957 
1958  break;
1959  }
1960  case EFT_ODFIBERU1:
1961  {
1962  for(iter=(*rpiter).second.ListODFibersU1.begin();iter!=(*rpiter).second.ListODFibersU1.end();++iter)
1963  {
1964  if (((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
1965  }
1966 
1967  if (iter==(*rpiter).second.ListODFibersU1.end())
1968  {
1969  LogStream<<MSG::ERROR<<"Cannot find ODFiberU1 PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
1970  }
1971  else
1972  {
1973  *pFiberParams = *iter;
1974  bRes=true;
1975  }
1976 
1977  break;
1978  }
1979  case EFT_ODFIBERV1:
1980  {
1981  for(iter=(*rpiter).second.ListODFibersV1.begin();iter!=(*rpiter).second.ListODFibersV1.end();++iter)
1982  {
1983  if (((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
1984  }
1985 
1986  if (iter==(*rpiter).second.ListODFibersV1.end())
1987  {
1988  LogStream<<MSG::ERROR<<"Cannot find ODFiberV1 PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
1989  }
1990  else
1991  {
1992  *pFiberParams = *iter;
1993  bRes=true;
1994  }
1995 
1996  break;
1997  }
1998  default:
1999  {
2000  LogStream<<MSG::ERROR<<"Unknown ODFiber eFType="<<eFType<<endmsg;
2001  break;
2002  }
2003  }
2004  }
2005  else
2006  {
2007  LogStream<<MSG::ERROR<<"Unknown Roma pot PotID="<<eRPName<<endmsg;
2008  }
2009 
2010  return bRes;
2011 }
2012 
2013 void ALFA_GeometryReader::SetODFiberPositionToMainReference(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID, const HepGeom::Point3D<float>& TransPoint, const double fTransSlope)
2014 {
2017 
2018  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::SetODFiberPositionToMainReference");
2019 
2021  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
2022  return;
2023  }
2024 
2025  if ((rpiter=m_MapRPot.find(eRPName))!=m_MapRPot.end())
2026  {
2027  switch (eFType)
2028  {
2029  case EFT_ODFIBERU0:
2030  {
2031  for(iter=(*rpiter).second.ListODFibersU0.begin();iter!=(*rpiter).second.ListODFibersU0.end();++iter)
2032  {
2033  if (((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
2034  }
2035 
2036  if (iter==(*rpiter).second.ListODFibersU0.end())
2037  {
2038  LogStream<<MSG::ERROR<<"Cannot find ODFiberU0 PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
2039  //throw new G4Exception("Wrong ODFiberU0");
2040  }
2041  else
2042  {
2043  (*iter).MainRefPointPos=TransPoint;
2044  (*iter).fMainRefPointSlope=fTransSlope;
2045  }
2046 
2047  break;
2048  }
2049  case EFT_ODFIBERV0:
2050  {
2051  for(iter=(*rpiter).second.ListODFibersV0.begin();iter!=(*rpiter).second.ListODFibersV0.end();++iter)
2052  {
2053  if (((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
2054  }
2055 
2056  if (iter==(*rpiter).second.ListODFibersV0.end())
2057  {
2058  LogStream<<MSG::ERROR<<"Cannot find ODFiberV0 PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
2059  }
2060  else
2061  {
2062  (*iter).MainRefPointPos=TransPoint;
2063  (*iter).fMainRefPointSlope=fTransSlope;
2064  }
2065 
2066  break;
2067  }
2068  case EFT_ODFIBERU1:
2069  {
2070  for(iter=(*rpiter).second.ListODFibersU1.begin();iter!=(*rpiter).second.ListODFibersU1.end();++iter)
2071  {
2072  if (((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
2073  }
2074 
2075  if (iter==(*rpiter).second.ListODFibersU1.end())
2076  {
2077  LogStream<<MSG::ERROR<<"Cannot find ODFiberU1 PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
2078  }
2079  else
2080  {
2081  (*iter).MainRefPointPos=TransPoint;
2082  (*iter).fMainRefPointSlope=fTransSlope;
2083  }
2084 
2085  break;
2086  }
2087  case EFT_ODFIBERV1:
2088  {
2089  for(iter=(*rpiter).second.ListODFibersV1.begin();iter!=(*rpiter).second.ListODFibersV1.end();++iter)
2090  {
2091  if (((*iter).nPlateID==nPlateID) && ((*iter).nFiberID==nFiberID)) break;
2092  }
2093 
2094  if (iter==(*rpiter).second.ListODFibersV1.end())
2095  {
2096  LogStream<<MSG::ERROR<<"Cannot find ODFiberV1 PotID="<<eRPName<<", PlateID="<<nPlateID<<" and FiberID="<<nFiberID<<endmsg;
2097  }
2098  else
2099  {
2100  (*iter).MainRefPointPos=TransPoint;
2101  (*iter).fMainRefPointSlope=fTransSlope;
2102  }
2103 
2104  break;
2105  }
2106  default:
2107  {
2108  LogStream<<MSG::ERROR<<"Unknown ODFiber eFType="<<eFType<<endmsg;
2109  break;
2110  }
2111  }
2112  }
2113  else
2114  {
2115  LogStream<<MSG::ERROR<<"Unknown Roman pot PotID="<<eRPName<<endmsg;
2116  }
2117 
2118 }
2119 
2120 double ALFA_GeometryReader::GetODFiberCentreYPos(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
2121 {
2122  double fYPos=0.0;
2123  FIBERPARAMS FiberParams;
2124 
2126  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetODFiberCentreYPos");
2127  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
2128  return 0.0;
2129  }
2130 
2131  if(GetODFiberParams(&FiberParams, eFType, eRPName, nPlateID, nFiberID))
2132  {
2133  fYPos=FiberParams.fcs_cladding.fCentreYPos;
2134  }
2135 
2136  return fYPos;
2137 }
2138 
2139 double ALFA_GeometryReader::GetODFiberAngle(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
2140 {
2141  double fAngle=0.0;
2142  FIBERPARAMS FiberParams;
2143 
2145  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetODFiberAngle");
2146  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
2147  return 0.0;
2148  }
2149 
2150  if(GetODFiberParams(&FiberParams, eFType, eRPName, nPlateID, nFiberID))
2151  {
2152  fAngle=FiberParams.fcs_cladding.fAngle;
2153  }
2154 
2155  return fAngle;
2156 }
2157 
2158 double ALFA_GeometryReader::GetMDFiberSlope(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
2159 {
2160  double fSlope=0.0;
2161  FIBERPARAMS FiberParams;
2162 
2163  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetMDFiberSlope");
2164 
2166  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
2167  return 0.0;
2168  }
2169 
2170  switch(eFType){
2171  case EFT_UFIBER:
2172  if(GetUFiberParams(&FiberParams, eRPName, nPlateID, nFiberID)){
2173  fSlope=FiberParams.fcs_atlas.fSlope;
2174  }
2175  break;
2176  case EFT_VFIBER:
2177  if(GetVFiberParams(&FiberParams, eRPName, nPlateID, nFiberID)){
2178  fSlope=FiberParams.fcs_atlas.fSlope;
2179  }
2180  break;
2181  default:
2182  LogStream<<MSG::ERROR<<"Invalid fiber type"<<endmsg;
2183  break;
2184  }
2185 
2186  return fSlope;
2187 }
2188 
2189 double ALFA_GeometryReader::GetMDFiberOffset(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
2190 {
2191  double fOffset=0.0;
2192  FIBERPARAMS FiberParams;
2193 
2194  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetMDFiberOffset");
2195 
2197  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
2198  return 0.0;
2199  }
2200 
2201  switch(eFType){
2202  case EFT_UFIBER:
2203  if(GetUFiberParams(&FiberParams, eRPName, nPlateID, nFiberID)){
2204  fOffset=FiberParams.fcs_atlas.fOffset;
2205  }
2206  break;
2207  case EFT_VFIBER:
2208  if(GetVFiberParams(&FiberParams, eRPName, nPlateID, nFiberID)){
2209  fOffset=FiberParams.fcs_atlas.fOffset;
2210  }
2211  break;
2212  default:
2213  LogStream<<MSG::ERROR<<"Invalid fiber type"<<endmsg;
2214  break;
2215  }
2216 
2217  return fOffset;
2218 }
2219 
2220 double ALFA_GeometryReader::GetMDFiberZPos(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
2221 {
2222  double fZPos=0.0;
2223  FIBERPARAMS FiberParams;
2224 
2225  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetMDFiberZPos");
2226 
2228  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
2229  return 0.0;
2230  }
2231 
2232  switch(eFType){
2233  case EFT_UFIBER:
2234  if(GetUFiberParams(&FiberParams, eRPName, nPlateID, nFiberID)){
2235  fZPos=FiberParams.fcs_atlas.fZPos;
2236  }
2237  break;
2238  case EFT_VFIBER:
2239  if(GetVFiberParams(&FiberParams, eRPName, nPlateID, nFiberID)){
2240  fZPos=FiberParams.fcs_atlas.fZPos;
2241  }
2242  break;
2243  default:
2244  LogStream<<MSG::ERROR<<"Invalid fiber type"<<endmsg;
2245  break;
2246  }
2247 
2248  return fZPos;
2249 }
2250 
2251 double ALFA_GeometryReader::GetODFiberSlope(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
2252 {
2253  double fSlope=0.0;
2254  FIBERPARAMS FiberParams;
2255 
2257  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetODFiberSlope");
2258  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
2259  return 0.0;
2260  }
2261 
2262  if(GetODFiberParams(&FiberParams, eFType, eRPName, nPlateID, nFiberID))
2263  {
2264  fSlope=FiberParams.fcs_atlas.fSlope;
2265  }
2266 
2267  return fSlope;
2268 }
2269 
2270 double ALFA_GeometryReader::GetODFiberOffset(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
2271 {
2272  double fOffset=0.0;
2273  FIBERPARAMS FiberParams;
2274 
2276  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetODFiberOffset");
2277  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
2278  return 0.0;
2279  }
2280 
2281  if(GetODFiberParams(&FiberParams, eFType, eRPName, nPlateID, nFiberID))
2282  {
2283  fOffset=FiberParams.fcs_atlas.fOffset;
2284  }
2285 
2286  return fOffset;
2287 }
2288 
2289 double ALFA_GeometryReader::GetODFiberZPos(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
2290 {
2291  double fZPos=0.0;
2292  FIBERPARAMS FiberParams;
2293 
2295  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::GetODFiberZPos");
2296  LogStream<<MSG::ERROR<<"Invalid coordinate system"<<endmsg;
2297  return 0.0;
2298  }
2299 
2300  if(GetODFiberParams(&FiberParams, eFType, eRPName, nPlateID, nFiberID))
2301  {
2302  fZPos=FiberParams.fcs_atlas.fZPos;
2303  }
2304 
2305  return fZPos;
2306 }
2307 
2308 bool ALFA_GeometryReader::ParseRPMetrology(eGeoSourceType eSourceType, const char* szDataSource)
2309 {
2310  bool bRes=false;
2311 
2312  eRPotName eRPName=ERPN_UNDEFINED;
2313  ALFA_ConfigParams CfgParams;
2314 
2315  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::ParseRPMetrology");
2316 
2317  if(eSourceType==EGST_FILE){
2318  // resolve ALFA Stations parameters
2319  if(CfgParams.Init(szDataSource,"[B7L1]")==0) return false;
2320  if(!SetupStationMetrologyPoints(CfgParams,EASN_B7L1)) return false;
2321 
2322  if(CfgParams.Init(szDataSource,"[A7L1]")==0) return false;
2323  if(!SetupStationMetrologyPoints(CfgParams,EASN_A7L1)) return false;
2324 
2325  if(CfgParams.Init(szDataSource,"[A7R1]")==0) return false;
2326  if(!SetupStationMetrologyPoints(CfgParams,EASN_A7R1)) return false;
2327 
2328  if(CfgParams.Init(szDataSource,"[B7R1]")==0) return false;
2329  if(!SetupStationMetrologyPoints(CfgParams,EASN_B7R1)) return false;
2330 
2331  // resolve Romain Pots parameters
2332  eRPName=ERPN_B7L1U;
2333  if(CfgParams.Init(szDataSource,"[B7L1U]")==0) return false;
2334  if(!SetupRPMetrologyPoints(CfgParams,eRPName)) return false;
2335  if(!SetupDetMetrologyPoints(CfgParams,eRPName)) return false;
2336 
2337  eRPName=ERPN_B7L1L;
2338  if(CfgParams.Init(szDataSource,"[B7L1L]")==0) return false;
2339  if(!SetupRPMetrologyPoints(CfgParams,eRPName)) return false;
2340  if(!SetupDetMetrologyPoints(CfgParams,eRPName)) return false;
2341 
2342  eRPName=ERPN_A7L1U;
2343  if(CfgParams.Init(szDataSource,"[A7L1U]")==0) return false;
2344  if(!SetupRPMetrologyPoints(CfgParams,eRPName)) return false;
2345  if(!SetupDetMetrologyPoints(CfgParams,eRPName)) return false;
2346 
2347  eRPName=ERPN_A7L1L;
2348  if(CfgParams.Init(szDataSource,"[A7L1L]")==0) return false;
2349  if(!SetupRPMetrologyPoints(CfgParams,eRPName)) return false;
2350  if(!SetupDetMetrologyPoints(CfgParams,eRPName)) return false;
2351 
2352  eRPName=ERPN_A7R1U;
2353  if(CfgParams.Init(szDataSource,"[A7R1U]")==0) return false;
2354  if(!SetupRPMetrologyPoints(CfgParams,eRPName)) return false;
2355  if(!SetupDetMetrologyPoints(CfgParams,eRPName)) return false;
2356 
2357  eRPName=ERPN_A7R1L;
2358  if(CfgParams.Init(szDataSource,"[A7R1L]")==0) return false;
2359  if(!SetupRPMetrologyPoints(CfgParams,eRPName)) return false;
2360  if(!SetupDetMetrologyPoints(CfgParams,eRPName)) return false;
2361 
2362  eRPName=ERPN_B7R1U;
2363  if(CfgParams.Init(szDataSource,"[B7R1U]")==0) return false;
2364  if(!SetupRPMetrologyPoints(CfgParams,eRPName)) return false;
2365  if(!SetupDetMetrologyPoints(CfgParams,eRPName)) return false;
2366 
2367  eRPName=ERPN_B7R1L;
2368  if(CfgParams.Init(szDataSource,"[B7R1L]")==0) return false;
2369  if(!SetupRPMetrologyPoints(CfgParams,eRPName)) return false;
2370  if(!SetupDetMetrologyPoints(CfgParams,eRPName)) return false;
2371 
2372  bRes=true;
2373  }
2374  else
2375  {
2376  LogStream<<MSG::ERROR<<"The file source is supported only."<<endmsg;
2377  bRes=false;
2378  }
2379 
2380  return bRes;
2381 }
2382 
2383 bool ALFA_GeometryReader::ResolveRPotRefPoints(const char* szvalue, eRPotName eRPName, eRefPointType eRPointType)
2384 {
2385  bool bRes=false;
2386  std::vector<HepGeom::Point3D<double> > vecRefPoints;
2387 
2388  if(eRPointType==ERPT_IDEAL || eRPointType==ERPT_REAL) bRes=ParseRefPoints(szvalue,vecRefPoints,EMCS_STATION);
2389  else if(eRPointType==ERPT_DETIDEAL || eRPointType==ERPT_DETREAL) bRes=ParseRefPoints(szvalue,vecRefPoints,EMCS_ROMANPOT);
2390 
2391  if(bRes){
2392  if(eRPointType==ERPT_IDEAL) m_RPPosParams[eRPName].VecIdealRPRefPoints=std::move(vecRefPoints);
2393  else if(eRPointType==ERPT_REAL) m_RPPosParams[eRPName].VecRealRPRefPoints=std::move(vecRefPoints);
2394  else if(eRPointType==ERPT_DETIDEAL) m_RPPosParams[eRPName].VecIdealDetRefPoints=std::move(vecRefPoints);
2395  else if(eRPointType==ERPT_DETREAL) m_RPPosParams[eRPName].VecRealDetRefPoints=std::move(vecRefPoints);
2396  }
2397 
2398  return bRes;
2399 }
2400 
2401 bool ALFA_GeometryReader::ParseRefPoints(const char* szvalue, std::vector<HepGeom::Point3D<double> >& vecRefPoints, eMetrologyCoordSystem eCSystem)
2402 {
2403  double fx{},fy{},fz{},faux{};
2404  char *ppos1,*ppos2,*ppos3,*ppos4,*pstop;
2405  char szbuff[513]{};
2406  HepGeom::Point3D<double> RefPoint;
2407 
2408  MsgStream LogStream(Athena::getMessageSvc(), "ALFA_GeometryReader::ParseRefPoints");
2409  if (strlen(szvalue) <513){
2410  strcpy(szbuff,szvalue);
2411  } else {
2412  LogStream<<MSG::ERROR<<"String too long for buffer."<<endmsg;
2413  }
2414  //get point count
2415  int i,nCnt=0;
2416  ppos2=szbuff;
2417  while((ppos1=strchr(ppos2,'['))!=nullptr){
2418  if(!(ppos2=strchr(ppos1+1,']'))) return false;
2419  ppos2++;
2420  nCnt++;
2421  }
2422 
2423  if(nCnt==0) return false;
2424  vecRefPoints.resize(nCnt);
2425 
2426  i=0;
2427  ppos2=szbuff;
2428  while((ppos1=strchr(ppos2,'['))!=nullptr){
2429  if(!(ppos2=strchr(ppos1,']'))) return false;
2430 
2431  //x-coordinate
2432  ppos3=ppos1+1;
2433  if(!(ppos4=strchr(ppos3+1,','))) return false;
2434  *ppos4=0;
2435  faux=strtod(ppos3,&pstop);
2436  if(pstop!=ppos4 && *pstop!=' ') return false;
2437  else fx=faux;
2438 
2439  //y-coordinate
2440  ppos3=ppos4+1;
2441  if(!(ppos4=strchr(ppos3+1,','))) return false;
2442  *ppos4=0;
2443  faux=strtod(ppos3,&pstop);
2444  if(pstop!=ppos4 && *pstop!=' ') return false;
2445  else fy=faux;
2446 
2447  //z-coordinate
2448  ppos3=ppos4+1;
2449  if(!(ppos4=strchr(ppos3+1,']'))) return false;
2450  *ppos4=0;
2451  faux=strtod(ppos3,&pstop);
2452  if(pstop!=ppos4 && *pstop!=' ') return false;
2453  else fz=faux;
2454 
2455  //rearanging coordinates to ATLAS scheme
2456  if(eCSystem==EMCS_ATLAS){
2457  RefPoint[0]=fx; RefPoint[1]=fy; RefPoint[2]=fz; // no swap
2458  }
2459  else if(eCSystem==EMCS_STATION){
2460  RefPoint[0]=fx; RefPoint[1]=fz; RefPoint[2]=-fy;
2461  }
2462  else if(eCSystem==EMCS_ROMANPOT){
2463  RefPoint[0]=fx; RefPoint[1]=-fz; RefPoint[2]=fy;
2464  }
2465  else if(eCSystem==EMCS_DETPIN1){
2466  RefPoint[0]=fx; RefPoint[1]=fy; RefPoint[2]=fz; // no swap
2467  }
2468  else throw new GaudiException("Invalid type of metrology coordinate system", "ALFA_GeometryReader::ParseRefPoints", StatusCode::FAILURE);
2469 
2470  vecRefPoints[i++]=RefPoint;
2471 
2472  ppos2++;
2473  }
2474 
2475  return true;
2476 }
2477 
2478 bool ALFA_GeometryReader::ParseArrayOfValues(const char* szvalue, std::vector<double>& vecValues)
2479 {
2480  bool bRes=true;
2481  double faux;
2482  char *ppos1,*ppos2,*pstop;
2483  char szbuff[512];
2484 
2485  vecValues.clear();
2486  memset(szbuff,0,sizeof(szbuff));
2487  if(szvalue) strncpy(szbuff,szvalue,sizeof(szbuff)-1);
2488 
2489  ppos1=szbuff;
2490  ppos2=strchr(ppos1,',');
2491  if(ppos2!=nullptr){
2492  while(ppos2!=nullptr){
2493  *ppos2=0;
2494 
2495  faux=strtod(ppos1,&pstop);
2496  if(pstop==ppos2) vecValues.push_back(faux);
2497  else{
2498  bRes=false;
2499  break;
2500  }
2501 
2502  ppos1=ppos2+1;
2503  ppos2=strchr(ppos1,',');
2504  }
2505 
2506  //load last value
2507  faux=strtod(ppos1,&pstop);
2508  if(*pstop==0) vecValues.push_back(faux);
2509  else bRes=false;
2510  }
2511 
2512  if(!bRes) vecValues.clear();
2513 
2514  return bRes;
2515 }
2516 
2518 {
2519  //bool bIsLightMetrology=true;
2520 
2521  double fZc;
2522  //double a1,a2;
2523  double a3,a4;
2524  double xp1,yp1;
2525  //double xp2,yp2,xp3,yp3,xr3;
2526  double xr1,yr1,xr2,yr2;//,yr3;
2527  HepGeom::Point3D<double> PointIdealD3, PointRealD3;
2528  HepGeom::Point3D<double> PointIdealD4, PointRealD4;
2529  HepGeom::Point3D<double> PointIdealD5, PointRealD5;
2530 
2531  std::vector<double> vecDetEdges;
2532  std::vector<HepGeom::Point3D<double> > vecNominalDetPoints;
2533  std::vector<HepGeom::Point3D<double> > vecRealDetPoints;
2534 
2535  // load nominal & real position of PSx in RP CS
2536  if(!CfgParams.IsKey("idealrefdetpoints")) return false;
2537  if(!ParseRefPoints(CfgParams.GetParameter("idealrefdetpoints"),vecNominalDetPoints,EMCS_ROMANPOT)) return false;
2538  if(!CfgParams.IsKey("realrefdetpoints")) return false;
2539  if(!ParseRefPoints(CfgParams.GetParameter("realrefdetpoints"),vecRealDetPoints,EMCS_ROMANPOT)) return false;
2540 
2541  if(!CfgParams.IsKey("realdetedgeypos")) return false;
2542  if(!ParseArrayOfValues(CfgParams.GetParameter("realdetedgeypos"),vecDetEdges)) return false;
2543 
2544  fZc=0.5*(vecDetEdges[0]+vecDetEdges[1]);
2545  PointIdealD3=HepGeom::Point3D<double>(10.0,0.0,0.0);
2546  PointIdealD4=HepGeom::Point3D<double>(0.0,10.0,0.0);
2547  PointIdealD5=HepGeom::Point3D<double>(0.0,0.0,10.0);
2548 
2549  //compute in-plane transformation matrix (deformation not included)
2550  xp1=vecNominalDetPoints[0].x();
2551  yp1=vecNominalDetPoints[0].y();
2552 
2553 
2554  xr1=vecRealDetPoints[0].x();
2555  yr1=vecRealDetPoints[0].y();
2556  xr2=vecRealDetPoints[1].x();
2557  yr2=vecRealDetPoints[1].y();
2558 
2559 
2560  double alpha=-atan((xr2-xr1)/(yr2-yr1));
2561  a3=xr1-xp1;//a3=0.5*(xr1+xr2);
2562  a4=yr1-yp1;//a4=0.5*(yr1+yr2);
2563 
2564 
2565 
2566  //-----------------------------------------
2567  HepGeom::Transform3D CorrectionInMainPoint, CorrectionInDetPin1;
2568 
2569  //use light metrology
2570  CorrectionInDetPin1=HepGeom::Translate3D(a3,a4,fZc-113.0*CLHEP::mm)*HepGeom::RotateZ3D(alpha);
2571 
2572  HepGeom::Point3D<double> MainPoint=ms_NominalRPMainPoint;
2573  HepGeom::Point3D<double> RPPin1=ms_NominalRPPin1;
2574  HepGeom::Point3D<double> DetPin1=ms_NominalDetPin1;
2575 
2576  //recalculate SW transform in MainPoint
2577  HepGeom::Vector3D<double> OriginShift=RPPin1+DetPin1-MainPoint;
2578 
2579  CLHEP::Hep3Vector TranslationInMainPoint=CorrectionInDetPin1.getTranslation()-CorrectionInDetPin1*OriginShift+OriginShift;
2580 
2581  CLHEP::HepRotation RotationInMainPoint=CorrectionInDetPin1.getRotation();
2582  CorrectionInMainPoint=HepGeom::Transform3D(RotationInMainPoint,TranslationInMainPoint);
2583 
2584  PointRealD3=CorrectionInMainPoint*PointIdealD3;
2585  PointRealD4=CorrectionInMainPoint*PointIdealD4;
2586  PointRealD5=CorrectionInMainPoint*PointIdealD5;
2587 
2588  m_RPPosParams[eRPName].VecIdealDetRefPoints.resize(3);
2589  m_RPPosParams[eRPName].VecRealDetRefPoints.resize(3);
2590 
2591  m_RPPosParams[eRPName].VecIdealDetRefPoints[0]=std::move(PointIdealD5);
2592  m_RPPosParams[eRPName].VecRealDetRefPoints[0]=std::move(PointRealD5);
2593 
2594  m_RPPosParams[eRPName].VecIdealDetRefPoints[1]=std::move(PointIdealD4);
2595  m_RPPosParams[eRPName].VecRealDetRefPoints[1]=std::move(PointRealD4);
2596 
2597  m_RPPosParams[eRPName].VecIdealDetRefPoints[2]=std::move(PointIdealD3);
2598  m_RPPosParams[eRPName].VecRealDetRefPoints[2]=std::move(PointRealD3);
2599 
2600  return true;
2601 }
2602 
2604 {
2605  bool bRes=true;
2606  const int nCnt=3;
2607  int i;
2608  double fx,fy,fz;
2609  double fCurrentLVDTmm;
2610  HepGeom::Point3D<double> PSinStation, RPPinNominal;
2611  double fCurrentLVDT=0.0;
2612  std::vector<double> vecPolyFitParams;
2613  std::vector<HepGeom::Point3D<double> > vecPSinRPCS;
2614  std::vector<HepGeom::Point3D<double> > vecNominalPSinStationCS;
2615  std::vector<HepGeom::Point3D<double> > vecRealPSinStationCS;
2616  RPPOSPARAMS RPPosParams;
2617 
2618  GetRPPosParams(&RPPosParams,eRPName);
2619  if(!RPPosParams.bIsLow){
2620  RPPinNominal=HepGeom::Point3D<double>(77.5*CLHEP::mm,172.2*CLHEP::mm,-124.0*CLHEP::mm);
2621  }
2622  else{
2623  RPPinNominal=HepGeom::Point3D<double>(77.5*CLHEP::mm,-172.2*CLHEP::mm,+124.0*CLHEP::mm);
2624  }
2625 
2626  vecNominalPSinStationCS.resize(nCnt);
2627  vecRealPSinStationCS.resize(nCnt);
2628 
2629  // load nominal position of PSx in RP CS
2630  if(!CfgParams.IsKey("psinrpss")) return false;
2631  if(!ParseRefPoints(CfgParams.GetParameter("psinrpss"),vecPSinRPCS,EMCS_ROMANPOT)) return false;
2632 
2633  //compute nominal position of PSx in Station CS
2634  for(i=0;i<nCnt;i++){
2635  vecNominalPSinStationCS[i]=RPPinNominal+HepGeom::RotateX3D(RPPosParams.bIsLow? 180*CLHEP::deg:0.0)*vecPSinRPCS[i];
2636  }
2637 
2638 
2639  //calculate LVDT position from position in [mm]
2640  fCurrentLVDTmm=RPPosParams.fCurrentLVDTmm;
2641 
2642  ParseArrayOfValues(CfgParams.GetParameter("mm2lvdtfit"),vecPolyFitParams);
2643  fCurrentLVDT=GetPolyFitValue(fCurrentLVDTmm,vecPolyFitParams); // true LVDT value
2644 
2645  //compute real position of PSx in Station CS from LVDT parametrization
2646  ParseArrayOfValues(CfgParams.GetParameter("ps1xlvdtpolyfit"),vecPolyFitParams);
2647  fx=GetPolyFitValue(fCurrentLVDT,vecPolyFitParams);
2648  ParseArrayOfValues(CfgParams.GetParameter("ps1ylvdtpolyfit"),vecPolyFitParams);
2649  fy=GetPolyFitValue(fCurrentLVDT,vecPolyFitParams);
2650  ParseArrayOfValues(CfgParams.GetParameter("ps1zlvdtpolyfit"),vecPolyFitParams);
2651  fz=GetPolyFitValue(fCurrentLVDT,vecPolyFitParams);
2652  PSinStation.set(fx,fy,fz);
2653  vecRealPSinStationCS[0]=PSinStation;
2654 
2655  ParseArrayOfValues(CfgParams.GetParameter("ps2xlvdtpolyfit"),vecPolyFitParams);
2656  fx=GetPolyFitValue(fCurrentLVDT,vecPolyFitParams);
2657  ParseArrayOfValues(CfgParams.GetParameter("ps2ylvdtpolyfit"),vecPolyFitParams);
2658  fy=GetPolyFitValue(fCurrentLVDT,vecPolyFitParams);
2659  ParseArrayOfValues(CfgParams.GetParameter("ps2zlvdtpolyfit"),vecPolyFitParams);
2660  fz=GetPolyFitValue(fCurrentLVDT,vecPolyFitParams);
2661  PSinStation.set(fx,fy,fz);
2662  vecRealPSinStationCS[1]=PSinStation;
2663 
2664  ParseArrayOfValues(CfgParams.GetParameter("ps3xlvdtpolyfit"),vecPolyFitParams);
2665  fx=GetPolyFitValue(fCurrentLVDT,vecPolyFitParams);
2666  ParseArrayOfValues(CfgParams.GetParameter("ps3ylvdtpolyfit"),vecPolyFitParams);
2667  fy=GetPolyFitValue(fCurrentLVDT,vecPolyFitParams);
2668  ParseArrayOfValues(CfgParams.GetParameter("ps3zlvdtpolyfit"),vecPolyFitParams);
2669  fz=GetPolyFitValue(fCurrentLVDT,vecPolyFitParams);
2670  PSinStation.set(fx,fy,fz);
2671  vecRealPSinStationCS[2]=std::move(PSinStation);
2672 
2673 
2674  m_RPPosParams[eRPName].VecIdealRPRefPoints=std::move(vecNominalPSinStationCS);
2675  m_RPPosParams[eRPName].VecRealRPRefPoints=std::move(vecRealPSinStationCS);
2676 
2677  bRes=true;
2678 
2679  return bRes;
2680 }
2681 
2683 {
2684  std::vector<HepGeom::Point3D<double> > vecShiftPoints;
2685 
2686  // load shift E
2687  if(!CfgParams.IsKey("shifte")) return false;
2688  if(!ParseRefPoints(CfgParams.GetParameter("shifte"),vecShiftPoints,EMCS_ATLAS)) return false;
2689  m_ASPosParams[eASName].ShiftE=vecShiftPoints[0];
2690 
2691  // load shift S
2692  if(!CfgParams.IsKey("shifts")) return false;
2693  if(!ParseRefPoints(CfgParams.GetParameter("shifts"),vecShiftPoints,EMCS_ATLAS)) return false;
2694  m_ASPosParams[eASName].ShiftS=vecShiftPoints[0];
2695 
2696  return true;
2697 }
2698 
2699 double ALFA_GeometryReader::GetPolyFitValue(const double fInputValue, const std::vector<double>& vecPolyFitParams)
2700 {
2701  int i,n;
2702  double fOutputValue=0.0;
2703 
2704  n=vecPolyFitParams.size();
2705 
2706  for(i=0;i<n;i++)
2707  {
2708  fOutputValue+=vecPolyFitParams[i]*pow(fInputValue,n-1-i);
2709  }
2710 
2711  return fOutputValue;
2712 }
2713 
2714 HepGeom::Point3D<double> ALFA_GeometryReader::GetDetPointInAtlas(eRPotName eRPName, const HepGeom::Point3D<double>& PointInDetCS)
2715 {
2716  RPPOSPARAMS RPPosParams;
2717  ASPOSPARAMS ASPosParams;
2718 
2719  HepGeom::Point3D<double> RPPin1=ms_NominalRPPin1;//HepGeom::Point3D<double>(+77.5*mm,+172.2*mm,-114.0*mm);
2720  HepGeom::Point3D<double> MainPoint=ms_NominalRPMainPoint;//HepGeom::Point3D<double>(0.0*mm,31.025*mm,18.0*mm);
2721  HepGeom::Point3D<double> AlfaRefPoint=ms_NominalAlfaRefPoint;//HepGeom::Point3D<double>(-77.5*mm,-35.7*mm,114.0*mm);
2722  HepGeom::Point3D<double> PointInAtlasCS, PointInRPotCS;
2723 
2725  GetRPPosParams(&RPPosParams, eRPName);
2726  GetASPosParams(&ASPosParams, RPPosParams.eASName);
2727  HepGeom::Vector3D<double> Shift=RPPin1-MainPoint;
2728  HepGeom::Point3D<double> PointInMainPoint=Shift+AlfaRefPoint+PointInDetCS;
2729  HepGeom::Point3D<double> PointInRPotCS=RPPosParams.DetTransformInMainPoint*PointInMainPoint; //wrt. MainPoint
2730  HepGeom::Transform3D TotTransform=ASPosParams.ASTransformInATLAS*RPPosParams.RPTransformInStation;
2731  PointInAtlasCS=TotTransform*PointInRPotCS;
2732  }
2733  else{
2734  throw new GaudiException(" The GetDetPointInAtlas() can be used only with EFCS_ATLAS or EFCS_CLADDING flag ", "ALFA_GeometryReader::GetDetPointInAtlas", StatusCode::FAILURE);
2735  }
2736 
2737  return PointInAtlasCS;
2738 }
2739 
2740 HepGeom::Point3D<double> ALFA_GeometryReader::GetDetPointInRPot(eRPotName eRPName, const HepGeom::Point3D<double>& PointInDetCS)
2741 {
2742  RPPOSPARAMS RPPosParams;
2743  HepGeom::Point3D<double> RPPin1=ms_NominalRPPin1;
2744  HepGeom::Point3D<double> MainPoint=ms_NominalRPMainPoint;
2745  HepGeom::Point3D<double> AlfaRefPoint=ms_NominalAlfaRefPoint;
2746  HepGeom::Point3D<double> PointInRPotCS;
2747 
2749  GetRPPosParams(&RPPosParams, eRPName);
2750 
2751  HepGeom::Vector3D<double> Shift=RPPin1-MainPoint;
2752  HepGeom::Point3D<double> PointInMainPoint=Shift+AlfaRefPoint+PointInDetCS;
2753  PointInRPotCS=RPPosParams.DetTransformInMainPoint*PointInMainPoint-Shift; // wrt. RPPin1
2754  }
2755  else{
2756  throw new GaudiException(" The GetDetPointInAtlas() can be used only with EFCS_ATLAS or EFCS_CLADDING flag ", "ALFA_GeometryReader::GetDetPointInAtlas", StatusCode::FAILURE);
2757  }
2758 
2759  return PointInRPotCS;
2760 }
2761 
2762 
2763 bool ALFA_GeometryReader::SaveRPGeometryParams(const eRPotName eRPName, const char* szDataDestination)
2764 {
2765  bool bRes= false;
2766  double fRotX,fRotY,fRotZ;
2767 
2768  FILE *pfile=fopen(szDataDestination,"w");
2769  if(pfile!=nullptr)
2770  {
2771  fprintf(pfile,"Romain pot geometry info: ----------------------------------------\r\n");
2772 
2773  fprintf(pfile,"LVDT: %.3f mm\r\n\r\n",m_RPPosParams[eRPName].fCurrentLVDTmm);
2774 
2775  fprintf(pfile,"Transformation matrix of RP in station MainPoint:\r\n");
2776  fprintf(pfile,"%+.5f %+.5f %+.5f %+.5f\r\n",m_RPPosParams[eRPName].RPTransformInStation.xx(),m_RPPosParams[eRPName].RPTransformInStation.xy(),m_RPPosParams[eRPName].RPTransformInStation.xz(),m_RPPosParams[eRPName].RPTransformInStation.dx());
2777  fprintf(pfile,"%+.5f %+.5f %+.5f %+.5f\r\n",m_RPPosParams[eRPName].RPTransformInStation.yx(),m_RPPosParams[eRPName].RPTransformInStation.yy(),m_RPPosParams[eRPName].RPTransformInStation.yz(),m_RPPosParams[eRPName].RPTransformInStation.dy());
2778  fprintf(pfile,"%+.5f %+.5f %+.5f %+.5f\r\n",m_RPPosParams[eRPName].RPTransformInStation.zx(),m_RPPosParams[eRPName].RPTransformInStation.zy(),m_RPPosParams[eRPName].RPTransformInStation.zz(),m_RPPosParams[eRPName].RPTransformInStation.dz());
2779 
2780  fRotZ=atan2(m_RPPosParams[eRPName].RPTransformInStation.yx(),m_RPPosParams[eRPName].RPTransformInStation.xx());
2781  fRotY=atan2(-m_RPPosParams[eRPName].RPTransformInStation.zx(),sqrt(pow(m_RPPosParams[eRPName].RPTransformInStation.zy(),2)+pow(m_RPPosParams[eRPName].RPTransformInStation.zz(),2)));//asin(m_RPPosParams[eRPName].RPTransformInStation.zx());
2782  fRotX=atan2(m_RPPosParams[eRPName].RPTransformInStation.zy(),m_RPPosParams[eRPName].RPTransformInStation.zz());
2783  fprintf(pfile,"RotX=%.5f rad, RotY=%.5f rad, RotZ=%.5f rad\r\n",fRotX,fRotY,fRotZ);
2784 
2785 
2786  fprintf(pfile,"\r\nDetector geometry info: ------------------------------------------\r\n");
2787  fprintf(pfile,"Transformation matrix of detector in RP MainPoint:\r\n");
2788  fprintf(pfile,"%+.5f %+.5f %+.5f %+.5f\r\n",m_RPPosParams[eRPName].DetTransformInMainPoint.xx(),m_RPPosParams[eRPName].DetTransformInMainPoint.xy(),m_RPPosParams[eRPName].DetTransformInMainPoint.xz(),m_RPPosParams[eRPName].DetTransformInMainPoint.dx());
2789  fprintf(pfile,"%+.5f %+.5f %+.5f %+.5f\r\n",m_RPPosParams[eRPName].DetTransformInMainPoint.yx(),m_RPPosParams[eRPName].DetTransformInMainPoint.yy(),m_RPPosParams[eRPName].DetTransformInMainPoint.yz(),m_RPPosParams[eRPName].DetTransformInMainPoint.dy());
2790  fprintf(pfile,"%+.5f %+.5f %+.5f %+.5f\r\n",m_RPPosParams[eRPName].DetTransformInMainPoint.zx(),m_RPPosParams[eRPName].DetTransformInMainPoint.zy(),m_RPPosParams[eRPName].DetTransformInMainPoint.zz(),m_RPPosParams[eRPName].DetTransformInMainPoint.dz());
2791 
2792  fRotZ=atan2(m_RPPosParams[eRPName].DetTransformInMainPoint.yx(),m_RPPosParams[eRPName].DetTransformInMainPoint.xx());
2793  fRotY=atan2(-m_RPPosParams[eRPName].DetTransformInMainPoint.zx(),sqrt(pow(m_RPPosParams[eRPName].DetTransformInMainPoint.zy(),2)+pow(m_RPPosParams[eRPName].DetTransformInMainPoint.zz(),2)));//asin(m_RPPosParams[eRPName].RPTransformInStation.zx());
2794  fRotX=atan2(m_RPPosParams[eRPName].DetTransformInMainPoint.zy(),m_RPPosParams[eRPName].DetTransformInMainPoint.zz());
2795  fprintf(pfile,"RotX=%.5f rad, RotY=%.5f rad, RotZ=%.5f rad\r\n",fRotX,fRotY,fRotZ);
2796 
2797  fprintf(pfile,"\r\nReference pins and Track point info: ------------------------------------------\r\n");
2798  fprintf(pfile,"RPPin1: nominal=[%.3f,%.3f,%.3f], real=[%.3f,%.3f,%.3f] (Station CS)\r\n",m_RPPosParams[eRPName].RefPins.IdealRPPin1.x(),m_RPPosParams[eRPName].RefPins.IdealRPPin1.y(),m_RPPosParams[eRPName].RefPins.IdealRPPin1.z(),
2799  m_RPPosParams[eRPName].RefPins.RealRPPin1.x(),m_RPPosParams[eRPName].RefPins.RealRPPin1.y(),m_RPPosParams[eRPName].RefPins.RealRPPin1.z());
2800  fprintf(pfile,"RPPin2: nominal=[%.3f,%.3f,%.3f], real=[%.3f,%.3f,%.3f] (Station CS)\r\n",m_RPPosParams[eRPName].RefPins.IdealRPPin2.x(),m_RPPosParams[eRPName].RefPins.IdealRPPin2.y(),m_RPPosParams[eRPName].RefPins.IdealRPPin2.z(),
2801  m_RPPosParams[eRPName].RefPins.RealRPPin2.x(),m_RPPosParams[eRPName].RefPins.RealRPPin2.y(),m_RPPosParams[eRPName].RefPins.RealRPPin2.z());
2802  fprintf(pfile,"RPPin3: nominal=[%.3f,%.3f,%.3f], real=[%.3f,%.3f,%.3f] (Station CS)\r\n",m_RPPosParams[eRPName].RefPins.IdealRPPin3.x(),m_RPPosParams[eRPName].RefPins.IdealRPPin3.y(),m_RPPosParams[eRPName].RefPins.IdealRPPin3.z(),
2803  m_RPPosParams[eRPName].RefPins.RealRPPin3.x(),m_RPPosParams[eRPName].RefPins.RealRPPin3.y(),m_RPPosParams[eRPName].RefPins.RealRPPin3.z());
2804  fprintf(pfile,"Detector TrackPoint: [%.3f,%.3f,%.3f] (ALFA CS), [%.3f,%.3f,%.3f] (RPot CS), [%.3f,%.3f,%.3f] (ATLAS CS)\r\n",m_RPPosParams[eRPName].RefPins.DTPInAlfaCS.x(),m_RPPosParams[eRPName].RefPins.DTPInAlfaCS.y(),m_RPPosParams[eRPName].RefPins.DTPInAlfaCS.z(),
2805  m_RPPosParams[eRPName].RefPins.DTPInRPotCS.x(),m_RPPosParams[eRPName].RefPins.DTPInRPotCS.y(),m_RPPosParams[eRPName].RefPins.DTPInRPotCS.z(),
2806  m_RPPosParams[eRPName].RefPins.DTPInAtlasCS.x(),m_RPPosParams[eRPName].RefPins.DTPInAtlasCS.y(),m_RPPosParams[eRPName].RefPins.DTPInAtlasCS.z());
2807  fprintf(pfile,"Detector CentrePoint: [%.3f,%.3f,%.3f] (ALFA CS), [%.3f,%.3f,%.3f] (RPot CS), [%.3f,%.3f,%.3f] (ATLAS CS)\r\n",m_RPPosParams[eRPName].RefPins.DCPInAlfaCS.x(),m_RPPosParams[eRPName].RefPins.DCPInAlfaCS.y(),m_RPPosParams[eRPName].RefPins.DCPInAlfaCS.z(),
2808  m_RPPosParams[eRPName].RefPins.DCPInRPotCS.x(),m_RPPosParams[eRPName].RefPins.DCPInRPotCS.y(),m_RPPosParams[eRPName].RefPins.DCPInRPotCS.z(),
2809  m_RPPosParams[eRPName].RefPins.DCPInAtlasCS.x(),m_RPPosParams[eRPName].RefPins.DCPInAtlasCS.y(),m_RPPosParams[eRPName].RefPins.DCPInAtlasCS.z());
2810 
2811 
2812  fclose(pfile);
2813 
2814  bRes=true;
2815  }
2816 
2817  return bRes;
2818 }
2819 
2821 {
2822  HepGeom::Transform3D TransMatrix;
2823  ASPOSPARAMS AParams;
2824  RPPOSPARAMS RPParams;
2825 
2826  HepGeom::Point3D<double> RPPin1=ms_NominalRPPin1;
2827  HepGeom::Point3D<double> MainPoint=ms_NominalRPMainPoint;
2828  HepGeom::Point3D<double> AlfaRefPoint=ms_NominalAlfaRefPoint;
2829 
2830  GetRPPosParams(&RPParams, eRPName);
2831  GetASPosParams(&AParams, RPParams.eASName);
2832 
2833  HepGeom::Vector3D<double> Shift1=RPPin1-MainPoint;
2834  HepGeom::Vector3D<double> Shift2=RPPin1-MainPoint+AlfaRefPoint;
2835  HepGeom::Vector3D<double> Shift3=0.5*(AParams.ShiftE+AParams.ShiftS);
2836 
2837  switch(eMatrixType)
2838  {
2839  case ETE_A1:
2840  TransMatrix=RPParams.RPTransformInStation;
2841  break;
2842  case ETE_A2:
2843  TransMatrix=RPParams.DetTransformInMainPoint;
2844  break;
2845  case ETE_A3:
2846  TransMatrix=AParams.ASTransformInATLAS;
2847  break;
2848  case ETE_T1:
2849  TransMatrix=HepGeom::Translate3D(-Shift1);
2850  break;
2851  case ETE_T2:
2852  TransMatrix=HepGeom::Translate3D(Shift2);
2853  break;
2854  case ETE_T3:
2855  TransMatrix=HepGeom::Translate3D(-Shift3);
2856  break;
2857  default:
2858  throw GaudiException(" Invalid matrix identificator ", "ALFA_GeometryReader::GetTransformMatrix", StatusCode::FAILURE);
2859  break;
2860  }
2861 
2862  return TransMatrix;
2863 }
2864 
2866 {
2867  RPPOSPARAMS RPParams;
2868  GetRPPosParams(&RPParams, eRPName);
2869 
2870  return RPParams.RefPins.DCPInAtlasCS.z();
2871 }
2872 
2874 {
2875  m_RPPosParams[ERPN_B7L1U].fCurrentLVDTmm=pConfig->CfgRPosParams[0].fCurrentLVDTmm;
2876  m_RPPosParams[ERPN_B7L1L].fCurrentLVDTmm=pConfig->CfgRPosParams[1].fCurrentLVDTmm;
2877  m_RPPosParams[ERPN_A7L1U].fCurrentLVDTmm=pConfig->CfgRPosParams[2].fCurrentLVDTmm;
2878  m_RPPosParams[ERPN_A7L1L].fCurrentLVDTmm=pConfig->CfgRPosParams[3].fCurrentLVDTmm;
2879  m_RPPosParams[ERPN_A7R1U].fCurrentLVDTmm=pConfig->CfgRPosParams[4].fCurrentLVDTmm;
2880  m_RPPosParams[ERPN_A7R1L].fCurrentLVDTmm=pConfig->CfgRPosParams[5].fCurrentLVDTmm;
2881  m_RPPosParams[ERPN_B7R1U].fCurrentLVDTmm=pConfig->CfgRPosParams[6].fCurrentLVDTmm;
2882  m_RPPosParams[ERPN_B7R1L].fCurrentLVDTmm=pConfig->CfgRPosParams[7].fCurrentLVDTmm;
2883 }
2884 
2886 {
2887  int i, nSign;
2888  double fTotYOffset;
2889 
2890  for(i=0;i<RPOTSCNT;i++){
2891  nSign=(i%2==0)? +1:-1;
2892  fTotYOffset=pConfig->CfgRPosParams[i].swcorr.fYOffset-nSign*(2.0*CLHEP::mm);//+nSign*arrFWDistance[i];
2893 
2894  m_RPPosParams[(eRPotName)(i+1)].OriginOfDetSWTransform=HepGeom::Point3D<double>(-77.5*CLHEP::mm+pConfig->CfgRPosParams[i].swcorr.fXOffset,-170.2*CLHEP::mm,114.0*CLHEP::mm);
2895  m_RPPosParams[(eRPotName)(i+1)].DetSWTransform=HepGeom::RotateZ3D(nSign*pConfig->CfgRPosParams[i].swcorr.fTheta);
2896  m_RPPosParams[(eRPotName)(i+1)].RPSWTransformInStation=HepGeom::Translate3D(-pConfig->CfgRPosParams[i].swcorr.fXOffset,fTotYOffset,0.0*CLHEP::mm);
2897  }
2898 }
2899 
2901 {
2903  for(int i=0;i<RPOTSCNT;i++){
2905  m_RPPosParams[(eRPotName)(i+1)].OriginOfDetSWTransform=pConfig->CfgRPosParams[i].usercorr.UserOriginOfDetTransInRPot;
2906  m_RPPosParams[(eRPotName)(i+1)].DetSWTransform=pConfig->CfgRPosParams[i].usercorr.UserTransformOfDetInRPot;
2907  m_RPPosParams[(eRPotName)(i+1)].RPSWTransformInStation=pConfig->CfgRPosParams[i].usercorr.UserTransformOfRPInStation;
2908  }
2909  }
2910  }
2911 }
GEOMETRYCONFIGURATION::fNominalZPosB7R1
double fNominalZPosB7R1
Definition: ALFA_GeometryReader.h:204
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
ERPT_IDEAL
@ ERPT_IDEAL
Definition: ALFA_GeometryReader.h:30
ALFA_GeometryReader::TransformFiberPositions
void TransformFiberPositions(PFIBERPARAMS pFiberParams, eRPotName eRPName, const eFiberType eType, const eGeoSourceType eSourceType)
Definition: ALFA_GeometryReader.cxx:109
CFGRPPOSPARAMS::fYOffset
double fYOffset
Definition: ALFA_GeometryReader.h:182
ALFA_GeometryReader::ResolveRPotRefPoints
bool ResolveRPotRefPoints(const char *szvalue, eRPotName eRPName, eRefPointType eRPointType)
Definition: ALFA_GeometryReader.cxx:2383
eFiberType
eFiberType
Definition: ALFA_GeometryReader.h:25
RPPINS::DTPInAlfaCS
HepGeom::Point3D< double > DTPInAlfaCS
Definition: ALFA_GeometryReader.h:42
ALFA_SvdCalc.h
RPPOSPARAMS
Definition: ALFA_GeometryReader.h:49
ALFA_GeometryReader::ReadFile
bool ReadFile(const eRPotName eRPName, const eFiberType eFType, const char *szFilename)
Definition: ALFA_GeometryReader.cxx:1077
RPPOSPARAMS::IdealMainPointInStation
HepGeom::Point3D< double > IdealMainPointInStation
Definition: ALFA_GeometryReader.h:52
FIBERPARAMS::nLayerID
int nLayerID
Definition: ALFA_GeometryReader.h:101
PathResolver::RecursiveSearch
@ RecursiveSearch
Definition: PathResolver.h:28
ALFA_ConfigParams::Init
int Init(const char *szFile, const char *szSection)
Definition: ALFA_ConfigParams.cxx:36
add-xsec-uncert-quadrature-N.alpha
alpha
Definition: add-xsec-uncert-quadrature-N.py:110
eFiberCoordSystem
eFiberCoordSystem
Definition: ALFA_GeometryReader.h:29
METROLOGYFILE
#define METROLOGYFILE
Definition: ALFA_constants.h:36
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
dsvd
int dsvd(double **a, int m, int n, double *w, double **v)
Definition: ALFA_SvdCalc.cxx:38
ALFA_GeometryReader::GetUFiberCentreXPos
double GetUFiberCentreXPos(const eRPotName eRPName, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:1369
ALFA_ConfigParams::GetParameter
const char * GetParameter(const char *szKey) const
Definition: ALFA_ConfigParams.cxx:82
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
EFT_ODFIBERV0
@ EFT_ODFIBERV0
Definition: ALFA_GeometryReader.h:25
ODLAYERSCNT
#define ODLAYERSCNT
Definition: ALFA_CLinkAlg.h:30
ROMAPOT::ListODFibersU1
std::list< FIBERPARAMS > ListODFibersU1
Definition: ALFA_GeometryReader.h:152
RPPOSPARAMS::IdealMainPoint
HepGeom::Point3D< double > IdealMainPoint
Definition: ALFA_GeometryReader.h:51
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
FIBERPARAMS::fOriginY
double fOriginY
Definition: ALFA_GeometryReader.h:118
ROMAPOT::ListVFibers
std::list< FIBERPARAMS > ListVFibers
Definition: ALFA_GeometryReader.h:149
ASPOSPARAMS::clear
void clear()
Definition: ALFA_GeometryReader.cxx:35
EGST_IDEALGEOMETRY
@ EGST_IDEALGEOMETRY
Definition: ALFA_GeometryReader.h:23
LArNewCalib_Delay_OFC_Cali.pfile
string pfile
Definition: LArNewCalib_Delay_OFC_Cali.py:181
JetTiledMap::W
@ W
Definition: TiledEtaPhiMap.h:44
RPPINS::IdealRPPin3
HepGeom::Point3D< double > IdealRPPin3
Definition: ALFA_GeometryReader.h:39
RPPINS::DCPInAlfaCS
HepGeom::Point3D< double > DCPInAlfaCS
Definition: ALFA_GeometryReader.h:43
eMetrologyCoordSystem
eMetrologyCoordSystem
Definition: ALFA_GeometryReader.h:31
EMCS_STATION
@ EMCS_STATION
Definition: ALFA_GeometryReader.h:31
ALFA_GeometryReader::SetupCurrentLVDT
void SetupCurrentLVDT(const PGEOMETRYCONFIGURATION pConfig)
Definition: ALFA_GeometryReader.cxx:2873
ALFA_RDBAccess::ReadGeometry
bool ReadGeometry(const eRPotName eRPName, eFiberType eFType, const std::string &element, const std::string &tag, const std::string &node)
Definition: ALFA_RDBAccess.cxx:17
ALFA_GeometryReader::SetupUserCorrections
void SetupUserCorrections(const PGEOMETRYCONFIGURATION pConfig)
Definition: ALFA_GeometryReader.cxx:2900
ERPN_B7R1U
@ ERPN_B7R1U
Definition: ALFA_GeometryReader.h:27
ALFA_GeometryReader::ReadDatabase
bool ReadDatabase(const eRPotName eRPName, const eFiberType eFType, const char *szDataSource)
Definition: ALFA_GeometryReader.cxx:1223
FIBERPARAMS::fOffset
double fOffset
Definition: ALFA_GeometryReader.h:113
ALFA_GeometryReader::GetMDFiberParams
bool GetMDFiberParams(PFIBERPARAMS pFiberParams, const eFiberType eFType, const eRPotName eRPName, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:1878
ALFA_GeometryReader::GetRPGeometryType
eGeoSourceType GetRPGeometryType(const eRPotName eRPName, eFiberType eFType)
Definition: ALFA_GeometryReader.cxx:1861
FIBERPARAMS::fZPos
double fZPos
Definition: ALFA_GeometryReader.h:114
ALFA_ConfigParams
Definition: ALFA_ConfigParams.h:21
INACTIVEDETEGDEDISTANCE
#define INACTIVEDETEGDEDISTANCE
Definition: ALFA_constants.h:32
ALFA_GeometryReader::SetIdealGeometry
bool SetIdealGeometry(const eRPotName eRPName, const eFiberType eFType)
Definition: ALFA_GeometryReader.cxx:992
ALFAFIBERSCNT
#define ALFAFIBERSCNT
Definition: ALFA_constants.h:10
eRPotName
eRPotName
Definition: ALFA_GeometryReader.h:27
DMTest::C
C_v1 C
Definition: C.h:26
EMT_SWCORRECTIONS
@ EMT_SWCORRECTIONS
Definition: ALFA_GeometryReader.h:24
ALFA_GeometryReader.h
ALFA_GeometryReader::m_eFCoordSystem
eFiberCoordSystem m_eFCoordSystem
Definition: ALFA_GeometryReader.h:224
RPPOSPARAMS::IdealRefPoint
HepGeom::Point3D< double > IdealRefPoint
Definition: ALFA_GeometryReader.h:53
ALFA_GeometryReader::TransformFiberPositionsFCSAtlas
void TransformFiberPositionsFCSAtlas(PFIBERPARAMS pFiberParams, eRPotName eRPName, const eFiberType eType, const eGeoSourceType eSourceType)
Definition: ALFA_GeometryReader.cxx:255
ALFA_GeometryReader::GetRPotLabel
const char * GetRPotLabel(const eRPotName eRPName)
Definition: ALFA_GeometryReader.h:279
FIBERPARAMS::fAngle
double fAngle
Definition: ALFA_GeometryReader.h:108
ERPN_A7L1U
@ ERPN_A7L1U
Definition: ALFA_GeometryReader.h:27
ROMAPOT::ListODFibersU0
std::list< FIBERPARAMS > ListODFibersU0
Definition: ALFA_GeometryReader.h:150
ALFA_GeometryReader::GetVFiberParams
bool GetVFiberParams(PFIBERPARAMS pFiberParams, const eRPotName eRPName, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:1339
ASPOSPARAMS::IdealMainPoint
HepGeom::Point3D< double > IdealMainPoint
Definition: ALFA_GeometryReader.h:85
RPOTSCNT
#define RPOTSCNT
Definition: ALFA_CLinkAlg.h:26
FIBERPARAMS::fOriginX
double fOriginX
Definition: ALFA_GeometryReader.h:118
ALFA_GeometryReader::GetListOfRPotIDs
void GetListOfRPotIDs(std::map< eRPotName, std::string > *pMapRPotName)
Definition: ALFA_GeometryReader.cxx:1803
ASPOSPARAMS::ASTransformInATLAS
HepGeom::Transform3D ASTransformInATLAS
Definition: ALFA_GeometryReader.h:92
deg
#define deg
Definition: SbPolyhedron.cxx:17
RPPOSPARAMS::RefPins
RPPINS RefPins
Definition: ALFA_GeometryReader.h:56
FIBERPARAMS::fCentreYPos
double fCentreYPos
Definition: ALFA_GeometryReader.h:106
ALFA_GeometryReader::GetODFiberSlope
double GetODFiberSlope(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:2251
ALFA_GeometryReader::SetODFiberPositionToMainReference
void SetODFiberPositionToMainReference(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID, const HepGeom::Point3D< float > &TransPoint, const double fTransSlope)
Definition: ALFA_GeometryReader.cxx:2013
ERPN_B7R1L
@ ERPN_B7R1L
Definition: ALFA_GeometryReader.h:27
RunActsMaterialMapping.FilePath
FilePath
Definition: RunActsMaterialMapping.py:99
CFGRPPOSPARAMS::fTheta
double fTheta
Definition: ALFA_GeometryReader.h:184
EASN_A7R1
@ EASN_A7R1
Definition: ALFA_GeometryReader.h:26
RPPOSPARAMS::eASName
eAStationName eASName
Definition: ALFA_GeometryReader.h:55
ALFA_GeometryReader::GetDetPointInRPot
HepGeom::Point3D< double > GetDetPointInRPot(eRPotName eRPName, const HepGeom::Point3D< double > &PointInDetCS)
Definition: ALFA_GeometryReader.cxx:2740
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
RPPOSPARAMS::VecRealRPRefPoints
std::vector< HepGeom::Point3D< double > > VecRealRPRefPoints
Definition: ALFA_GeometryReader.h:62
GEOMETRYCONFIGURATION::fNominalZPosB7L1
double fNominalZPosB7L1
Definition: ALFA_GeometryReader.h:202
ALFA_GeometryReader::ParseRefPoints
bool ParseRefPoints(const char *szvalue, std::vector< HepGeom::Point3D< double > > &vecRefPoints, eMetrologyCoordSystem eCSystem)
Definition: ALFA_GeometryReader.cxx:2401
CFGRPPOSPARAMS::fXOffset
double fXOffset
Definition: ALFA_GeometryReader.h:183
ALFA_GeometryReader::SetUFiberPositionToMainReference
void SetUFiberPositionToMainReference(const eRPotName eRPName, const int nPlateID, const int nFiberID, const HepGeom::Point3D< float > &TransPoint, const double fTransSlope)
Definition: ALFA_GeometryReader.cxx:1441
ERPT_REAL
@ ERPT_REAL
Definition: ALFA_GeometryReader.h:30
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
RPPOSPARAMS::DetTransformInMainPoint
HepGeom::Transform3D DetTransformInMainPoint
Definition: ALFA_GeometryReader.h:76
RPPOSPARAMS::VecIdealRPRefPoints
std::vector< HepGeom::Point3D< double > > VecIdealRPRefPoints
Definition: ALFA_GeometryReader.h:61
EFCS_CLADDING
@ EFCS_CLADDING
Definition: ALFA_GeometryReader.h:29
EFT_FIBERMD
@ EFT_FIBERMD
Definition: ALFA_GeometryReader.h:25
ALFA_ConfigParams::IsKey
bool IsKey(const char *szKey) const
Definition: ALFA_ConfigParams.cxx:98
x
#define x
RPPOSPARAMS::szLabel
char szLabel[8]
Definition: ALFA_GeometryReader.h:50
FIBERPARAMS
Definition: ALFA_GeometryReader.h:98
ETE_T3
@ ETE_T3
Definition: ALFA_GeometryReader.h:32
ALFA_GeometryReader::GetTransformMatrix
HepGeom::Transform3D GetTransformMatrix(const eRPotName eRPName, const eTransformElement eMatrixType)
Definition: ALFA_GeometryReader.cxx:2820
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
ETE_A1
@ ETE_A1
Definition: ALFA_GeometryReader.h:32
GEOMETRYCONFIGURATION::clear
void clear()
Definition: ALFA_GeometryReader.cxx:72
ROMAPOT
Definition: ALFA_GeometryReader.h:139
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
GEOMETRYCONFIGURATION
Definition: ALFA_GeometryReader.h:196
EMT_NOMINAL
@ EMT_NOMINAL
Definition: ALFA_GeometryReader.h:24
eAStationName
eAStationName
Definition: ALFA_GeometryReader.h:26
CFGRPPOSPARAMS::strODConnString
std::string strODConnString
Definition: ALFA_GeometryReader.h:178
ALFA_GeometryReader::GetASPosParams
bool GetASPosParams(PASPOSPARAMS pRPosParams, const eAStationName eASName)
Definition: ALFA_GeometryReader.cxx:1842
CFGRPPOSPARAMS::strMDConnString
std::string strMDConnString
Definition: ALFA_GeometryReader.h:177
ASPOSPARAMS
Definition: ALFA_GeometryReader.h:83
CFGRPPOSPARAMS::fCurrentLVDTmm
double fCurrentLVDTmm
Definition: ALFA_GeometryReader.h:180
EMT_METROLOGY
@ EMT_METROLOGY
Definition: ALFA_GeometryReader.h:24
CFGRPPOSPARAMS::UserTransformOfDetInRPot
HepGeom::Transform3D UserTransformOfDetInRPot
Definition: ALFA_GeometryReader.h:190
FIBERPARAMS::fMainRefPointSlope
double fMainRefPointSlope
Definition: ALFA_GeometryReader.h:126
ALFA_GeometryReader::m_ASPosParams
std::map< eAStationName, ASPOSPARAMS > m_ASPosParams
Definition: ALFA_GeometryReader.h:230
ALFA_GeometryReader::GetODFiberOffset
double GetODFiberOffset(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:2270
ALFA_GeometryReader::GetMDFiberOffset
double GetMDFiberOffset(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:2189
ALFA_GeometryReader::PrintFiberGeometry
void PrintFiberGeometry(std::ostream &OutStream)
Definition: ALFA_GeometryReader.cxx:1537
FIBERPARAMS::fOriginZ
double fOriginZ
Definition: ALFA_GeometryReader.h:118
ALFA_GeometryReader::GetVFiberAngle
double GetVFiberAngle(const eRPotName eRPName, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:1423
ALFA_RDBAccess::m_ListFiberData
std::list< FIBERDATA > m_ListFiberData
Definition: ALFA_RDBAccess.h:59
ALFA_GeometryReader::SaveRPGeometryParams
bool SaveRPGeometryParams(const eRPotName eRPName, const char *szDataDestination)
Definition: ALFA_GeometryReader.cxx:2763
ALFA_GeometryReader::m_eMetrologyType
eMetrologyType m_eMetrologyType
Definition: ALFA_GeometryReader.h:226
CFGRPPOSPARAMS::swcorr
struct CFGRPPOSPARAMS::@51 swcorr
ETE_A2
@ ETE_A2
Definition: ALFA_GeometryReader.h:32
EASN_UNDEFINED
@ EASN_UNDEFINED
Definition: ALFA_GeometryReader.h:26
CFGRPPOSPARAMS::bIsEnabledUserTranform
bool bIsEnabledUserTranform
Definition: ALFA_GeometryReader.h:188
RPPOSPARAMS::VecIdealDetRefPoints
std::vector< HepGeom::Point3D< double > > VecIdealDetRefPoints
Definition: ALFA_GeometryReader.h:69
RPPINS::DTPInRPotCS
HepGeom::Point3D< double > DTPInRPotCS
Definition: ALFA_GeometryReader.h:42
ALFA_GeometryReader::m_RPPosParams
std::map< eRPotName, RPPOSPARAMS > m_RPPosParams
Definition: ALFA_GeometryReader.h:229
eMetrologyType
eMetrologyType
Definition: ALFA_GeometryReader.h:24
EASN_B7L1
@ EASN_B7L1
Definition: ALFA_GeometryReader.h:26
ROMAPOT::ListUFibers
std::list< FIBERPARAMS > ListUFibers
Definition: ALFA_GeometryReader.h:148
ALFA_GeometryReader::ReadSource
bool ReadSource(const eGeoSourceType eSourceType, const eRPotName eRPName, const eFiberType eFType, const char *szDataSource)
Definition: ALFA_GeometryReader.cxx:935
RPPINS::DCPInAtlasCS
HepGeom::Point3D< double > DCPInAtlasCS
Definition: ALFA_GeometryReader.h:43
eTransformElement
eTransformElement
Definition: ALFA_GeometryReader.h:32
RPPOSPARAMS::RPSWTransformInStation
HepGeom::Transform3D RPSWTransformInStation
Definition: ALFA_GeometryReader.h:64
ERPPT_ACTIVE
@ ERPPT_ACTIVE
Definition: ALFA_GeometryReader.h:28
RPPOSPARAMS::DetSWTransformInMainPoint
HepGeom::Transform3D DetSWTransformInMainPoint
Definition: ALFA_GeometryReader.h:72
DETEDGEDISTANCE
#define DETEDGEDISTANCE
Definition: ALFA_constants.h:31
ERPN_B7L1U
@ ERPN_B7L1U
Definition: ALFA_GeometryReader.h:27
lumiFormat.i
int i
Definition: lumiFormat.py:85
ERPN_UNDEFINED
@ ERPN_UNDEFINED
Definition: ALFA_GeometryReader.h:27
ALFA_GeometryReader::ms_NominalDetPin1
static const HepGeom::Point3D< double > ms_NominalDetPin1
Definition: ALFA_GeometryReader.h:220
z
#define z
ALFA_GeometryReader::SetupSWCorrections
void SetupSWCorrections(const PGEOMETRYCONFIGURATION pConfig)
Definition: ALFA_GeometryReader.cxx:2885
ASPOSPARAMS::ShiftE
HepGeom::Vector3D< double > ShiftE
Definition: ALFA_GeometryReader.h:89
RPPOSPARAMS::RPTransformInStation
HepGeom::Transform3D RPTransformInStation
Definition: ALFA_GeometryReader.h:65
beamspotman.n
n
Definition: beamspotman.py:731
ASPOSPARAMS::ShiftS
HepGeom::Vector3D< double > ShiftS
Definition: ALFA_GeometryReader.h:90
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EFT_ODFIBERU1
@ EFT_ODFIBERU1
Definition: ALFA_GeometryReader.h:25
EGST_UNDEFINED
@ EGST_UNDEFINED
Definition: ALFA_GeometryReader.h:23
eRefPointType
eRefPointType
Definition: ALFA_GeometryReader.h:30
EFT_VFIBER
@ EFT_VFIBER
Definition: ALFA_GeometryReader.h:25
ALFA_GeometryReader::SetupStationMetrologyPoints
bool SetupStationMetrologyPoints(ALFA_ConfigParams &CfgParams, eAStationName eASName)
Definition: ALFA_GeometryReader.cxx:2682
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
FIBERPARAMS::fDirX
double fDirX
Definition: ALFA_GeometryReader.h:119
ALFA_GeometryReader::GetPlateParams
bool GetPlateParams(PPLATEPARAMS pPlateParams, const eRPotName eRPName, const int nPlateID)
Definition: ALFA_GeometryReader.cxx:1505
ALFA_GeometryReader::Initialize
bool Initialize(const PGEOMETRYCONFIGURATION pConfig, eFiberCoordSystem eFCoordSystem)
Definition: ALFA_GeometryReader.cxx:623
RPPOSPARAMS::DetIdealTransformInMainPoint
HepGeom::Transform3D DetIdealTransformInMainPoint
Definition: ALFA_GeometryReader.h:71
ALFA_GeometryReader::ms_NominalAlfaRefPoint
static const HepGeom::Point3D< double > ms_NominalAlfaRefPoint
Definition: ALFA_GeometryReader.h:219
FIBERPARAMS::fcs_cladding
struct FIBERPARAMS::@46 fcs_cladding
ERPN_B7L1L
@ ERPN_B7L1L
Definition: ALFA_GeometryReader.h:27
RPPINS::IdealRPPin1
HepGeom::Point3D< double > IdealRPPin1
Definition: ALFA_GeometryReader.h:37
RPPOSPARAMS::clear
void clear()
Definition: ALFA_GeometryReader.cxx:45
RPPOSPARAMS::RPIdealTransformInStation
HepGeom::Transform3D RPIdealTransformInStation
Definition: ALFA_GeometryReader.h:63
FIBERPARAMS::fDirZ
double fDirZ
Definition: ALFA_GeometryReader.h:119
GEOMETRYCONFIGURATION::CfgRPosParams
CFGRPPOSPARAMS CfgRPosParams[RPOTSCNT]
Definition: ALFA_GeometryReader.h:205
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
ASPOSPARAMS::szLabel
char szLabel[8]
Definition: ALFA_GeometryReader.h:84
FIBERPARAMS::MainRefPointPos
HepGeom::Point3D< float > MainRefPointPos
Definition: ALFA_GeometryReader.h:127
Scale
void Scale(TH1 *h, double d=1)
Definition: comparitor.cxx:77
ALFA_RDBAccess.h
RPPOSPARAMS::VecRealDetRefPoints
std::vector< HepGeom::Point3D< double > > VecRealDetRefPoints
Definition: ALFA_GeometryReader.h:70
ALFALAYERSCNT
#define ALFALAYERSCNT
Definition: ALFA_constants.h:8
FIBERPARAMS::nPlateID
int nPlateID
Definition: ALFA_GeometryReader.h:99
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition: Control/CxxUtils/Root/StringUtils.cxx:91
CFGRPPOSPARAMS::usercorr
struct CFGRPPOSPARAMS::@52 usercorr
fill
void fill(H5::Group &out_file, size_t iterations)
Definition: test-hdf5-writer.cxx:95
EFT_UFIBER
@ EFT_UFIBER
Definition: ALFA_GeometryReader.h:25
ALFA_GeometryReader::GetRPPosParams
bool GetRPPosParams(PRPPOSPARAMS pRPosParams, const eRPotName eRPName)
Definition: ALFA_GeometryReader.cxx:1823
ALFA_GeometryReader::m_ListExistingRPots
std::list< eRPotName > m_ListExistingRPots
Definition: ALFA_GeometryReader.h:234
ERPN_A7R1L
@ ERPN_A7R1L
Definition: ALFA_GeometryReader.h:27
FIBERPARAMS::fCentreXPos
double fCentreXPos
Definition: ALFA_GeometryReader.h:105
RPPINS::clear
void clear()
Definition: ALFA_GeometryReader.cxx:25
GEOMETRYCONFIGURATION::eRPMetrologyGeoType
int eRPMetrologyGeoType
Definition: ALFA_GeometryReader.h:197
PathResolver.h
FIBERPARAMS::nFiberID
int nFiberID
Definition: ALFA_GeometryReader.h:100
EFT_UNDEFINED
@ EFT_UNDEFINED
Definition: ALFA_GeometryReader.h:25
ALFA_GeometryReader::GetDetPointInAtlas
HepGeom::Point3D< double > GetDetPointInAtlas(eRPotName eRPName, const HepGeom::Point3D< double > &PointInDetCS)
Definition: ALFA_GeometryReader.cxx:2714
ALFA_GeometryReader::StoreReconstructionGeometry
bool StoreReconstructionGeometry(const eRPotName eRPName, const eFiberType eFType, const char *szDataDestination)
Definition: ALFA_GeometryReader.cxx:1614
EGST_DATABASE
@ EGST_DATABASE
Definition: ALFA_GeometryReader.h:23
RPPINS::RealRPPin2
HepGeom::Point3D< double > RealRPPin2
Definition: ALFA_GeometryReader.h:38
ALFA_GeometryReader::ms_NominalRPPin1
static const HepGeom::Point3D< double > ms_NominalRPPin1
Definition: ALFA_GeometryReader.h:217
ROMAPOT::ListODFibersV1
std::list< FIBERPARAMS > ListODFibersV1
Definition: ALFA_GeometryReader.h:153
RPPOSPARAMS::fCurrentLVDTmm
double fCurrentLVDTmm
Definition: ALFA_GeometryReader.h:57
ROMAPOT::ListODFibersV0
std::list< FIBERPARAMS > ListODFibersV0
Definition: ALFA_GeometryReader.h:151
RPPINS::RealRPPin3
HepGeom::Point3D< double > RealRPPin3
Definition: ALFA_GeometryReader.h:39
ALFA_GeometryReader::GetMDFiberZPos
double GetMDFiberZPos(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:2220
ALFA_GeometryReader::GetODFiberParams
bool GetODFiberParams(PFIBERPARAMS pFiberParams, const eFiberType eFType, const eRPotName eRPName, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:1910
ALFA_GeometryReader::ms_NominalRPMainPoint
static const HepGeom::Point3D< double > ms_NominalRPMainPoint
Definition: ALFA_GeometryReader.h:218
RPPOSPARAMS::OriginOfDetSWTransform
HepGeom::Point3D< double > OriginOfDetSWTransform
Definition: ALFA_GeometryReader.h:75
ALFA_GeometryReader::SetVFiberPositionToMainReference
void SetVFiberPositionToMainReference(const eRPotName eRPName, const int nPlateID, const int nFiberID, const HepGeom::Point3D< float > &TransPoint, const double fTransSlope)
Definition: ALFA_GeometryReader.cxx:1473
GEOMETRYCONFIGURATION::fNominalZPosA7L1
double fNominalZPosA7L1
Definition: ALFA_GeometryReader.h:201
ALFA_GeometryReader::GetRPotZPosInAtlas
double GetRPotZPosInAtlas(const eRPotName eRPName)
Definition: ALFA_GeometryReader.cxx:2865
EASN_A7L1
@ EASN_A7L1
Definition: ALFA_GeometryReader.h:26
CFGRPPOSPARAMS::UserOriginOfDetTransInRPot
HepGeom::Point3D< double > UserOriginOfDetTransInRPot
Definition: ALFA_GeometryReader.h:189
EMCS_ROMANPOT
@ EMCS_ROMANPOT
Definition: ALFA_GeometryReader.h:31
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
CFGRPPOSPARAMS::eODGeoType
int eODGeoType
Definition: ALFA_GeometryReader.h:176
ALFA_GeometryReader::GetMDFiberSlope
double GetMDFiberSlope(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:2158
ERPN_A7R1U
@ ERPN_A7R1U
Definition: ALFA_GeometryReader.h:27
ODPLATESCNT
#define ODPLATESCNT
Definition: ALFA_CLinkAlg.h:31
ALFA_GeometryReader::GetODFiberCentreYPos
double GetODFiberCentreYPos(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:2120
ALFA_GeometryReader::GetUFiberParams
bool GetUFiberParams(PFIBERPARAMS pFiberParams, const eRPotName eRPName, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:1311
y
#define y
RPPINS::RealRPPin1
HepGeom::Point3D< double > RealRPPin1
Definition: ALFA_GeometryReader.h:37
RPPOSPARAMS::DetectorNormal
HepGeom::Vector3D< double > DetectorNormal
Definition: ALFA_GeometryReader.h:58
ERPPT_UNSET
@ ERPPT_UNSET
Definition: ALFA_GeometryReader.h:28
ALFA_GeometryReader::GetListOfExistingRPotIDs
void GetListOfExistingRPotIDs(std::list< eRPotName > *pListRPotName)
Definition: ALFA_GeometryReader.cxx:1818
EFCS_ATLAS
@ EFCS_ATLAS
Definition: ALFA_GeometryReader.h:29
ALFA_GeometryReader::GetUFiberAngle
double GetUFiberAngle(const eRPotName eRPName, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:1405
ODFIBERSCNT
#define ODFIBERSCNT
Definition: ALFA_CLinkAlg.h:32
CFGRPPOSPARAMS::eRPPosType
int eRPPosType
Definition: ALFA_GeometryReader.h:174
ALFA_GeometryReader::ParseRPMetrology
bool ParseRPMetrology(eGeoSourceType eSourceType, const char *szDataSource)
Definition: ALFA_GeometryReader.cxx:2308
ALFA_GeometryReader::m_MapRPot
std::map< eRPotName, ROMAPOT > m_MapRPot
Definition: ALFA_GeometryReader.h:233
ALFA_GeometryReader::ReadFiberGeometry
bool ReadFiberGeometry(const PGEOMETRYCONFIGURATION pConfig)
Definition: ALFA_GeometryReader.cxx:907
GEOMETRYCONFIGURATION::bShiftToX97Pos
bool bShiftToX97Pos
Definition: ALFA_GeometryReader.h:199
ERPT_DETIDEAL
@ ERPT_DETIDEAL
Definition: ALFA_GeometryReader.h:30
FIBERPARAMS::fSlope
double fSlope
Definition: ALFA_GeometryReader.h:112
EFT_ODFIBERU0
@ EFT_ODFIBERU0
Definition: ALFA_GeometryReader.h:25
RPPOSPARAMS::bIsLow
bool bIsLow
Definition: ALFA_GeometryReader.h:54
CFGRPPOSPARAMS::UserTransformOfRPInStation
HepGeom::Transform3D UserTransformOfRPInStation
Definition: ALFA_GeometryReader.h:191
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
ALFA_GeometryReader::InitializeDefault
bool InitializeDefault(const PGEOMETRYCONFIGURATION pConfig)
Definition: ALFA_GeometryReader.cxx:382
RPPOSPARAMS::DetSWTransform
HepGeom::Transform3D DetSWTransform
Definition: ALFA_GeometryReader.h:74
EGST_FILE
@ EGST_FILE
Definition: ALFA_GeometryReader.h:23
FIBERPARAMS::fDirY
double fDirY
Definition: ALFA_GeometryReader.h:119
eGeoSourceType
eGeoSourceType
Definition: ALFA_GeometryReader.h:23
ALFA_GeometryReader::UpdateGeometry
void UpdateGeometry()
Definition: ALFA_GeometryReader.cxx:1783
ASPOSPARAMS::ASTransformInMainPoint
HepGeom::Transform3D ASTransformInMainPoint
Definition: ALFA_GeometryReader.h:91
ALFA_GeometryReader::TransformFiberPositionsFCSCladding
void TransformFiberPositionsFCSCladding(PFIBERPARAMS pFiberParams, eRPotName eRPName, const eFiberType eType, const eGeoSourceType eSourceType)
Definition: ALFA_GeometryReader.cxx:124
EFT_ODFIBERV1
@ EFT_ODFIBERV1
Definition: ALFA_GeometryReader.h:25
FIBERPARAMS::fcs_atlas_full
struct FIBERPARAMS::@48 fcs_atlas_full
AthenaPoolTestStep2WriteDoubleSelector.OutStream
OutStream
Definition: AthenaPoolTestStep2WriteDoubleSelector.py:77
ALFA_RDBAccess
Definition: ALFA_RDBAccess.h:40
GEOMETRYCONFIGURATION::strRPMetrologyConnString
std::string strRPMetrologyConnString
Definition: ALFA_GeometryReader.h:198
RPPINS::DTPInAtlasCS
HepGeom::Point3D< double > DTPInAtlasCS
Definition: ALFA_GeometryReader.h:42
ERPN_A7L1L
@ ERPN_A7L1L
Definition: ALFA_GeometryReader.h:27
EFT_FIBEROD
@ EFT_FIBEROD
Definition: ALFA_GeometryReader.h:25
EMT_UNDEFINED
@ EMT_UNDEFINED
Definition: ALFA_GeometryReader.h:24
EMCS_DETPIN1
@ EMCS_DETPIN1
Definition: ALFA_GeometryReader.h:31
Shift
@ Shift
Definition: CMAparameters.h:19
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
ALFA_GeometryReader::SetupRPMetrologyPoints
bool SetupRPMetrologyPoints(ALFA_ConfigParams &CfgParams, eRPotName eRPName)
Definition: ALFA_GeometryReader.cxx:2603
ALFA_GeometryReader::ComputeTransformMatrix
HepGeom::Transform3D ComputeTransformMatrix(const std::vector< HepGeom::Point3D< double > > &VecIdealRefPoints, const std::vector< HepGeom::Point3D< double > > &VecRealRefPoints, const int nPointCnt, HepGeom::Scale3D &Scale, bool bForceUseSVD=false)
Definition: ALFA_GeometryReader.cxx:804
RPPINS::IdealRPPin2
HepGeom::Point3D< double > IdealRPPin2
Definition: ALFA_GeometryReader.h:38
GEOMETRYCONFIGURATION::fNominalZPosA7R1
double fNominalZPosA7R1
Definition: ALFA_GeometryReader.h:203
ALFA_GeometryReader::GetVFiberCentreXPos
double GetVFiberCentreXPos(const eRPotName eRPName, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:1387
CFGRPPOSPARAMS::eMDGeoType
int eMDGeoType
Definition: ALFA_GeometryReader.h:175
StoreGateSvc.h
ERPT_DETREAL
@ ERPT_DETREAL
Definition: ALFA_GeometryReader.h:30
ALFA_GeometryReader::UpdateStationsPosParams
void UpdateStationsPosParams()
Definition: ALFA_GeometryReader.cxx:702
ALFA_GeometryReader::SetupDetMetrologyPoints
bool SetupDetMetrologyPoints(ALFA_ConfigParams &CfgParams, eRPotName eRPName)
Definition: ALFA_GeometryReader.cxx:2517
ALFAPLATESCNT
#define ALFAPLATESCNT
Definition: ALFA_constants.h:9
ALFA_GeometryReader::GetODFiberZPos
double GetODFiberZPos(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:2289
FIBERPARAMS::fcs_atlas
struct FIBERPARAMS::@47 fcs_atlas
ALFA_GeometryReader::GetODFiberAngle
double GetODFiberAngle(const eRPotName eRPName, const eFiberType eFType, const int nPlateID, const int nFiberID)
Definition: ALFA_GeometryReader.cxx:2139
ALFA_GeometryReader::GetPolyFitValue
double GetPolyFitValue(const double fInputValue, const std::vector< double > &vecPolyFitParams)
Definition: ALFA_GeometryReader.cxx:2699
ALFA_GeometryReader::UpdateSimRPPos
void UpdateSimRPPos(const eRPotName eRPName)
Definition: ALFA_GeometryReader.cxx:733
EASN_B7R1
@ EASN_B7R1
Definition: ALFA_GeometryReader.h:26
ALFA_GeometryReader::ParseArrayOfValues
bool ParseArrayOfValues(const char *szvalue, std::vector< double > &vecValues)
Definition: ALFA_GeometryReader.cxx:2478
EMCS_ATLAS
@ EMCS_ATLAS
Definition: ALFA_GeometryReader.h:31
ETE_A3
@ ETE_A3
Definition: ALFA_GeometryReader.h:32
ETE_T1
@ ETE_T1
Definition: ALFA_GeometryReader.h:32
PLATEPARAMS
Definition: ALFA_GeometryReader.h:133
ETE_T2
@ ETE_T2
Definition: ALFA_GeometryReader.h:32