ATLAS Offline Software
SCT_FSIHelper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
9 #include "GaudiKernel/SystemOfUnits.h"
10 
11 #include <iostream>
12 
13 FSILocation:: FSILocation(const std::string& name,
14  double radius,
15  double phi,
16  int side)
17  : m_name(name),
18  m_radius(radius),
19  m_phi(phi),
20  m_side(side)
21 {}
22 
23 
25  int simType,
26  const std::string & simTypeString,
27  const std::string & locationType,
28  const std::string & actualType)
29  : m_location(location),
30  m_simType(simType),
31  m_simTypeStr(simTypeString),
32  m_locType(locationType),
33  m_actualType(actualType)
34 {}
35 
36 
38  : m_rdb(rdb)
39 {
40  int numWheels = m_rdb->fwdGeneral()->getInt("NUMWHEELS");
41  m_wheelLocMap.resize(numWheels);
42  m_wheelLocMapConst.resize(numWheels);
43  fill();
44 }
45 
47 {
48 }
49 
50 
51 void
53 {
54  // Loop through location types
55  for (int iLocIndex = 0; iLocIndex < m_rdb->fwdFSILocationSize(); iLocIndex++) {
56  std::string locType = m_rdb->fwdFSILocation(iLocIndex)->getString("LOCTYPE");
57  double radius = m_rdb->fwdFSILocation(iLocIndex)->getDouble("LOCR") * Gaudi::Units::mm;
58  double rphi = m_rdb->fwdFSILocation(iLocIndex)->getDouble("LOCPHI") * Gaudi::Units::deg;
59  int side = m_rdb->fwdFSILocation(iLocIndex)->getInt("SIDE");
60  m_locationTypes[locType] = std::make_unique<FSILocation>(locType, radius, rphi, side);
61  }
62 
63  // Loop through all fsi's
64  for (int index = 0; index < m_rdb->fwdFSISize(); index++) {
65  unsigned int iWheel = m_rdb->fwdFSI(index)->getInt("WHEEL") - 1;
66  int simType = m_rdb->fwdFSI(index)->getInt("SIMTYPE");
67  std::string simTypeString = m_rdb->fwdFSIType(simType)->getString("TYPENAME");
68  int simTypeCheck = m_rdb->fwdFSIType(simType)->getInt("SIMTYPE");
69  std::string locationType = m_rdb->fwdFSI(index)->getString("LOCTYPE");
70  std::string actualType = m_rdb->fwdFSI(index)->getString("ACTUALTYPE");
71 
72  if (simTypeCheck != simType) std::cout << "Error in simType to index match in table SctFwdFSIType" << std::endl;
73 
74  FSILocation * location = m_locationTypes[locationType].get();
75  if (!location) std::cout << "Error filling FSI information. No FSI of type " << locationType << " found" << std::endl;
76  std::unique_ptr<FSIDetails> fsi = std::make_unique<FSIDetails>(location, simType, simTypeString, locationType, actualType);
77 
78  if (iWheel >= m_wheelLocMap.size())
79  std::cout << "Error in FSIHelper: wheel number is out of range: " << iWheel << std::endl;
80 
81  m_wheelLocMapConst[iWheel].push_back(fsi.get());
82  m_wheelLocMap[iWheel].push_back(std::move(fsi));
83 
84  }
85 }
86 
87 
88 const std::vector<const FSIDetails *> &
89 FSIHelper::fsiVector(int iWheel) const
90 {
91  return m_wheelLocMapConst[iWheel];
92 }
IRDBRecord::getInt
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
SCT_DataBase::fwdGeneral
const IRDBRecord * fwdGeneral() const
Definition: SCT_DataBase.cxx:251
SCT_DataBase::fwdFSIType
const IRDBRecord * fwdFSIType(int i) const
Definition: SCT_DataBase.cxx:245
FSIDetails::FSIDetails
FSIDetails(const FSILocation *location, int simType, const std::string &simTypeString, const std::string &locationType, const std::string &actualType)
Definition: SCT_FSIHelper.cxx:24
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
SCT_DataBase::fwdFSI
const IRDBRecord * fwdFSI(int i) const
Definition: SCT_DataBase.cxx:247
FSIHelper::m_locationTypes
std::map< std::string, std::unique_ptr< FSILocation > > m_locationTypes
Definition: SCT_FSIHelper.h:75
SCT_FSIHelper.h
index
Definition: index.py:1
SCT_DataBase.h
IRDBRecord::getString
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
FSIHelper::fill
void fill()
Definition: SCT_FSIHelper.cxx:52
deg
#define deg
Definition: SbPolyhedron.cxx:17
FSIHelper::m_wheelLocMapConst
std::vector< std::vector< const FSIDetails * > > m_wheelLocMapConst
Definition: SCT_FSIHelper.h:74
TRT::Hit::side
@ side
Definition: HitInfo.h:83
SCT_DataBase::fwdFSILocationSize
int fwdFSILocationSize() const
Definition: SCT_DataBase.cxx:244
FSIHelper::m_rdb
SCT_DataBase * m_rdb
Definition: SCT_FSIHelper.h:77
FSIHelper::fsiVector
const std::vector< const FSIDetails * > & fsiVector(int wheel) const
Definition: SCT_FSIHelper.cxx:89
FSILocation
Definition: SCT_FSIHelper.h:16
SCT_DataBase
Definition: SCT_DataBase.h:17
python.sizes.location
string location
Definition: sizes.py:11
FSILocation::FSILocation
FSILocation(const std::string &name, double radius, double phi, int side)
Definition: SCT_FSIHelper.cxx:13
FSIHelper::FSIHelper
FSIHelper(SCT_DataBase *rdb)
Definition: SCT_FSIHelper.cxx:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
FSIHelper::m_wheelLocMap
std::vector< std::vector< std::unique_ptr< FSIDetails > > > m_wheelLocMap
Definition: SCT_FSIHelper.h:73
SCT_DataBase::fwdFSISize
int fwdFSISize() const
Definition: SCT_DataBase.cxx:248
SCT_DataBase::fwdFSILocation
const IRDBRecord * fwdFSILocation(int i) const
Definition: SCT_DataBase.cxx:243
IRDBRecord::getDouble
virtual double getDouble(const std::string &fieldName) const =0
Get double field value.
FSIHelper::~FSIHelper
~FSIHelper()
Definition: SCT_FSIHelper.cxx:46