LDMX Software
Public Member Functions | Static Public Attributes | Friends | List of all members
hcal::HcalDetectorMap Class Reference

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

#include <HcalDetectorMap.h>

Public Member Functions

 HcalDetectorMap (const std::string &connections_table, 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::HcalElectronicsID, ldmx::HcalDigiID >
 ElectronicsMap (bool want_d2e=false)
 
void clear ()
 Remove all entries from the map.
 
void addEntry (ldmx::HcalElectronicsID eid, ldmx::HcalDigiID did)
 Add an entry to the map.
 
bool exists (ldmx::HcalElectronicsID eid) const
 Tests if a given electronics id is in the map.
 
bool exists (ldmx::HcalDigiID 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::HcalDigiID get (ldmx::HcalElectronicsID eid) const
 Get the detector ID for this electronics ID.
 
ldmx::HcalElectronicsID get (ldmx::HcalDigiID 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 {"HcalDetectorMap"}
 The name of the EID <-> DetID map for the ECal.
 

Friends

class HcalDetectorMapLoader
 Provider which loads the map.
 

Detailed Description

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

The class is loaded from a single connection table, currently in the form of a CSV file, using the HcalDetectorMapLoader declared and defined in the source.

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 33 of file HcalDetectorMap.h.

Constructor & Destructor Documentation

◆ HcalDetectorMap()

hcal::HcalDetectorMap::HcalDetectorMap ( const std::string &  connections_table,
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.

Column Names "Polarfire" "HGCROC" "Channel" "CMB" "Quadbar" "Bar" "Plane" "Cable"

Each HGCROC has two links coming out of it, one for the upper half of the channels and one for the lower half, this means we need to modify the hgcroc/channel pair to be actual link/channel pairs where the new link has range twice as big as the hgcroc ID but the new channel has a range half as big as the old one.

each hgcroc has two links,

  • one for the upper half of channels (36-71)
  • one for the lower half (0-35)

we assign the links' number based on the hgcroc ID so that the link count starts from 0 and the two links for one hgcroc ID are next to each other. The upper half of channels are given the higher link number.

the Hcal skips every 9th channel because those are the channels that are skipped in the trigger sum when the chip is summing 4 channels together

Skipped: 8, 17, 26, 35, 44, 53, 62, 71

without zero suppresssion then, this means some channels will appear in the raw data but will not be in the detector mapping so they should be skipped

Definition at line 47 of file HcalDetectorMap.cxx.

51 want_d2e) {
52 this->clear();
53 conditions::StreamCSVLoader csv(connections_table);
54 while (csv.nextRow()) {
65 int polarfire = csv.getInteger("Polarfire");
66 int hgcroc = csv.getInteger("HGCROC");
67 int chan = csv.getInteger("Channel");
68
89 int link = 2 * hgcroc; // link count starts from 0
90 if (chan >= 36) {
91 link += 1;
92 chan -= 36;
93 }
94
95 // one quadbar groups 4 strips and each quadbar is connected to 2 CMBs - one
96 // in each end
97 int end = csv.getInteger("CMB") % 2;
98 if (end == 0)
99 end = 1; // negative end (?)
100 else
101 end = 0; // positive end (?)
102
103 // The Bar field in the map represents a numbering *within a quadbar* not
104 // the strip number.
105 //
106 // This gives correct range for the strip numbers [0,7] and [0,11] but the
107 // actual order of the quadbars has to be checked
108
109 auto QuadBar{csv.getInteger("QuadBar")};
110 auto BarNumber{csv.getInteger("Bar")};
111 // Strip = (4 - Bar) + 4 * (QuadBar - 1)
112 // QuadBar starts at 1 so we need to subtract to get first value
113 // to be zero
114 auto strip{(BarNumber - 1) +
115 4 * (QuadBar - 1)}; // This is flipped from the original
116 if (csv.getInteger("Plane") % 2 == 1)
117 strip = (4 - BarNumber) +
118 4 * (QuadBar - 1); // Plane 2 is backward by mistake
119 ldmx::HcalDigiID detid(0 /*section - only one section during test beam*/,
120 csv.getInteger("Plane") /*layer*/, strip /*strip*/,
121 end /*end*/);
122 ldmx::HcalElectronicsID eleid(polarfire /*polarfire fpga*/, link /*elink*/,
123 chan /*channel*/);
124
125 if (this->exists(eleid)) {
126 std::stringstream ss;
127 ss << "Two different mappings for electronics channel " << eleid;
128 EXCEPTION_RAISE("DuplicateMapping", ss.str());
129 }
130 this->addEntry(eleid, detid);
131 }
132}
Specialization of the GeneralCSVLoader for loading from a file/stream.
Base class for all conditions objects, very simple.
static constexpr const char * CONDITIONS_OBJECT_NAME
The name of the EID <-> DetID map for the ECal.
ElectronicsMap.
void addEntry(ldmx::HcalElectronicsID eid, ldmx::HcalDigiID did)
Add an entry to the map.
bool exists(ldmx::HcalElectronicsID eid) const
Tests if a given electronics id is in the map.
Extension of HcalAbstractID providing access to HCal digi information.
Definition HcalDigiID.h:13
Identifies a location in the Hcal readout chain.

References ldmx::ElectronicsMap< ldmx::HcalElectronicsID, ldmx::HcalDigiID >::addEntry(), ldmx::ElectronicsMap< ldmx::HcalElectronicsID, ldmx::HcalDigiID >::clear(), ldmx::ElectronicsMap< ldmx::HcalElectronicsID, ldmx::HcalDigiID >::exists(), conditions::GeneralCSVLoader::getInteger(), and conditions::GeneralCSVLoader::nextRow().

Friends And Related Symbol Documentation

◆ HcalDetectorMapLoader

friend class HcalDetectorMapLoader
friend

Provider which loads the map.

Definition at line 50 of file HcalDetectorMap.h.

Member Data Documentation

◆ CONDITIONS_OBJECT_NAME

constexpr const char* hcal::HcalDetectorMap::CONDITIONS_OBJECT_NAME {"HcalDetectorMap"}
staticconstexpr

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

Definition at line 38 of file HcalDetectorMap.h.

38{"HcalDetectorMap"};

Referenced by dqm::NtuplizeHgcrocDigiCollection::analyze(), and hcal::HcalRawDecoder::produce().


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