LDMX Software
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
ecal::EcalDetectorMap Class Reference

Class which provides various information about how the parts of the Ecal connect to each other. More...

#include <EcalDetectorMap.h>

Classes

struct  CellInformation
 Table of per-module cell information. More...
 
struct  MotherboardLinksInformation
 Table of per-motherboard connections information. More...
 
struct  MotherboardsPerLayer
 Table of per-layer motherboard layouts. More...
 

Public Member Functions

 EcalDetectorMap (const std::string &cell_map, const std::string &motherboard_map, const std::string &layer_map, bool want_d2e)
 Default constructor which builds the necessary maps.
 
- Public Member Functions inherited from framework::ConditionsObject
 ConditionsObject (const std::string &name)
 Class constructor.
 
virtual ~ConditionsObject ()
 Destructor.
 
std::string getName () const
 Get the name of this object.
 
- Public Member Functions inherited from ldmx::ElectronicsMap< ldmx::EcalElectronicsID, ldmx::EcalID >
 ElectronicsMap (bool want_d2e=false)
 
void clear ()
 Remove all entries from the map.
 
void addEntry (ldmx::EcalElectronicsID eid, ldmx::EcalID did)
 Add an entry to the map.
 
bool exists (ldmx::EcalElectronicsID eid) const
 Tests if a given electronics id is in the map.
 
bool exists (ldmx::EcalID did) const
 Tests if a given detector id is in the map This method is slow O(N) if the map is not configured for detector id to electronics id.
 
ldmx::EcalID get (ldmx::EcalElectronicsID eid) const
 Get the detector ID for this electronics ID.
 
ldmx::EcalElectronicsID get (ldmx::EcalID did) const
 Get the electronics ID for this detector ID This method is slow O(N) if the map is not configured for detector id to electronics id.
 

Static Public Attributes

static constexpr const char * CONDITIONS_OBJECT_NAME {"EcalDetectorMap"}
 The name of the EID <-> DetID map for the ECal.
 

Private Member Functions

void loadCellMap (conditions::GeneralCSVLoader &loader)
 import cell map from the provided CSV loader
 
void loadMotherboardMap (conditions::GeneralCSVLoader &loader)
 import motherboard map from the provided CSV loader
 
void loadLayerMap (conditions::GeneralCSVLoader &loader)
 import layer map from the provided CSV loader
 
void buildElectronicsMap ()
 build the electronics map from loaded maps
 

Private Attributes

std::vector< CellInformationcells_
 
std::vector< MotherboardLinksInformationelinks_
 
std::vector< MotherboardsPerLayerlayers_
 

Friends

class EcalDetectorMapLoader
 Provider which loads the map.
 

Detailed Description

Class which provides various information about how the parts of the Ecal connect to each other.

The class is loaded from three tables, currently in the form of CSV objects, using the EcalDetectorMapLoader declared and defined in the source.

CellMap gives the information for a single Ecal module and has the following columns CELLID – EcalDetectorID cell id ROCID – which ROC on the module ROC_ELINK_NUMBER – which elink on the ROC (0/1) ROC_ELINK_CHANNEL – which channel on the elink (0-35)

MotherboardMap gives information about how the modules plug into a given type of motherboard ROCID – which ROC on the module ROC_ELINK_NUMBER – which elink on the ROC (0/1) MODULE – which module on the layer POLARFIRE_ELINK – elink input number on the Polarfire MOTHERBOARD_TYPE – what type of motherboard is this

LayerMap gives information about how the motherboards are used on the various layers LAYER – layer number MOTHERBOARD_TYPE OLINK – DAQ optical link number

We inherit from two classes: (1) the ConditionsObject because we are a conditions object and (2) from the ElectronicsMap template because we are a electronics map.

Definition at line 47 of file EcalDetectorMap.h.

Constructor & Destructor Documentation

◆ EcalDetectorMap()

ecal::EcalDetectorMap::EcalDetectorMap ( const std::string &  cell_map,
const std::string &  motherboard_map,
const std::string &  layer_map,
bool  want_d2e 
)

Default constructor which builds the necessary maps.

Parameters
[in]want_d2etrue if we want to build a reverse mapping Building a reverse (detector->electronics) map takes extra time and memory so it should be off by default.

Definition at line 51 of file EcalDetectorMap.cxx.

56 conditions::StreamCSVLoader scell(cell_map);
57 this->loadCellMap(scell);
58 conditions::StreamCSVLoader smb(motherboard_map);
59 this->loadMotherboardMap(smb);
60 conditions::StreamCSVLoader slayer(layer_map);
61 this->loadLayerMap(slayer);
62 this->buildElectronicsMap();
63}
Specialization of the GeneralCSVLoader for loading from a file/stream.
void loadCellMap(conditions::GeneralCSVLoader &loader)
import cell map from the provided CSV loader
void loadMotherboardMap(conditions::GeneralCSVLoader &loader)
import motherboard map from the provided CSV loader
static constexpr const char * CONDITIONS_OBJECT_NAME
The name of the EID <-> DetID map for the ECal.
void buildElectronicsMap()
build the electronics map from loaded maps
void loadLayerMap(conditions::GeneralCSVLoader &loader)
import layer map from the provided CSV loader
Base class for all conditions objects, very simple.
ElectronicsMap.

References buildElectronicsMap(), loadCellMap(), loadLayerMap(), and loadMotherboardMap().

Member Function Documentation

◆ buildElectronicsMap()

void ecal::EcalDetectorMap::buildElectronicsMap ( )
private

build the electronics map from loaded maps

Definition at line 101 of file EcalDetectorMap.cxx.

101 {
102 this->clear(); // empty the electronics map
103 // loop over optical links
104 for (auto olink : layers_) {
105 for (auto elink : elinks_) {
106 // select only matching motherboard types
107 if (elink.motherboard_type != olink.motherboard_type) continue;
108
109 for (auto cell : cells_) {
110 // select only cells which are associated with the appropriate elink
111 if (elink.rocid != cell.rocid ||
112 elink.roc_elink_number != cell.roc_elink_number)
113 continue;
114
115 // now, we have only cells which are relevant
116 ldmx::EcalID precisionId(olink.layer, elink.module, cell.module_cellid);
117 ldmx::EcalElectronicsID elecId(olink.daq_opticallink,
118 elink.polarfire_elink,
119 cell.roc_elink_channel);
120
121 if (this->exists(elecId)) {
122 std::stringstream ss;
123 ss << "Two different mappings for electronics channel " << elecId;
124 EXCEPTION_RAISE("DuplicateMapping", ss.str());
125 }
126 this->addEntry(elecId, precisionId);
127 }
128 }
129 }
130}
Identifies a location in the Ecal readout chain.
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.
Definition EcalID.h:20
void addEntry(ldmx::EcalElectronicsID eid, ldmx::EcalID did)
Add an entry to the map.
bool exists(ldmx::EcalElectronicsID eid) const
Tests if a given electronics id is in the map.

References ldmx::ElectronicsMap< ldmx::EcalElectronicsID, ldmx::EcalID >::addEntry(), ldmx::ElectronicsMap< ldmx::EcalElectronicsID, ldmx::EcalID >::clear(), and ldmx::ElectronicsMap< ldmx::EcalElectronicsID, ldmx::EcalID >::exists().

Referenced by EcalDetectorMap().

◆ loadCellMap()

void ecal::EcalDetectorMap::loadCellMap ( conditions::GeneralCSVLoader loader)
private

import cell map from the provided CSV loader

Definition at line 65 of file EcalDetectorMap.cxx.

65 {
66 cells_.clear();
67 while (loader.nextRow()) {
68 CellInformation ci;
69 ci.module_cellid = loader.getInteger("CELLID");
70 ci.rocid = loader.getInteger("ROCID");
71 ci.roc_elink_number = loader.getInteger("ROC_ELINK_NUMBER");
72 ci.roc_elink_channel = loader.getInteger("ROC_ELINK_CHANNEL");
73 cells_.push_back(ci);
74 }
75}
bool nextRow()
Advance to next row if possible.
int getInteger(const std::string &colname, bool ignore_case=true) const
Get the value for the given column in the current row as an integer.

References conditions::GeneralCSVLoader::getInteger(), ecal::EcalDetectorMap::CellInformation::module_cellid, conditions::GeneralCSVLoader::nextRow(), ecal::EcalDetectorMap::CellInformation::roc_elink_channel, ecal::EcalDetectorMap::CellInformation::roc_elink_number, and ecal::EcalDetectorMap::CellInformation::rocid.

Referenced by EcalDetectorMap().

◆ loadLayerMap()

void ecal::EcalDetectorMap::loadLayerMap ( conditions::GeneralCSVLoader loader)
private

import layer map from the provided CSV loader

Definition at line 90 of file EcalDetectorMap.cxx.

90 {
91 layers_.clear();
92 while (loader.nextRow()) {
93 MotherboardsPerLayer mpl;
94 mpl.motherboard_type = loader.getInteger("MOTHERBOARD_TYPE");
95 mpl.layer = loader.getInteger("LAYER");
96 mpl.daq_opticallink = loader.getInteger("OLINK");
97 layers_.push_back(mpl);
98 }
99}

References ecal::EcalDetectorMap::MotherboardsPerLayer::daq_opticallink, conditions::GeneralCSVLoader::getInteger(), ecal::EcalDetectorMap::MotherboardsPerLayer::layer, ecal::EcalDetectorMap::MotherboardsPerLayer::motherboard_type, and conditions::GeneralCSVLoader::nextRow().

Referenced by EcalDetectorMap().

◆ loadMotherboardMap()

void ecal::EcalDetectorMap::loadMotherboardMap ( conditions::GeneralCSVLoader loader)
private

import motherboard map from the provided CSV loader

Definition at line 77 of file EcalDetectorMap.cxx.

77 {
78 elinks_.clear();
79 while (loader.nextRow()) {
80 MotherboardLinksInformation mli;
81 mli.motherboard_type = loader.getInteger("MOTHERBOARD_TYPE");
82 mli.module = loader.getInteger("MODULE");
83 mli.rocid = loader.getInteger("ROCID");
84 mli.roc_elink_number = loader.getInteger("ROC_ELINK_NUMBER");
85 mli.polarfire_elink = loader.getInteger("POLARFIRE_ELINK");
86 elinks_.push_back(mli);
87 }
88}

References conditions::GeneralCSVLoader::getInteger(), ecal::EcalDetectorMap::MotherboardLinksInformation::motherboard_type, conditions::GeneralCSVLoader::nextRow(), ecal::EcalDetectorMap::MotherboardLinksInformation::polarfire_elink, ecal::EcalDetectorMap::MotherboardLinksInformation::roc_elink_number, and ecal::EcalDetectorMap::MotherboardLinksInformation::rocid.

Referenced by EcalDetectorMap().

Friends And Related Symbol Documentation

◆ EcalDetectorMapLoader

friend class EcalDetectorMapLoader
friend

Provider which loads the map.

Definition at line 66 of file EcalDetectorMap.h.

Member Data Documentation

◆ cells_

std::vector<CellInformation> ecal::EcalDetectorMap::cells_
private

Definition at line 93 of file EcalDetectorMap.h.

◆ CONDITIONS_OBJECT_NAME

constexpr const char* ecal::EcalDetectorMap::CONDITIONS_OBJECT_NAME {"EcalDetectorMap"}
staticconstexpr

The name of the EID <-> DetID map for the ECal.

Definition at line 52 of file EcalDetectorMap.h.

52{"EcalDetectorMap"};

Referenced by ecal::EcalRawDecoder::produce(), and ecal::EcalRawEncoder::produce().

◆ elinks_

std::vector<MotherboardLinksInformation> ecal::EcalDetectorMap::elinks_
private

Definition at line 110 of file EcalDetectorMap.h.

◆ layers_

std::vector<MotherboardsPerLayer> ecal::EcalDetectorMap::layers_
private

Definition at line 123 of file EcalDetectorMap.h.


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