ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1::PpmCoolMappingTool Class Reference

PPM crate/module/channel to eta/phi/layer mappings. More...

#include <PpmCoolMappingTool.h>

Inheritance diagram for LVL1::PpmCoolMappingTool:
Collaboration diagram for LVL1::PpmCoolMappingTool:

Public Member Functions

virtual StatusCode initialize () override
virtual void handle (const Incident &) override
virtual bool mapping (int crate, int module, int channel, double &eta, double &phi, int &layer) const override
 Return eta, phi and layer mapping for given crate/module/channel.
virtual bool mapping (double eta, double phi, int layer, int &crate, int &module, int &channel) const override
 Return crate, module and channel mapping for given eta/phi/layer.

Private Attributes

ToolHandle< CaloTriggerTowerServicem_ttSvc { this, "CaloTriggerTowerService", "CaloTriggerTowerService" }
const CaloLVL1_IDm_lvl1Helper = nullptr
const TTOnlineIDm_l1ttonlineHelper = nullptr
std::vector< unsigned int > m_idTable
 Mapping lookup table.

Static Private Attributes

static const int s_maxTableEntries = 8192

Detailed Description

PPM crate/module/channel to eta/phi/layer mappings.

Uses COOL channel mapping tools

Author
Peter Faulkner

Definition at line 33 of file PpmCoolMappingTool.h.

Member Function Documentation

◆ handle()

void LVL1::PpmCoolMappingTool::handle ( const Incident & inc)
overridevirtual

Definition at line 58 of file PpmCoolMappingTool.cxx.

59{
60 // FIXME: not thread safe --- won't work if there's more than one run
61 // in the input.
62 if (inc.type()=="BeginRun") {
63 ATH_MSG_DEBUG("Resetting mapping table at start of run");
64
66 for (int index = 0; index < s_maxTableEntries; ++index) {
67 const int channel = index & 0x3f;
68 const int module = (index >> 6) & 0x0f;
69 const int crate = index >> 10;
70 const int slot = module + 5;
71 const int pin = channel % 16;
72 const int asic = channel / 16;
73
74 Identifier ttId(0);
75 Identifier invalidId(0);
76 try {
77 ATH_MSG_VERBOSE("crate/module/channel " << crate << "/"
78 << module << "/" << channel
79 << " maps to crate/slot/pin/asic " << crate << "/"
80 << slot << "/" << pin << "/" << asic);
81 const HWIdentifier id = m_l1ttonlineHelper->channelId(crate, slot, pin,
82 asic);
83 ATH_MSG_VERBOSE("hardware_id: " << id);
84
85 ttId = m_ttSvc->cnvToIdentifier(id, true);
86 ATH_MSG_VERBOSE("tower_id: " << ttId);
87 }
88 catch (const CaloID_Exception&) { ttId = invalidId; }
89 if (ttId == invalidId) {
90 m_idTable[index] = 0;
91 }
92 else {
93 const int side = (m_lvl1Helper->pos_neg_z(ttId) == 1) ? 1 : 2;
94 const int sample = m_lvl1Helper->sampling(ttId);
95 const int region = m_lvl1Helper->region(ttId);
96 const int ieta = m_lvl1Helper->eta(ttId);
97 const int iphi = m_lvl1Helper->phi(ttId);
98 m_idTable[index] = (side<<14)+(sample<<13)+(region<<11)+(ieta<<6)+iphi;
99 }
100 }
101 }
102 return;
103}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
static const ITkStripOnlineId invalidId
const TTOnlineID * m_l1ttonlineHelper
std::vector< unsigned int > m_idTable
Mapping lookup table.
const CaloLVL1_ID * m_lvl1Helper
static const int s_maxTableEntries
ToolHandle< CaloTriggerTowerService > m_ttSvc
str index
Definition DeMoScan.py:362

◆ initialize()

StatusCode LVL1::PpmCoolMappingTool::initialize ( )
overridevirtual

Definition at line 28 of file PpmCoolMappingTool.cxx.

29{
30 // Retrieve the CaloTriggerTowerService tool
31 ATH_CHECK( m_ttSvc.retrieve() );
32
33 // Retrieve the CaloIdManager from the detector store
34 const CaloIdManager* caloMgr = 0;
35 ATH_CHECK( detStore()->retrieve(caloMgr) );
36
37 // Use the CaloIdManager to get a pointer to an instance
38 // of the CaloLVL1_ID helper
39 ATH_CHECK( (m_lvl1Helper = caloMgr->getLVL1_ID()) != nullptr );
40
41 // Use the CaloIdManager to get a pointer to an instance
42 // of the TTOnlineID helper
43 ATH_CHECK( (m_l1ttonlineHelper = caloMgr->getTTOnlineID()) != nullptr );
44
45 // Incident Service:
46 ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", name());
47 ATH_CHECK( incSvc.retrieve() );
48
49 //start listening to "BeginRun"
50 incSvc->addListener(this, "BeginRun");
51
52 return StatusCode::SUCCESS;
53}
#define ATH_CHECK
Evaluate an expression and check for errors.
const TTOnlineID * getTTOnlineID(void) const
const CaloLVL1_ID * getLVL1_ID(void) const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ mapping() [1/2]

bool LVL1::PpmCoolMappingTool::mapping ( double eta,
double phi,
int layer,
int & crate,
int & module,
int & channel ) const
overridevirtual

Return crate, module and channel mapping for given eta/phi/layer.

Definition at line 141 of file PpmCoolMappingTool.cxx.

143{
144 if (eta <= -4.9 || eta >= 4.9 || phi <= 0. || phi >= 2.*M_PI) return false;
145
146 const double etaOffsets[5] = { 0., 2.5, 3.1, 3.2, 4.9 };
147 const double etaGrans[4] = { 0.1, 0.2, 0.1, 0.425 };
148 const double phiGrans[4] = { M_PI/32., M_PI/16., M_PI/16., M_PI/8. };
149 const int side = (eta < 0.) ? -1 : 1;
150 int region = 0;
151 int ieta = 0;
152 int iphi = 0;
153 const double absEta = fabs(eta);
154 for (int i = 0; i < 4; ++i) {
155 if (absEta < etaOffsets[i+1]) {
156 region = i;
157 ieta = int((absEta - etaOffsets[i]) / etaGrans[i]);
158 iphi = int(phi / phiGrans[i]);
159 break;
160 }
161 }
162
163 HWIdentifier id(0);
164 HWIdentifier invalidId(0);
165 try {
166 ATH_MSG_VERBOSE("eta/phi/layer " << eta << "/" << phi << "/"
167 << layer << " maps to side/layer/region/ieta/iphi "
168 << side << "/" << layer << "/" << region << "/"
169 << ieta << "/" << iphi);
170 const Identifier ttId = m_lvl1Helper->tower_id(side, layer, region,
171 ieta, iphi);
172 ATH_MSG_VERBOSE("tower_id: " << ttId);
173
174 id = m_ttSvc->createTTChannelID(ttId, true);
175
176 ATH_MSG_VERBOSE("hardware_id: " << id);
177
178 }
179 catch (const CaloID_Exception&) { id = invalidId; }
180 if (id == invalidId) return false;
181
182 const int slot = m_l1ttonlineHelper->module(id);
183 const int pin = m_l1ttonlineHelper->submodule(id);
184 const int asic = m_l1ttonlineHelper->channel(id);
185
186 crate = m_l1ttonlineHelper->crate(id);
187 module = slot - 5;
188 channel = asic * 16 + pin;
189
190 ATH_MSG_VERBOSE("eta/phi/layer " << eta << "/" << phi << "/" << layer
191 << " maps to crate/module/channel "
192 << crate << "/" << module << "/" << channel);
193
194 return true;
195}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
bool absEta(const xAOD::TauJet &tau, float &out)

◆ mapping() [2/2]

bool LVL1::PpmCoolMappingTool::mapping ( int crate,
int module,
int channel,
double & eta,
double & phi,
int & layer ) const
overridevirtual

Return eta, phi and layer mapping for given crate/module/channel.

Definition at line 107 of file PpmCoolMappingTool.cxx.

109{
110 if (crate < 0 || crate >= 8 || module < 0 || module >= 16 ||
111 channel < 0 || channel >= 64) return false;
112
113 int index = (crate<<10) + (module<<6) + channel;
114 if (index >= s_maxTableEntries) return false;
115
116 if (index >= static_cast<int>(m_idTable.size()) || m_idTable[index] == 0) {
117 return false;
118 }
119 const unsigned int entry = m_idTable[index];
120 const int side = ((entry>>14) == 1) ? 1 : -1;
121 const int region = (entry>>11)&0x3;
122 const int ieta = (entry>>6)&0x1f;
123 const int iphi = entry&0x3f;
124 const double etaOffsets[4] = { 0., 2.5, 3.1, 3.2 };
125 const double etaGrans[4] = { 0.1, 0.2, 0.1, 0.425 };
126 const double phiGrans[4] = { M_PI/32., M_PI/16., M_PI/16., M_PI/8. };
127
128 eta = side * (etaOffsets[region] + etaGrans[region] * (ieta + 0.5));
129 phi = phiGrans[region] * (iphi + 0.5);
130 layer = (entry>>13)&0x1;
131
132 ATH_MSG_VERBOSE("crate/module/channel " << crate << "/" << module
133 << "/" << channel << " maps to eta/phi/layer "
134 << eta << "/" << phi << "/" << layer);
135
136 return true;
137}
@ layer
Definition HitInfo.h:79

Member Data Documentation

◆ m_idTable

std::vector<unsigned int> LVL1::PpmCoolMappingTool::m_idTable
private

Mapping lookup table.

Definition at line 58 of file PpmCoolMappingTool.h.

◆ m_l1ttonlineHelper

const TTOnlineID* LVL1::PpmCoolMappingTool::m_l1ttonlineHelper = nullptr
private

Definition at line 55 of file PpmCoolMappingTool.h.

◆ m_lvl1Helper

const CaloLVL1_ID* LVL1::PpmCoolMappingTool::m_lvl1Helper = nullptr
private

Definition at line 54 of file PpmCoolMappingTool.h.

◆ m_ttSvc

ToolHandle<CaloTriggerTowerService> LVL1::PpmCoolMappingTool::m_ttSvc { this, "CaloTriggerTowerService", "CaloTriggerTowerService" }
private

Definition at line 52 of file PpmCoolMappingTool.h.

53{ this, "CaloTriggerTowerService", "CaloTriggerTowerService" };

◆ s_maxTableEntries

const int LVL1::PpmCoolMappingTool::s_maxTableEntries = 8192
staticprivate

Definition at line 59 of file PpmCoolMappingTool.h.


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