Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
add python config class for ecal detector map
Browse files Browse the repository at this point in the history
  • Loading branch information
tomeichlersmith committed Nov 30, 2021
1 parent 1b14002 commit 71c1c29
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
45 changes: 45 additions & 0 deletions python/EcalDetectorMap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""Conditions object providers for a mapping between ecal electronics IDs and detector IDs"""

from LDMX.Framework import ldmxcfg

class EcalDetectorMap(ldmxcfg.ConditionsObjectProvider) :
"""The COP that maps between Electronic and Detector IDs.
The mapping is defined in three 'tiers'.
1. cell - Each cell of a module has specific ROC elink and channel
2. motherboard - Each module has a specific ROC elink and polarfire
3. layer - Each layer has specific daq optical link
So three CSV tables are necessary for providing this mapping.
We can't have multiple different detector maps during a single
run, so this class is meant to be a singleton.
Attributes
----------
__instance : EcalDetectorMap
Singleton instance of this object
"""

__instance = None

def get() :
"""Get the single instance of the EcalDetectorMap
Returns
-------
EcalDetectorMap
Single instance of the provider
"""
return EcalGeometryProvider.__instance

def __init__(self, cell_map, motherboard_map, layer_map) :
if EcalDetectorMap.__instance != None :
raise Exception('EcalDetectorMap is a singleton class and should only be created once. You can retrieve the single instance with EcalDetectorMap.get()')
else:
# the name needs to match the conditions object name in EcalDetectorMap.h
super().__init__("EcalDetectorMap","ecal::EcalDetectorMapLoader","Ecal")
self.cell_map = cell_map
self.motherboard_map = motherboard_map
self.layer_map = layer_map

6 changes: 3 additions & 3 deletions src/Ecal/EcalDetectorMap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class EcalDetectorMapLoader : public framework::ConditionsObjectProvider {
framework::Process& process)
: ConditionsObjectProvider(EcalDetectorMap::CONDITIONS_OBJECT_NAME,
tagname, parameters, process), theMap_{0} {
cellMap_=parameters.getParameter<std::string>("CellMap");
motherboardMap_=parameters.getParameter<std::string>("MotherboardMap");
layerMap_=parameters.getParameter<std::string>("LayerMap");
cellMap_=parameters.getParameter<std::string>("cell_map");
motherboardMap_=parameters.getParameter<std::string>("motherboard_map");
layerMap_=parameters.getParameter<std::string>("layer_map");
}

virtual std::pair<const framework::ConditionsObject*,
Expand Down

0 comments on commit 71c1c29

Please sign in to comment.