ATLAS Offline Software
Loading...
Searching...
No Matches
PixelStaveTypes Class Reference

#include <PixelStaveTypes.h>

Collaboration diagram for PixelStaveTypes:

Classes

class  Datum
class  Key

Public Member Functions

 PixelStaveTypes (const IRDBRecordset_ptr &table)
int getFluidType (int layer, int phiModule) const
int getBiStaveType (int layer, int phiModule) const

Private Types

typedef std::map< Key, DatumMapType

Private Member Functions

const DatumgetData (int layer, int phiModule) const

Private Attributes

MapType m_dataLookup
std::map< int, int > m_maxSector

Static Private Attributes

static const Datum s_defaultDatum

Detailed Description

Definition at line 13 of file PixelStaveTypes.h.

Member Typedef Documentation

◆ MapType

typedef std::map<Key, Datum> PixelStaveTypes::MapType
private

Definition at line 40 of file PixelStaveTypes.h.

Constructor & Destructor Documentation

◆ PixelStaveTypes()

PixelStaveTypes::PixelStaveTypes ( const IRDBRecordset_ptr & table)

Definition at line 35 of file PixelStaveTypes.cxx.

36{
37 for(const auto& rec : *table) {
38 int layer = rec->getInt("LAYER");
39 int phiModule = rec->getInt("SECTOR");
40 int fluidType = rec->getInt("FLUIDTYPE");
41 int biStaveType = rec->getInt("BISTAVETYPE");
42
43 m_dataLookup[Key(layer,phiModule)] = Datum(fluidType,biStaveType);
44 m_maxSector[layer] = std::max(phiModule, m_maxSector[layer]); // Store the max sector for each layer.
45 }
46}
std::map< int, int > m_maxSector
@ layer
Definition HitInfo.h:79
@ phiModule
Definition HitInfo.h:80

Member Function Documentation

◆ getBiStaveType()

int PixelStaveTypes::getBiStaveType ( int layer,
int phiModule ) const

Definition at line 55 of file PixelStaveTypes.cxx.

56{
57 return getData(layer, phiModule).biStaveType;
58}
const Datum & getData(int layer, int phiModule) const

◆ getData()

const PixelStaveTypes::Datum & PixelStaveTypes::getData ( int layer,
int phiModule ) const
private

Definition at line 62 of file PixelStaveTypes.cxx.

63{
64 int layerTmp = layer;
65
66 // If no entries for layer, use layer 0.
67 std::map<int,int>::const_iterator iterMaxSector;
68 iterMaxSector = m_maxSector.find(layerTmp);
69 if (iterMaxSector == m_maxSector.end() && layerTmp) {
70 layerTmp = 0;
71 iterMaxSector = m_maxSector.find(layerTmp);
72 }
73
74 if (iterMaxSector != m_maxSector.end()) {
75 int maxSector = iterMaxSector->second;
76 // if phiModule is greater than max Sector in table then assume pattern repeats.
77 // NB This is not the case as the pattern is not very regular and there is an entery
78 // for each layer and phi sector.
79 int phiModuleTmp = phiModule % (maxSector+1);
80
81 MapType::const_iterator iter;
82 iter = m_dataLookup.find(Key(layerTmp, phiModuleTmp));
83
84 if (iter != m_dataLookup.end()) return iter->second;
85 }
86
87 std::cout << "ERROR: PixelStaveTypes cannot find type for layer,phiModule: " << layer << ", " << phiModule << std::endl;
88 return s_defaultDatum;
89}
static const Datum s_defaultDatum

◆ getFluidType()

int PixelStaveTypes::getFluidType ( int layer,
int phiModule ) const

Definition at line 49 of file PixelStaveTypes.cxx.

50{
51 return getData(layer, phiModule).fluidType;
52}

Member Data Documentation

◆ m_dataLookup

MapType PixelStaveTypes::m_dataLookup
private

Definition at line 41 of file PixelStaveTypes.h.

◆ m_maxSector

std::map<int,int> PixelStaveTypes::m_maxSector
private

Definition at line 43 of file PixelStaveTypes.h.

◆ s_defaultDatum

const PixelStaveTypes::Datum PixelStaveTypes::s_defaultDatum
staticprivate

Definition at line 45 of file PixelStaveTypes.h.


The documentation for this class was generated from the following files: